From 3e40f15fde27952462999f0ad37287a6f0e00f02 Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Thu, 28 Apr 2016 17:05:26 -0400 Subject: [PATCH 01/20] Support resolving bundled references --- Sources/Client/Reference+Resolving.swift | 48 ++++++++++++-- Sources/Models/FHIRAbstractBase.swift | 18 ++++++ SwiftFHIR.xcodeproj/project.pbxproj | 5 +- Tests/ReferenceTests.swift | 46 +++++++++++++ Tests/TestResources/ReferenceBundled.json | 78 +++++++++++++++++++++++ fhir-parser | 2 +- 6 files changed, 186 insertions(+), 11 deletions(-) create mode 100644 Tests/TestResources/ReferenceBundled.json diff --git a/Sources/Client/Reference+Resolving.swift b/Sources/Client/Reference+Resolving.swift index 369472bd..db56600e 100644 --- a/Sources/Client/Reference+Resolving.swift +++ b/Sources/Client/Reference+Resolving.swift @@ -18,11 +18,14 @@ import Models extension Reference { /** - Determines if a reference has already been resolved or if it is a contained resource which can be returned - immediately. + Determines if a reference has already been resolved, if it is a contained or a bundled resource which can be returned immediately. + + If this method returns nil, it's possible that the referenced resource must be fetched from a server. Use the `resolve(type:callback:)` + method to achive that feat. That method will initially call this method and hence may return immediately if a reference has already been + resolved (or is contained/bundled). - parameter type: The resource type that should be dereferenced - - returns: An instance of the desired type, or nil if it hasn't been resolved yet OR is of a different type + - returns: An instance of the desired type, nil if it cannot immediately be resolved OR if it is of a different type */ public func resolved(type: T.Type) -> T? { guard let refid = processedReferenceIdentifier() else { @@ -38,15 +41,46 @@ extension Reference { } // not yet resolved, let's look at contained resources - if let contained = owningResource()?.containedResource(refid) as? T { - return contained + if let contained = owningResource()?.containedResource(refid) { + if let contained = contained as? T { + return contained + } + fhir_warn("reference “\(refid)” was contained as «\(resolved)», which is not of the expected type “\(T.self)”") + return nil + } + + // not contained, are we in a bundle and the resource is bundled? + let refIsRelative = !refid.containsString("://") && !refid.hasPrefix("urn:") + var bundle = owningBundle() + while nil != bundle { + if let entries = bundle?.entry { + var refUrl = refid + if refIsRelative { + let base = bundle?._server?.baseURL.absoluteString ?? "" + refUrl = base + refid + } + + for entry in entries { + if let entryUrl = entry.fullUrl?.absoluteString where entryUrl == refUrl { + if let found = entry.resource as? T { + return found + } + fhir_warn("reference “\(refid)” was bundled as «\(entry.resource)», which is not of the expected type “\(T.self)”") + return nil + } + } + } + bundle = bundle?.owningBundle() } + return nil } /** - Checks if a reference can be resolved immediately by calling `resolved()` first, if not proceeds to request the referenced resource from - the respective location. + Resolves the reference, automatically determining how to resolve it from either contained, bundled or fetching from a server. + + Checks if a reference can be resolved immediately by calling `resolved(type:)` first, if not proceeds to request the referenced resource + from the respective location. - parameter type: The type of the resource to expect - parameter callback: The callback to call upon success or failure, with the resolved resource or nil diff --git a/Sources/Models/FHIRAbstractBase.swift b/Sources/Models/FHIRAbstractBase.swift index 4d16df47..4ec4311f 100644 --- a/Sources/Models/FHIRAbstractBase.swift +++ b/Sources/Models/FHIRAbstractBase.swift @@ -148,6 +148,8 @@ public class FHIRAbstractBase: CustomStringConvertible { /** The resource owning the receiver; used during reference resolving and to look up the instance's `_server`, if any. + + - returns: The owning `DomainResource` instance or nil */ public func owningResource() -> DomainResource? { var owner = _owner @@ -160,6 +162,22 @@ public class FHIRAbstractBase: CustomStringConvertible { return nil } + /** + Returns the receiver's owning Bundle, if it has one. + + - returns: The owning `Bundle` instance or nil + */ + public func owningBundle() -> Bundle? { + var owner = _owner + while nil != owner { + if let owner = owner as? Bundle { + return owner + } + owner = owner?._owner + } + return nil + } + // MARK: - Printable diff --git a/SwiftFHIR.xcodeproj/project.pbxproj b/SwiftFHIR.xcodeproj/project.pbxproj index 6b125fe4..708548cb 100644 --- a/SwiftFHIR.xcodeproj/project.pbxproj +++ b/SwiftFHIR.xcodeproj/project.pbxproj @@ -808,7 +808,7 @@ EEF20E151A5D4FFE009A6EDA /* README.md */, EE1310DC1C1B7E3700D9DAE7 /* Package.swift */, EE684C2019A789BA00B5A2C0 /* SwiftFHIR */, - EE684C2A19A789BA00B5A2C0 /* SwiftFHIRTests */, + EE684C2A19A789BA00B5A2C0 /* Tests */, EEEE31291BB2829A008866E2 /* Metadata */, EE684C1F19A789BA00B5A2C0 /* Products */, ); @@ -835,7 +835,7 @@ name = SwiftFHIR; sourceTree = ""; }; - EE684C2A19A789BA00B5A2C0 /* SwiftFHIRTests */ = { + EE684C2A19A789BA00B5A2C0 /* Tests */ = { isa = PBXGroup; children = ( EE684C2C19A789BA00B5A2C0 /* Info.plist */, @@ -847,7 +847,6 @@ EEEB096E19AD248700C324FC /* ModelTests */, EEEE31191BB278E3008866E2 /* AppKit.framework */, ); - name = SwiftFHIRTests; path = Tests; sourceTree = ""; }; diff --git a/Tests/ReferenceTests.swift b/Tests/ReferenceTests.swift index 91cf5654..7156e18a 100644 --- a/Tests/ReferenceTests.swift +++ b/Tests/ReferenceTests.swift @@ -41,6 +41,52 @@ class ReferenceTests: XCTestCase { } } + func testBundledReference() { + if let path = NSBundle(forClass: self.dynamicType).pathForResource("ReferenceBundled", ofType: "json", inDirectory: "TestResources") { + let bundle = try! Bundle.instantiateFromPath(path) + XCTAssertEqual("Bundle", bundle.dynamicType.resourceName) + + // get resources + let pat23 = bundle.entry?[0].resource as? Patient + XCTAssertEqual("Patient", pat23?.dynamicType.resourceName) + XCTAssertEqual("Darth", pat23?.name?[0].given?[0]) + let patURN = bundle.entry?[1].resource as? Patient + XCTAssertEqual("Patient", patURN?.dynamicType.resourceName) + XCTAssertEqual("Ben", patURN?.name?[0].given?[0]) + let obs123 = bundle.entry?[2].resource as? Observation + XCTAssertEqual("Observation", obs123?.dynamicType.resourceName) + XCTAssertEqual("123", obs123?.id) + let obs56 = bundle.entry?[3].resource as? Observation + XCTAssertEqual("Observation", obs56?.dynamicType.resourceName) + XCTAssertEqual("56", obs56?.id) + let obs34 = bundle.entry?[4].resource as? Observation + XCTAssertEqual("Observation", obs34?.dynamicType.resourceName) + XCTAssertEqual("34", obs34?.id) + + // test resolving + bundle._server = FHIROpenServer(baseURL: NSURL(string: "https://fhir.smarthealthit.org")!) + let res1 = obs123!.subject!.resolved(Patient.self) // relative reference, bundled + XCTAssertTrue(res1 === pat23) + let res2 = obs123!.subject!.resolved(Medication.self) + XCTAssertNil(res2, "Must not resolve on type mismatch") + + let res3 = obs56!.subject!.resolved(Patient.self) // bundled, URN-referenced + XCTAssertTrue(res3 === patURN) + + let readyExpectation = expectationWithDescription("absolute") + obs34!.subject!.resolve(Patient.self) { pat in // absolute reference, on same server but different endpoint + XCTAssertNil(pat, "Must not resolve Patient on same server but different endpoint") + readyExpectation.fulfill() + } + waitForExpectationsWithTimeout(1) { error in + XCTAssertNil(error, "Should return immediately") + } + } + else { + XCTAssertTrue(false, "Test resource not bundled") + } + } + func testRelativeReference() { if let path = NSBundle(forClass: self.dynamicType).pathForResource("ReferenceRelative", ofType: "json", inDirectory: "TestResources") { let order1 = try! MedicationOrder.instantiateFromPath(path) diff --git a/Tests/TestResources/ReferenceBundled.json b/Tests/TestResources/ReferenceBundled.json new file mode 100644 index 00000000..da4bc00a --- /dev/null +++ b/Tests/TestResources/ReferenceBundled.json @@ -0,0 +1,78 @@ +{ + "resourceType": "Bundle", + "type": "collection", + "entry": [ + { + "fullUrl": "https://fhir.smarthealthit.org/Patient/23", + "resource": { + "resourceType": "Patient", + "id": "23", + "name": [ + { + "given": ["Darth"], + "family": ["Vader"] + }, + { + "given": ["Anakin"], + "family": ["Skywalker"] + } + ] + } + }, + { + "fullUrl": "urn:uuid:04121321-4af5-424c-a0e1-ed3aab1c349d", + "resource": { + "resourceType": "Patient", + "name": [ + { + "given": ["Ben"], + "family": ["Kenobi"] + }, + { + "given": ["Obi-Wan"], + "family": ["Kenobi"] + } + ] + } + }, + { + "fullUrl": "https://fhir.smarthealthit.org/Observation/123", + "resource": { + "resourceType": "Observation", + "id": "123", + "subject": { + "reference": "Patient/23" + }, + "code": {}, + "status": "active", + "comment": "Observation 123, referencing subject relatively" + } + }, + { + "fullUrl": "https://fhir.smarthealthit.org/Observation/56", + "resource": { + "resourceType": "Observation", + "id": "56", + "subject": { + "reference": "urn:uuid:04121321-4af5-424c-a0e1-ed3aab1c349d" + }, + "code": {}, + "status": "active", + "comment": "Observation 56, referencing subject via UUID" + } + }, + { + "fullUrl": "https://fhir.smarthealthit.org/Observation/34", + "resource": { + "resourceType": "Observation", + "id": "34", + "subject": { + "reference": "https://fhir.smarthealthit.org/dev/Patient/99" + }, + "code": {}, + "status": "active", + "comment": "Observation 34 with absolute subject reference to different endpoint" + } + } + ] +} diff --git a/fhir-parser b/fhir-parser index c6c837ba..2a2eb7cf 160000 --- a/fhir-parser +++ b/fhir-parser @@ -1 +1 @@ -Subproject commit c6c837ba2fcfe94bf80d634563a3288f12a3d740 +Subproject commit 2a2eb7cf0491323c1a2bef0335957a629f672c5e From 0ca5a0f1bff750ad1e832d30521b6a35f2871cac Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Thu, 5 May 2016 17:30:11 -0400 Subject: [PATCH 02/20] Remove unnecessary request logging Can be done in subclasses if needed --- Sources/Client/FHIROpenServer.swift | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Sources/Client/FHIROpenServer.swift b/Sources/Client/FHIROpenServer.swift index 10040ef7..5586ec69 100644 --- a/Sources/Client/FHIROpenServer.swift +++ b/Sources/Client/FHIROpenServer.swift @@ -139,13 +139,8 @@ public class FHIROpenServer: FHIRServer { public func performPreparedRequest(request: NSMutableURLRequest, withSession session: NSURLSession, handler: R, callback: ((response: FHIRServerResponse) -> Void)) { let task = session.dataTaskWithRequest(request) { data, response, error in let res = handler.response(response: response, data: data, error: error) - fhir_logIfDebug("Server responded with status \(res.status)") - //let str = NSString(data: data!, encoding: NSUTF8StringEncoding) - //logIfDebug("\(str)") callback(response: res) } - - fhir_logIfDebug("Performing \(handler.type.rawValue) request against \(request.URL!)") task.resume() } From 36774740d25566f37549cd7179674355a05121a1 Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Thu, 5 May 2016 19:15:21 -0400 Subject: [PATCH 03/20] Extend FHIRServerResponse with debugDescription --- Sources/Client/FHIRServerDataResponse.swift | 28 +++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/Sources/Client/FHIRServerDataResponse.swift b/Sources/Client/FHIRServerDataResponse.swift index 63402538..2bb70ca1 100644 --- a/Sources/Client/FHIRServerDataResponse.swift +++ b/Sources/Client/FHIRServerDataResponse.swift @@ -13,9 +13,9 @@ import Models /** - Encapsulates a server response, which can also indicate that there was no response or not even a request, in which case the `error` - property carries the only useful information. - */ +Encapsulates a server response, which can also indicate that there was no response or not even a request, in which case the `error` +property carries the only useful information. +*/ public class FHIRServerDataResponse: FHIRServerResponse { /// The HTTP status code. @@ -100,8 +100,8 @@ public class FHIRServerDataResponse: FHIRServerResponse { /** - Encapsulates a server response with JSON response body, if any. - */ +Encapsulates a server response with JSON response body, if any. +*/ public class FHIRServerJSONResponse: FHIRServerDataResponse { /// The response body, decoded into a FHIRJSON @@ -171,10 +171,24 @@ public class FHIRServerJSONResponse: FHIRServerDataResponse { } +// MARK: - + +extension FHIRServerResponse { + + /// Nicely format status code, response headers and response body (if any). + public var debugDescription: String { + var msg = "HTTP 1.1 \(status)" + headers.forEach() { msg += "\n\($0): \($1)" } + if let body = body where body.length > 0 { + msg += "\n\n\(NSString(data: body, encoding: NSUTF8StringEncoding) ?? "")" + } + return msg + } +} /** - Return a human-readable, localized string for error codes of the NSURLErrorDomain. - */ +Return a human-readable, localized string for error codes of the NSURLErrorDomain. +*/ func NSURLErrorHumanize(error: NSError) -> String { assert(NSURLErrorDomain == error.domain, "Can only use this function with errors in the NSURLErrorDomain") switch error.code { From 896a8a338d616a876159bcc532a174ebf218a4dd Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Thu, 21 Jul 2016 13:54:52 +0200 Subject: [PATCH 04/20] Compatibility with Swift 2.3 --- Info.plist | 4 ++-- README.md | 1 + Sources/Client/FHIROpenServer.swift | 4 ++-- Sources/Client/Resource+REST.swift | 5 +++- SwiftFHIR.xcodeproj/project.pbxproj | 24 +++++++++++++++---- .../xcschemes/SwiftFHIR-OSX.xcscheme | 2 +- .../xcschemes/SwiftFHIR-iOS.xcscheme | 2 +- 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Info.plist b/Info.plist index 40d2e7bb..9f613094 100644 --- a/Info.plist +++ b/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.2.3 + 2.3 CFBundleSignature ???? CFBundleVersion - 2.2.3.0 + 2.3.0.0 NSHumanReadableCopyright Copyright © 2014 CHIP. All rights reserved. NSPrincipalClass diff --git a/README.md b/README.md index be008473..4701206e 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ See the `develop` branch or specific `feature/x` branches for new Swift or FHIR Version | Swift | FHIR |   ---------|-----------|---------------|----------------------------- + **2.3** | 2.3 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.2.3**| 2.2 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.2** | 2.0-2.2 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.1** | 2.0-2.2 | `1.0.1.7108` | DSTU 2 diff --git a/Sources/Client/FHIROpenServer.swift b/Sources/Client/FHIROpenServer.swift index 5586ec69..a4b36e4b 100644 --- a/Sources/Client/FHIROpenServer.swift +++ b/Sources/Client/FHIROpenServer.swift @@ -35,8 +35,8 @@ public class FHIROpenServer: FHIRServer { Main initializer. Makes sure the base URL ends with a "/" to facilitate URL generation later on. */ public required init(baseURL base: NSURL, auth: [String: AnyObject]? = nil) { - if let last = base.absoluteString.characters.last where last != "/" { - baseURL = base.URLByAppendingPathComponent("/") + if let last = base.absoluteString?.characters.last where last != "/" { + baseURL = base.URLByAppendingPathComponent("/")! } else { baseURL = base diff --git a/Sources/Client/Resource+REST.swift b/Sources/Client/Resource+REST.swift index a7df8598..48f5f104 100644 --- a/Sources/Client/Resource+REST.swift +++ b/Sources/Client/Resource+REST.swift @@ -76,7 +76,10 @@ public extension Resource { public func absoluteURL() throws -> NSURL { let relative = try relativeURLPath() if let server = _server { - return server.baseURL.URLByAppendingPathComponent(relative) + if let absolute = server.baseURL.URLByAppendingPathComponent(relative) { + return absolute + } + throw FHIRError.ResourceLocationUnknown } throw FHIRError.ResourceWithoutServer } diff --git a/SwiftFHIR.xcodeproj/project.pbxproj b/SwiftFHIR.xcodeproj/project.pbxproj index 708548cb..ffb9c91e 100644 --- a/SwiftFHIR.xcodeproj/project.pbxproj +++ b/SwiftFHIR.xcodeproj/project.pbxproj @@ -1222,7 +1222,7 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "SMART Health IT"; TargetAttributes = { EE684C1D19A789BA00B5A2C0 = { @@ -1231,8 +1231,12 @@ EE684C2819A789BA00B5A2C0 = { CreatedOnToolsVersion = 6.0; }; + EE6DA7CD1A5D4B1000E00708 = { + LastSwiftMigration = 0800; + }; EE6DA85C1A5D4B3A00E00708 = { CreatedOnToolsVersion = 6.2; + LastSwiftMigration = 0800; }; }; }; @@ -1837,6 +1841,7 @@ ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -1854,6 +1859,7 @@ MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1883,6 +1889,7 @@ ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -1892,6 +1899,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -1936,14 +1944,15 @@ PRODUCT_NAME = SwiftFHIR; SDKROOT = macosx; SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; EE684C3519A789BA00B5A2C0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; COMBINE_HIDPI_IMAGES = YES; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", "$(inherited)", @@ -1959,8 +1968,8 @@ EE684C3619A789BA00B5A2C0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; COMBINE_HIDPI_IMAGES = YES; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", "$(inherited)", @@ -1970,6 +1979,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.chip.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; @@ -2012,13 +2022,14 @@ PRODUCT_NAME = SwiftFHIR; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; EE6DA8671A5D4B3A00E00708 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -2029,14 +2040,15 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.chip.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_VERSION = 2.3; }; name = Debug; }; EE6DA8681A5D4B3A00E00708 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; COPY_PHASE_STRIP = NO; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -2046,6 +2058,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.chip.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 2.3; }; name = Release; }; diff --git a/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme b/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme index 895c972e..96b4ae60 100644 --- a/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme +++ b/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme @@ -1,6 +1,6 @@ Date: Mon, 25 Jul 2016 16:34:44 +0200 Subject: [PATCH 05/20] Revert "Compatibility with Swift 2.3" This reverts commit 896a8a338d616a876159bcc532a174ebf218a4dd. --- Info.plist | 4 ++-- README.md | 1 - Sources/Client/FHIROpenServer.swift | 4 ++-- Sources/Client/Resource+REST.swift | 5 +--- SwiftFHIR.xcodeproj/project.pbxproj | 24 ++++--------------- .../xcschemes/SwiftFHIR-OSX.xcscheme | 2 +- .../xcschemes/SwiftFHIR-iOS.xcscheme | 2 +- 7 files changed, 12 insertions(+), 30 deletions(-) diff --git a/Info.plist b/Info.plist index 9f613094..40d2e7bb 100644 --- a/Info.plist +++ b/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.3 + 2.2.3 CFBundleSignature ???? CFBundleVersion - 2.3.0.0 + 2.2.3.0 NSHumanReadableCopyright Copyright © 2014 CHIP. All rights reserved. NSPrincipalClass diff --git a/README.md b/README.md index 4701206e..be008473 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ See the `develop` branch or specific `feature/x` branches for new Swift or FHIR Version | Swift | FHIR |   ---------|-----------|---------------|----------------------------- - **2.3** | 2.3 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.2.3**| 2.2 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.2** | 2.0-2.2 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.1** | 2.0-2.2 | `1.0.1.7108` | DSTU 2 diff --git a/Sources/Client/FHIROpenServer.swift b/Sources/Client/FHIROpenServer.swift index a4b36e4b..5586ec69 100644 --- a/Sources/Client/FHIROpenServer.swift +++ b/Sources/Client/FHIROpenServer.swift @@ -35,8 +35,8 @@ public class FHIROpenServer: FHIRServer { Main initializer. Makes sure the base URL ends with a "/" to facilitate URL generation later on. */ public required init(baseURL base: NSURL, auth: [String: AnyObject]? = nil) { - if let last = base.absoluteString?.characters.last where last != "/" { - baseURL = base.URLByAppendingPathComponent("/")! + if let last = base.absoluteString.characters.last where last != "/" { + baseURL = base.URLByAppendingPathComponent("/") } else { baseURL = base diff --git a/Sources/Client/Resource+REST.swift b/Sources/Client/Resource+REST.swift index 48f5f104..a7df8598 100644 --- a/Sources/Client/Resource+REST.swift +++ b/Sources/Client/Resource+REST.swift @@ -76,10 +76,7 @@ public extension Resource { public func absoluteURL() throws -> NSURL { let relative = try relativeURLPath() if let server = _server { - if let absolute = server.baseURL.URLByAppendingPathComponent(relative) { - return absolute - } - throw FHIRError.ResourceLocationUnknown + return server.baseURL.URLByAppendingPathComponent(relative) } throw FHIRError.ResourceWithoutServer } diff --git a/SwiftFHIR.xcodeproj/project.pbxproj b/SwiftFHIR.xcodeproj/project.pbxproj index ffb9c91e..708548cb 100644 --- a/SwiftFHIR.xcodeproj/project.pbxproj +++ b/SwiftFHIR.xcodeproj/project.pbxproj @@ -1222,7 +1222,7 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 0700; ORGANIZATIONNAME = "SMART Health IT"; TargetAttributes = { EE684C1D19A789BA00B5A2C0 = { @@ -1231,12 +1231,8 @@ EE684C2819A789BA00B5A2C0 = { CreatedOnToolsVersion = 6.0; }; - EE6DA7CD1A5D4B1000E00708 = { - LastSwiftMigration = 0800; - }; EE6DA85C1A5D4B3A00E00708 = { CreatedOnToolsVersion = 6.2; - LastSwiftMigration = 0800; }; }; }; @@ -1841,7 +1837,6 @@ ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -1859,7 +1854,6 @@ MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1889,7 +1883,6 @@ ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -1899,7 +1892,6 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; - SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -1944,15 +1936,14 @@ PRODUCT_NAME = SwiftFHIR; SDKROOT = macosx; SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; EE684C3519A789BA00B5A2C0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; COMBINE_HIDPI_IMAGES = YES; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", "$(inherited)", @@ -1968,8 +1959,8 @@ EE684C3619A789BA00B5A2C0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; COMBINE_HIDPI_IMAGES = YES; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", "$(inherited)", @@ -1979,7 +1970,6 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.chip.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; @@ -2022,14 +2012,13 @@ PRODUCT_NAME = SwiftFHIR; SDKROOT = iphoneos; SKIP_INSTALL = YES; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; EE6DA8671A5D4B3A00E00708 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -2040,15 +2029,14 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.chip.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_VERSION = 2.3; }; name = Debug; }; EE6DA8681A5D4B3A00E00708 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; COPY_PHASE_STRIP = NO; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -2058,8 +2046,6 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.chip.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 2.3; }; name = Release; }; diff --git a/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme b/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme index 96b4ae60..895c972e 100644 --- a/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme +++ b/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme @@ -1,6 +1,6 @@ Date: Thu, 21 Jul 2016 13:54:52 +0200 Subject: [PATCH 06/20] Compatibility with Swift 2.3 --- Info.plist | 4 ++-- README.md | 1 + Sources/Client/FHIROpenServer.swift | 4 ++-- Sources/Client/Resource+REST.swift | 5 +++- SwiftFHIR.xcodeproj/project.pbxproj | 24 +++++++++++++++---- .../xcschemes/SwiftFHIR-OSX.xcscheme | 2 +- .../xcschemes/SwiftFHIR-iOS.xcscheme | 2 +- 7 files changed, 30 insertions(+), 12 deletions(-) diff --git a/Info.plist b/Info.plist index 40d2e7bb..9f613094 100644 --- a/Info.plist +++ b/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.2.3 + 2.3 CFBundleSignature ???? CFBundleVersion - 2.2.3.0 + 2.3.0.0 NSHumanReadableCopyright Copyright © 2014 CHIP. All rights reserved. NSPrincipalClass diff --git a/README.md b/README.md index be008473..4701206e 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ See the `develop` branch or specific `feature/x` branches for new Swift or FHIR Version | Swift | FHIR |   ---------|-----------|---------------|----------------------------- + **2.3** | 2.3 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.2.3**| 2.2 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.2** | 2.0-2.2 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.1** | 2.0-2.2 | `1.0.1.7108` | DSTU 2 diff --git a/Sources/Client/FHIROpenServer.swift b/Sources/Client/FHIROpenServer.swift index 5586ec69..a4b36e4b 100644 --- a/Sources/Client/FHIROpenServer.swift +++ b/Sources/Client/FHIROpenServer.swift @@ -35,8 +35,8 @@ public class FHIROpenServer: FHIRServer { Main initializer. Makes sure the base URL ends with a "/" to facilitate URL generation later on. */ public required init(baseURL base: NSURL, auth: [String: AnyObject]? = nil) { - if let last = base.absoluteString.characters.last where last != "/" { - baseURL = base.URLByAppendingPathComponent("/") + if let last = base.absoluteString?.characters.last where last != "/" { + baseURL = base.URLByAppendingPathComponent("/")! } else { baseURL = base diff --git a/Sources/Client/Resource+REST.swift b/Sources/Client/Resource+REST.swift index a7df8598..48f5f104 100644 --- a/Sources/Client/Resource+REST.swift +++ b/Sources/Client/Resource+REST.swift @@ -76,7 +76,10 @@ public extension Resource { public func absoluteURL() throws -> NSURL { let relative = try relativeURLPath() if let server = _server { - return server.baseURL.URLByAppendingPathComponent(relative) + if let absolute = server.baseURL.URLByAppendingPathComponent(relative) { + return absolute + } + throw FHIRError.ResourceLocationUnknown } throw FHIRError.ResourceWithoutServer } diff --git a/SwiftFHIR.xcodeproj/project.pbxproj b/SwiftFHIR.xcodeproj/project.pbxproj index 708548cb..ffb9c91e 100644 --- a/SwiftFHIR.xcodeproj/project.pbxproj +++ b/SwiftFHIR.xcodeproj/project.pbxproj @@ -1222,7 +1222,7 @@ attributes = { LastSwiftMigration = 0700; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0800; ORGANIZATIONNAME = "SMART Health IT"; TargetAttributes = { EE684C1D19A789BA00B5A2C0 = { @@ -1231,8 +1231,12 @@ EE684C2819A789BA00B5A2C0 = { CreatedOnToolsVersion = 6.0; }; + EE6DA7CD1A5D4B1000E00708 = { + LastSwiftMigration = 0800; + }; EE6DA85C1A5D4B3A00E00708 = { CreatedOnToolsVersion = 6.2; + LastSwiftMigration = 0800; }; }; }; @@ -1837,6 +1841,7 @@ ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", @@ -1854,6 +1859,7 @@ MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -1883,6 +1889,7 @@ ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; @@ -1892,6 +1899,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.0; MACOSX_DEPLOYMENT_TARGET = 10.9; MTL_ENABLE_DEBUG_INFO = NO; + SWIFT_VERSION = 2.3; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; @@ -1936,14 +1944,15 @@ PRODUCT_NAME = SwiftFHIR; SDKROOT = macosx; SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; EE684C3519A789BA00B5A2C0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; COMBINE_HIDPI_IMAGES = YES; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", "$(inherited)", @@ -1959,8 +1968,8 @@ EE684C3619A789BA00B5A2C0 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; COMBINE_HIDPI_IMAGES = YES; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = ( "$(DEVELOPER_FRAMEWORKS_DIR)", "$(inherited)", @@ -1970,6 +1979,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.chip.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; @@ -2012,13 +2022,14 @@ PRODUCT_NAME = SwiftFHIR; SDKROOT = iphoneos; SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; }; name = Release; }; EE6DA8671A5D4B3A00E00708 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -2029,14 +2040,15 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.chip.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_VERSION = 2.3; }; name = Debug; }; EE6DA8681A5D4B3A00E00708 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; COPY_PHASE_STRIP = NO; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; FRAMEWORK_SEARCH_PATHS = ( "$(SDKROOT)/Developer/Library/Frameworks", "$(inherited)", @@ -2046,6 +2058,8 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.chip.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 2.3; }; name = Release; }; diff --git a/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme b/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme index 895c972e..96b4ae60 100644 --- a/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme +++ b/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme @@ -1,6 +1,6 @@ Date: Mon, 25 Jul 2016 16:36:44 +0200 Subject: [PATCH 07/20] Update version number --- CHANGELOG.md | 5 +++++ FHIR.podspec | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e7a7ebe..fe76f62d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ Changelog ========= +## 2.3 + +- Update to Swift 2.3 + + ## 2.2.3 - Address deprecation warnings appearing with Swift 2.2 diff --git a/FHIR.podspec b/FHIR.podspec index ae1281ce..d5aee83c 100644 --- a/FHIR.podspec +++ b/FHIR.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| s.name = "FHIR" - s.version = "2.2.3" + s.version = "2.3" s.summary = "Swift 🔥FHIR data model classes, with some goodies." s.description = <<-DESC Swift 🔥FHIR data model classes, generated from spec. Uses custom Date/Time structs to facilitate From 44d096bbb5fb5b26e14a8a1390317c7b2d82e169 Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Tue, 9 Aug 2016 17:32:46 +0200 Subject: [PATCH 08/20] Support DSTU-2 models with Swift 3 --- FHIR.podspec | 2 +- Info.plist | 4 +- Sources/Models/Account.swift | 2 +- Sources/Models/ActionDefinition.swift | 545 --- Sources/Models/Address.swift | 9 +- Sources/Models/Age.swift | 2 +- Sources/Models/AllergyIntolerance.swift | 24 +- Sources/Models/Annotation.swift | 2 +- Sources/Models/Appointment.swift | 92 +- Sources/Models/AppointmentResponse.swift | 2 +- Sources/Models/Attachment.swift | 2 +- Sources/Models/AuditEvent.swift | 714 ++-- Sources/Models/BackboneElement.swift | 2 +- Sources/Models/Basic.swift | 2 +- Sources/Models/Binary.swift | 2 +- Sources/Models/BodySite.swift | 2 +- Sources/Models/Bundle.swift | 4 +- Sources/Models/CarePlan.swift | 2 +- Sources/Models/CareTeam.swift | 240 -- Sources/Models/Claim.swift | 1141 +----- Sources/Models/ClaimResponse.swift | 367 +- Sources/Models/ClinicalImpression.swift | 2 +- Sources/Models/CodeSystem.swift | 1026 ----- Sources/Models/CodeableConcept.swift | 2 +- Sources/Models/Coding.swift | 2 +- Sources/Models/Communication.swift | 2 +- Sources/Models/CommunicationRequest.swift | 2 +- Sources/Models/CompartmentDefinition.swift | 395 -- Sources/Models/Composition.swift | 2 +- Sources/Models/ConceptMap.swift | 114 +- Sources/Models/Condition.swift | 2 +- Sources/Models/Conformance.swift | 39 +- Sources/Models/ContactPoint.swift | 2 +- Sources/Models/Contract.swift | 165 +- Sources/Models/Count.swift | 2 +- Sources/Models/Coverage.swift | 212 +- Sources/Models/DataElement.swift | 18 +- Sources/Models/DataRequirement.swift | 353 -- Sources/Models/DateAndTime.swift | 3 + Sources/Models/DecisionSupportRule.swift | 119 - .../Models/DecisionSupportServiceModule.swift | 103 - Sources/Models/DetectedIssue.swift | 2 +- Sources/Models/Device.swift | 52 +- Sources/Models/DeviceComponent.swift | 2 +- Sources/Models/DeviceMetric.swift | 2 +- Sources/Models/DeviceUseRequest.swift | 2 +- Sources/Models/DeviceUseStatement.swift | 2 +- Sources/Models/DiagnosticOrder.swift | 8 +- Sources/Models/DiagnosticReport.swift | 2 +- Sources/Models/Distance.swift | 2 +- Sources/Models/DocumentManifest.swift | 2 +- Sources/Models/DocumentReference.swift | 2 +- Sources/Models/DomainResource.swift | 2 +- Sources/Models/Duration.swift | 2 +- Sources/Models/Element.swift | 2 +- Sources/Models/ElementDefinition.swift | 204 +- Sources/Models/EligibilityRequest.swift | 299 +- Sources/Models/EligibilityResponse.swift | 496 +-- Sources/Models/Encounter.swift | 2 +- Sources/Models/EnrollmentRequest.swift | 2 +- Sources/Models/EnrollmentResponse.swift | 2 +- Sources/Models/EpisodeOfCare.swift | 109 +- Sources/Models/ExpansionProfile.swift | 1007 ----- Sources/Models/ExplanationOfBenefit.swift | 3475 +---------------- Sources/Models/Extension.swift | 2 +- Sources/Models/FHIRAbstractBase+Factory.swift | 372 +- Sources/Models/FamilyMemberHistory.swift | 2 +- Sources/Models/Flag.swift | 2 +- Sources/Models/Goal.swift | 2 +- Sources/Models/Group.swift | 17 +- Sources/Models/GuidanceResponse.swift | 599 --- Sources/Models/HealthcareService.swift | 117 +- Sources/Models/HumanName.swift | 2 +- Sources/Models/Identifier.swift | 2 +- Sources/Models/ImagingExcerpt.swift | 883 ----- Sources/Models/ImagingObjectSelection.swift | 52 +- Sources/Models/ImagingStudy.swift | 6 +- Sources/Models/Immunization.swift | 2 +- .../Models/ImmunizationRecommendation.swift | 2 +- Sources/Models/ImplementationGuide.swift | 44 +- Sources/Models/Library.swift | 565 --- Sources/Models/Linkage.swift | 157 - Sources/Models/List.swift | 12 +- Sources/Models/Location.swift | 4 +- Sources/Models/Measure.swift | 704 ---- Sources/Models/MeasureReport.swift | 804 ---- Sources/Models/Media.swift | 2 +- Sources/Models/Medication.swift | 84 +- Sources/Models/MedicationAdministration.swift | 14 +- Sources/Models/MedicationDispense.swift | 21 +- Sources/Models/MedicationOrder.swift | 57 +- Sources/Models/MedicationStatement.swift | 16 +- Sources/Models/MessageHeader.swift | 2 +- Sources/Models/Meta.swift | 2 +- Sources/Models/ModuleDefinition.swift | 986 ----- Sources/Models/ModuleMetadata.swift | 748 ---- Sources/Models/Money.swift | 2 +- Sources/Models/NamingSystem.swift | 4 +- Sources/Models/Narrative.swift | 2 +- Sources/Models/NutritionOrder.swift | 4 +- Sources/Models/Observation.swift | 16 +- Sources/Models/OperationDefinition.swift | 68 +- Sources/Models/OperationOutcome.swift | 21 +- Sources/Models/Order.swift | 2 +- Sources/Models/OrderResponse.swift | 2 +- Sources/Models/OrderSet.swift | 88 - Sources/Models/Organization.swift | 2 +- Sources/Models/ParameterDefinition.swift | 161 - Sources/Models/Parameters.swift | 2 +- Sources/Models/Patient.swift | 2 +- Sources/Models/PaymentNotice.swift | 162 +- Sources/Models/PaymentReconciliation.swift | 234 +- Sources/Models/Period.swift | 2 +- Sources/Models/Person.swift | 2 +- Sources/Models/Practitioner.swift | 62 +- Sources/Models/PractitionerRole.swift | 405 -- Sources/Models/Procedure.swift | 2 +- Sources/Models/ProcedureRequest.swift | 2 +- Sources/Models/ProcessRequest.swift | 147 +- Sources/Models/ProcessResponse.swift | 118 +- Sources/Models/ProtocolFHIR.swift | 1010 ----- Sources/Models/Provenance.swift | 29 +- Sources/Models/Quantity.swift | 2 +- Sources/Models/Questionnaire.swift | 825 +--- Sources/Models/QuestionnaireResponse.swift | 202 +- Sources/Models/Range.swift | 2 +- Sources/Models/Ratio.swift | 2 +- Sources/Models/Reference.swift | 2 +- Sources/Models/ReferralRequest.swift | 100 +- Sources/Models/RelatedPerson.swift | 2 +- Sources/Models/Resource.swift | 2 +- Sources/Models/RiskAssessment.swift | 2 +- Sources/Models/SampledData.swift | 2 +- Sources/Models/Schedule.swift | 48 +- Sources/Models/SearchParameter.swift | 34 +- Sources/Models/Sequence.swift | 998 ----- Sources/Models/Signature.swift | 12 +- Sources/Models/Slot.swift | 105 +- Sources/Models/Specimen.swift | 14 +- Sources/Models/StructureDefinition.swift | 67 +- Sources/Models/StructureMap.swift | 1349 ------- Sources/Models/Subscription.swift | 2 +- Sources/Models/Substance.swift | 2 +- Sources/Models/SupplyDelivery.swift | 2 +- Sources/Models/SupplyRequest.swift | 2 +- Sources/Models/Task.swift | 1494 ------- Sources/Models/TestScript.swift | 1400 ++----- Sources/Models/Timing.swift | 60 +- Sources/Models/TriggerDefinition.swift | 156 - Sources/Models/ValueSet.swift | 435 ++- Sources/Models/VisionPrescription.swift | 2 +- SwiftFHIR.xcodeproj/project.pbxproj | 246 -- Tests/ModelTests/AccountTests.swift | 2 +- .../ModelTests/AllergyIntoleranceTests.swift | 14 +- .../ModelTests/AppointmentResponseTests.swift | 5 +- Tests/ModelTests/AppointmentTests.swift | 49 +- Tests/ModelTests/AuditEventTests.swift | 484 +-- Tests/ModelTests/BasicTests.swift | 2 +- Tests/ModelTests/BinaryTests.swift | 2 +- Tests/ModelTests/BodySiteTests.swift | 2 +- Tests/ModelTests/BundleTests.swift | 4 +- Tests/ModelTests/CarePlanTests.swift | 4 +- Tests/ModelTests/CareTeamTests.swift | 55 - Tests/ModelTests/ClaimResponseTests.swift | 16 +- Tests/ModelTests/ClaimTests.swift | 324 +- .../ModelTests/ClinicalImpressionTests.swift | 2 +- Tests/ModelTests/CodeSystemTests.swift | 141 - .../CommunicationRequestTests.swift | 2 +- Tests/ModelTests/CommunicationTests.swift | 2 +- Tests/ModelTests/CompositionTests.swift | 2 +- Tests/ModelTests/ConceptMapTests.swift | 74 +- Tests/ModelTests/ConditionTests.swift | 2 +- Tests/ModelTests/ConformanceTests.swift | 3 +- Tests/ModelTests/ContractTests.swift | 2 +- Tests/ModelTests/CoverageTests.swift | 14 +- Tests/ModelTests/DataElementTests.swift | 9 +- .../ModelTests/DecisionSupportRuleTests.swift | 59 - .../DecisionSupportServiceModuleTests.swift | 71 - Tests/ModelTests/DetectedIssueTests.swift | 2 +- Tests/ModelTests/DeviceComponentTests.swift | 2 +- Tests/ModelTests/DeviceMetricTests.swift | 2 +- Tests/ModelTests/DeviceTests.swift | 47 +- Tests/ModelTests/DeviceUseRequestTests.swift | 2 +- .../ModelTests/DeviceUseStatementTests.swift | 2 +- Tests/ModelTests/DiagnosticOrderTests.swift | 67 +- Tests/ModelTests/DiagnosticReportTests.swift | 85 +- Tests/ModelTests/DocumentManifestTests.swift | 62 + Tests/ModelTests/DocumentReferenceTests.swift | 2 +- .../ModelTests/EligibilityRequestTests.swift | 8 +- .../ModelTests/EligibilityResponseTests.swift | 8 +- Tests/ModelTests/EncounterTests.swift | 8 +- Tests/ModelTests/EnrollmentRequestTests.swift | 2 +- .../ModelTests/EnrollmentResponseTests.swift | 2 +- Tests/ModelTests/EpisodeOfCareTests.swift | 9 +- Tests/ModelTests/ExpansionProfileTests.swift | 48 - .../ExplanationOfBenefitTests.swift | 42 +- .../ModelTests/FamilyMemberHistoryTests.swift | 2 +- Tests/ModelTests/FlagTests.swift | 2 +- Tests/ModelTests/GoalTests.swift | 2 +- Tests/ModelTests/GroupTests.swift | 2 +- Tests/ModelTests/GuidanceResponseTests.swift | 47 - Tests/ModelTests/HealthcareServiceTests.swift | 22 +- Tests/ModelTests/ImagingExcerptTests.swift | 78 - .../ImagingObjectSelectionTests.swift | 2 +- Tests/ModelTests/ImagingStudyTests.swift | 2 +- .../ImmunizationRecommendationTests.swift | 6 +- Tests/ModelTests/ImmunizationTests.swift | 2 +- .../ModelTests/ImplementationGuideTests.swift | 4 +- Tests/ModelTests/LibraryTests.swift | 137 - Tests/ModelTests/LinkageTests.swift | 50 - Tests/ModelTests/ListTests.swift | 4 +- Tests/ModelTests/LocationTests.swift | 2 +- Tests/ModelTests/MeasureReportTests.swift | 443 --- Tests/ModelTests/MediaTests.swift | 2 +- Tests/ModelTests/MedicationOrderTests.swift | 56 +- Tests/ModelTests/MedicationTests.swift | 10 +- Tests/ModelTests/MessageHeaderTests.swift | 2 +- Tests/ModelTests/ModuleDefinitionTests.swift | 54 - Tests/ModelTests/NamingSystemTests.swift | 2 +- Tests/ModelTests/NutritionOrderTests.swift | 18 +- Tests/ModelTests/ObservationTests.swift | 606 ++- .../ModelTests/OperationDefinitionTests.swift | 4 +- Tests/ModelTests/OperationOutcomeTests.swift | 2 +- Tests/ModelTests/OrderResponseTests.swift | 2 +- Tests/ModelTests/OrderSetTests.swift | 143 - Tests/ModelTests/OrderTests.swift | 2 +- Tests/ModelTests/OrganizationTests.swift | 6 +- Tests/ModelTests/ParametersTests.swift | 2 +- Tests/ModelTests/PatientTests.swift | 2 +- Tests/ModelTests/PaymentNoticeTests.swift | 6 +- .../PaymentReconciliationTests.swift | 11 +- Tests/ModelTests/PersonTests.swift | 2 +- Tests/ModelTests/PractitionerRoleTests.swift | 58 - Tests/ModelTests/PractitionerTests.swift | 122 +- Tests/ModelTests/ProcedureRequestTests.swift | 6 +- Tests/ModelTests/ProcedureTests.swift | 2 +- Tests/ModelTests/ProcessRequestTests.swift | 28 +- Tests/ModelTests/ProcessResponseTests.swift | 7 +- Tests/ModelTests/ProtocolFHIRTests.swift | 221 -- Tests/ModelTests/ProvenanceTests.swift | 23 +- .../QuestionnaireResponseTests.swift | 186 +- Tests/ModelTests/QuestionnaireTests.swift | 264 +- Tests/ModelTests/ReferralRequestTests.swift | 7 +- Tests/ModelTests/RelatedPersonTests.swift | 2 +- Tests/ModelTests/RiskAssessmentTests.swift | 2 +- Tests/ModelTests/ScheduleTests.swift | 12 +- Tests/ModelTests/SearchParameterTests.swift | 2 +- Tests/ModelTests/SequenceTests.swift | 60 - Tests/ModelTests/SlotTests.swift | 33 +- Tests/ModelTests/SpecimenTests.swift | 4 +- .../ModelTests/StructureDefinitionTests.swift | 204 +- Tests/ModelTests/StructureMapTests.swift | 57 - Tests/ModelTests/SubscriptionTests.swift | 2 +- Tests/ModelTests/SubstanceTests.swift | 2 +- Tests/ModelTests/SupplyDeliveryTests.swift | 2 +- Tests/ModelTests/SupplyRequestTests.swift | 2 +- Tests/ModelTests/TaskTests.swift | 51 - Tests/ModelTests/TestScriptTests.swift | 123 +- Tests/ModelTests/ValueSetTests.swift | 119 +- .../ModelTests/VisionPrescriptionTests.swift | 2 +- fhir-parser | 2 +- generate-docs.sh | 2 +- generator-settings.py | 6 +- 263 files changed, 4200 insertions(+), 28711 deletions(-) delete mode 100644 Sources/Models/ActionDefinition.swift delete mode 100644 Sources/Models/CareTeam.swift delete mode 100644 Sources/Models/CodeSystem.swift delete mode 100644 Sources/Models/CompartmentDefinition.swift delete mode 100644 Sources/Models/DataRequirement.swift delete mode 100644 Sources/Models/DecisionSupportRule.swift delete mode 100644 Sources/Models/DecisionSupportServiceModule.swift delete mode 100644 Sources/Models/ExpansionProfile.swift delete mode 100644 Sources/Models/GuidanceResponse.swift delete mode 100644 Sources/Models/ImagingExcerpt.swift delete mode 100644 Sources/Models/Library.swift delete mode 100644 Sources/Models/Linkage.swift delete mode 100644 Sources/Models/Measure.swift delete mode 100644 Sources/Models/MeasureReport.swift delete mode 100644 Sources/Models/ModuleDefinition.swift delete mode 100644 Sources/Models/ModuleMetadata.swift delete mode 100644 Sources/Models/OrderSet.swift delete mode 100644 Sources/Models/ParameterDefinition.swift delete mode 100644 Sources/Models/PractitionerRole.swift delete mode 100644 Sources/Models/ProtocolFHIR.swift delete mode 100644 Sources/Models/Sequence.swift delete mode 100644 Sources/Models/StructureMap.swift delete mode 100644 Sources/Models/Task.swift delete mode 100644 Sources/Models/TriggerDefinition.swift delete mode 100644 Tests/ModelTests/CareTeamTests.swift delete mode 100644 Tests/ModelTests/CodeSystemTests.swift delete mode 100644 Tests/ModelTests/DecisionSupportRuleTests.swift delete mode 100644 Tests/ModelTests/DecisionSupportServiceModuleTests.swift create mode 100644 Tests/ModelTests/DocumentManifestTests.swift delete mode 100644 Tests/ModelTests/ExpansionProfileTests.swift delete mode 100644 Tests/ModelTests/GuidanceResponseTests.swift delete mode 100644 Tests/ModelTests/ImagingExcerptTests.swift delete mode 100644 Tests/ModelTests/LibraryTests.swift delete mode 100644 Tests/ModelTests/LinkageTests.swift delete mode 100644 Tests/ModelTests/MeasureReportTests.swift delete mode 100644 Tests/ModelTests/ModuleDefinitionTests.swift delete mode 100644 Tests/ModelTests/OrderSetTests.swift delete mode 100644 Tests/ModelTests/PractitionerRoleTests.swift delete mode 100644 Tests/ModelTests/ProtocolFHIRTests.swift delete mode 100644 Tests/ModelTests/SequenceTests.swift delete mode 100644 Tests/ModelTests/StructureMapTests.swift delete mode 100644 Tests/ModelTests/TaskTests.swift diff --git a/FHIR.podspec b/FHIR.podspec index ae1281ce..bc3e9978 100644 --- a/FHIR.podspec +++ b/FHIR.podspec @@ -7,7 +7,7 @@ Pod::Spec.new do |s| s.name = "FHIR" - s.version = "2.2.3" + s.version = "2.8" s.summary = "Swift 🔥FHIR data model classes, with some goodies." s.description = <<-DESC Swift 🔥FHIR data model classes, generated from spec. Uses custom Date/Time structs to facilitate diff --git a/Info.plist b/Info.plist index 66a7b30a..b1eb6d93 100644 --- a/Info.plist +++ b/Info.plist @@ -15,11 +15,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.9 + 2.8 CFBundleSignature ???? CFBundleVersion - 2.9.0.0 + 2.8.0.0 NSHumanReadableCopyright Copyright © 2014 CHIP. All rights reserved. NSPrincipalClass diff --git a/Sources/Models/Account.swift b/Sources/Models/Account.swift index 96c26fd9..a385c9c6 100644 --- a/Sources/Models/Account.swift +++ b/Sources/Models/Account.swift @@ -2,7 +2,7 @@ // Account.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Account) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Account) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/ActionDefinition.swift b/Sources/Models/ActionDefinition.swift deleted file mode 100644 index 7f994ded..00000000 --- a/Sources/Models/ActionDefinition.swift +++ /dev/null @@ -1,545 +0,0 @@ -// -// ActionDefinition.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ActionDefinition) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * The definition of an action to be performed. - * - * The definition of an action to be performed. Some aspects of the definition are specified statically, and some - * aspects can be specified dynamically by referencing logic defined in a library. - */ -public class ActionDefinition: Element { - override public class var resourceName: String { - get { return "ActionDefinition" } - } - - /// A sub-action. - public var action: [ActionDefinition]? - - /// Unique identifier. - public var actionIdentifier: Identifier? - - /// Defines behaviors such as selection and grouping. - public var behavior: [ActionDefinitionBehavior]? - - /// The meaning of the action or its sub-actions. - public var concept: [CodeableConcept]? - - /// Dynamic aspects of the definition. - public var customization: [ActionDefinitionCustomization]? - - /// Short description of the action. - public var description_fhir: String? - - /// Supporting documentation for the intended performer of the action. - public var documentation: [Attachment]? - - /// User-visible label for the action (e.g. 1. or A.). - public var label: String? - - /// patient | practitioner | related-person. - public var participantType: [String]? - - /// Relationship to another action. - public var relatedAction: ActionDefinitionRelatedAction? - - /// Static portion of the action definition. - public var resource: Reference? - - /// Evidence that supports taking the action. - public var supportingEvidence: [Attachment]? - - /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system. - public var textEquivalent: String? - - /// User-visible title. - public var title: String? - - /// create | update | remove | fire-event. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["action"] { - presentKeys.insert("action") - if let val = exist as? [FHIRJSON] { - self.action = ActionDefinition.instantiate(fromArray: val, owner: self) as? [ActionDefinition] - } - else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["actionIdentifier"] { - presentKeys.insert("actionIdentifier") - if let val = exist as? FHIRJSON { - self.actionIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "actionIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["behavior"] { - presentKeys.insert("behavior") - if let val = exist as? [FHIRJSON] { - self.behavior = ActionDefinitionBehavior.instantiate(fromArray: val, owner: self) as? [ActionDefinitionBehavior] - } - else { - errors.append(FHIRJSONError(key: "behavior", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["concept"] { - presentKeys.insert("concept") - if let val = exist as? [FHIRJSON] { - self.concept = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["customization"] { - presentKeys.insert("customization") - if let val = exist as? [FHIRJSON] { - self.customization = ActionDefinitionCustomization.instantiate(fromArray: val, owner: self) as? [ActionDefinitionCustomization] - } - else { - errors.append(FHIRJSONError(key: "customization", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["documentation"] { - presentKeys.insert("documentation") - if let val = exist as? [FHIRJSON] { - self.documentation = Attachment.instantiate(fromArray: val, owner: self) as? [Attachment] - } - else { - errors.append(FHIRJSONError(key: "documentation", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["label"] { - presentKeys.insert("label") - if let val = exist as? String { - self.label = val - } - else { - errors.append(FHIRJSONError(key: "label", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["participantType"] { - presentKeys.insert("participantType") - if let val = exist as? [String] { - self.participantType = val - } - else { - errors.append(FHIRJSONError(key: "participantType", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["relatedAction"] { - presentKeys.insert("relatedAction") - if let val = exist as? FHIRJSON { - self.relatedAction = ActionDefinitionRelatedAction(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "relatedAction", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["resource"] { - presentKeys.insert("resource") - if let val = exist as? FHIRJSON { - self.resource = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["supportingEvidence"] { - presentKeys.insert("supportingEvidence") - if let val = exist as? [FHIRJSON] { - self.supportingEvidence = Attachment.instantiate(fromArray: val, owner: self) as? [Attachment] - } - else { - errors.append(FHIRJSONError(key: "supportingEvidence", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["textEquivalent"] { - presentKeys.insert("textEquivalent") - if let val = exist as? String { - self.textEquivalent = val - } - else { - errors.append(FHIRJSONError(key: "textEquivalent", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["title"] { - presentKeys.insert("title") - if let val = exist as? String { - self.title = val - } - else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let action = self.action { - json["action"] = ActionDefinition.asJSONArray(action) - } - if let actionIdentifier = self.actionIdentifier { - json["actionIdentifier"] = actionIdentifier.asJSON() - } - if let behavior = self.behavior { - json["behavior"] = ActionDefinitionBehavior.asJSONArray(behavior) - } - if let concept = self.concept { - json["concept"] = CodeableConcept.asJSONArray(concept) - } - if let customization = self.customization { - json["customization"] = ActionDefinitionCustomization.asJSONArray(customization) - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let documentation = self.documentation { - json["documentation"] = Attachment.asJSONArray(documentation) - } - if let label = self.label { - json["label"] = label.asJSON() - } - if let participantType = self.participantType { - var arr = [AnyObject]() - for val in participantType { - arr.append(val.asJSON()) - } - json["participantType"] = arr - } - if let relatedAction = self.relatedAction { - json["relatedAction"] = relatedAction.asJSON() - } - if let resource = self.resource { - json["resource"] = resource.asJSON() - } - if let supportingEvidence = self.supportingEvidence { - json["supportingEvidence"] = Attachment.asJSONArray(supportingEvidence) - } - if let textEquivalent = self.textEquivalent { - json["textEquivalent"] = textEquivalent.asJSON() - } - if let title = self.title { - json["title"] = title.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Defines behaviors such as selection and grouping. - * - * A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the - * receiving environment. - */ -public class ActionDefinitionBehavior: Element { - override public class var resourceName: String { - get { return "ActionDefinitionBehavior" } - } - - /// The type of behavior (grouping, precheck, selection, cardinality, etc). - public var type: Coding? - - /// Specific behavior (e.g. required, at-most-one, single, etc). - public var value: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: Coding, value: Coding) { - self.init(json: nil) - self.type = type - self.value = value - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? FHIRJSON { - self.value = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "value", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "value")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let type = self.type { - json["type"] = type.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * 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. - */ -public class ActionDefinitionCustomization: Element { - override public class var resourceName: String { - get { return "ActionDefinitionCustomization" } - } - - /// An expression that provides the dynamic value for the customization. - public var expression: String? - - /// The path to the element to be set dynamically. - public var path: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(expression: String, path: String) { - self.init(json: nil) - self.expression = expression - self.path = path - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["expression"] { - presentKeys.insert("expression") - if let val = exist as? String { - self.expression = val - } - else { - errors.append(FHIRJSONError(key: "expression", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "expression")) - } - if let exist: AnyObject = js["path"] { - presentKeys.insert("path") - if let val = exist as? String { - self.path = val - } - else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "path")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let expression = self.expression { - json["expression"] = expression.asJSON() - } - if let path = self.path { - json["path"] = path.asJSON() - } - - return json - } -} - - -/** - * Relationship to another action. - * - * A relationship to another action such as "before" or "30-60 minutes after start of". - */ -public class ActionDefinitionRelatedAction: Element { - override public class var resourceName: String { - get { return "ActionDefinitionRelatedAction" } - } - - /// Identifier of the related action. - public var actionIdentifier: Identifier? - - /// start | end. - public var anchor: String? - - /// Time offset for the relationship. - public var offsetQuantity: Quantity? - - /// Time offset for the relationship. - public var offsetRange: Range? - - /// before | after. - public var relationship: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(actionIdentifier: Identifier, relationship: String) { - self.init(json: nil) - self.actionIdentifier = actionIdentifier - self.relationship = relationship - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["actionIdentifier"] { - presentKeys.insert("actionIdentifier") - if let val = exist as? FHIRJSON { - self.actionIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "actionIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "actionIdentifier")) - } - if let exist: AnyObject = js["anchor"] { - presentKeys.insert("anchor") - if let val = exist as? String { - self.anchor = val - } - else { - errors.append(FHIRJSONError(key: "anchor", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["offsetQuantity"] { - presentKeys.insert("offsetQuantity") - if let val = exist as? FHIRJSON { - self.offsetQuantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "offsetQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["offsetRange"] { - presentKeys.insert("offsetRange") - if let val = exist as? FHIRJSON { - self.offsetRange = Range(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "offsetRange", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["relationship"] { - presentKeys.insert("relationship") - if let val = exist as? String { - self.relationship = val - } - else { - errors.append(FHIRJSONError(key: "relationship", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "relationship")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let actionIdentifier = self.actionIdentifier { - json["actionIdentifier"] = actionIdentifier.asJSON() - } - if let anchor = self.anchor { - json["anchor"] = anchor.asJSON() - } - if let offsetQuantity = self.offsetQuantity { - json["offsetQuantity"] = offsetQuantity.asJSON() - } - if let offsetRange = self.offsetRange { - json["offsetRange"] = offsetRange.asJSON() - } - if let relationship = self.relationship { - json["relationship"] = relationship.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Address.swift b/Sources/Models/Address.swift index 51e34e1e..ff245f5d 100644 --- a/Sources/Models/Address.swift +++ b/Sources/Models/Address.swift @@ -2,7 +2,7 @@ // Address.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Address) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Address) on 2016-08-09. // 2016, SMART Health IT. // @@ -10,11 +10,10 @@ import Foundation /** - * An address expressed using postal conventions (as opposed to GPS or other location definition formats). + * A postal address. * - * 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 and which might - * not be valid for mail delivery. There are a variety of postal address formats defined around the world. + * There is a variety of postal address formats defined around the world. This format defines a superset that is the + * basis for all addresses around the world. */ public class Address: Element { override public class var resourceName: String { diff --git a/Sources/Models/Age.swift b/Sources/Models/Age.swift index 5663a0c8..d751c84c 100644 --- a/Sources/Models/Age.swift +++ b/Sources/Models/Age.swift @@ -2,7 +2,7 @@ // Age.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Age) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Age) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/AllergyIntolerance.swift b/Sources/Models/AllergyIntolerance.swift index 2a31accb..0ae32a58 100644 --- a/Sources/Models/AllergyIntolerance.swift +++ b/Sources/Models/AllergyIntolerance.swift @@ -2,7 +2,7 @@ // AllergyIntolerance.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) on 2016-08-09. // 2016, SMART Health IT. // @@ -23,7 +23,7 @@ public class AllergyIntolerance: DomainResource { /// food | medication | environment | other - Category of Substance. public var category: String? - /// low | high | unable-to-assess. + /// CRITL | CRITH | CRITU. public var criticality: String? /// External ids for this item. @@ -33,7 +33,7 @@ public class AllergyIntolerance: DomainResource { public var lastOccurence: DateTime? /// Additional text not captured in other fields. - public var note: [Annotation]? + public var note: Annotation? /// Date(/time) when manifestations showed. public var onset: DateTime? @@ -116,11 +116,11 @@ public class AllergyIntolerance: DomainResource { } if let exist: AnyObject = js["note"] { presentKeys.insert("note") - if let val = exist as? [FHIRJSON] { - self.note = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] + if let val = exist as? FHIRJSON { + self.note = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["onset"] { @@ -230,7 +230,7 @@ public class AllergyIntolerance: DomainResource { json["lastOccurence"] = lastOccurence.asJSON() } if let note = self.note { - json["note"] = Annotation.asJSONArray(note) + json["note"] = note.asJSON() } if let onset = self.onset { json["onset"] = onset.asJSON() @@ -288,7 +288,7 @@ public class AllergyIntoleranceReaction: BackboneElement { public var manifestation: [CodeableConcept]? /// Text about event not captured in other fields. - public var note: [Annotation]? + public var note: Annotation? /// Date(/time) when manifestations showed. public var onset: DateTime? @@ -355,11 +355,11 @@ public class AllergyIntoleranceReaction: BackboneElement { } if let exist: AnyObject = js["note"] { presentKeys.insert("note") - if let val = exist as? [FHIRJSON] { - self.note = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] + if let val = exist as? FHIRJSON { + self.note = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["onset"] { @@ -409,7 +409,7 @@ public class AllergyIntoleranceReaction: BackboneElement { json["manifestation"] = CodeableConcept.asJSONArray(manifestation) } if let note = self.note { - json["note"] = Annotation.asJSONArray(note) + json["note"] = note.asJSON() } if let onset = self.onset { json["onset"] = onset.asJSON() diff --git a/Sources/Models/Annotation.swift b/Sources/Models/Annotation.swift index 866a741e..62ae1abb 100644 --- a/Sources/Models/Annotation.swift +++ b/Sources/Models/Annotation.swift @@ -2,7 +2,7 @@ // Annotation.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Annotation) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Annotation) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Appointment.swift b/Sources/Models/Appointment.swift index 8c5d56dd..2cb260ad 100644 --- a/Sources/Models/Appointment.swift +++ b/Sources/Models/Appointment.swift @@ -2,7 +2,7 @@ // Appointment.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Appointment) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Appointment) on 2016-08-09. // 2016, SMART Health IT. // @@ -18,15 +18,9 @@ public class Appointment: DomainResource { get { return "Appointment" } } - /// The style of appointment or patient that has been booked in the slot (not service type). - public var appointmentType: CodeableConcept? - /// Additional comments. public var comment: String? - /// The date that this appointment was initially created. - public var created: DateTime? - /// Shown on a subject line in a meeting request, or appointment list. public var description_fhir: String? @@ -48,24 +42,18 @@ public class Appointment: DomainResource { /// Reason this appointment is scheduled. public var reason: CodeableConcept? - /// 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]? - /// If provided, then no schedule and start/end values MUST match slot. public var slot: [Reference]? - /// The specialty of a practitioner that would be required to perform the service requested in this appointment. - public var specialty: [CodeableConcept]? - /// When appointment is to take place. public var start: Instant? /// proposed | pending | booked | arrived | fulfilled | cancelled | noshow. public var status: String? + /// The type of appointment that is being booked. + public var type: CodeableConcept? + /** Initialize with a JSON object. */ public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { @@ -82,15 +70,6 @@ public class Appointment: DomainResource { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["appointmentType"] { - presentKeys.insert("appointmentType") - if let val = exist as? FHIRJSON { - self.appointmentType = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "appointmentType", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["comment"] { presentKeys.insert("comment") if let val = exist as? String { @@ -100,15 +79,6 @@ public class Appointment: DomainResource { errors.append(FHIRJSONError(key: "comment", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["created"] { - presentKeys.insert("created") - if let val = exist as? String { - self.created = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["description"] { presentKeys.insert("description") if let val = exist as? String { @@ -175,24 +145,6 @@ public class Appointment: DomainResource { errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["serviceCategory"] { - presentKeys.insert("serviceCategory") - if let val = exist as? FHIRJSON { - self.serviceCategory = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "serviceCategory", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["serviceType"] { - presentKeys.insert("serviceType") - if let val = exist as? [FHIRJSON] { - self.serviceType = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "serviceType", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["slot"] { presentKeys.insert("slot") if let val = exist as? [FHIRJSON] { @@ -202,15 +154,6 @@ public class Appointment: DomainResource { errors.append(FHIRJSONError(key: "slot", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["specialty"] { - presentKeys.insert("specialty") - if let val = exist as? [FHIRJSON] { - self.specialty = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "specialty", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["start"] { presentKeys.insert("start") if let val = exist as? String { @@ -232,6 +175,15 @@ public class Appointment: DomainResource { else { errors.append(FHIRJSONError(key: "status")) } + if let exist: AnyObject = js["type"] { + presentKeys.insert("type") + if let val = exist as? FHIRJSON { + self.type = CodeableConcept(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } } return errors.isEmpty ? nil : errors } @@ -239,15 +191,9 @@ public class Appointment: DomainResource { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let appointmentType = self.appointmentType { - json["appointmentType"] = appointmentType.asJSON() - } if let comment = self.comment { json["comment"] = comment.asJSON() } - if let created = self.created { - json["created"] = created.asJSON() - } if let description_fhir = self.description_fhir { json["description"] = description_fhir.asJSON() } @@ -269,24 +215,18 @@ public class Appointment: DomainResource { if let reason = self.reason { json["reason"] = reason.asJSON() } - if let serviceCategory = self.serviceCategory { - json["serviceCategory"] = serviceCategory.asJSON() - } - if let serviceType = self.serviceType { - json["serviceType"] = CodeableConcept.asJSONArray(serviceType) - } if let slot = self.slot { json["slot"] = Reference.asJSONArray(slot) } - if let specialty = self.specialty { - json["specialty"] = CodeableConcept.asJSONArray(specialty) - } if let start = self.start { json["start"] = start.asJSON() } if let status = self.status { json["status"] = status.asJSON() } + if let type = self.type { + json["type"] = type.asJSON() + } return json } diff --git a/Sources/Models/AppointmentResponse.swift b/Sources/Models/AppointmentResponse.swift index 202306ce..01730433 100644 --- a/Sources/Models/AppointmentResponse.swift +++ b/Sources/Models/AppointmentResponse.swift @@ -2,7 +2,7 @@ // AppointmentResponse.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Attachment.swift b/Sources/Models/Attachment.swift index 0d6d6c2e..2ceda10d 100644 --- a/Sources/Models/Attachment.swift +++ b/Sources/Models/Attachment.swift @@ -2,7 +2,7 @@ // Attachment.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Attachment) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Attachment) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/AuditEvent.swift b/Sources/Models/AuditEvent.swift index a6fe3f40..abbbee4f 100644 --- a/Sources/Models/AuditEvent.swift +++ b/Sources/Models/AuditEvent.swift @@ -2,7 +2,7 @@ // AuditEvent.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/AuditEvent) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AuditEvent) on 2016-08-09. // 2016, SMART Health IT. // @@ -20,14 +20,120 @@ public class AuditEvent: DomainResource { get { return "AuditEvent" } } + /// What was done. + public var event: AuditEventEvent? + + /// Specific instances of data or objects that have been accessed. + public var object: [AuditEventObject]? + + /// A person, a hardware device or software process. + public var participant: [AuditEventParticipant]? + + /// Application systems and processes. + public var source: AuditEventSource? + + + /** Initialize with a JSON object. */ + public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { + super.init(json: json, owner: owner) + } + + /** Convenience initializer, taking all required properties as arguments. */ + public convenience init(event: AuditEventEvent, participant: [AuditEventParticipant], source: AuditEventSource) { + self.init(json: nil) + self.event = event + self.participant = participant + self.source = source + } + + public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + if let js = json { + if let exist: AnyObject = js["event"] { + presentKeys.insert("event") + if let val = exist as? FHIRJSON { + self.event = AuditEventEvent(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "event", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "event")) + } + if let exist: AnyObject = js["object"] { + presentKeys.insert("object") + if let val = exist as? [FHIRJSON] { + self.object = AuditEventObject.instantiate(fromArray: val, owner: self) as? [AuditEventObject] + } + else { + errors.append(FHIRJSONError(key: "object", wants: Array.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["participant"] { + presentKeys.insert("participant") + if let val = exist as? [FHIRJSON] { + self.participant = AuditEventParticipant.instantiate(fromArray: val, owner: self) as? [AuditEventParticipant] + } + else { + errors.append(FHIRJSONError(key: "participant", wants: Array.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "participant")) + } + if let exist: AnyObject = js["source"] { + presentKeys.insert("source") + if let val = exist as? FHIRJSON { + self.source = AuditEventSource(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "source")) + } + } + return errors.isEmpty ? nil : errors + } + + override public func asJSON() -> FHIRJSON { + var json = super.asJSON() + + if let event = self.event { + json["event"] = event.asJSON() + } + if let object = self.object { + json["object"] = AuditEventObject.asJSONArray(object) + } + if let participant = self.participant { + json["participant"] = AuditEventParticipant.asJSONArray(participant) + } + if let source = self.source { + json["source"] = source.asJSON() + } + + return json + } +} + + +/** + * What was done. + * + * Identifies the name, action type, time, and disposition of the audited event. + */ +public class AuditEventEvent: BackboneElement { + override public class var resourceName: String { + get { return "AuditEventEvent" } + } + /// Type of action performed during the event. public var action: String? - /// Actor involved in the event. - public var agent: [AuditEventAgent]? - - /// Specific instances of data or objects that have been accessed. - public var entity: [AuditEventEntity]? + /// Time when the event occurred on source. + public var dateTime: Instant? /// Whether the event succeeded or failed. public var outcome: String? @@ -38,12 +144,6 @@ public class AuditEvent: DomainResource { /// The purposeOfUse of the event. public var purposeOfEvent: [Coding]? - /// Time when the event occurred on source. - public var recorded: Instant? - - /// Application systems and processes. - public var source: AuditEventSource? - /// More specific type/id for the event. public var subtype: [Coding]? @@ -57,11 +157,9 @@ public class AuditEvent: DomainResource { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(agent: [AuditEventAgent], recorded: Instant, source: AuditEventSource, type: Coding) { + public convenience init(dateTime: Instant, type: Coding) { self.init(json: nil) - self.agent = agent - self.recorded = recorded - self.source = source + self.dateTime = dateTime self.type = type } @@ -77,26 +175,17 @@ public class AuditEvent: DomainResource { errors.append(FHIRJSONError(key: "action", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["agent"] { - presentKeys.insert("agent") - if let val = exist as? [FHIRJSON] { - self.agent = AuditEventAgent.instantiate(fromArray: val, owner: self) as? [AuditEventAgent] + if let exist: AnyObject = js["dateTime"] { + presentKeys.insert("dateTime") + if let val = exist as? String { + self.dateTime = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "agent", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateTime", wants: String.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "agent")) - } - if let exist: AnyObject = js["entity"] { - presentKeys.insert("entity") - if let val = exist as? [FHIRJSON] { - self.entity = AuditEventEntity.instantiate(fromArray: val, owner: self) as? [AuditEventEntity] - } - else { - errors.append(FHIRJSONError(key: "entity", wants: Array.self, has: exist.dynamicType)) - } + errors.append(FHIRJSONError(key: "dateTime")) } if let exist: AnyObject = js["outcome"] { presentKeys.insert("outcome") @@ -125,30 +214,6 @@ public class AuditEvent: DomainResource { errors.append(FHIRJSONError(key: "purposeOfEvent", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["recorded"] { - presentKeys.insert("recorded") - if let val = exist as? String { - self.recorded = Instant(string: val) - } - else { - errors.append(FHIRJSONError(key: "recorded", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "recorded")) - } - if let exist: AnyObject = js["source"] { - presentKeys.insert("source") - if let val = exist as? FHIRJSON { - self.source = AuditEventSource(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "source")) - } if let exist: AnyObject = js["subtype"] { presentKeys.insert("subtype") if let val = exist as? [FHIRJSON] { @@ -180,11 +245,8 @@ public class AuditEvent: DomainResource { if let action = self.action { json["action"] = action.asJSON() } - if let agent = self.agent { - json["agent"] = AuditEventAgent.asJSONArray(agent) - } - if let entity = self.entity { - json["entity"] = AuditEventEntity.asJSONArray(entity) + if let dateTime = self.dateTime { + json["dateTime"] = dateTime.asJSON() } if let outcome = self.outcome { json["outcome"] = outcome.asJSON() @@ -195,12 +257,6 @@ public class AuditEvent: DomainResource { if let purposeOfEvent = self.purposeOfEvent { json["purposeOfEvent"] = Coding.asJSONArray(purposeOfEvent) } - if let recorded = self.recorded { - json["recorded"] = recorded.asJSON() - } - if let source = self.source { - json["source"] = source.asJSON() - } if let subtype = self.subtype { json["subtype"] = Coding.asJSONArray(subtype) } @@ -214,13 +270,264 @@ public class AuditEvent: DomainResource { /** - * Actor involved in the event. - * - * An actor taking an active role in the event or activity that is logged. + * Specific instances of data or objects that have been accessed. + */ +public class AuditEventObject: BackboneElement { + override public class var resourceName: String { + get { return "AuditEventObject" } + } + + /// Descriptive text. + public var description_fhir: String? + + /// Additional Information about the Object. + public var detail: [AuditEventObjectDetail]? + + /// Specific instance of object (e.g. versioned). + public var identifier: Identifier? + + /// Life-cycle stage for the object. + public var lifecycle: Coding? + + /// Instance-specific descriptor for Object. + public var name: String? + + /// Actual query for object. + public var query: Base64Binary? + + /// Specific instance of resource (e.g. versioned). + public var reference: Reference? + + /// What role the Object played. + public var role: Coding? + + /// Security labels applied to the object. + public var securityLabel: [Coding]? + + /// Type of object involved. + public var type: Coding? + + + /** Initialize with a JSON object. */ + public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { + super.init(json: json, owner: owner) + } + + public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + if let js = json { + if let exist: AnyObject = js["description"] { + presentKeys.insert("description") + if let val = exist as? String { + self.description_fhir = val + } + else { + errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["detail"] { + presentKeys.insert("detail") + if let val = exist as? [FHIRJSON] { + self.detail = AuditEventObjectDetail.instantiate(fromArray: val, owner: self) as? [AuditEventObjectDetail] + } + else { + errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["identifier"] { + presentKeys.insert("identifier") + if let val = exist as? FHIRJSON { + self.identifier = Identifier(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["lifecycle"] { + presentKeys.insert("lifecycle") + if let val = exist as? FHIRJSON { + self.lifecycle = Coding(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "lifecycle", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["name"] { + presentKeys.insert("name") + if let val = exist as? String { + self.name = val + } + else { + errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["query"] { + presentKeys.insert("query") + if let val = exist as? String { + self.query = Base64Binary(string: val) + } + else { + errors.append(FHIRJSONError(key: "query", wants: String.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["reference"] { + presentKeys.insert("reference") + if let val = exist as? FHIRJSON { + self.reference = Reference(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "reference", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["role"] { + presentKeys.insert("role") + if let val = exist as? FHIRJSON { + self.role = Coding(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["securityLabel"] { + presentKeys.insert("securityLabel") + if let val = exist as? [FHIRJSON] { + self.securityLabel = Coding.instantiate(fromArray: val, owner: self) as? [Coding] + } + else { + errors.append(FHIRJSONError(key: "securityLabel", wants: Array.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["type"] { + presentKeys.insert("type") + if let val = exist as? FHIRJSON { + self.type = Coding(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + } + return errors.isEmpty ? nil : errors + } + + override public func asJSON() -> FHIRJSON { + var json = super.asJSON() + + if let description_fhir = self.description_fhir { + json["description"] = description_fhir.asJSON() + } + if let detail = self.detail { + json["detail"] = AuditEventObjectDetail.asJSONArray(detail) + } + if let identifier = self.identifier { + json["identifier"] = identifier.asJSON() + } + if let lifecycle = self.lifecycle { + json["lifecycle"] = lifecycle.asJSON() + } + if let name = self.name { + json["name"] = name.asJSON() + } + if let query = self.query { + json["query"] = query.asJSON() + } + if let reference = self.reference { + json["reference"] = reference.asJSON() + } + if let role = self.role { + json["role"] = role.asJSON() + } + if let securityLabel = self.securityLabel { + json["securityLabel"] = Coding.asJSONArray(securityLabel) + } + if let type = self.type { + json["type"] = type.asJSON() + } + + return json + } +} + + +/** + * Additional Information about the Object. + */ +public class AuditEventObjectDetail: BackboneElement { + override public class var resourceName: String { + get { return "AuditEventObjectDetail" } + } + + /// Name of the property. + public var type: String? + + /// Property value. + public var value: Base64Binary? + + + /** Initialize with a JSON object. */ + public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { + super.init(json: json, owner: owner) + } + + /** Convenience initializer, taking all required properties as arguments. */ + public convenience init(type: String, value: Base64Binary) { + self.init(json: nil) + self.type = type + self.value = value + } + + public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + if let js = json { + if let exist: AnyObject = js["type"] { + presentKeys.insert("type") + if let val = exist as? String { + self.type = val + } + else { + errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "type")) + } + if let exist: AnyObject = js["value"] { + presentKeys.insert("value") + if let val = exist as? String { + self.value = Base64Binary(string: val) + } + else { + errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "value")) + } + } + return errors.isEmpty ? nil : errors + } + + override public func asJSON() -> FHIRJSON { + var json = super.asJSON() + + if let type = self.type { + json["type"] = type.asJSON() + } + if let value = self.value { + json["value"] = value.asJSON() + } + + return json + } +} + + +/** + * A person, a hardware device or software process. */ -public class AuditEventAgent: BackboneElement { +public class AuditEventParticipant: BackboneElement { override public class var resourceName: String { - get { return "AuditEventAgent" } + get { return "AuditEventParticipant" } } /// Alternative User id e.g. authentication. @@ -232,11 +539,11 @@ public class AuditEventAgent: BackboneElement { /// Type of media. public var media: Coding? - /// Human-meaningful name for the agent. + /// Human-meaningful name for the user. public var name: String? /// Logical network location for application activity. - public var network: AuditEventAgentNetwork? + public var network: AuditEventParticipantNetwork? /// Policy that authorized event. public var policy: [URL]? @@ -250,7 +557,7 @@ public class AuditEventAgent: BackboneElement { /// Whether user is initiator. public var requestor: Bool? - /// Agent role in the event. + /// User roles (e.g. local RBAC codes). public var role: [CodeableConcept]? /// Unique identifier for the user. @@ -310,7 +617,7 @@ public class AuditEventAgent: BackboneElement { if let exist: AnyObject = js["network"] { presentKeys.insert("network") if let val = exist as? FHIRJSON { - self.network = AuditEventAgentNetwork(json: val, owner: self) + self.network = AuditEventParticipantNetwork(json: val, owner: self) } else { errors.append(FHIRJSONError(key: "network", wants: FHIRJSON.self, has: exist.dynamicType)) @@ -428,9 +735,9 @@ public class AuditEventAgent: BackboneElement { * * Logical network location for application activity, if the activity has a network location. */ -public class AuditEventAgentNetwork: BackboneElement { +public class AuditEventParticipantNetwork: BackboneElement { override public class var resourceName: String { - get { return "AuditEventAgentNetwork" } + get { return "AuditEventParticipantNetwork" } } /// Identifier for the network access point of the user device. @@ -485,259 +792,6 @@ public class AuditEventAgentNetwork: BackboneElement { } -/** - * Specific instances of data or objects that have been accessed. - */ -public class AuditEventEntity: BackboneElement { - override public class var resourceName: String { - get { return "AuditEventEntity" } - } - - /// Descriptive text. - public var description_fhir: String? - - /// Additional Information about the entity. - public var detail: [AuditEventEntityDetail]? - - /// Specific instance of object (e.g. versioned). - public var identifier: Identifier? - - /// Life-cycle stage for the object. - public var lifecycle: Coding? - - /// Descriptor for entity. - public var name: String? - - /// Query parameters. - public var query: Base64Binary? - - /// Specific instance of resource (e.g. versioned). - public var reference: Reference? - - /// What role the entity played. - public var role: Coding? - - /// Security labels applied to the object. - public var securityLabel: [Coding]? - - /// Type of object involved. - public var type: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["detail"] { - presentKeys.insert("detail") - if let val = exist as? [FHIRJSON] { - self.detail = AuditEventEntityDetail.instantiate(fromArray: val, owner: self) as? [AuditEventEntityDetail] - } - else { - errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["lifecycle"] { - presentKeys.insert("lifecycle") - if let val = exist as? FHIRJSON { - self.lifecycle = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "lifecycle", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["query"] { - presentKeys.insert("query") - if let val = exist as? String { - self.query = Base64Binary(string: val) - } - else { - errors.append(FHIRJSONError(key: "query", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["reference"] { - presentKeys.insert("reference") - if let val = exist as? FHIRJSON { - self.reference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["role"] { - presentKeys.insert("role") - if let val = exist as? FHIRJSON { - self.role = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["securityLabel"] { - presentKeys.insert("securityLabel") - if let val = exist as? [FHIRJSON] { - self.securityLabel = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "securityLabel", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let detail = self.detail { - json["detail"] = AuditEventEntityDetail.asJSONArray(detail) - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let lifecycle = self.lifecycle { - json["lifecycle"] = lifecycle.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let query = self.query { - json["query"] = query.asJSON() - } - if let reference = self.reference { - json["reference"] = reference.asJSON() - } - if let role = self.role { - json["role"] = role.asJSON() - } - if let securityLabel = self.securityLabel { - json["securityLabel"] = Coding.asJSONArray(securityLabel) - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Additional Information about the entity. - */ -public class AuditEventEntityDetail: BackboneElement { - override public class var resourceName: String { - get { return "AuditEventEntityDetail" } - } - - /// Name of the property. - public var type: String? - - /// Property value. - public var value: Base64Binary? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String, value: Base64Binary) { - self.init(json: nil) - self.type = type - self.value = value - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? String { - self.value = Base64Binary(string: val) - } - else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "value")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let type = self.type { - json["type"] = type.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - /** * Application systems and processes. */ diff --git a/Sources/Models/BackboneElement.swift b/Sources/Models/BackboneElement.swift index 50b767cf..d01a2e36 100644 --- a/Sources/Models/BackboneElement.swift +++ b/Sources/Models/BackboneElement.swift @@ -2,7 +2,7 @@ // BackboneElement.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/BackboneElement) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/BackboneElement) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Basic.swift b/Sources/Models/Basic.swift index f9f24243..78ffa970 100644 --- a/Sources/Models/Basic.swift +++ b/Sources/Models/Basic.swift @@ -2,7 +2,7 @@ // Basic.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Basic) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Basic) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Binary.swift b/Sources/Models/Binary.swift index aee33304..f0267912 100644 --- a/Sources/Models/Binary.swift +++ b/Sources/Models/Binary.swift @@ -2,7 +2,7 @@ // Binary.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Binary) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Binary) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/BodySite.swift b/Sources/Models/BodySite.swift index b261a6ea..204a72d6 100644 --- a/Sources/Models/BodySite.swift +++ b/Sources/Models/BodySite.swift @@ -2,7 +2,7 @@ // BodySite.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/BodySite) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/BodySite) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Bundle.swift b/Sources/Models/Bundle.swift index 737a0447..ed370732 100644 --- a/Sources/Models/Bundle.swift +++ b/Sources/Models/Bundle.swift @@ -2,7 +2,7 @@ // Bundle.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Bundle) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Bundle) on 2016-08-09. // 2016, SMART Health IT. // @@ -402,7 +402,7 @@ public class BundleEntryResponse: BackboneElement { /// The location, if the operation returns a location. public var location: URL? - /// Status response code (text optional). + /// Status return code for entry. public var status: String? diff --git a/Sources/Models/CarePlan.swift b/Sources/Models/CarePlan.swift index 29242260..65acbe53 100644 --- a/Sources/Models/CarePlan.swift +++ b/Sources/Models/CarePlan.swift @@ -2,7 +2,7 @@ // CarePlan.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/CarePlan) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CarePlan) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/CareTeam.swift b/Sources/Models/CareTeam.swift deleted file mode 100644 index 25ba7082..00000000 --- a/Sources/Models/CareTeam.swift +++ /dev/null @@ -1,240 +0,0 @@ -// -// CareTeam.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/CareTeam) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * 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. - */ -public class CareTeam: DomainResource { - override public class var resourceName: String { - get { return "CareTeam" } - } - - /// External Ids for this team. - public var identifier: [Identifier]? - - /// Organization responsible for the care team. - public var managingOrganization: Reference? - - /// Name of the team, such as crisis assessment team. - public var name: String? - - /// Members of the team. - public var participant: [CareTeamParticipant]? - - /// Time period team covers. - public var period: Period? - - /// active | suspended | inactive | entered in error. - public var status: CodeableConcept? - - /// Who care team is for. - public var subject: Reference? - - /// Type of team. - public var type: [CodeableConcept]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? [FHIRJSON] { - self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["managingOrganization"] { - presentKeys.insert("managingOrganization") - if let val = exist as? FHIRJSON { - self.managingOrganization = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["participant"] { - presentKeys.insert("participant") - if let val = exist as? [FHIRJSON] { - self.participant = CareTeamParticipant.instantiate(fromArray: val, owner: self) as? [CareTeamParticipant] - } - else { - errors.append(FHIRJSONError(key: "participant", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["period"] { - presentKeys.insert("period") - if let val = exist as? FHIRJSON { - self.period = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["status"] { - presentKeys.insert("status") - if let val = exist as? FHIRJSON { - self.status = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "status", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["subject"] { - presentKeys.insert("subject") - if let val = exist as? FHIRJSON { - self.subject = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? [FHIRJSON] { - self.type = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) - } - if let managingOrganization = self.managingOrganization { - json["managingOrganization"] = managingOrganization.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let participant = self.participant { - json["participant"] = CareTeamParticipant.asJSONArray(participant) - } - if let period = self.period { - json["period"] = period.asJSON() - } - if let status = self.status { - json["status"] = status.asJSON() - } - if let subject = self.subject { - json["subject"] = subject.asJSON() - } - if let type = self.type { - json["type"] = CodeableConcept.asJSONArray(type) - } - - return json - } -} - - -/** - * Members of the team. - * - * Identifies all people and organizations who are expected to be involved in the care team. - */ -public class CareTeamParticipant: BackboneElement { - override public class var resourceName: String { - get { return "CareTeamParticipant" } - } - - /// Who is involved. - public var member: Reference? - - /// Time period of participant. - public var period: Period? - - /// Type of involvement. - public var role: CodeableConcept? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["member"] { - presentKeys.insert("member") - if let val = exist as? FHIRJSON { - self.member = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "member", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["period"] { - presentKeys.insert("period") - if let val = exist as? FHIRJSON { - self.period = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["role"] { - presentKeys.insert("role") - if let val = exist as? FHIRJSON { - self.role = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let member = self.member { - json["member"] = member.asJSON() - } - if let period = self.period { - json["period"] = period.asJSON() - } - if let role = self.role { - json["role"] = role.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Claim.swift b/Sources/Models/Claim.swift index dbb4ccc0..a2d57e55 100644 --- a/Sources/Models/Claim.swift +++ b/Sources/Models/Claim.swift @@ -2,7 +2,7 @@ // Claim.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Claim) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Claim) on 2016-08-09. // 2016, SMART Health IT. // @@ -20,23 +20,17 @@ public class Claim: DomainResource { get { return "Claim" } } - /// When the accident occurred. - public var accidentDate: FHIRDate? + /// Accident Date. + public var accident: FHIRDate? - /// Accident Place. - public var accidentLocationAddress: Address? - - /// Accident Place. - public var accidentLocationReference: Reference? - - /// The nature of the accident. + /// Accident Type. public var accidentType: Coding? - /// Additional supporting materials and documents. - public var additionalMaterial: [Coding]? + /// Additional materials, documents, etc.. + public var additionalMaterials: [Coding]? - /// Period for charge submission. - public var billablePeriod: Period? + /// List of presenting Conditions. + public var condition: [Coding]? /// Insurance or medical plan. public var coverage: [ClaimCoverage]? @@ -47,27 +41,18 @@ public class Claim: DomainResource { /// Diagnosis. public var diagnosis: [ClaimDiagnosis]? - /// Period unable to work. - public var employmentImpacted: Period? - - /// Author. - public var entererIdentifier: Identifier? - /// Author. - public var entererReference: Reference? + public var enterer: Reference? - /// Servicing Facility. - public var facilityIdentifier: Identifier? + /// Eligibility exceptions. + public var exception: [Coding]? /// Servicing Facility. - public var facilityReference: Reference? + public var facility: Reference? /// Funds requested to be reserved. public var fundsReserve: Coding? - /// Period in hospital. - public var hospitalization: Period? - /// Claim number. public var identifier: [Identifier]? @@ -80,83 +65,41 @@ public class Claim: DomainResource { /// Only if type = oral. public var missingTeeth: [ClaimMissingTeeth]? - /// Occurrence Span Codes. - public var occurenceSpanCode: [Coding]? - - /// Occurrence Codes. - public var occurrenceCode: [Coding]? - - /// Condition related Onset related dates and codes. - public var onset: [ClaimOnset]? - - /// Responsible organization. - public var organizationIdentifier: Identifier? - /// Responsible organization. - public var organizationReference: Reference? + public var organization: Reference? /// Original Prescription. - public var originalPrescriptionIdentifier: Identifier? - - /// Original Prescription. - public var originalPrescriptionReference: Reference? + public var originalPrescription: Reference? /// Original specification followed. public var originalRuleset: Coding? /// The subject of the Products and Services. - public var patientIdentifier: Identifier? - - /// The subject of the Products and Services. - public var patientReference: Reference? + public var patient: Reference? - /// Party to be paid any benefits payable. + /// Payee. public var payee: ClaimPayee? /// Prescription. - public var prescriptionIdentifier: Identifier? - - /// Prescription. - public var prescriptionReference: Reference? + public var prescription: Reference? /// Desired processing priority. public var priority: Coding? - /// Procedures performed. - public var procedure: [ClaimProcedure]? - - /// Responsible provider. - public var providerIdentifier: Identifier? - /// Responsible provider. - public var providerReference: Reference? + public var provider: Reference? /// Treatment Referral. - public var referralIdentifier: Identifier? - - /// Treatment Referral. - public var referralReference: Reference? - - /// Related Claims which may be revelant to processing this claimn. - public var related: [ClaimRelated]? + public var referral: Reference? /// Current specification followed. public var ruleset: Coding? - /// List of special Conditions. - public var specialCondition: [Coding]? - - /// Finer grained claim type information. - public var subType: [Coding]? + /// Name of School. + public var school: String? /// Insurer. - public var targetIdentifier: Identifier? - - /// Insurer. - public var targetReference: Reference? - - /// Total claim cost. - public var total: Quantity? + public var target: Reference? /// institutional | oral | pharmacy | professional | vision. public var type: String? @@ -164,9 +107,6 @@ public class Claim: DomainResource { /// complete | proposed | exploratory | other. public var use: String? - /// Value Codes. - public var valueCode: [Coding]? - /** Initialize with a JSON object. */ public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { @@ -174,41 +114,22 @@ public class Claim: DomainResource { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(patientIdentifier: Identifier, patientReference: Reference, type: String) { + public convenience init(patient: Reference, type: String) { self.init(json: nil) - self.patientIdentifier = patientIdentifier - self.patientReference = patientReference + self.patient = patient self.type = type } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["accidentDate"] { - presentKeys.insert("accidentDate") + if let exist: AnyObject = js["accident"] { + presentKeys.insert("accident") if let val = exist as? String { - self.accidentDate = FHIRDate(string: val) + self.accident = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "accidentDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["accidentLocationAddress"] { - presentKeys.insert("accidentLocationAddress") - if let val = exist as? FHIRJSON { - self.accidentLocationAddress = Address(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "accidentLocationAddress", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["accidentLocationReference"] { - presentKeys.insert("accidentLocationReference") - if let val = exist as? FHIRJSON { - self.accidentLocationReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "accidentLocationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "accident", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["accidentType"] { @@ -220,22 +141,22 @@ public class Claim: DomainResource { errors.append(FHIRJSONError(key: "accidentType", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["additionalMaterial"] { - presentKeys.insert("additionalMaterial") + if let exist: AnyObject = js["additionalMaterials"] { + presentKeys.insert("additionalMaterials") if let val = exist as? [FHIRJSON] { - self.additionalMaterial = Coding.instantiate(fromArray: val, owner: self) as? [Coding] + self.additionalMaterials = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "additionalMaterial", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "additionalMaterials", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["billablePeriod"] { - presentKeys.insert("billablePeriod") - if let val = exist as? FHIRJSON { - self.billablePeriod = Period(json: val, owner: self) + if let exist: AnyObject = js["condition"] { + presentKeys.insert("condition") + if let val = exist as? [FHIRJSON] { + self.condition = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "billablePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "condition", wants: Array.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["coverage"] { @@ -265,49 +186,31 @@ public class Claim: DomainResource { errors.append(FHIRJSONError(key: "diagnosis", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["employmentImpacted"] { - presentKeys.insert("employmentImpacted") + if let exist: AnyObject = js["enterer"] { + presentKeys.insert("enterer") if let val = exist as? FHIRJSON { - self.employmentImpacted = Period(json: val, owner: self) + self.enterer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "employmentImpacted", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "enterer", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["entererIdentifier"] { - presentKeys.insert("entererIdentifier") - if let val = exist as? FHIRJSON { - self.entererIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "entererIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["entererReference"] { - presentKeys.insert("entererReference") - if let val = exist as? FHIRJSON { - self.entererReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "entererReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["facilityIdentifier"] { - presentKeys.insert("facilityIdentifier") - if let val = exist as? FHIRJSON { - self.facilityIdentifier = Identifier(json: val, owner: self) + if let exist: AnyObject = js["exception"] { + presentKeys.insert("exception") + if let val = exist as? [FHIRJSON] { + self.exception = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "facilityIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exception", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["facilityReference"] { - presentKeys.insert("facilityReference") + if let exist: AnyObject = js["facility"] { + presentKeys.insert("facility") if let val = exist as? FHIRJSON { - self.facilityReference = Reference(json: val, owner: self) + self.facility = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "facilityReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "facility", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["fundsReserve"] { @@ -319,15 +222,6 @@ public class Claim: DomainResource { errors.append(FHIRJSONError(key: "fundsReserve", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["hospitalization"] { - presentKeys.insert("hospitalization") - if let val = exist as? FHIRJSON { - self.hospitalization = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "hospitalization", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { @@ -364,67 +258,22 @@ public class Claim: DomainResource { errors.append(FHIRJSONError(key: "missingTeeth", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["occurenceSpanCode"] { - presentKeys.insert("occurenceSpanCode") - if let val = exist as? [FHIRJSON] { - self.occurenceSpanCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "occurenceSpanCode", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["occurrenceCode"] { - presentKeys.insert("occurrenceCode") - if let val = exist as? [FHIRJSON] { - self.occurrenceCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "occurrenceCode", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["onset"] { - presentKeys.insert("onset") - if let val = exist as? [FHIRJSON] { - self.onset = ClaimOnset.instantiate(fromArray: val, owner: self) as? [ClaimOnset] - } - else { - errors.append(FHIRJSONError(key: "onset", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organizationIdentifier"] { - presentKeys.insert("organizationIdentifier") + if let exist: AnyObject = js["organization"] { + presentKeys.insert("organization") if let val = exist as? FHIRJSON { - self.organizationIdentifier = Identifier(json: val, owner: self) + self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["organizationReference"] { - presentKeys.insert("organizationReference") + if let exist: AnyObject = js["originalPrescription"] { + presentKeys.insert("originalPrescription") if let val = exist as? FHIRJSON { - self.organizationReference = Reference(json: val, owner: self) + self.originalPrescription = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["originalPrescriptionIdentifier"] { - presentKeys.insert("originalPrescriptionIdentifier") - if let val = exist as? FHIRJSON { - self.originalPrescriptionIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "originalPrescriptionIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["originalPrescriptionReference"] { - presentKeys.insert("originalPrescriptionReference") - if let val = exist as? FHIRJSON { - self.originalPrescriptionReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "originalPrescriptionReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalPrescription", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["originalRuleset"] { @@ -436,23 +285,17 @@ public class Claim: DomainResource { errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["patientIdentifier"] { - presentKeys.insert("patientIdentifier") + if let exist: AnyObject = js["patient"] { + presentKeys.insert("patient") if let val = exist as? FHIRJSON { - self.patientIdentifier = Identifier(json: val, owner: self) + self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patientIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["patientReference"] { - presentKeys.insert("patientReference") - if let val = exist as? FHIRJSON { - self.patientReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "patientReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } + else { + errors.append(FHIRJSONError(key: "patient")) } if let exist: AnyObject = js["payee"] { presentKeys.insert("payee") @@ -463,22 +306,13 @@ public class Claim: DomainResource { errors.append(FHIRJSONError(key: "payee", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["prescriptionIdentifier"] { - presentKeys.insert("prescriptionIdentifier") - if let val = exist as? FHIRJSON { - self.prescriptionIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "prescriptionIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["prescriptionReference"] { - presentKeys.insert("prescriptionReference") + if let exist: AnyObject = js["prescription"] { + presentKeys.insert("prescription") if let val = exist as? FHIRJSON { - self.prescriptionReference = Reference(json: val, owner: self) + self.prescription = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "prescriptionReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prescription", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["priority"] { @@ -490,58 +324,22 @@ public class Claim: DomainResource { errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["procedure"] { - presentKeys.insert("procedure") - if let val = exist as? [FHIRJSON] { - self.procedure = ClaimProcedure.instantiate(fromArray: val, owner: self) as? [ClaimProcedure] - } - else { - errors.append(FHIRJSONError(key: "procedure", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["providerIdentifier"] { - presentKeys.insert("providerIdentifier") + if let exist: AnyObject = js["provider"] { + presentKeys.insert("provider") if let val = exist as? FHIRJSON { - self.providerIdentifier = Identifier(json: val, owner: self) + self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "providerIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["providerReference"] { - presentKeys.insert("providerReference") + if let exist: AnyObject = js["referral"] { + presentKeys.insert("referral") if let val = exist as? FHIRJSON { - self.providerReference = Reference(json: val, owner: self) + self.referral = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "providerReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["referralIdentifier"] { - presentKeys.insert("referralIdentifier") - if let val = exist as? FHIRJSON { - self.referralIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "referralIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["referralReference"] { - presentKeys.insert("referralReference") - if let val = exist as? FHIRJSON { - self.referralReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "referralReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["related"] { - presentKeys.insert("related") - if let val = exist as? [FHIRJSON] { - self.related = ClaimRelated.instantiate(fromArray: val, owner: self) as? [ClaimRelated] - } - else { - errors.append(FHIRJSONError(key: "related", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "referral", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["ruleset"] { @@ -553,49 +351,22 @@ public class Claim: DomainResource { errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["specialCondition"] { - presentKeys.insert("specialCondition") - if let val = exist as? [FHIRJSON] { - self.specialCondition = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "specialCondition", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["subType"] { - presentKeys.insert("subType") - if let val = exist as? [FHIRJSON] { - self.subType = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "subType", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["targetIdentifier"] { - presentKeys.insert("targetIdentifier") - if let val = exist as? FHIRJSON { - self.targetIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "targetIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["targetReference"] { - presentKeys.insert("targetReference") - if let val = exist as? FHIRJSON { - self.targetReference = Reference(json: val, owner: self) + if let exist: AnyObject = js["school"] { + presentKeys.insert("school") + if let val = exist as? String { + self.school = val } else { - errors.append(FHIRJSONError(key: "targetReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "school", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["total"] { - presentKeys.insert("total") + if let exist: AnyObject = js["target"] { + presentKeys.insert("target") if let val = exist as? FHIRJSON { - self.total = Quantity(json: val, owner: self) + self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "total", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["type"] { @@ -619,20 +390,6 @@ public class Claim: DomainResource { errors.append(FHIRJSONError(key: "use", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["valueCode"] { - presentKeys.insert("valueCode") - if let val = exist as? [FHIRJSON] { - self.valueCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "valueCode", wants: Array.self, has: exist.dynamicType)) - } - } - - // check if nonoptional expanded properties are present - if nil == self.patientIdentifier && nil == self.patientReference { - errors.append(FHIRJSONError(key: "patient*")) - } } return errors.isEmpty ? nil : errors } @@ -640,23 +397,17 @@ public class Claim: DomainResource { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let accidentDate = self.accidentDate { - json["accidentDate"] = accidentDate.asJSON() - } - if let accidentLocationAddress = self.accidentLocationAddress { - json["accidentLocationAddress"] = accidentLocationAddress.asJSON() - } - if let accidentLocationReference = self.accidentLocationReference { - json["accidentLocationReference"] = accidentLocationReference.asJSON() + if let accident = self.accident { + json["accident"] = accident.asJSON() } if let accidentType = self.accidentType { json["accidentType"] = accidentType.asJSON() } - if let additionalMaterial = self.additionalMaterial { - json["additionalMaterial"] = Coding.asJSONArray(additionalMaterial) + if let additionalMaterials = self.additionalMaterials { + json["additionalMaterials"] = Coding.asJSONArray(additionalMaterials) } - if let billablePeriod = self.billablePeriod { - json["billablePeriod"] = billablePeriod.asJSON() + if let condition = self.condition { + json["condition"] = Coding.asJSONArray(condition) } if let coverage = self.coverage { json["coverage"] = ClaimCoverage.asJSONArray(coverage) @@ -667,27 +418,18 @@ public class Claim: DomainResource { if let diagnosis = self.diagnosis { json["diagnosis"] = ClaimDiagnosis.asJSONArray(diagnosis) } - if let employmentImpacted = self.employmentImpacted { - json["employmentImpacted"] = employmentImpacted.asJSON() + if let enterer = self.enterer { + json["enterer"] = enterer.asJSON() } - if let entererIdentifier = self.entererIdentifier { - json["entererIdentifier"] = entererIdentifier.asJSON() + if let exception = self.exception { + json["exception"] = Coding.asJSONArray(exception) } - if let entererReference = self.entererReference { - json["entererReference"] = entererReference.asJSON() - } - if let facilityIdentifier = self.facilityIdentifier { - json["facilityIdentifier"] = facilityIdentifier.asJSON() - } - if let facilityReference = self.facilityReference { - json["facilityReference"] = facilityReference.asJSON() + if let facility = self.facility { + json["facility"] = facility.asJSON() } if let fundsReserve = self.fundsReserve { json["fundsReserve"] = fundsReserve.asJSON() } - if let hospitalization = self.hospitalization { - json["hospitalization"] = hospitalization.asJSON() - } if let identifier = self.identifier { json["identifier"] = Identifier.asJSONArray(identifier) } @@ -700,83 +442,41 @@ public class Claim: DomainResource { if let missingTeeth = self.missingTeeth { json["missingTeeth"] = ClaimMissingTeeth.asJSONArray(missingTeeth) } - if let occurenceSpanCode = self.occurenceSpanCode { - json["occurenceSpanCode"] = Coding.asJSONArray(occurenceSpanCode) - } - if let occurrenceCode = self.occurrenceCode { - json["occurrenceCode"] = Coding.asJSONArray(occurrenceCode) - } - if let onset = self.onset { - json["onset"] = ClaimOnset.asJSONArray(onset) - } - if let organizationIdentifier = self.organizationIdentifier { - json["organizationIdentifier"] = organizationIdentifier.asJSON() - } - if let organizationReference = self.organizationReference { - json["organizationReference"] = organizationReference.asJSON() + if let organization = self.organization { + json["organization"] = organization.asJSON() } - if let originalPrescriptionIdentifier = self.originalPrescriptionIdentifier { - json["originalPrescriptionIdentifier"] = originalPrescriptionIdentifier.asJSON() - } - if let originalPrescriptionReference = self.originalPrescriptionReference { - json["originalPrescriptionReference"] = originalPrescriptionReference.asJSON() + if let originalPrescription = self.originalPrescription { + json["originalPrescription"] = originalPrescription.asJSON() } if let originalRuleset = self.originalRuleset { json["originalRuleset"] = originalRuleset.asJSON() } - if let patientIdentifier = self.patientIdentifier { - json["patientIdentifier"] = patientIdentifier.asJSON() - } - if let patientReference = self.patientReference { - json["patientReference"] = patientReference.asJSON() + if let patient = self.patient { + json["patient"] = patient.asJSON() } if let payee = self.payee { json["payee"] = payee.asJSON() } - if let prescriptionIdentifier = self.prescriptionIdentifier { - json["prescriptionIdentifier"] = prescriptionIdentifier.asJSON() - } - if let prescriptionReference = self.prescriptionReference { - json["prescriptionReference"] = prescriptionReference.asJSON() + if let prescription = self.prescription { + json["prescription"] = prescription.asJSON() } if let priority = self.priority { json["priority"] = priority.asJSON() } - if let procedure = self.procedure { - json["procedure"] = ClaimProcedure.asJSONArray(procedure) - } - if let providerIdentifier = self.providerIdentifier { - json["providerIdentifier"] = providerIdentifier.asJSON() + if let provider = self.provider { + json["provider"] = provider.asJSON() } - if let providerReference = self.providerReference { - json["providerReference"] = providerReference.asJSON() - } - if let referralIdentifier = self.referralIdentifier { - json["referralIdentifier"] = referralIdentifier.asJSON() - } - if let referralReference = self.referralReference { - json["referralReference"] = referralReference.asJSON() - } - if let related = self.related { - json["related"] = ClaimRelated.asJSONArray(related) + if let referral = self.referral { + json["referral"] = referral.asJSON() } if let ruleset = self.ruleset { json["ruleset"] = ruleset.asJSON() } - if let specialCondition = self.specialCondition { - json["specialCondition"] = Coding.asJSONArray(specialCondition) - } - if let subType = self.subType { - json["subType"] = Coding.asJSONArray(subType) + if let school = self.school { + json["school"] = school.asJSON() } - if let targetIdentifier = self.targetIdentifier { - json["targetIdentifier"] = targetIdentifier.asJSON() - } - if let targetReference = self.targetReference { - json["targetReference"] = targetReference.asJSON() - } - if let total = self.total { - json["total"] = total.asJSON() + if let target = self.target { + json["target"] = target.asJSON() } if let type = self.type { json["type"] = type.asJSON() @@ -784,9 +484,6 @@ public class Claim: DomainResource { if let use = self.use { json["use"] = use.asJSON() } - if let valueCode = self.valueCode { - json["valueCode"] = Coding.asJSONArray(valueCode) - } return json } @@ -810,12 +507,9 @@ public class ClaimCoverage: BackboneElement { public var claimResponse: Reference? /// Insurance information. - public var coverageIdentifier: Identifier? + public var coverage: Reference? - /// Insurance information. - public var coverageReference: Reference? - - /// Is the focal Coverage. + /// The focal Coverage. public var focal: Bool? /// Original version. @@ -824,6 +518,9 @@ public class ClaimCoverage: BackboneElement { /// Pre-Authorization/Determination Reference. public var preAuthRef: [String]? + /// Patient relationship to subscriber. + public var relationship: Coding? + /// Service instance identifier. public var sequence: UInt? @@ -834,11 +531,11 @@ public class ClaimCoverage: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(coverageIdentifier: Identifier, coverageReference: Reference, focal: Bool, sequence: UInt) { + public convenience init(coverage: Reference, focal: Bool, relationship: Coding, sequence: UInt) { self.init(json: nil) - self.coverageIdentifier = coverageIdentifier - self.coverageReference = coverageReference + self.coverage = coverage self.focal = focal + self.relationship = relationship self.sequence = sequence } @@ -863,23 +560,17 @@ public class ClaimCoverage: BackboneElement { errors.append(FHIRJSONError(key: "claimResponse", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["coverageIdentifier"] { - presentKeys.insert("coverageIdentifier") + if let exist: AnyObject = js["coverage"] { + presentKeys.insert("coverage") if let val = exist as? FHIRJSON { - self.coverageIdentifier = Identifier(json: val, owner: self) + self.coverage = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "coverageIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "coverage", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["coverageReference"] { - presentKeys.insert("coverageReference") - if let val = exist as? FHIRJSON { - self.coverageReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "coverageReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } + else { + errors.append(FHIRJSONError(key: "coverage")) } if let exist: AnyObject = js["focal"] { presentKeys.insert("focal") @@ -911,6 +602,18 @@ public class ClaimCoverage: BackboneElement { errors.append(FHIRJSONError(key: "preAuthRef", wants: Array.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["relationship"] { + presentKeys.insert("relationship") + if let val = exist as? FHIRJSON { + self.relationship = Coding(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "relationship")) + } if let exist: AnyObject = js["sequence"] { presentKeys.insert("sequence") if let val = exist as? UInt { @@ -923,11 +626,6 @@ public class ClaimCoverage: BackboneElement { else { errors.append(FHIRJSONError(key: "sequence")) } - - // check if nonoptional expanded properties are present - if nil == self.coverageIdentifier && nil == self.coverageReference { - errors.append(FHIRJSONError(key: "coverage*")) - } } return errors.isEmpty ? nil : errors } @@ -941,11 +639,8 @@ public class ClaimCoverage: BackboneElement { if let claimResponse = self.claimResponse { json["claimResponse"] = claimResponse.asJSON() } - if let coverageIdentifier = self.coverageIdentifier { - json["coverageIdentifier"] = coverageIdentifier.asJSON() - } - if let coverageReference = self.coverageReference { - json["coverageReference"] = coverageReference.asJSON() + if let coverage = self.coverage { + json["coverage"] = coverage.asJSON() } if let focal = self.focal { json["focal"] = focal.asJSON() @@ -960,6 +655,9 @@ public class ClaimCoverage: BackboneElement { } json["preAuthRef"] = arr } + if let relationship = self.relationship { + json["relationship"] = relationship.asJSON() + } if let sequence = self.sequence { json["sequence"] = sequence.asJSON() } @@ -982,7 +680,7 @@ public class ClaimDiagnosis: BackboneElement { /// Patient's list of diagnosis. public var diagnosis: Coding? - /// Number to covey order of diagnosis. + /// Sequence of diagnosis. public var sequence: UInt? @@ -1060,7 +758,7 @@ public class ClaimItem: BackboneElement { /// Additional items. public var detail: [ClaimItemDetail]? - /// Applicable diagnoses. + /// Diagnosis Link. public var diagnosisLinkId: [UInt]? /// Price scaling factor. @@ -1072,26 +770,14 @@ public class ClaimItem: BackboneElement { /// Total item cost. public var net: Quantity? - /// Place of service. - public var place: Coding? - /// Difficulty scaling factor. public var points: NSDecimalNumber? - /// Program specific reason for item inclusion. - public var programCode: [Coding]? - /// Prosthetic details. public var prosthesis: ClaimItemProsthesis? /// Responsible practitioner. - public var providerIdentifier: Identifier? - - /// Type, classification or Specialization. - public var providerQualification: Coding? - - /// Responsible practitioner. - public var providerReference: Reference? + public var provider: Reference? /// Count of Products or Services. public var quantity: Quantity? @@ -1102,29 +788,17 @@ public class ClaimItem: BackboneElement { /// Item Code. public var service: Coding? - /// Service/Product modifiers. - public var serviceModifier: [Coding]? - - /// Date or dates of Service. - public var servicedDate: FHIRDate? - - /// Date or dates of Service. - public var servicedPeriod: Period? + /// Date of Service. + public var serviceDate: FHIRDate? /// Service Sub-location. public var subSite: [Coding]? - /// Supervising Practitioner. - public var supervisorIdentifier: Identifier? - - /// Supervising Practitioner. - public var supervisorReference: Reference? - /// Group or type of product or service. public var type: Coding? /// Unique Device Identifier. - public var udi: [Reference]? + public var udi: Coding? /// Fee, charge or cost per point. public var unitPrice: Quantity? @@ -1200,15 +874,6 @@ public class ClaimItem: BackboneElement { errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["place"] { - presentKeys.insert("place") - if let val = exist as? FHIRJSON { - self.place = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "place", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["points"] { presentKeys.insert("points") if let val = exist as? NSNumber { @@ -1218,15 +883,6 @@ public class ClaimItem: BackboneElement { errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["programCode"] { - presentKeys.insert("programCode") - if let val = exist as? [FHIRJSON] { - self.programCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "programCode", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["prosthesis"] { presentKeys.insert("prosthesis") if let val = exist as? FHIRJSON { @@ -1236,31 +892,13 @@ public class ClaimItem: BackboneElement { errors.append(FHIRJSONError(key: "prosthesis", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["providerIdentifier"] { - presentKeys.insert("providerIdentifier") + if let exist: AnyObject = js["provider"] { + presentKeys.insert("provider") if let val = exist as? FHIRJSON { - self.providerIdentifier = Identifier(json: val, owner: self) + self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "providerIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["providerQualification"] { - presentKeys.insert("providerQualification") - if let val = exist as? FHIRJSON { - self.providerQualification = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "providerQualification", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["providerReference"] { - presentKeys.insert("providerReference") - if let val = exist as? FHIRJSON { - self.providerReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "providerReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["quantity"] { @@ -1296,31 +934,13 @@ public class ClaimItem: BackboneElement { else { errors.append(FHIRJSONError(key: "service")) } - if let exist: AnyObject = js["serviceModifier"] { - presentKeys.insert("serviceModifier") - if let val = exist as? [FHIRJSON] { - self.serviceModifier = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "serviceModifier", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["servicedDate"] { - presentKeys.insert("servicedDate") + if let exist: AnyObject = js["serviceDate"] { + presentKeys.insert("serviceDate") if let val = exist as? String { - self.servicedDate = FHIRDate(string: val) + self.serviceDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "servicedDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["servicedPeriod"] { - presentKeys.insert("servicedPeriod") - if let val = exist as? FHIRJSON { - self.servicedPeriod = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "servicedPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "serviceDate", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["subSite"] { @@ -1332,24 +952,6 @@ public class ClaimItem: BackboneElement { errors.append(FHIRJSONError(key: "subSite", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["supervisorIdentifier"] { - presentKeys.insert("supervisorIdentifier") - if let val = exist as? FHIRJSON { - self.supervisorIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "supervisorIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["supervisorReference"] { - presentKeys.insert("supervisorReference") - if let val = exist as? FHIRJSON { - self.supervisorReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "supervisorReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { @@ -1364,11 +966,11 @@ public class ClaimItem: BackboneElement { } if let exist: AnyObject = js["udi"] { presentKeys.insert("udi") - if let val = exist as? [FHIRJSON] { - self.udi = Reference.instantiate(fromArray: val, owner: self) as? [Reference] + if let val = exist as? FHIRJSON { + self.udi = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "udi", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "udi", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["unitPrice"] { @@ -1409,26 +1011,14 @@ public class ClaimItem: BackboneElement { if let net = self.net { json["net"] = net.asJSON() } - if let place = self.place { - json["place"] = place.asJSON() - } if let points = self.points { json["points"] = points.asJSON() } - if let programCode = self.programCode { - json["programCode"] = Coding.asJSONArray(programCode) - } if let prosthesis = self.prosthesis { json["prosthesis"] = prosthesis.asJSON() } - if let providerIdentifier = self.providerIdentifier { - json["providerIdentifier"] = providerIdentifier.asJSON() - } - if let providerQualification = self.providerQualification { - json["providerQualification"] = providerQualification.asJSON() - } - if let providerReference = self.providerReference { - json["providerReference"] = providerReference.asJSON() + if let provider = self.provider { + json["provider"] = provider.asJSON() } if let quantity = self.quantity { json["quantity"] = quantity.asJSON() @@ -1439,29 +1029,17 @@ public class ClaimItem: BackboneElement { if let service = self.service { json["service"] = service.asJSON() } - if let serviceModifier = self.serviceModifier { - json["serviceModifier"] = Coding.asJSONArray(serviceModifier) - } - if let servicedDate = self.servicedDate { - json["servicedDate"] = servicedDate.asJSON() - } - if let servicedPeriod = self.servicedPeriod { - json["servicedPeriod"] = servicedPeriod.asJSON() + if let serviceDate = self.serviceDate { + json["serviceDate"] = serviceDate.asJSON() } if let subSite = self.subSite { json["subSite"] = Coding.asJSONArray(subSite) } - if let supervisorIdentifier = self.supervisorIdentifier { - json["supervisorIdentifier"] = supervisorIdentifier.asJSON() - } - if let supervisorReference = self.supervisorReference { - json["supervisorReference"] = supervisorReference.asJSON() - } if let type = self.type { json["type"] = type.asJSON() } if let udi = self.udi { - json["udi"] = Reference.asJSONArray(udi) + json["udi"] = udi.asJSON() } if let unitPrice = self.unitPrice { json["unitPrice"] = unitPrice.asJSON() @@ -1491,9 +1069,6 @@ public class ClaimItemDetail: BackboneElement { /// Difficulty scaling factor. public var points: NSDecimalNumber? - /// Program specific reason for item inclusion. - public var programCode: [Coding]? - /// Count of Products or Services. public var quantity: Quantity? @@ -1510,7 +1085,7 @@ public class ClaimItemDetail: BackboneElement { public var type: Coding? /// Unique Device Identifier. - public var udi: [Reference]? + public var udi: Coding? /// Fee, charge or cost per point. public var unitPrice: Quantity? @@ -1559,15 +1134,6 @@ public class ClaimItemDetail: BackboneElement { errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["programCode"] { - presentKeys.insert("programCode") - if let val = exist as? [FHIRJSON] { - self.programCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "programCode", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { @@ -1624,11 +1190,11 @@ public class ClaimItemDetail: BackboneElement { } if let exist: AnyObject = js["udi"] { presentKeys.insert("udi") - if let val = exist as? [FHIRJSON] { - self.udi = Reference.instantiate(fromArray: val, owner: self) as? [Reference] + if let val = exist as? FHIRJSON { + self.udi = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "udi", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "udi", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["unitPrice"] { @@ -1656,9 +1222,6 @@ public class ClaimItemDetail: BackboneElement { if let points = self.points { json["points"] = points.asJSON() } - if let programCode = self.programCode { - json["programCode"] = Coding.asJSONArray(programCode) - } if let quantity = self.quantity { json["quantity"] = quantity.asJSON() } @@ -1675,7 +1238,7 @@ public class ClaimItemDetail: BackboneElement { json["type"] = type.asJSON() } if let udi = self.udi { - json["udi"] = Reference.asJSONArray(udi) + json["udi"] = udi.asJSON() } if let unitPrice = self.unitPrice { json["unitPrice"] = unitPrice.asJSON() @@ -1705,9 +1268,6 @@ public class ClaimItemDetailSubDetail: BackboneElement { /// Difficulty scaling factor. public var points: NSDecimalNumber? - /// Program specific reason for item inclusion. - public var programCode: [Coding]? - /// Count of Products or Services. public var quantity: Quantity? @@ -1721,7 +1281,7 @@ public class ClaimItemDetailSubDetail: BackboneElement { public var type: Coding? /// Unique Device Identifier. - public var udi: [Reference]? + public var udi: Coding? /// Fee, charge or cost per point. public var unitPrice: Quantity? @@ -1770,15 +1330,6 @@ public class ClaimItemDetailSubDetail: BackboneElement { errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["programCode"] { - presentKeys.insert("programCode") - if let val = exist as? [FHIRJSON] { - self.programCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "programCode", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { @@ -1826,11 +1377,11 @@ public class ClaimItemDetailSubDetail: BackboneElement { } if let exist: AnyObject = js["udi"] { presentKeys.insert("udi") - if let val = exist as? [FHIRJSON] { - self.udi = Reference.instantiate(fromArray: val, owner: self) as? [Reference] + if let val = exist as? FHIRJSON { + self.udi = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "udi", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "udi", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["unitPrice"] { @@ -1858,9 +1409,6 @@ public class ClaimItemDetailSubDetail: BackboneElement { if let points = self.points { json["points"] = points.asJSON() } - if let programCode = self.programCode { - json["programCode"] = Coding.asJSONArray(programCode) - } if let quantity = self.quantity { json["quantity"] = quantity.asJSON() } @@ -1874,7 +1422,7 @@ public class ClaimItemDetailSubDetail: BackboneElement { json["type"] = type.asJSON() } if let udi = self.udi { - json["udi"] = Reference.asJSONArray(udi) + json["udi"] = udi.asJSON() } if let unitPrice = self.unitPrice { json["unitPrice"] = unitPrice.asJSON() @@ -1973,10 +1521,10 @@ public class ClaimMissingTeeth: BackboneElement { get { return "ClaimMissingTeeth" } } - /// Date tooth was extracted if known. + /// Date of Extraction. public var extractionDate: FHIRDate? - /// Indicates whether it was extracted or other reason. + /// Reason for missing. public var reason: Coding? /// Tooth Code. @@ -2050,22 +1598,25 @@ public class ClaimMissingTeeth: BackboneElement { /** - * Condition related Onset related dates and codes. + * Payee. * - * Period, start and last dates of aspects of the Condition or related services. + * The party to be reimbursed for the services. */ -public class ClaimOnset: BackboneElement { +public class ClaimPayee: BackboneElement { override public class var resourceName: String { - get { return "ClaimOnset" } + get { return "ClaimPayee" } } - /// Illness, injury or treatable condition date. - public var timeDate: FHIRDate? + /// Organization who is the payee. + public var organization: Reference? + + /// Other person who is the payee. + public var person: Reference? - /// Illness, injury or treatable condition date. - public var timePeriod: Period? + /// Provider who is the payee. + public var provider: Reference? - /// Onset of what. + /// Party to be paid any benefits payable. public var type: Coding? @@ -2077,105 +1628,31 @@ public class ClaimOnset: BackboneElement { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["timeDate"] { - presentKeys.insert("timeDate") - if let val = exist as? String { - self.timeDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "timeDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["timePeriod"] { - presentKeys.insert("timePeriod") + if let exist: AnyObject = js["organization"] { + presentKeys.insert("organization") if let val = exist as? FHIRJSON { - self.timePeriod = Period(json: val, owner: self) + self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "timePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let timeDate = self.timeDate { - json["timeDate"] = timeDate.asJSON() - } - if let timePeriod = self.timePeriod { - json["timePeriod"] = timePeriod.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Party to be paid any benefits payable. - * - * The party to be reimbursed for the services. - */ -public class ClaimPayee: BackboneElement { - override public class var resourceName: String { - get { return "ClaimPayee" } - } - - /// Party to receive the payable. - public var partyIdentifier: Identifier? - - /// Party to receive the payable. - public var partyReference: Reference? - - /// Type of party: Subscriber, Provider, other. - public var type: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: Coding) { - self.init(json: nil) - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["partyIdentifier"] { - presentKeys.insert("partyIdentifier") + if let exist: AnyObject = js["person"] { + presentKeys.insert("person") if let val = exist as? FHIRJSON { - self.partyIdentifier = Identifier(json: val, owner: self) + self.person = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "partyIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "person", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["partyReference"] { - presentKeys.insert("partyReference") + if let exist: AnyObject = js["provider"] { + presentKeys.insert("provider") if let val = exist as? FHIRJSON { - self.partyReference = Reference(json: val, owner: self) + self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "partyReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["type"] { @@ -2187,9 +1664,6 @@ public class ClaimPayee: BackboneElement { errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "type")) - } } return errors.isEmpty ? nil : errors } @@ -2197,11 +1671,14 @@ public class ClaimPayee: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let partyIdentifier = self.partyIdentifier { - json["partyIdentifier"] = partyIdentifier.asJSON() + if let organization = self.organization { + json["organization"] = organization.asJSON() + } + if let person = self.person { + json["person"] = person.asJSON() } - if let partyReference = self.partyReference { - json["partyReference"] = partyReference.asJSON() + if let provider = self.provider { + json["provider"] = provider.asJSON() } if let type = self.type { json["type"] = type.asJSON() @@ -2211,203 +1688,3 @@ public class ClaimPayee: BackboneElement { } } - -/** - * Procedures performed. - * - * Ordered list of patient procedures performed to support the adjudication. - */ -public class ClaimProcedure: BackboneElement { - override public class var resourceName: String { - get { return "ClaimProcedure" } - } - - /// When the procedure was performed. - public var date: DateTime? - - /// Patient's list of procedures performed. - public var procedureCoding: Coding? - - /// Patient's list of procedures performed. - public var procedureReference: Reference? - - /// Procedure sequence for reference. - public var sequence: UInt? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(procedureCoding: Coding, procedureReference: Reference, sequence: UInt) { - self.init(json: nil) - self.procedureCoding = procedureCoding - self.procedureReference = procedureReference - self.sequence = sequence - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["date"] { - presentKeys.insert("date") - if let val = exist as? String { - self.date = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["procedureCoding"] { - presentKeys.insert("procedureCoding") - if let val = exist as? FHIRJSON { - self.procedureCoding = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "procedureCoding", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["procedureReference"] { - presentKeys.insert("procedureReference") - if let val = exist as? FHIRJSON { - self.procedureReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "procedureReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["sequence"] { - presentKeys.insert("sequence") - if let val = exist as? UInt { - self.sequence = val - } - else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "sequence")) - } - - // check if nonoptional expanded properties are present - if nil == self.procedureCoding && nil == self.procedureReference { - errors.append(FHIRJSONError(key: "procedure*")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let date = self.date { - json["date"] = date.asJSON() - } - if let procedureCoding = self.procedureCoding { - json["procedureCoding"] = procedureCoding.asJSON() - } - if let procedureReference = self.procedureReference { - json["procedureReference"] = procedureReference.asJSON() - } - if let sequence = self.sequence { - json["sequence"] = sequence.asJSON() - } - - return json - } -} - - -/** - * 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. - */ -public class ClaimRelated: BackboneElement { - override public class var resourceName: String { - get { return "ClaimRelated" } - } - - /// Reference to the related claim. - public var claimIdentifier: Identifier? - - /// Reference to the related claim. - public var claimReference: Reference? - - /// Related file or case reference. - public var reference: Identifier? - - /// How the reference claim is related. - public var relationship: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["claimIdentifier"] { - presentKeys.insert("claimIdentifier") - if let val = exist as? FHIRJSON { - self.claimIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "claimIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["claimReference"] { - presentKeys.insert("claimReference") - if let val = exist as? FHIRJSON { - self.claimReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "claimReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["reference"] { - presentKeys.insert("reference") - if let val = exist as? FHIRJSON { - self.reference = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["relationship"] { - presentKeys.insert("relationship") - if let val = exist as? FHIRJSON { - self.relationship = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let claimIdentifier = self.claimIdentifier { - json["claimIdentifier"] = claimIdentifier.asJSON() - } - if let claimReference = self.claimReference { - json["claimReference"] = claimReference.asJSON() - } - if let reference = self.reference { - json["reference"] = reference.asJSON() - } - if let relationship = self.relationship { - json["relationship"] = relationship.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/ClaimResponse.swift b/Sources/Models/ClaimResponse.swift index 9ef8b219..c8b44540 100644 --- a/Sources/Models/ClaimResponse.swift +++ b/Sources/Models/ClaimResponse.swift @@ -2,7 +2,7 @@ // ClaimResponse.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ClaimResponse) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ClaimResponse) on 2016-08-09. // 2016, SMART Health IT. // @@ -47,10 +47,7 @@ public class ClaimResponse: DomainResource { public var note: [ClaimResponseNote]? /// Insurer. - public var organizationIdentifier: Identifier? - - /// Insurer. - public var organizationReference: Reference? + public var organization: Reference? /// Original version. public var originalRuleset: Coding? @@ -77,22 +74,13 @@ public class ClaimResponse: DomainResource { public var paymentRef: Identifier? /// Id of resource triggering adjudication. - public var requestIdentifier: Identifier? + public var request: Reference? /// Responsible organization. - public var requestOrganizationIdentifier: Identifier? - - /// Responsible organization. - public var requestOrganizationReference: Reference? - - /// Responsible practitioner. - public var requestProviderIdentifier: Identifier? + public var requestOrganization: Reference? /// Responsible practitioner. - public var requestProviderReference: Reference? - - /// Id of resource triggering adjudication. - public var requestReference: Reference? + public var requestProvider: Reference? /// Funds reserved status. public var reserved: Coding? @@ -199,22 +187,13 @@ public class ClaimResponse: DomainResource { errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["organizationIdentifier"] { - presentKeys.insert("organizationIdentifier") - if let val = exist as? FHIRJSON { - self.organizationIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "organizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organizationReference"] { - presentKeys.insert("organizationReference") + if let exist: AnyObject = js["organization"] { + presentKeys.insert("organization") if let val = exist as? FHIRJSON { - self.organizationReference = Reference(json: val, owner: self) + self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["originalRuleset"] { @@ -289,58 +268,31 @@ public class ClaimResponse: DomainResource { errors.append(FHIRJSONError(key: "paymentRef", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestIdentifier"] { - presentKeys.insert("requestIdentifier") - if let val = exist as? FHIRJSON { - self.requestIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestOrganizationIdentifier"] { - presentKeys.insert("requestOrganizationIdentifier") + if let exist: AnyObject = js["request"] { + presentKeys.insert("request") if let val = exist as? FHIRJSON { - self.requestOrganizationIdentifier = Identifier(json: val, owner: self) + self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestOrganizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestOrganizationReference"] { - presentKeys.insert("requestOrganizationReference") + if let exist: AnyObject = js["requestOrganization"] { + presentKeys.insert("requestOrganization") if let val = exist as? FHIRJSON { - self.requestOrganizationReference = Reference(json: val, owner: self) + self.requestOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestOrganizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestProviderIdentifier"] { - presentKeys.insert("requestProviderIdentifier") + if let exist: AnyObject = js["requestProvider"] { + presentKeys.insert("requestProvider") if let val = exist as? FHIRJSON { - self.requestProviderIdentifier = Identifier(json: val, owner: self) + self.requestProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProviderIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestProviderReference"] { - presentKeys.insert("requestProviderReference") - if let val = exist as? FHIRJSON { - self.requestProviderReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestProviderReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestReference"] { - presentKeys.insert("requestReference") - if let val = exist as? FHIRJSON { - self.requestReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["reserved"] { @@ -422,11 +374,8 @@ public class ClaimResponse: DomainResource { if let note = self.note { json["note"] = ClaimResponseNote.asJSONArray(note) } - if let organizationIdentifier = self.organizationIdentifier { - json["organizationIdentifier"] = organizationIdentifier.asJSON() - } - if let organizationReference = self.organizationReference { - json["organizationReference"] = organizationReference.asJSON() + if let organization = self.organization { + json["organization"] = organization.asJSON() } if let originalRuleset = self.originalRuleset { json["originalRuleset"] = originalRuleset.asJSON() @@ -452,23 +401,14 @@ public class ClaimResponse: DomainResource { if let paymentRef = self.paymentRef { json["paymentRef"] = paymentRef.asJSON() } - if let requestIdentifier = self.requestIdentifier { - json["requestIdentifier"] = requestIdentifier.asJSON() - } - if let requestOrganizationIdentifier = self.requestOrganizationIdentifier { - json["requestOrganizationIdentifier"] = requestOrganizationIdentifier.asJSON() + if let request = self.request { + json["request"] = request.asJSON() } - if let requestOrganizationReference = self.requestOrganizationReference { - json["requestOrganizationReference"] = requestOrganizationReference.asJSON() + if let requestOrganization = self.requestOrganization { + json["requestOrganization"] = requestOrganization.asJSON() } - if let requestProviderIdentifier = self.requestProviderIdentifier { - json["requestProviderIdentifier"] = requestProviderIdentifier.asJSON() - } - if let requestProviderReference = self.requestProviderReference { - json["requestProviderReference"] = requestProviderReference.asJSON() - } - if let requestReference = self.requestReference { - json["requestReference"] = requestReference.asJSON() + if let requestProvider = self.requestProvider { + json["requestProvider"] = requestProvider.asJSON() } if let reserved = self.reserved { json["reserved"] = reserved.asJSON() @@ -644,10 +584,7 @@ public class ClaimResponseAddItemAdjudication: BackboneElement { public var amount: Quantity? /// Adjudication category such as co-pay, eligible, benefit, etc.. - public var category: Coding? - - /// Adjudication reason. - public var reason: Coding? + public var code: Coding? /// Non-monetary value. public var value: NSDecimalNumber? @@ -659,9 +596,9 @@ public class ClaimResponseAddItemAdjudication: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { + public convenience init(code: Coding) { self.init(json: nil) - self.category = category + self.code = code } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { @@ -676,26 +613,17 @@ public class ClaimResponseAddItemAdjudication: BackboneElement { errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") + if let exist: AnyObject = js["code"] { + presentKeys.insert("code") if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) + self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["reason"] { - presentKeys.insert("reason") - if let val = exist as? FHIRJSON { - self.reason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) - } + errors.append(FHIRJSONError(key: "code")) } if let exist: AnyObject = js["value"] { presentKeys.insert("value") @@ -716,11 +644,8 @@ public class ClaimResponseAddItemAdjudication: BackboneElement { if let amount = self.amount { json["amount"] = amount.asJSON() } - if let category = self.category { - json["category"] = category.asJSON() - } - if let reason = self.reason { - json["reason"] = reason.asJSON() + if let code = self.code { + json["code"] = code.asJSON() } if let value = self.value { json["value"] = value.asJSON() @@ -831,10 +756,7 @@ public class ClaimResponseAddItemDetailAdjudication: BackboneElement { public var amount: Quantity? /// Adjudication category such as co-pay, eligible, benefit, etc.. - public var category: Coding? - - /// Adjudication reason. - public var reason: Coding? + public var code: Coding? /// Non-monetary value. public var value: NSDecimalNumber? @@ -846,9 +768,9 @@ public class ClaimResponseAddItemDetailAdjudication: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { + public convenience init(code: Coding) { self.init(json: nil) - self.category = category + self.code = code } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { @@ -863,26 +785,17 @@ public class ClaimResponseAddItemDetailAdjudication: BackboneElement { errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") + if let exist: AnyObject = js["code"] { + presentKeys.insert("code") if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) + self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["reason"] { - presentKeys.insert("reason") - if let val = exist as? FHIRJSON { - self.reason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) - } + errors.append(FHIRJSONError(key: "code")) } if let exist: AnyObject = js["value"] { presentKeys.insert("value") @@ -903,11 +816,8 @@ public class ClaimResponseAddItemDetailAdjudication: BackboneElement { if let amount = self.amount { json["amount"] = amount.asJSON() } - if let category = self.category { - json["category"] = category.asJSON() - } - if let reason = self.reason { - json["reason"] = reason.asJSON() + if let code = self.code { + json["code"] = code.asJSON() } if let value = self.value { json["value"] = value.asJSON() @@ -935,17 +845,20 @@ public class ClaimResponseCoverage: BackboneElement { public var claimResponse: Reference? /// Insurance information. - public var coverageIdentifier: Identifier? - - /// Insurance information. - public var coverageReference: Reference? + public var coverage: Reference? /// Is the focal Coverage. public var focal: Bool? + /// Original version. + public var originalRuleset: Coding? + /// Pre-Authorization/Determination Reference. public var preAuthRef: [String]? + /// Patient relationship to subscriber. + public var relationship: Coding? + /// Service instance identifier. public var sequence: UInt? @@ -956,11 +869,11 @@ public class ClaimResponseCoverage: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(coverageIdentifier: Identifier, coverageReference: Reference, focal: Bool, sequence: UInt) { + public convenience init(coverage: Reference, focal: Bool, relationship: Coding, sequence: UInt) { self.init(json: nil) - self.coverageIdentifier = coverageIdentifier - self.coverageReference = coverageReference + self.coverage = coverage self.focal = focal + self.relationship = relationship self.sequence = sequence } @@ -985,23 +898,17 @@ public class ClaimResponseCoverage: BackboneElement { errors.append(FHIRJSONError(key: "claimResponse", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["coverageIdentifier"] { - presentKeys.insert("coverageIdentifier") + if let exist: AnyObject = js["coverage"] { + presentKeys.insert("coverage") if let val = exist as? FHIRJSON { - self.coverageIdentifier = Identifier(json: val, owner: self) + self.coverage = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "coverageIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "coverage", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["coverageReference"] { - presentKeys.insert("coverageReference") - if let val = exist as? FHIRJSON { - self.coverageReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "coverageReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } + else { + errors.append(FHIRJSONError(key: "coverage")) } if let exist: AnyObject = js["focal"] { presentKeys.insert("focal") @@ -1015,6 +922,15 @@ public class ClaimResponseCoverage: BackboneElement { else { errors.append(FHIRJSONError(key: "focal")) } + if let exist: AnyObject = js["originalRuleset"] { + presentKeys.insert("originalRuleset") + if let val = exist as? FHIRJSON { + self.originalRuleset = Coding(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["preAuthRef"] { presentKeys.insert("preAuthRef") if let val = exist as? [String] { @@ -1024,6 +940,18 @@ public class ClaimResponseCoverage: BackboneElement { errors.append(FHIRJSONError(key: "preAuthRef", wants: Array.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["relationship"] { + presentKeys.insert("relationship") + if let val = exist as? FHIRJSON { + self.relationship = Coding(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "relationship")) + } if let exist: AnyObject = js["sequence"] { presentKeys.insert("sequence") if let val = exist as? UInt { @@ -1036,11 +964,6 @@ public class ClaimResponseCoverage: BackboneElement { else { errors.append(FHIRJSONError(key: "sequence")) } - - // check if nonoptional expanded properties are present - if nil == self.coverageIdentifier && nil == self.coverageReference { - errors.append(FHIRJSONError(key: "coverage*")) - } } return errors.isEmpty ? nil : errors } @@ -1054,15 +977,15 @@ public class ClaimResponseCoverage: BackboneElement { if let claimResponse = self.claimResponse { json["claimResponse"] = claimResponse.asJSON() } - if let coverageIdentifier = self.coverageIdentifier { - json["coverageIdentifier"] = coverageIdentifier.asJSON() - } - if let coverageReference = self.coverageReference { - json["coverageReference"] = coverageReference.asJSON() + if let coverage = self.coverage { + json["coverage"] = coverage.asJSON() } if let focal = self.focal { json["focal"] = focal.asJSON() } + if let originalRuleset = self.originalRuleset { + json["originalRuleset"] = originalRuleset.asJSON() + } if let preAuthRef = self.preAuthRef { var arr = [AnyObject]() for val in preAuthRef { @@ -1070,6 +993,9 @@ public class ClaimResponseCoverage: BackboneElement { } json["preAuthRef"] = arr } + if let relationship = self.relationship { + json["relationship"] = relationship.asJSON() + } if let sequence = self.sequence { json["sequence"] = sequence.asJSON() } @@ -1299,10 +1225,7 @@ public class ClaimResponseItemAdjudication: BackboneElement { public var amount: Quantity? /// Adjudication category such as co-pay, eligible, benefit, etc.. - public var category: Coding? - - /// Adjudication reason. - public var reason: Coding? + public var code: Coding? /// Non-monetary value. public var value: NSDecimalNumber? @@ -1314,9 +1237,9 @@ public class ClaimResponseItemAdjudication: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { + public convenience init(code: Coding) { self.init(json: nil) - self.category = category + self.code = code } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { @@ -1331,26 +1254,17 @@ public class ClaimResponseItemAdjudication: BackboneElement { errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") + if let exist: AnyObject = js["code"] { + presentKeys.insert("code") if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) + self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["reason"] { - presentKeys.insert("reason") - if let val = exist as? FHIRJSON { - self.reason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) - } + errors.append(FHIRJSONError(key: "code")) } if let exist: AnyObject = js["value"] { presentKeys.insert("value") @@ -1371,11 +1285,8 @@ public class ClaimResponseItemAdjudication: BackboneElement { if let amount = self.amount { json["amount"] = amount.asJSON() } - if let category = self.category { - json["category"] = category.asJSON() - } - if let reason = self.reason { - json["reason"] = reason.asJSON() + if let code = self.code { + json["code"] = code.asJSON() } if let value = self.value { json["value"] = value.asJSON() @@ -1486,10 +1397,7 @@ public class ClaimResponseItemDetailAdjudication: BackboneElement { public var amount: Quantity? /// Adjudication category such as co-pay, eligible, benefit, etc.. - public var category: Coding? - - /// Adjudication reason. - public var reason: Coding? + public var code: Coding? /// Non-monetary value. public var value: NSDecimalNumber? @@ -1501,9 +1409,9 @@ public class ClaimResponseItemDetailAdjudication: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { + public convenience init(code: Coding) { self.init(json: nil) - self.category = category + self.code = code } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { @@ -1518,26 +1426,17 @@ public class ClaimResponseItemDetailAdjudication: BackboneElement { errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") + if let exist: AnyObject = js["code"] { + presentKeys.insert("code") if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) + self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["reason"] { - presentKeys.insert("reason") - if let val = exist as? FHIRJSON { - self.reason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) - } + errors.append(FHIRJSONError(key: "code")) } if let exist: AnyObject = js["value"] { presentKeys.insert("value") @@ -1558,11 +1457,8 @@ public class ClaimResponseItemDetailAdjudication: BackboneElement { if let amount = self.amount { json["amount"] = amount.asJSON() } - if let category = self.category { - json["category"] = category.asJSON() - } - if let reason = self.reason { - json["reason"] = reason.asJSON() + if let code = self.code { + json["code"] = code.asJSON() } if let value = self.value { json["value"] = value.asJSON() @@ -1658,10 +1554,7 @@ public class ClaimResponseItemDetailSubDetailAdjudication: BackboneElement { public var amount: Quantity? /// Adjudication category such as co-pay, eligible, benefit, etc.. - public var category: Coding? - - /// Adjudication reason. - public var reason: Coding? + public var code: Coding? /// Non-monetary value. public var value: NSDecimalNumber? @@ -1673,9 +1566,9 @@ public class ClaimResponseItemDetailSubDetailAdjudication: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { + public convenience init(code: Coding) { self.init(json: nil) - self.category = category + self.code = code } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { @@ -1690,26 +1583,17 @@ public class ClaimResponseItemDetailSubDetailAdjudication: BackboneElement { errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") + if let exist: AnyObject = js["code"] { + presentKeys.insert("code") if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) + self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["reason"] { - presentKeys.insert("reason") - if let val = exist as? FHIRJSON { - self.reason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) - } + errors.append(FHIRJSONError(key: "code")) } if let exist: AnyObject = js["value"] { presentKeys.insert("value") @@ -1730,11 +1614,8 @@ public class ClaimResponseItemDetailSubDetailAdjudication: BackboneElement { if let amount = self.amount { json["amount"] = amount.asJSON() } - if let category = self.category { - json["category"] = category.asJSON() - } - if let reason = self.reason { - json["reason"] = reason.asJSON() + if let code = self.code { + json["code"] = code.asJSON() } if let value = self.value { json["value"] = value.asJSON() diff --git a/Sources/Models/ClinicalImpression.swift b/Sources/Models/ClinicalImpression.swift index eaac1737..3851ee40 100644 --- a/Sources/Models/ClinicalImpression.swift +++ b/Sources/Models/ClinicalImpression.swift @@ -2,7 +2,7 @@ // ClinicalImpression.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ClinicalImpression) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ClinicalImpression) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/CodeSystem.swift b/Sources/Models/CodeSystem.swift deleted file mode 100644 index 77686096..00000000 --- a/Sources/Models/CodeSystem.swift +++ /dev/null @@ -1,1026 +0,0 @@ -// -// CodeSystem.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/CodeSystem) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * 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. - */ -public class CodeSystem: DomainResource { - override public class var resourceName: String { - get { return "CodeSystem" } - } - - /// If code comparison is case sensitive. - public var caseSensitive: Bool? - - /// If code system defines a post-composition grammar. - public var compositional: Bool? - - /// Concepts in the code system. - public var concept: [CodeSystemConcept]? - - /// Contact details of the publisher. - public var contact: [CodeSystemContact]? - - /// not-present | examplar | fragment | complete. - public var content: String? - - /// Use and/or publishing restrictions. - public var copyright: String? - - /// Total concepts in the code system. - public var count: UInt? - - /// Date for given status. - public var date: DateTime? - - /// Human language description of the code system. - public var description_fhir: String? - - /// If for testing purposes, not real usage. - public var experimental: Bool? - - /// Filter that can be used in a value set. - public var filter: [CodeSystemFilter]? - - /// Additional identifier for the code system (e.g. HL7 v2 / CDA). - public var identifier: Identifier? - - /// Informal name for this code system. - public var name: String? - - /// Additional information supplied about each concept. - public var property: [CodeSystemProperty]? - - /// Name of the publisher (organization or individual). - public var publisher: String? - - /// Why needed. - public var requirements: String? - - /// draft | active | retired. - public var status: String? - - /// Globally unique logical identifier for code system (Coding.system). - public var url: URL? - - /// Content intends to support these contexts. - public var useContext: [CodeableConcept]? - - /// Canonical URL for value set with entire code system. - public var valueSet: URL? - - /// Logical identifier for this version (Coding.version). - public var version: String? - - /// If definitions are not stable. - public var versionNeeded: Bool? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(content: String, status: String) { - self.init(json: nil) - self.content = content - self.status = status - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["caseSensitive"] { - presentKeys.insert("caseSensitive") - if let val = exist as? Bool { - self.caseSensitive = val - } - else { - errors.append(FHIRJSONError(key: "caseSensitive", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["compositional"] { - presentKeys.insert("compositional") - if let val = exist as? Bool { - self.compositional = val - } - else { - errors.append(FHIRJSONError(key: "compositional", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["concept"] { - presentKeys.insert("concept") - if let val = exist as? [FHIRJSON] { - self.concept = CodeSystemConcept.instantiate(fromArray: val, owner: self) as? [CodeSystemConcept] - } - else { - errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["contact"] { - presentKeys.insert("contact") - if let val = exist as? [FHIRJSON] { - self.contact = CodeSystemContact.instantiate(fromArray: val, owner: self) as? [CodeSystemContact] - } - else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["content"] { - presentKeys.insert("content") - if let val = exist as? String { - self.content = val - } - else { - errors.append(FHIRJSONError(key: "content", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "content")) - } - if let exist: AnyObject = js["copyright"] { - presentKeys.insert("copyright") - if let val = exist as? String { - self.copyright = val - } - else { - errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["count"] { - presentKeys.insert("count") - if let val = exist as? UInt { - self.count = val - } - else { - errors.append(FHIRJSONError(key: "count", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["date"] { - presentKeys.insert("date") - if let val = exist as? String { - self.date = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["experimental"] { - presentKeys.insert("experimental") - if let val = exist as? Bool { - self.experimental = val - } - else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["filter"] { - presentKeys.insert("filter") - if let val = exist as? [FHIRJSON] { - self.filter = CodeSystemFilter.instantiate(fromArray: val, owner: self) as? [CodeSystemFilter] - } - else { - errors.append(FHIRJSONError(key: "filter", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["property"] { - presentKeys.insert("property") - if let val = exist as? [FHIRJSON] { - self.property = CodeSystemProperty.instantiate(fromArray: val, owner: self) as? [CodeSystemProperty] - } - else { - errors.append(FHIRJSONError(key: "property", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["publisher"] { - presentKeys.insert("publisher") - if let val = exist as? String { - self.publisher = val - } - else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requirements"] { - presentKeys.insert("requirements") - if let val = exist as? String { - self.requirements = val - } - else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["status"] { - presentKeys.insert("status") - if let val = exist as? String { - self.status = val - } - else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "status")) - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["useContext"] { - presentKeys.insert("useContext") - if let val = exist as? [FHIRJSON] { - self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueSet"] { - presentKeys.insert("valueSet") - if let val = exist as? String { - self.valueSet = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueSet", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["versionNeeded"] { - presentKeys.insert("versionNeeded") - if let val = exist as? Bool { - self.versionNeeded = val - } - else { - errors.append(FHIRJSONError(key: "versionNeeded", wants: Bool.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let caseSensitive = self.caseSensitive { - json["caseSensitive"] = caseSensitive.asJSON() - } - if let compositional = self.compositional { - json["compositional"] = compositional.asJSON() - } - if let concept = self.concept { - json["concept"] = CodeSystemConcept.asJSONArray(concept) - } - if let contact = self.contact { - json["contact"] = CodeSystemContact.asJSONArray(contact) - } - if let content = self.content { - json["content"] = content.asJSON() - } - if let copyright = self.copyright { - json["copyright"] = copyright.asJSON() - } - if let count = self.count { - json["count"] = count.asJSON() - } - if let date = self.date { - json["date"] = date.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let experimental = self.experimental { - json["experimental"] = experimental.asJSON() - } - if let filter = self.filter { - json["filter"] = CodeSystemFilter.asJSONArray(filter) - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let property = self.property { - json["property"] = CodeSystemProperty.asJSONArray(property) - } - if let publisher = self.publisher { - json["publisher"] = publisher.asJSON() - } - if let requirements = self.requirements { - json["requirements"] = requirements.asJSON() - } - if let status = self.status { - json["status"] = status.asJSON() - } - if let url = self.url { - json["url"] = url.asJSON() - } - if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) - } - if let valueSet = self.valueSet { - json["valueSet"] = valueSet.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - if let versionNeeded = self.versionNeeded { - json["versionNeeded"] = versionNeeded.asJSON() - } - - return json - } -} - - -/** - * 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. - */ -public class CodeSystemConcept: BackboneElement { - override public class var resourceName: String { - get { return "CodeSystemConcept" } - } - - /// Code that identifies concept. - public var code: String? - - /// Child Concepts (is-a/contains/categorizes). - public var concept: [CodeSystemConcept]? - - /// Formal definition. - public var definition: String? - - /// Additional representations for the concept. - public var designation: [CodeSystemConceptDesignation]? - - /// Text to display to the user. - public var display: String? - - /// Property value for the concept. - public var property: [CodeSystemConceptProperty]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(code: String) { - self.init(json: nil) - self.code = code - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["code"] { - presentKeys.insert("code") - if let val = exist as? String { - self.code = val - } - else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "code")) - } - if let exist: AnyObject = js["concept"] { - presentKeys.insert("concept") - if let val = exist as? [FHIRJSON] { - self.concept = CodeSystemConcept.instantiate(fromArray: val, owner: self) as? [CodeSystemConcept] - } - else { - errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["definition"] { - presentKeys.insert("definition") - if let val = exist as? String { - self.definition = val - } - else { - errors.append(FHIRJSONError(key: "definition", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["designation"] { - presentKeys.insert("designation") - if let val = exist as? [FHIRJSON] { - self.designation = CodeSystemConceptDesignation.instantiate(fromArray: val, owner: self) as? [CodeSystemConceptDesignation] - } - else { - errors.append(FHIRJSONError(key: "designation", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["display"] { - presentKeys.insert("display") - if let val = exist as? String { - self.display = val - } - else { - errors.append(FHIRJSONError(key: "display", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["property"] { - presentKeys.insert("property") - if let val = exist as? [FHIRJSON] { - self.property = CodeSystemConceptProperty.instantiate(fromArray: val, owner: self) as? [CodeSystemConceptProperty] - } - else { - errors.append(FHIRJSONError(key: "property", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let code = self.code { - json["code"] = code.asJSON() - } - if let concept = self.concept { - json["concept"] = CodeSystemConcept.asJSONArray(concept) - } - if let definition = self.definition { - json["definition"] = definition.asJSON() - } - if let designation = self.designation { - json["designation"] = CodeSystemConceptDesignation.asJSONArray(designation) - } - if let display = self.display { - json["display"] = display.asJSON() - } - if let property = self.property { - json["property"] = CodeSystemConceptProperty.asJSONArray(property) - } - - return json - } -} - - -/** - * Additional representations for the concept. - * - * Additional representations for the concept - other languages, aliases, specialized purposes, used for particular - * purposes, etc. - */ -public class CodeSystemConceptDesignation: BackboneElement { - override public class var resourceName: String { - get { return "CodeSystemConceptDesignation" } - } - - /// Human language of the designation. - public var language: String? - - /// Details how this designation would be used. - public var use: Coding? - - /// The text value for this designation. - public var value: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(value: String) { - self.init(json: nil) - self.value = value - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["language"] { - presentKeys.insert("language") - if let val = exist as? String { - self.language = val - } - else { - errors.append(FHIRJSONError(key: "language", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["use"] { - presentKeys.insert("use") - if let val = exist as? FHIRJSON { - self.use = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "use", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? String { - self.value = val - } - else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "value")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let language = self.language { - json["language"] = language.asJSON() - } - if let use = self.use { - json["use"] = use.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * Property value for the concept. - * - * A property value for this concept. - */ -public class CodeSystemConceptProperty: BackboneElement { - override public class var resourceName: String { - get { return "CodeSystemConceptProperty" } - } - - /// Reference to CodeSystem.property.code. - public var code: String? - - /// Value of the property for this concept. - public var valueBoolean: Bool? - - /// Value of the property for this concept. - public var valueCode: String? - - /// Value of the property for this concept. - public var valueCoding: Coding? - - /// Value of the property for this concept. - public var valueDateTime: DateTime? - - /// Value of the property for this concept. - public var valueInteger: Int? - - /// Value of the property for this concept. - public var valueString: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(code: String, valueBoolean: Bool, valueCode: String, valueCoding: Coding, valueDateTime: DateTime, valueInteger: Int, valueString: String) { - self.init(json: nil) - self.code = code - self.valueBoolean = valueBoolean - self.valueCode = valueCode - self.valueCoding = valueCoding - self.valueDateTime = valueDateTime - self.valueInteger = valueInteger - self.valueString = valueString - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["code"] { - presentKeys.insert("code") - if let val = exist as? String { - self.code = val - } - else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "code")) - } - if let exist: AnyObject = js["valueBoolean"] { - presentKeys.insert("valueBoolean") - if let val = exist as? Bool { - self.valueBoolean = val - } - else { - errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCode"] { - presentKeys.insert("valueCode") - if let val = exist as? String { - self.valueCode = val - } - else { - errors.append(FHIRJSONError(key: "valueCode", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCoding"] { - presentKeys.insert("valueCoding") - if let val = exist as? FHIRJSON { - self.valueCoding = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueCoding", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueDateTime"] { - presentKeys.insert("valueDateTime") - if let val = exist as? String { - self.valueDateTime = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueInteger"] { - presentKeys.insert("valueInteger") - if let val = exist as? Int { - self.valueInteger = val - } - else { - errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueString"] { - presentKeys.insert("valueString") - if let val = exist as? String { - self.valueString = val - } - else { - errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: exist.dynamicType)) - } - } - - // check if nonoptional expanded properties are present - if nil == self.valueCode && nil == self.valueCoding && nil == self.valueString && nil == self.valueInteger && nil == self.valueBoolean && nil == self.valueDateTime { - errors.append(FHIRJSONError(key: "value*")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let code = self.code { - json["code"] = code.asJSON() - } - if let valueBoolean = self.valueBoolean { - json["valueBoolean"] = valueBoolean.asJSON() - } - if let valueCode = self.valueCode { - json["valueCode"] = valueCode.asJSON() - } - if let valueCoding = self.valueCoding { - json["valueCoding"] = valueCoding.asJSON() - } - if let valueDateTime = self.valueDateTime { - json["valueDateTime"] = valueDateTime.asJSON() - } - if let valueInteger = self.valueInteger { - json["valueInteger"] = valueInteger.asJSON() - } - if let valueString = self.valueString { - json["valueString"] = valueString.asJSON() - } - - return json - } -} - - -/** - * Contact details of the publisher. - * - * Contacts to assist a user in finding and communicating with the publisher. - */ -public class CodeSystemContact: BackboneElement { - override public class var resourceName: String { - get { return "CodeSystemContact" } - } - - /// Name of an individual to contact. - public var name: String? - - /// Contact details for individual or publisher. - public var telecom: [ContactPoint]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["telecom"] { - presentKeys.insert("telecom") - if let val = exist as? [FHIRJSON] { - self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] - } - else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) - } - - return json - } -} - - -/** - * 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. - */ -public class CodeSystemFilter: BackboneElement { - override public class var resourceName: String { - get { return "CodeSystemFilter" } - } - - /// Code that identifies the filter. - public var code: String? - - /// How or why the filter is used. - public var description_fhir: String? - - /// Operators that can be used with filter. - public var operator_fhir: [String]? - - /// What to use for the value. - public var value: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(code: String, operator_fhir: [String], value: String) { - self.init(json: nil) - self.code = code - self.operator_fhir = operator_fhir - self.value = value - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["code"] { - presentKeys.insert("code") - if let val = exist as? String { - self.code = val - } - else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "code")) - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["operator"] { - presentKeys.insert("operator") - if let val = exist as? [String] { - self.operator_fhir = val - } - else { - errors.append(FHIRJSONError(key: "operator", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "operator")) - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? String { - self.value = val - } - else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "value")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let code = self.code { - json["code"] = code.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let operator_fhir = self.operator_fhir { - var arr = [AnyObject]() - for val in operator_fhir { - arr.append(val.asJSON()) - } - json["operator"] = arr - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * Additional information supplied about each concept. - * - * A property defines an additional slot through which additional information can be provided about a concept. - */ -public class CodeSystemProperty: BackboneElement { - override public class var resourceName: String { - get { return "CodeSystemProperty" } - } - - /// Identifies the property, both internally and externally. - public var code: String? - - /// Why the property is defined, and/or what it conveys. - public var description_fhir: String? - - /// code | Coding | string | integer | boolean | dateTime. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(code: String, type: String) { - self.init(json: nil) - self.code = code - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["code"] { - presentKeys.insert("code") - if let val = exist as? String { - self.code = val - } - else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "code")) - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let code = self.code { - json["code"] = code.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/CodeableConcept.swift b/Sources/Models/CodeableConcept.swift index 415861a1..faee7ccd 100644 --- a/Sources/Models/CodeableConcept.swift +++ b/Sources/Models/CodeableConcept.swift @@ -2,7 +2,7 @@ // CodeableConcept.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/CodeableConcept) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CodeableConcept) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Coding.swift b/Sources/Models/Coding.swift index ac74c511..d3fd4631 100644 --- a/Sources/Models/Coding.swift +++ b/Sources/Models/Coding.swift @@ -2,7 +2,7 @@ // Coding.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Coding) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Coding) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Communication.swift b/Sources/Models/Communication.swift index a2ab8170..9d0183a0 100644 --- a/Sources/Models/Communication.swift +++ b/Sources/Models/Communication.swift @@ -2,7 +2,7 @@ // Communication.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Communication) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Communication) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/CommunicationRequest.swift b/Sources/Models/CommunicationRequest.swift index eb69d656..8873fb7e 100644 --- a/Sources/Models/CommunicationRequest.swift +++ b/Sources/Models/CommunicationRequest.swift @@ -2,7 +2,7 @@ // CommunicationRequest.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/CommunicationRequest) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CommunicationRequest) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/CompartmentDefinition.swift b/Sources/Models/CompartmentDefinition.swift deleted file mode 100644 index f9937cc6..00000000 --- a/Sources/Models/CompartmentDefinition.swift +++ /dev/null @@ -1,395 +0,0 @@ -// -// CompartmentDefinition.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/CompartmentDefinition) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * Compartment Definition for a resource. - * - * A compartment definition that defines how resources are accessed on a server. - */ -public class CompartmentDefinition: DomainResource { - override public class var resourceName: String { - get { return "CompartmentDefinition" } - } - - /// Patient | Encounter | RelatedPerson | Practitioner | Device. - public var code: String? - - /// Contact details of the publisher. - public var contact: [CompartmentDefinitionContact]? - - /// Publication Date(/time). - public var date: DateTime? - - /// Natural language description of the CompartmentDefinition. - public var description_fhir: String? - - /// If for testing purposes, not real usage. - public var experimental: Bool? - - /// Informal name for this compartment definition. - public var name: String? - - /// Name of the publisher (Organization or individual). - public var publisher: String? - - /// Why this compartment definition is defined. - public var requirements: String? - - /// How resource is related to the compartment. - public var resource: [CompartmentDefinitionResource]? - - /// Whether the search syntax is supported. - public var search: Bool? - - /// draft | active | retired. - public var status: String? - - /// Absolute URL used to reference this compartment definition. - public var url: URL? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(code: String, name: String, search: Bool, url: URL) { - self.init(json: nil) - self.code = code - self.name = name - self.search = search - self.url = url - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["code"] { - presentKeys.insert("code") - if let val = exist as? String { - self.code = val - } - else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "code")) - } - if let exist: AnyObject = js["contact"] { - presentKeys.insert("contact") - if let val = exist as? [FHIRJSON] { - self.contact = CompartmentDefinitionContact.instantiate(fromArray: val, owner: self) as? [CompartmentDefinitionContact] - } - else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["date"] { - presentKeys.insert("date") - if let val = exist as? String { - self.date = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["experimental"] { - presentKeys.insert("experimental") - if let val = exist as? Bool { - self.experimental = val - } - else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["publisher"] { - presentKeys.insert("publisher") - if let val = exist as? String { - self.publisher = val - } - else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requirements"] { - presentKeys.insert("requirements") - if let val = exist as? String { - self.requirements = val - } - else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["resource"] { - presentKeys.insert("resource") - if let val = exist as? [FHIRJSON] { - self.resource = CompartmentDefinitionResource.instantiate(fromArray: val, owner: self) as? [CompartmentDefinitionResource] - } - else { - errors.append(FHIRJSONError(key: "resource", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["search"] { - presentKeys.insert("search") - if let val = exist as? Bool { - self.search = val - } - else { - errors.append(FHIRJSONError(key: "search", wants: Bool.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "search")) - } - if let exist: AnyObject = js["status"] { - presentKeys.insert("status") - if let val = exist as? String { - self.status = val - } - else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "url")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let code = self.code { - json["code"] = code.asJSON() - } - if let contact = self.contact { - json["contact"] = CompartmentDefinitionContact.asJSONArray(contact) - } - if let date = self.date { - json["date"] = date.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let experimental = self.experimental { - json["experimental"] = experimental.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let publisher = self.publisher { - json["publisher"] = publisher.asJSON() - } - if let requirements = self.requirements { - json["requirements"] = requirements.asJSON() - } - if let resource = self.resource { - json["resource"] = CompartmentDefinitionResource.asJSONArray(resource) - } - if let search = self.search { - json["search"] = search.asJSON() - } - if let status = self.status { - json["status"] = status.asJSON() - } - if let url = self.url { - json["url"] = url.asJSON() - } - - return json - } -} - - -/** - * Contact details of the publisher. - * - * Contacts to assist a user in finding and communicating with the publisher. - */ -public class CompartmentDefinitionContact: BackboneElement { - override public class var resourceName: String { - get { return "CompartmentDefinitionContact" } - } - - /// Name of an individual to contact. - public var name: String? - - /// Contact details for individual or publisher. - public var telecom: [ContactPoint]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["telecom"] { - presentKeys.insert("telecom") - if let val = exist as? [FHIRJSON] { - self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] - } - else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) - } - - return json - } -} - - -/** - * How resource is related to the compartment. - * - * Information about how a resource it related to the compartment. - */ -public class CompartmentDefinitionResource: BackboneElement { - override public class var resourceName: String { - get { return "CompartmentDefinitionResource" } - } - - /// Name of resource type. - public var code: String? - - /// Additional doco about the resource and compartment. - public var documentation: String? - - /// Search Parameter Name, or chained params. - public var param: [String]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(code: String) { - self.init(json: nil) - self.code = code - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["code"] { - presentKeys.insert("code") - if let val = exist as? String { - self.code = val - } - else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "code")) - } - if let exist: AnyObject = js["documentation"] { - presentKeys.insert("documentation") - if let val = exist as? String { - self.documentation = val - } - else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["param"] { - presentKeys.insert("param") - if let val = exist as? [String] { - self.param = val - } - else { - errors.append(FHIRJSONError(key: "param", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let code = self.code { - json["code"] = code.asJSON() - } - if let documentation = self.documentation { - json["documentation"] = documentation.asJSON() - } - if let param = self.param { - var arr = [AnyObject]() - for val in param { - arr.append(val.asJSON()) - } - json["param"] = arr - } - - return json - } -} - diff --git a/Sources/Models/Composition.swift b/Sources/Models/Composition.swift index e61c6abf..f5d34cbd 100644 --- a/Sources/Models/Composition.swift +++ b/Sources/Models/Composition.swift @@ -2,7 +2,7 @@ // Composition.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Composition) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Composition) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/ConceptMap.swift b/Sources/Models/ConceptMap.swift index 2a43e3ed..abdf32c1 100644 --- a/Sources/Models/ConceptMap.swift +++ b/Sources/Models/ConceptMap.swift @@ -2,7 +2,7 @@ // ConceptMap.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ConceptMap) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ConceptMap) on 2016-08-09. // 2016, SMART Health IT. // @@ -343,7 +343,7 @@ public class ConceptMapContact: BackboneElement { get { return "ConceptMapContact" } } - /// Name of an individual to contact. + /// Name of a individual to contact. public var name: String? /// Contact details for individual or publisher. @@ -409,14 +409,11 @@ public class ConceptMapElement: BackboneElement { public var code: String? /// Code System (if value set crosses code systems). - public var system: URL? + public var codeSystem: URL? /// Concept in target system for element. public var target: [ConceptMapElementTarget]? - /// Specific version of the code system. - public var version: String? - /** Initialize with a JSON object. */ public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { @@ -435,13 +432,13 @@ public class ConceptMapElement: BackboneElement { errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["system"] { - presentKeys.insert("system") + if let exist: AnyObject = js["codeSystem"] { + presentKeys.insert("codeSystem") if let val = exist as? String { - self.system = URL(string: val) + self.codeSystem = URL(string: val) } else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "codeSystem", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["target"] { @@ -453,15 +450,6 @@ public class ConceptMapElement: BackboneElement { errors.append(FHIRJSONError(key: "target", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } } return errors.isEmpty ? nil : errors } @@ -472,15 +460,12 @@ public class ConceptMapElement: BackboneElement { if let code = self.code { json["code"] = code.asJSON() } - if let system = self.system { - json["system"] = system.asJSON() + if let codeSystem = self.codeSystem { + json["codeSystem"] = codeSystem.asJSON() } if let target = self.target { json["target"] = ConceptMapElementTarget.asJSONArray(target) } - if let version = self.version { - json["version"] = version.asJSON() - } return json } @@ -500,6 +485,9 @@ public class ConceptMapElementTarget: BackboneElement { /// Code that identifies the target element. public var code: String? + /// System of the target (if necessary). + public var codeSystem: URL? + /// Description of status/issues in mapping. public var comments: String? @@ -512,12 +500,6 @@ public class ConceptMapElementTarget: BackboneElement { /// Other concepts that this mapping also produces. public var product: [ConceptMapElementTargetDependsOn]? - /// System of the target (if necessary). - public var system: URL? - - /// Specific version of the code system. - public var version: String? - /** Initialize with a JSON object. */ public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { @@ -542,6 +524,15 @@ public class ConceptMapElementTarget: BackboneElement { errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["codeSystem"] { + presentKeys.insert("codeSystem") + if let val = exist as? String { + self.codeSystem = URL(string: val) + } + else { + errors.append(FHIRJSONError(key: "codeSystem", wants: String.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["comments"] { presentKeys.insert("comments") if let val = exist as? String { @@ -581,24 +572,6 @@ public class ConceptMapElementTarget: BackboneElement { errors.append(FHIRJSONError(key: "product", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["system"] { - presentKeys.insert("system") - if let val = exist as? String { - self.system = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } } return errors.isEmpty ? nil : errors } @@ -609,6 +582,9 @@ public class ConceptMapElementTarget: BackboneElement { if let code = self.code { json["code"] = code.asJSON() } + if let codeSystem = self.codeSystem { + json["codeSystem"] = codeSystem.asJSON() + } if let comments = self.comments { json["comments"] = comments.asJSON() } @@ -621,12 +597,6 @@ public class ConceptMapElementTarget: BackboneElement { if let product = self.product { json["product"] = ConceptMapElementTargetDependsOn.asJSONArray(product) } - if let system = self.system { - json["system"] = system.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } return json } @@ -647,12 +617,12 @@ public class ConceptMapElementTargetDependsOn: BackboneElement { /// Value of the referenced element. public var code: String? + /// Code System (if necessary). + public var codeSystem: URL? + /// Reference to element/field/ValueSet mapping depends on. public var element: URL? - /// Code System (if necessary). - public var system: URL? - /** Initialize with a JSON object. */ public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { @@ -660,11 +630,11 @@ public class ConceptMapElementTargetDependsOn: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(code: String, element: URL, system: URL) { + public convenience init(code: String, codeSystem: URL, element: URL) { self.init(json: nil) self.code = code + self.codeSystem = codeSystem self.element = element - self.system = system } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { @@ -682,29 +652,29 @@ public class ConceptMapElementTargetDependsOn: BackboneElement { else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["element"] { - presentKeys.insert("element") + if let exist: AnyObject = js["codeSystem"] { + presentKeys.insert("codeSystem") if let val = exist as? String { - self.element = URL(string: val) + self.codeSystem = URL(string: val) } else { - errors.append(FHIRJSONError(key: "element", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "codeSystem", wants: String.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "element")) + errors.append(FHIRJSONError(key: "codeSystem")) } - if let exist: AnyObject = js["system"] { - presentKeys.insert("system") + if let exist: AnyObject = js["element"] { + presentKeys.insert("element") if let val = exist as? String { - self.system = URL(string: val) + self.element = URL(string: val) } else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "element", wants: String.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "system")) + errors.append(FHIRJSONError(key: "element")) } } return errors.isEmpty ? nil : errors @@ -716,12 +686,12 @@ public class ConceptMapElementTargetDependsOn: BackboneElement { if let code = self.code { json["code"] = code.asJSON() } + if let codeSystem = self.codeSystem { + json["codeSystem"] = codeSystem.asJSON() + } if let element = self.element { json["element"] = element.asJSON() } - if let system = self.system { - json["system"] = system.asJSON() - } return json } diff --git a/Sources/Models/Condition.swift b/Sources/Models/Condition.swift index 6b9e831e..b5c89d79 100644 --- a/Sources/Models/Condition.swift +++ b/Sources/Models/Condition.swift @@ -2,7 +2,7 @@ // Condition.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Condition) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Condition) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Conformance.swift b/Sources/Models/Conformance.swift index 10855814..fe1ea790 100644 --- a/Sources/Models/Conformance.swift +++ b/Sources/Models/Conformance.swift @@ -2,7 +2,7 @@ // Conformance.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Conformance) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Conformance) on 2016-08-09. // 2016, SMART Health IT. // @@ -65,7 +65,7 @@ public class Conformance: DomainResource { /// Name of the publisher (Organization or individual). public var publisher: String? - /// Why this resource has been created. + /// Why is this needed?. public var requirements: String? /// If the endpoint is a RESTful one. @@ -80,9 +80,6 @@ public class Conformance: DomainResource { /// Logical uri to reference this statement. public var url: URL? - /// Content intends to support these contexts. - public var useContext: [CodeableConcept]? - /// Logical id for this version of the statement. public var version: String? @@ -93,14 +90,13 @@ public class Conformance: DomainResource { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(acceptUnknown: String, date: DateTime, fhirVersion: String, format: [String], kind: String, status: String) { + public convenience init(acceptUnknown: String, date: DateTime, fhirVersion: String, format: [String], kind: String) { self.init(json: nil) self.acceptUnknown = acceptUnknown self.date = date self.fhirVersion = fhirVersion self.format = format self.kind = kind - self.status = status } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { @@ -292,9 +288,6 @@ public class Conformance: DomainResource { errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "status")) - } if let exist: AnyObject = js["url"] { presentKeys.insert("url") if let val = exist as? String { @@ -304,15 +297,6 @@ public class Conformance: DomainResource { errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["useContext"] { - presentKeys.insert("useContext") - if let val = exist as? [FHIRJSON] { - self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["version"] { presentKeys.insert("version") if let val = exist as? String { @@ -393,9 +377,6 @@ public class Conformance: DomainResource { if let url = self.url { json["url"] = url.asJSON() } - if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) - } if let version = self.version { json["version"] = version.asJSON() } @@ -415,7 +396,7 @@ public class ConformanceContact: BackboneElement { get { return "ConformanceContact" } } - /// Name of an individual to contact. + /// Name of a individual to contact. public var name: String? /// Contact details for individual or publisher. @@ -642,7 +623,7 @@ public class ConformanceMessaging: BackboneElement { /// Messaging interface behavior details. public var documentation: String? - /// Where messages should be sent. + /// A messaging service end-point. public var endpoint: [ConformanceMessagingEndpoint]? /// Declare support for this event. @@ -731,7 +712,7 @@ public class ConformanceMessaging: BackboneElement { /** - * Where messages should be sent. + * A messaging service end-point. * * An endpoint (network accessible address) to which messages and/or replies are to be sent. */ @@ -1011,9 +992,10 @@ public class ConformanceRest: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(mode: String) { + public convenience init(mode: String, resource: [ConformanceRestResource]) { self.init(json: nil) self.mode = mode + self.resource = resource } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { @@ -1076,6 +1058,9 @@ public class ConformanceRest: BackboneElement { errors.append(FHIRJSONError(key: "resource", wants: Array.self, has: exist.dynamicType)) } } + else { + errors.append(FHIRJSONError(key: "resource")) + } if let exist: AnyObject = js["searchParam"] { presentKeys.insert("searchParam") if let val = exist as? [FHIRJSON] { @@ -1536,7 +1521,7 @@ public class ConformanceRestResourceInteraction: BackboneElement { get { return "ConformanceRestResourceInteraction" } } - /// read | vread | update | delete | history-instance | history-type | create | search-type. + /// read | vread | update | delete | history-instance | validate | history-type | create | search-type. public var code: String? /// Anything special about operation behavior. diff --git a/Sources/Models/ContactPoint.swift b/Sources/Models/ContactPoint.swift index de8381c8..d61d0add 100644 --- a/Sources/Models/ContactPoint.swift +++ b/Sources/Models/ContactPoint.swift @@ -2,7 +2,7 @@ // ContactPoint.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Contract.swift b/Sources/Models/Contract.swift index b493f840..cf2066bb 100644 --- a/Sources/Models/Contract.swift +++ b/Sources/Models/Contract.swift @@ -2,7 +2,7 @@ // Contract.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Contract) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Contract) on 2016-08-09. // 2016, SMART Health IT. // @@ -25,8 +25,8 @@ public class Contract: DomainResource { /// Contract Action Reason. public var actionReason: [CodeableConcept]? - /// Contract Agent. - public var agent: [ContractAgent]? + /// Contract Actor. + public var actor: [ContractActor]? /// Effective time. public var applies: Period? @@ -64,16 +64,13 @@ public class Contract: DomainResource { /// Contract Subtype. public var subType: [CodeableConcept]? - /// Contract Target Entity. + /// Subject of this Contract. public var subject: [Reference]? /// Contract Term List. public var term: [ContractTerm]? - /// Context of the Contract. - public var topic: [Reference]? - - /// Contract Type. + /// Contract Tyoe. public var type: CodeableConcept? /// Contract Valued Item. @@ -106,13 +103,13 @@ public class Contract: DomainResource { errors.append(FHIRJSONError(key: "actionReason", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["agent"] { - presentKeys.insert("agent") + if let exist: AnyObject = js["actor"] { + presentKeys.insert("actor") if let val = exist as? [FHIRJSON] { - self.agent = ContractAgent.instantiate(fromArray: val, owner: self) as? [ContractAgent] + self.actor = ContractActor.instantiate(fromArray: val, owner: self) as? [ContractActor] } else { - errors.append(FHIRJSONError(key: "agent", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actor", wants: Array.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["applies"] { @@ -241,15 +238,6 @@ public class Contract: DomainResource { errors.append(FHIRJSONError(key: "term", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["topic"] { - presentKeys.insert("topic") - if let val = exist as? [FHIRJSON] { - self.topic = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "topic", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { @@ -281,8 +269,8 @@ public class Contract: DomainResource { if let actionReason = self.actionReason { json["actionReason"] = CodeableConcept.asJSONArray(actionReason) } - if let agent = self.agent { - json["agent"] = ContractAgent.asJSONArray(agent) + if let actor = self.actor { + json["actor"] = ContractActor.asJSONArray(actor) } if let applies = self.applies { json["applies"] = applies.asJSON() @@ -326,9 +314,6 @@ public class Contract: DomainResource { if let term = self.term { json["term"] = ContractTerm.asJSONArray(term) } - if let topic = self.topic { - json["topic"] = Reference.asJSONArray(topic) - } if let type = self.type { json["type"] = type.asJSON() } @@ -342,20 +327,19 @@ public class Contract: DomainResource { /** - * Contract Agent. + * Contract Actor. * - * An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity - * taking place. + * List of Contract actors. */ -public class ContractAgent: BackboneElement { +public class ContractActor: BackboneElement { override public class var resourceName: String { - get { return "ContractAgent" } + get { return "ContractActor" } } - /// Contract Agent Type. - public var actor: Reference? + /// Contract Actor Type. + public var entity: Reference? - /// Contract Agent Role. + /// Contract Actor Role. public var role: [CodeableConcept]? @@ -365,25 +349,25 @@ public class ContractAgent: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(actor: Reference) { + public convenience init(entity: Reference) { self.init(json: nil) - self.actor = actor + self.entity = entity } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["actor"] { - presentKeys.insert("actor") + if let exist: AnyObject = js["entity"] { + presentKeys.insert("entity") if let val = exist as? FHIRJSON { - self.actor = Reference(json: val, owner: self) + self.entity = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entity", wants: FHIRJSON.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "actor")) + errors.append(FHIRJSONError(key: "entity")) } if let exist: AnyObject = js["role"] { presentKeys.insert("role") @@ -401,8 +385,8 @@ public class ContractAgent: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let actor = self.actor { - json["actor"] = actor.asJSON() + if let entity = self.entity { + json["entity"] = entity.asJSON() } if let role = self.role { json["role"] = CodeableConcept.asJSONArray(role) @@ -641,9 +625,7 @@ public class ContractRule: BackboneElement { /** * Contract Signer. * - * 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. + * Party signing this Contract. */ public class ContractSigner: BackboneElement { override public class var resourceName: String { @@ -654,7 +636,7 @@ public class ContractSigner: BackboneElement { public var party: Reference? /// Contract Documentation Signature. - public var signature: [Signature]? + public var signature: String? /// Contract Signer Type. public var type: Coding? @@ -666,7 +648,7 @@ public class ContractSigner: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(party: Reference, signature: [Signature], type: Coding) { + public convenience init(party: Reference, signature: String, type: Coding) { self.init(json: nil) self.party = party self.signature = signature @@ -690,11 +672,11 @@ public class ContractSigner: BackboneElement { } if let exist: AnyObject = js["signature"] { presentKeys.insert("signature") - if let val = exist as? [FHIRJSON] { - self.signature = Signature.instantiate(fromArray: val, owner: self) as? [Signature] + if let val = exist as? String { + self.signature = val } else { - errors.append(FHIRJSONError(key: "signature", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "signature", wants: String.self, has: exist.dynamicType)) } } else { @@ -723,7 +705,7 @@ public class ContractSigner: BackboneElement { json["party"] = party.asJSON() } if let signature = self.signature { - json["signature"] = Signature.asJSONArray(signature) + json["signature"] = signature.asJSON() } if let type = self.type { json["type"] = type.asJSON() @@ -750,8 +732,8 @@ public class ContractTerm: BackboneElement { /// Contract Term Action Reason. public var actionReason: [CodeableConcept]? - /// Contract Term Agent List. - public var agent: [ContractTermAgent]? + /// Contract Term Actor List. + public var actor: [ContractTermActor]? /// Contract Term Effective Time. public var applies: Period? @@ -768,12 +750,12 @@ public class ContractTerm: BackboneElement { /// Contract Term Subtype. public var subType: CodeableConcept? + /// Subject of this Contract Term. + public var subject: Reference? + /// Human readable Contract term text. public var text: String? - /// Context of the Contract term. - public var topic: [Reference]? - /// Contract Term Type. public var type: CodeableConcept? @@ -807,13 +789,13 @@ public class ContractTerm: BackboneElement { errors.append(FHIRJSONError(key: "actionReason", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["agent"] { - presentKeys.insert("agent") + if let exist: AnyObject = js["actor"] { + presentKeys.insert("actor") if let val = exist as? [FHIRJSON] { - self.agent = ContractTermAgent.instantiate(fromArray: val, owner: self) as? [ContractTermAgent] + self.actor = ContractTermActor.instantiate(fromArray: val, owner: self) as? [ContractTermActor] } else { - errors.append(FHIRJSONError(key: "agent", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actor", wants: Array.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["applies"] { @@ -861,6 +843,15 @@ public class ContractTerm: BackboneElement { errors.append(FHIRJSONError(key: "subType", wants: FHIRJSON.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["subject"] { + presentKeys.insert("subject") + if let val = exist as? FHIRJSON { + self.subject = Reference(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["text"] { presentKeys.insert("text") if let val = exist as? String { @@ -870,15 +861,6 @@ public class ContractTerm: BackboneElement { errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["topic"] { - presentKeys.insert("topic") - if let val = exist as? [FHIRJSON] { - self.topic = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "topic", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { @@ -910,8 +892,8 @@ public class ContractTerm: BackboneElement { if let actionReason = self.actionReason { json["actionReason"] = CodeableConcept.asJSONArray(actionReason) } - if let agent = self.agent { - json["agent"] = ContractTermAgent.asJSONArray(agent) + if let actor = self.actor { + json["actor"] = ContractTermActor.asJSONArray(actor) } if let applies = self.applies { json["applies"] = applies.asJSON() @@ -928,12 +910,12 @@ public class ContractTerm: BackboneElement { if let subType = self.subType { json["subType"] = subType.asJSON() } + if let subject = self.subject { + json["subject"] = subject.asJSON() + } if let text = self.text { json["text"] = text.asJSON() } - if let topic = self.topic { - json["topic"] = Reference.asJSONArray(topic) - } if let type = self.type { json["type"] = type.asJSON() } @@ -947,20 +929,19 @@ public class ContractTerm: BackboneElement { /** - * Contract Term Agent List. + * Contract Term Actor List. * - * An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity - * taking place. + * List of actors participating in this Contract Provision. */ -public class ContractTermAgent: BackboneElement { +public class ContractTermActor: BackboneElement { override public class var resourceName: String { - get { return "ContractTermAgent" } + get { return "ContractTermActor" } } - /// Contract Term Agent List. - public var actor: Reference? + /// Contract Term Actor. + public var entity: Reference? - /// Contract Term Agent Role. + /// Contract Term Actor Role. public var role: [CodeableConcept]? @@ -970,25 +951,25 @@ public class ContractTermAgent: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(actor: Reference) { + public convenience init(entity: Reference) { self.init(json: nil) - self.actor = actor + self.entity = entity } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["actor"] { - presentKeys.insert("actor") + if let exist: AnyObject = js["entity"] { + presentKeys.insert("entity") if let val = exist as? FHIRJSON { - self.actor = Reference(json: val, owner: self) + self.entity = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entity", wants: FHIRJSON.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "actor")) + errors.append(FHIRJSONError(key: "entity")) } if let exist: AnyObject = js["role"] { presentKeys.insert("role") @@ -1006,8 +987,8 @@ public class ContractTermAgent: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let actor = self.actor { - json["actor"] = actor.asJSON() + if let entity = self.entity { + json["entity"] = entity.asJSON() } if let role = self.role { json["role"] = CodeableConcept.asJSONArray(role) diff --git a/Sources/Models/Count.swift b/Sources/Models/Count.swift index d1e420f4..8d4c5d67 100644 --- a/Sources/Models/Count.swift +++ b/Sources/Models/Count.swift @@ -2,7 +2,7 @@ // Count.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Count) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Count) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Coverage.swift b/Sources/Models/Coverage.swift index b7389282..b176fb1c 100644 --- a/Sources/Models/Coverage.swift +++ b/Sources/Models/Coverage.swift @@ -2,7 +2,7 @@ // Coverage.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Coverage) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Coverage) on 2016-08-09. // 2016, SMART Health IT. // @@ -19,38 +19,26 @@ public class Coverage: DomainResource { get { return "Coverage" } } - /// Plan Beneficiary. - public var beneficiaryIdentifier: Identifier? - - /// Plan Beneficiary. - public var beneficiaryReference: Reference? - /// BIN Number. - public var bin: String? + public var bin: Identifier? /// Contract details. public var contract: [Reference]? - /// Dependent number. + /// The dependent number. public var dependent: UInt? - /// Eligibility exceptions. - public var exception: [Coding]? - /// An identifier for the group. public var group: String? /// The primary coverage ID. public var identifier: [Identifier]? - /// Identifier for the plan issuer. - public var issuerIdentifier: Identifier? - - /// Identifier for the plan issuer. - public var issuerReference: Reference? + /// An identifier for the plan issuer. + public var issuer: Reference? /// Insurer network. - public var network: String? + public var network: Identifier? /// Coverage start and end dates. public var period: Period? @@ -58,24 +46,18 @@ public class Coverage: DomainResource { /// An identifier for the plan. public var plan: String? - /// Plan holder. - public var planholderIdentifier: Identifier? - - /// Plan holder. - public var planholderReference: Reference? - - /// Patient relationship to planholder. - public var relationship: Coding? - - /// Name of School. - public var school: String? - /// The plan instance or sequence counter. public var sequence: UInt? /// An identifier for the subsection of the plan. public var subPlan: String? + /// Plan holder information. + public var subscriber: Reference? + + /// Subscriber ID. + public var subscriberId: Identifier? + /// Type of coverage. public var type: Coding? @@ -85,46 +67,16 @@ public class Coverage: DomainResource { super.init(json: json, owner: owner) } - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(beneficiaryIdentifier: Identifier, beneficiaryReference: Reference, issuerIdentifier: Identifier, issuerReference: Reference, planholderIdentifier: Identifier, planholderReference: Reference, relationship: Coding) { - self.init(json: nil) - self.beneficiaryIdentifier = beneficiaryIdentifier - self.beneficiaryReference = beneficiaryReference - self.issuerIdentifier = issuerIdentifier - self.issuerReference = issuerReference - self.planholderIdentifier = planholderIdentifier - self.planholderReference = planholderReference - self.relationship = relationship - } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["beneficiaryIdentifier"] { - presentKeys.insert("beneficiaryIdentifier") - if let val = exist as? FHIRJSON { - self.beneficiaryIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "beneficiaryIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["beneficiaryReference"] { - presentKeys.insert("beneficiaryReference") - if let val = exist as? FHIRJSON { - self.beneficiaryReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "beneficiaryReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["bin"] { presentKeys.insert("bin") - if let val = exist as? String { - self.bin = val + if let val = exist as? FHIRJSON { + self.bin = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bin", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bin", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["contract"] { @@ -145,15 +97,6 @@ public class Coverage: DomainResource { errors.append(FHIRJSONError(key: "dependent", wants: UInt.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["exception"] { - presentKeys.insert("exception") - if let val = exist as? [FHIRJSON] { - self.exception = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "exception", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["group"] { presentKeys.insert("group") if let val = exist as? String { @@ -172,31 +115,22 @@ public class Coverage: DomainResource { errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["issuerIdentifier"] { - presentKeys.insert("issuerIdentifier") - if let val = exist as? FHIRJSON { - self.issuerIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "issuerIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["issuerReference"] { - presentKeys.insert("issuerReference") + if let exist: AnyObject = js["issuer"] { + presentKeys.insert("issuer") if let val = exist as? FHIRJSON { - self.issuerReference = Reference(json: val, owner: self) + self.issuer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "issuerReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "issuer", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["network"] { presentKeys.insert("network") - if let val = exist as? String { - self.network = val + if let val = exist as? FHIRJSON { + self.network = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "network", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "network", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["period"] { @@ -217,45 +151,6 @@ public class Coverage: DomainResource { errors.append(FHIRJSONError(key: "plan", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["planholderIdentifier"] { - presentKeys.insert("planholderIdentifier") - if let val = exist as? FHIRJSON { - self.planholderIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "planholderIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["planholderReference"] { - presentKeys.insert("planholderReference") - if let val = exist as? FHIRJSON { - self.planholderReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "planholderReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["relationship"] { - presentKeys.insert("relationship") - if let val = exist as? FHIRJSON { - self.relationship = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "relationship")) - } - if let exist: AnyObject = js["school"] { - presentKeys.insert("school") - if let val = exist as? String { - self.school = val - } - else { - errors.append(FHIRJSONError(key: "school", wants: String.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["sequence"] { presentKeys.insert("sequence") if let val = exist as? UInt { @@ -274,6 +169,24 @@ public class Coverage: DomainResource { errors.append(FHIRJSONError(key: "subPlan", wants: String.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["subscriber"] { + presentKeys.insert("subscriber") + if let val = exist as? FHIRJSON { + self.subscriber = Reference(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "subscriber", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["subscriberId"] { + presentKeys.insert("subscriberId") + if let val = exist as? FHIRJSON { + self.subscriberId = Identifier(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "subscriberId", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { @@ -283,17 +196,6 @@ public class Coverage: DomainResource { errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) } } - - // check if nonoptional expanded properties are present - if nil == self.beneficiaryIdentifier && nil == self.beneficiaryReference { - errors.append(FHIRJSONError(key: "beneficiary*")) - } - if nil == self.issuerIdentifier && nil == self.issuerReference { - errors.append(FHIRJSONError(key: "issuer*")) - } - if nil == self.planholderIdentifier && nil == self.planholderReference { - errors.append(FHIRJSONError(key: "planholder*")) - } } return errors.isEmpty ? nil : errors } @@ -301,12 +203,6 @@ public class Coverage: DomainResource { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let beneficiaryIdentifier = self.beneficiaryIdentifier { - json["beneficiaryIdentifier"] = beneficiaryIdentifier.asJSON() - } - if let beneficiaryReference = self.beneficiaryReference { - json["beneficiaryReference"] = beneficiaryReference.asJSON() - } if let bin = self.bin { json["bin"] = bin.asJSON() } @@ -316,20 +212,14 @@ public class Coverage: DomainResource { if let dependent = self.dependent { json["dependent"] = dependent.asJSON() } - if let exception = self.exception { - json["exception"] = Coding.asJSONArray(exception) - } if let group = self.group { json["group"] = group.asJSON() } if let identifier = self.identifier { json["identifier"] = Identifier.asJSONArray(identifier) } - if let issuerIdentifier = self.issuerIdentifier { - json["issuerIdentifier"] = issuerIdentifier.asJSON() - } - if let issuerReference = self.issuerReference { - json["issuerReference"] = issuerReference.asJSON() + if let issuer = self.issuer { + json["issuer"] = issuer.asJSON() } if let network = self.network { json["network"] = network.asJSON() @@ -340,24 +230,18 @@ public class Coverage: DomainResource { if let plan = self.plan { json["plan"] = plan.asJSON() } - if let planholderIdentifier = self.planholderIdentifier { - json["planholderIdentifier"] = planholderIdentifier.asJSON() - } - if let planholderReference = self.planholderReference { - json["planholderReference"] = planholderReference.asJSON() - } - if let relationship = self.relationship { - json["relationship"] = relationship.asJSON() - } - if let school = self.school { - json["school"] = school.asJSON() - } if let sequence = self.sequence { json["sequence"] = sequence.asJSON() } if let subPlan = self.subPlan { json["subPlan"] = subPlan.asJSON() } + if let subscriber = self.subscriber { + json["subscriber"] = subscriber.asJSON() + } + if let subscriberId = self.subscriberId { + json["subscriberId"] = subscriberId.asJSON() + } if let type = self.type { json["type"] = type.asJSON() } diff --git a/Sources/Models/DataElement.swift b/Sources/Models/DataElement.swift index f479ef09..8171b91c 100644 --- a/Sources/Models/DataElement.swift +++ b/Sources/Models/DataElement.swift @@ -2,7 +2,7 @@ // DataElement.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DataElement) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DataElement) on 2016-08-09. // 2016, SMART Health IT. // @@ -274,7 +274,7 @@ public class DataElementContact: BackboneElement { get { return "DataElementContact" } } - /// Name of an individual to contact. + /// Name of a individual to contact. public var name: String? /// Contact details for individual or publisher. @@ -338,7 +338,7 @@ public class DataElementMapping: BackboneElement { } /// Versions, Issues, Scope limitations etc.. - public var comment: String? + public var comments: String? /// Internal id when this mapping is used. public var identity: String? @@ -364,13 +364,13 @@ public class DataElementMapping: BackboneElement { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["comment"] { - presentKeys.insert("comment") + if let exist: AnyObject = js["comments"] { + presentKeys.insert("comments") if let val = exist as? String { - self.comment = val + self.comments = val } else { - errors.append(FHIRJSONError(key: "comment", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comments", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["identity"] { @@ -410,8 +410,8 @@ public class DataElementMapping: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let comment = self.comment { - json["comment"] = comment.asJSON() + if let comments = self.comments { + json["comments"] = comments.asJSON() } if let identity = self.identity { json["identity"] = identity.asJSON() diff --git a/Sources/Models/DataRequirement.swift b/Sources/Models/DataRequirement.swift deleted file mode 100644 index 880f1b71..00000000 --- a/Sources/Models/DataRequirement.swift +++ /dev/null @@ -1,353 +0,0 @@ -// -// DataRequirement.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DataRequirement) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * 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. - */ -public class DataRequirement: Element { - override public class var resourceName: String { - get { return "DataRequirement" } - } - - /// Code filters for the data. - public var codeFilter: [DataRequirementCodeFilter]? - - /// Date filters for the data. - public var dateFilter: [DataRequirementDateFilter]? - - /// Indicates that specific structure elements are referenced by the knowledge module. - public var mustSupport: [String]? - - /// The profile of the required data. - public var profile: Reference? - - /// The type of the required data. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String) { - self.init(json: nil) - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["codeFilter"] { - presentKeys.insert("codeFilter") - if let val = exist as? [FHIRJSON] { - self.codeFilter = DataRequirementCodeFilter.instantiate(fromArray: val, owner: self) as? [DataRequirementCodeFilter] - } - else { - errors.append(FHIRJSONError(key: "codeFilter", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["dateFilter"] { - presentKeys.insert("dateFilter") - if let val = exist as? [FHIRJSON] { - self.dateFilter = DataRequirementDateFilter.instantiate(fromArray: val, owner: self) as? [DataRequirementDateFilter] - } - else { - errors.append(FHIRJSONError(key: "dateFilter", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["mustSupport"] { - presentKeys.insert("mustSupport") - if let val = exist as? [String] { - self.mustSupport = val - } - else { - errors.append(FHIRJSONError(key: "mustSupport", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["profile"] { - presentKeys.insert("profile") - if let val = exist as? FHIRJSON { - self.profile = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let codeFilter = self.codeFilter { - json["codeFilter"] = DataRequirementCodeFilter.asJSONArray(codeFilter) - } - if let dateFilter = self.dateFilter { - json["dateFilter"] = DataRequirementDateFilter.asJSONArray(dateFilter) - } - if let mustSupport = self.mustSupport { - var arr = [AnyObject]() - for val in mustSupport { - arr.append(val.asJSON()) - } - json["mustSupport"] = arr - } - if let profile = self.profile { - json["profile"] = profile.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Code filters for the data. - * - * Code filters specify additional constraints on the data, specifying the value set of interest for a particular - * element of the data. - */ -public class DataRequirementCodeFilter: Element { - override public class var resourceName: String { - get { return "DataRequirementCodeFilter" } - } - - /// The code-valued attribute of the filter. - public var path: String? - - /// Code value of the filter. - public var valueCode: [String]? - - /// CodeableConcept value of the filter. - public var valueCodeableConcept: [CodeableConcept]? - - /// Coding value of the filter. - public var valueCoding: [Coding]? - - /// Valueset for the filter. - public var valueSetReference: Reference? - - /// Valueset for the filter. - public var valueSetString: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(path: String) { - self.init(json: nil) - self.path = path - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["path"] { - presentKeys.insert("path") - if let val = exist as? String { - self.path = val - } - else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "path")) - } - if let exist: AnyObject = js["valueCode"] { - presentKeys.insert("valueCode") - if let val = exist as? [String] { - self.valueCode = val - } - else { - errors.append(FHIRJSONError(key: "valueCode", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCodeableConcept"] { - presentKeys.insert("valueCodeableConcept") - if let val = exist as? [FHIRJSON] { - self.valueCodeableConcept = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCoding"] { - presentKeys.insert("valueCoding") - if let val = exist as? [FHIRJSON] { - self.valueCoding = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "valueCoding", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueSetReference"] { - presentKeys.insert("valueSetReference") - if let val = exist as? FHIRJSON { - self.valueSetReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueSetReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueSetString"] { - presentKeys.insert("valueSetString") - if let val = exist as? String { - self.valueSetString = val - } - else { - errors.append(FHIRJSONError(key: "valueSetString", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let path = self.path { - json["path"] = path.asJSON() - } - if let valueCode = self.valueCode { - var arr = [AnyObject]() - for val in valueCode { - arr.append(val.asJSON()) - } - json["valueCode"] = arr - } - if let valueCodeableConcept = self.valueCodeableConcept { - json["valueCodeableConcept"] = CodeableConcept.asJSONArray(valueCodeableConcept) - } - if let valueCoding = self.valueCoding { - json["valueCoding"] = Coding.asJSONArray(valueCoding) - } - if let valueSetReference = self.valueSetReference { - json["valueSetReference"] = valueSetReference.asJSON() - } - if let valueSetString = self.valueSetString { - json["valueSetString"] = valueSetString.asJSON() - } - - return json - } -} - - -/** - * Date filters for the data. - * - * Date filters specify additional constraints on the data in terms of the applicable date range for specific elements. - */ -public class DataRequirementDateFilter: Element { - override public class var resourceName: String { - get { return "DataRequirementDateFilter" } - } - - /// The date-valued attribute of the filter. - public var path: String? - - /// The value of the filter, as a Period or dateTime value. - public var valueDateTime: DateTime? - - /// The value of the filter, as a Period or dateTime value. - public var valuePeriod: Period? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(path: String) { - self.init(json: nil) - self.path = path - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["path"] { - presentKeys.insert("path") - if let val = exist as? String { - self.path = val - } - else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "path")) - } - if let exist: AnyObject = js["valueDateTime"] { - presentKeys.insert("valueDateTime") - if let val = exist as? String { - self.valueDateTime = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valuePeriod"] { - presentKeys.insert("valuePeriod") - if let val = exist as? FHIRJSON { - self.valuePeriod = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let path = self.path { - json["path"] = path.asJSON() - } - if let valueDateTime = self.valueDateTime { - json["valueDateTime"] = valueDateTime.asJSON() - } - if let valuePeriod = self.valuePeriod { - json["valuePeriod"] = valuePeriod.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/DateAndTime.swift b/Sources/Models/DateAndTime.swift index 944403e4..66444c5a 100644 --- a/Sources/Models/DateAndTime.swift +++ b/Sources/Models/DateAndTime.swift @@ -668,6 +668,9 @@ class DateAndTimeParser { if scanner.scanInt(&hour) && hour >= 0 && hour < 24 && scanner.scanString(":", into: nil) && scanner.scanInt(&minute) && minute >= 0 && minute < 60 { + /* this crashes in Xcode 8b2, see https://bugs.swift.org/browse/SR-1782 + var decimalSet = CharacterSet.decimalDigits + */ let digitSet = CharacterSet.decimalDigits var decimalSet = NSMutableCharacterSet.decimalDigits decimalSet.insert(".") diff --git a/Sources/Models/DecisionSupportRule.swift b/Sources/Models/DecisionSupportRule.swift deleted file mode 100644 index 8b66be29..00000000 --- a/Sources/Models/DecisionSupportRule.swift +++ /dev/null @@ -1,119 +0,0 @@ -// -// DecisionSupportRule.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DecisionSupportRule) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * A decision support rule. - * - * This resource defines a decision support rule of the form [on Event] if Condition then Action. It is intended to be - * a shareable, computable definition of a actions that should be taken whenever some condition is met in response to a - * particular event or events. - */ -public class DecisionSupportRule: DomainResource { - override public class var resourceName: String { - get { return "DecisionSupportRule" } - } - - /// "then" perform these actions. - public var action: [ActionDefinition]? - - /// "if" some condition is true. - public var condition: String? - - /// Logic used within the rule. - public var library: [Reference]? - - /// Module information for the rule. - public var moduleMetadata: ModuleMetadata? - - /// "when" the rule should be invoked. - public var trigger: [TriggerDefinition]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["action"] { - presentKeys.insert("action") - if let val = exist as? [FHIRJSON] { - self.action = ActionDefinition.instantiate(fromArray: val, owner: self) as? [ActionDefinition] - } - else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["condition"] { - presentKeys.insert("condition") - if let val = exist as? String { - self.condition = val - } - else { - errors.append(FHIRJSONError(key: "condition", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["library"] { - presentKeys.insert("library") - if let val = exist as? [FHIRJSON] { - self.library = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "library", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["moduleMetadata"] { - presentKeys.insert("moduleMetadata") - if let val = exist as? FHIRJSON { - self.moduleMetadata = ModuleMetadata(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "moduleMetadata", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["trigger"] { - presentKeys.insert("trigger") - if let val = exist as? [FHIRJSON] { - self.trigger = TriggerDefinition.instantiate(fromArray: val, owner: self) as? [TriggerDefinition] - } - else { - errors.append(FHIRJSONError(key: "trigger", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let action = self.action { - json["action"] = ActionDefinition.asJSONArray(action) - } - if let condition = self.condition { - json["condition"] = condition.asJSON() - } - if let library = self.library { - json["library"] = Reference.asJSONArray(library) - } - if let moduleMetadata = self.moduleMetadata { - json["moduleMetadata"] = moduleMetadata.asJSON() - } - if let trigger = self.trigger { - json["trigger"] = TriggerDefinition.asJSONArray(trigger) - } - - return json - } -} - diff --git a/Sources/Models/DecisionSupportServiceModule.swift b/Sources/Models/DecisionSupportServiceModule.swift deleted file mode 100644 index ed9357ec..00000000 --- a/Sources/Models/DecisionSupportServiceModule.swift +++ /dev/null @@ -1,103 +0,0 @@ -// -// DecisionSupportServiceModule.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DecisionSupportServiceModule) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * A description of decision support service functionality. - * - * The DecisionSupportServiceModule describes a unit of decision support functionality that is made available as a - * service, such as immunization modules or drug-drug interaction checking. - */ -public class DecisionSupportServiceModule: DomainResource { - override public class var resourceName: String { - get { return "DecisionSupportServiceModule" } - } - - /// Data requirements for the module. - public var dataRequirement: [DataRequirement]? - - /// Metadata for the service module. - public var moduleMetadata: ModuleMetadata? - - /// Parameters to the module. - public var parameter: [ParameterDefinition]? - - /// "when" the module should be invoked. - public var trigger: [TriggerDefinition]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["dataRequirement"] { - presentKeys.insert("dataRequirement") - if let val = exist as? [FHIRJSON] { - self.dataRequirement = DataRequirement.instantiate(fromArray: val, owner: self) as? [DataRequirement] - } - else { - errors.append(FHIRJSONError(key: "dataRequirement", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["moduleMetadata"] { - presentKeys.insert("moduleMetadata") - if let val = exist as? FHIRJSON { - self.moduleMetadata = ModuleMetadata(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "moduleMetadata", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["parameter"] { - presentKeys.insert("parameter") - if let val = exist as? [FHIRJSON] { - self.parameter = ParameterDefinition.instantiate(fromArray: val, owner: self) as? [ParameterDefinition] - } - else { - errors.append(FHIRJSONError(key: "parameter", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["trigger"] { - presentKeys.insert("trigger") - if let val = exist as? [FHIRJSON] { - self.trigger = TriggerDefinition.instantiate(fromArray: val, owner: self) as? [TriggerDefinition] - } - else { - errors.append(FHIRJSONError(key: "trigger", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let dataRequirement = self.dataRequirement { - json["dataRequirement"] = DataRequirement.asJSONArray(dataRequirement) - } - if let moduleMetadata = self.moduleMetadata { - json["moduleMetadata"] = moduleMetadata.asJSON() - } - if let parameter = self.parameter { - json["parameter"] = ParameterDefinition.asJSONArray(parameter) - } - if let trigger = self.trigger { - json["trigger"] = TriggerDefinition.asJSONArray(trigger) - } - - return json - } -} - diff --git a/Sources/Models/DetectedIssue.swift b/Sources/Models/DetectedIssue.swift index c3691a34..3d699172 100644 --- a/Sources/Models/DetectedIssue.swift +++ b/Sources/Models/DetectedIssue.swift @@ -2,7 +2,7 @@ // DetectedIssue.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DetectedIssue) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DetectedIssue) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Device.swift b/Sources/Models/Device.swift index 8745c01c..ceae67c9 100644 --- a/Sources/Models/Device.swift +++ b/Sources/Models/Device.swift @@ -2,7 +2,7 @@ // Device.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Device) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Device) on 2016-08-09. // 2016, SMART Health IT. // @@ -10,13 +10,13 @@ import Foundation /** - * Item used in healthcare. + * An instance of a manufactured te that is used in the provision of 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 includes 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. + * This resource identifies an instance 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 includes 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. */ public class Device: DomainResource { override public class var resourceName: String { @@ -27,9 +27,9 @@ public class Device: DomainResource { public var contact: [ContactPoint]? /// Date and time of expiry of this device (if applicable). - public var expirationDate: DateTime? + public var expiry: DateTime? - /// Instance identifier. + /// Instance id from manufacturer, owner, and others. public var identifier: [Identifier]? /// Where the resource is found. @@ -38,7 +38,7 @@ public class Device: DomainResource { /// Lot number of manufacture. public var lotNumber: String? - /// Date when the device was made. + /// Manufacture date. public var manufactureDate: DateTime? /// Name of device manufacturer. @@ -53,7 +53,7 @@ public class Device: DomainResource { /// Organization responsible for device. public var owner: Reference? - /// Patient to whom Device is affixed. + /// If the resource is affixed to a person. public var patient: Reference? /// available | not-available | entered-in-error. @@ -62,8 +62,8 @@ public class Device: DomainResource { /// What kind of device this is. public var type: CodeableConcept? - /// Unique Device Identifier (UDI) Barcode string. - public var udiCarrier: Identifier? + /// FDA mandated Unique Device Identifier. + public var udi: String? /// Network address to contact device. public var url: URL? @@ -95,13 +95,13 @@ public class Device: DomainResource { errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["expirationDate"] { - presentKeys.insert("expirationDate") + if let exist: AnyObject = js["expiry"] { + presentKeys.insert("expiry") if let val = exist as? String { - self.expirationDate = DateTime(string: val) + self.expiry = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "expirationDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "expiry", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["identifier"] { @@ -206,13 +206,13 @@ public class Device: DomainResource { else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["udiCarrier"] { - presentKeys.insert("udiCarrier") - if let val = exist as? FHIRJSON { - self.udiCarrier = Identifier(json: val, owner: self) + if let exist: AnyObject = js["udi"] { + presentKeys.insert("udi") + if let val = exist as? String { + self.udi = val } else { - errors.append(FHIRJSONError(key: "udiCarrier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "udi", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["url"] { @@ -243,8 +243,8 @@ public class Device: DomainResource { if let contact = self.contact { json["contact"] = ContactPoint.asJSONArray(contact) } - if let expirationDate = self.expirationDate { - json["expirationDate"] = expirationDate.asJSON() + if let expiry = self.expiry { + json["expiry"] = expiry.asJSON() } if let identifier = self.identifier { json["identifier"] = Identifier.asJSONArray(identifier) @@ -279,8 +279,8 @@ public class Device: DomainResource { if let type = self.type { json["type"] = type.asJSON() } - if let udiCarrier = self.udiCarrier { - json["udiCarrier"] = udiCarrier.asJSON() + if let udi = self.udi { + json["udi"] = udi.asJSON() } if let url = self.url { json["url"] = url.asJSON() diff --git a/Sources/Models/DeviceComponent.swift b/Sources/Models/DeviceComponent.swift index 95c91157..bb470b2d 100644 --- a/Sources/Models/DeviceComponent.swift +++ b/Sources/Models/DeviceComponent.swift @@ -2,7 +2,7 @@ // DeviceComponent.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DeviceComponent) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceComponent) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/DeviceMetric.swift b/Sources/Models/DeviceMetric.swift index 81fafd78..55579fe8 100644 --- a/Sources/Models/DeviceMetric.swift +++ b/Sources/Models/DeviceMetric.swift @@ -2,7 +2,7 @@ // DeviceMetric.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DeviceMetric) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceMetric) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/DeviceUseRequest.swift b/Sources/Models/DeviceUseRequest.swift index 62283149..80d3efc7 100644 --- a/Sources/Models/DeviceUseRequest.swift +++ b/Sources/Models/DeviceUseRequest.swift @@ -2,7 +2,7 @@ // DeviceUseRequest.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DeviceUseRequest) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceUseRequest) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/DeviceUseStatement.swift b/Sources/Models/DeviceUseStatement.swift index 05f8c10d..0025b57d 100644 --- a/Sources/Models/DeviceUseStatement.swift +++ b/Sources/Models/DeviceUseStatement.swift @@ -2,7 +2,7 @@ // DeviceUseStatement.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/DiagnosticOrder.swift b/Sources/Models/DiagnosticOrder.swift index 0960ff11..3a675349 100644 --- a/Sources/Models/DiagnosticOrder.swift +++ b/Sources/Models/DiagnosticOrder.swift @@ -2,7 +2,7 @@ // DiagnosticOrder.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DiagnosticOrder) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DiagnosticOrder) on 2016-08-09. // 2016, SMART Health IT. // @@ -46,7 +46,7 @@ public class DiagnosticOrder: DomainResource { /// If the whole order relates to specific specimens. public var specimen: [Reference]? - /// proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error. + /// proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed. public var status: String? /// Who and/or what test is about. @@ -250,7 +250,7 @@ public class DiagnosticOrderEvent: BackboneElement { /// More information about the event and its context. public var description_fhir: CodeableConcept? - /// proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error. + /// proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed. public var status: String? @@ -359,7 +359,7 @@ public class DiagnosticOrderItem: BackboneElement { /// If this item relates to specific specimens. public var specimen: [Reference]? - /// proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed | entered-in-error. + /// proposed | draft | planned | requested | received | accepted | in-progress | review | completed | cancelled | suspended | rejected | failed. public var status: String? diff --git a/Sources/Models/DiagnosticReport.swift b/Sources/Models/DiagnosticReport.swift index 90b1d5ed..db755824 100644 --- a/Sources/Models/DiagnosticReport.swift +++ b/Sources/Models/DiagnosticReport.swift @@ -2,7 +2,7 @@ // DiagnosticReport.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DiagnosticReport) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DiagnosticReport) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Distance.swift b/Sources/Models/Distance.swift index bd7153f0..bcf355a6 100644 --- a/Sources/Models/Distance.swift +++ b/Sources/Models/Distance.swift @@ -2,7 +2,7 @@ // Distance.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Distance) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Distance) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/DocumentManifest.swift b/Sources/Models/DocumentManifest.swift index 744de2e8..2c505fd3 100644 --- a/Sources/Models/DocumentManifest.swift +++ b/Sources/Models/DocumentManifest.swift @@ -2,7 +2,7 @@ // DocumentManifest.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/DocumentReference.swift b/Sources/Models/DocumentReference.swift index 58a96156..c53fd8c4 100644 --- a/Sources/Models/DocumentReference.swift +++ b/Sources/Models/DocumentReference.swift @@ -2,7 +2,7 @@ // DocumentReference.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DocumentReference) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DocumentReference) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/DomainResource.swift b/Sources/Models/DomainResource.swift index 36e3c411..a41c8d6b 100644 --- a/Sources/Models/DomainResource.swift +++ b/Sources/Models/DomainResource.swift @@ -2,7 +2,7 @@ // DomainResource.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/DomainResource) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DomainResource) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Duration.swift b/Sources/Models/Duration.swift index 390f9b2a..5ce7b09e 100644 --- a/Sources/Models/Duration.swift +++ b/Sources/Models/Duration.swift @@ -2,7 +2,7 @@ // Duration.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Duration) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Duration) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Element.swift b/Sources/Models/Element.swift index cbfc224f..4aed6664 100644 --- a/Sources/Models/Element.swift +++ b/Sources/Models/Element.swift @@ -2,7 +2,7 @@ // Element.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Element) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Element) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/ElementDefinition.swift b/Sources/Models/ElementDefinition.swift index 456117b2..0db4a6e9 100644 --- a/Sources/Models/ElementDefinition.swift +++ b/Sources/Models/ElementDefinition.swift @@ -2,7 +2,7 @@ // ElementDefinition.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ElementDefinition) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ElementDefinition) on 2016-08-09. // 2016, SMART Health IT. // @@ -40,208 +40,205 @@ public class ElementDefinition: Element { /// Condition that must evaluate to true. public var constraint: [ElementDefinitionConstraint]? - /// Reference to definition of content for the element. - public var contentReference: URL? - - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueAddress: Address? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueAnnotation: Annotation? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueAttachment: Attachment? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueBase64Binary: Base64Binary? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueBoolean: Bool? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueCode: String? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueCodeableConcept: CodeableConcept? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueCoding: Coding? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueContactPoint: ContactPoint? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueDate: FHIRDate? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueDateTime: DateTime? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueDecimal: NSDecimalNumber? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueHumanName: HumanName? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueId: String? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueIdentifier: Identifier? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueInstant: Instant? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueInteger: Int? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueMarkdown: String? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueMeta: Meta? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueOid: String? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValuePeriod: Period? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValuePositiveInt: UInt? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueQuantity: Quantity? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueRange: Range? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueRatio: Ratio? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueReference: Reference? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueSampledData: SampledData? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueSignature: Signature? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueString: String? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueTime: FHIRTime? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueTiming: Timing? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueUnsignedInt: UInt? - /// Specified value if missing from instance. + /// Specified value it missing from instance. public var defaultValueUri: URL? /// Full formal definition as narrative text. public var definition: String? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleAddress: Address? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleAnnotation: Annotation? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleAttachment: Attachment? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleBase64Binary: Base64Binary? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleBoolean: Bool? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleCode: String? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleCodeableConcept: CodeableConcept? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleCoding: Coding? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleContactPoint: ContactPoint? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleDate: FHIRDate? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleDateTime: DateTime? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleDecimal: NSDecimalNumber? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleHumanName: HumanName? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleId: String? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleIdentifier: Identifier? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleInstant: Instant? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleInteger: Int? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleMarkdown: String? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleMeta: Meta? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleOid: String? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var examplePeriod: Period? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var examplePositiveInt: UInt? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleQuantity: Quantity? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleRange: Range? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleRatio: Ratio? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleReference: Reference? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleSampledData: SampledData? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleSignature: Signature? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleString: String? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleTime: FHIRTime? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleTiming: Timing? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleUnsignedInt: UInt? - /// Example value (as defined for type). + /// Example value: [as defined for type]. public var exampleUri: URL? /// Value must be exactly this. @@ -571,6 +568,9 @@ public class ElementDefinition: Element { /// Name for this particular element definition (reference target). public var name: String? + /// To another element constraint (by element.name). + public var nameReference: String? + /// The path of the element (see the Detailed Descriptions). public var path: String? @@ -673,10 +673,10 @@ public class ElementDefinition: Element { /// Value must have at least these property values. public var patternUri: URL? - /// xmlAttr | xmlText | typeAttr | cdaText. + /// How this element is represented in instances. public var representation: [String]? - /// Why this resource has been created. + /// Why is this needed?. public var requirements: String? /// Concise definition for xml presentation. @@ -766,15 +766,6 @@ public class ElementDefinition: Element { errors.append(FHIRJSONError(key: "constraint", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["contentReference"] { - presentKeys.insert("contentReference") - if let val = exist as? String { - self.contentReference = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "contentReference", wants: String.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["defaultValueAddress"] { presentKeys.insert("defaultValueAddress") if let val = exist as? FHIRJSON { @@ -2359,6 +2350,15 @@ public class ElementDefinition: Element { errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["nameReference"] { + presentKeys.insert("nameReference") + if let val = exist as? String { + self.nameReference = val + } + else { + errors.append(FHIRJSONError(key: "nameReference", wants: String.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["path"] { presentKeys.insert("path") if let val = exist as? String { @@ -2749,9 +2749,6 @@ public class ElementDefinition: Element { if let constraint = self.constraint { json["constraint"] = ElementDefinitionConstraint.asJSONArray(constraint) } - if let contentReference = self.contentReference { - json["contentReference"] = contentReference.asJSON() - } if let defaultValueAddress = self.defaultValueAddress { json["defaultValueAddress"] = defaultValueAddress.asJSON() } @@ -3280,6 +3277,9 @@ public class ElementDefinition: Element { if let name = self.name { json["name"] = name.asJSON() } + if let nameReference = self.nameReference { + json["nameReference"] = nameReference.asJSON() + } if let path = self.path { json["path"] = path.asJSON() } @@ -3410,7 +3410,7 @@ public class ElementDefinition: Element { /** * Base definition information for tools. * - * Information about the base definition of the element, provided to make it unnecessary for tools to trace the + * Information about the base definition of the element, provided to make it unncessary for tools to trace the * deviation of the element through the derived and related profiles. This information is only provided where the * element definition represents a constraint on another element definition, and must be present if there is a base * element definition. @@ -3616,16 +3616,13 @@ public class ElementDefinitionConstraint: Element { get { return "ElementDefinitionConstraint" } } - /// FluentPath expression of constraint. - public var expression: String? - /// Human description of constraint. public var human: String? /// Target of 'condition' reference above. public var key: String? - /// Why this constraint is necessary or appropriate. + /// Why this constraint necessary or appropriate. public var requirements: String? /// error | warning. @@ -3652,15 +3649,6 @@ public class ElementDefinitionConstraint: Element { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["expression"] { - presentKeys.insert("expression") - if let val = exist as? String { - self.expression = val - } - else { - errors.append(FHIRJSONError(key: "expression", wants: String.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["human"] { presentKeys.insert("human") if let val = exist as? String { @@ -3725,9 +3713,6 @@ public class ElementDefinitionConstraint: Element { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let expression = self.expression { - json["expression"] = expression.asJSON() - } if let human = self.human { json["human"] = human.asJSON() } @@ -3856,7 +3841,7 @@ public class ElementDefinitionSlicing: Element { /// Text description of how slicing works (or not). public var description_fhir: String? - /// Element values that are used to distinguish the slices. + /// Element values that used to distinguish the slices. public var discriminator: [String]? /// If elements must be in same order as slices. @@ -3967,9 +3952,6 @@ public class ElementDefinitionType: Element { /// Profile (StructureDefinition) to apply (or IG). public var profile: [URL]? - /// either | independent | specific. - public var versioning: String? - /** Initialize with a JSON object. */ public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { @@ -4015,15 +3997,6 @@ public class ElementDefinitionType: Element { errors.append(FHIRJSONError(key: "profile", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["versioning"] { - presentKeys.insert("versioning") - if let val = exist as? String { - self.versioning = val - } - else { - errors.append(FHIRJSONError(key: "versioning", wants: String.self, has: exist.dynamicType)) - } - } } return errors.isEmpty ? nil : errors } @@ -4048,9 +4021,6 @@ public class ElementDefinitionType: Element { } json["profile"] = arr } - if let versioning = self.versioning { - json["versioning"] = versioning.asJSON() - } return json } diff --git a/Sources/Models/EligibilityRequest.swift b/Sources/Models/EligibilityRequest.swift index 720d3f56..ab3953d2 100644 --- a/Sources/Models/EligibilityRequest.swift +++ b/Sources/Models/EligibilityRequest.swift @@ -2,7 +2,7 @@ // EligibilityRequest.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/EligibilityRequest) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EligibilityRequest) on 2016-08-09. // 2016, SMART Health IT. // @@ -20,77 +20,26 @@ public class EligibilityRequest: DomainResource { get { return "EligibilityRequest" } } - /// Benefit Category. - public var benefitCategory: Coding? - - /// Benefit SubCategory. - public var benefitSubCategory: Coding? - - /// Business agreement. - public var businessArrangement: String? - - /// Insurance or medical plan. - public var coverageIdentifier: Identifier? - - /// Insurance or medical plan. - public var coverageReference: Reference? - /// Creation date. public var created: DateTime? - /// Author. - public var entererIdentifier: Identifier? - - /// Author. - public var entererReference: Reference? - - /// Servicing Facility. - public var facilityIdentifier: Identifier? - - /// Servicing Facility. - public var facilityReference: Reference? - /// Business Identifier. public var identifier: [Identifier]? /// Responsible organization. - public var organizationIdentifier: Identifier? - - /// Responsible organization. - public var organizationReference: Reference? + public var organization: Reference? /// Original version. public var originalRuleset: Coding? - /// The subject of the Products and Services. - public var patientIdentifier: Identifier? - - /// The subject of the Products and Services. - public var patientReference: Reference? - - /// Desired processing priority. - public var priority: Coding? - - /// Responsible practitioner. - public var providerIdentifier: Identifier? - /// Responsible practitioner. - public var providerReference: Reference? + public var provider: Reference? /// Resource version. public var ruleset: Coding? - /// Estimated date or dates of Service. - public var servicedDate: FHIRDate? - - /// Estimated date or dates of Service. - public var servicedPeriod: Period? - - /// Insurer. - public var targetIdentifier: Identifier? - /// Insurer. - public var targetReference: Reference? + public var target: Reference? /** Initialize with a JSON object. */ @@ -101,51 +50,6 @@ public class EligibilityRequest: DomainResource { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["benefitCategory"] { - presentKeys.insert("benefitCategory") - if let val = exist as? FHIRJSON { - self.benefitCategory = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "benefitCategory", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["benefitSubCategory"] { - presentKeys.insert("benefitSubCategory") - if let val = exist as? FHIRJSON { - self.benefitSubCategory = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "benefitSubCategory", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["businessArrangement"] { - presentKeys.insert("businessArrangement") - if let val = exist as? String { - self.businessArrangement = val - } - else { - errors.append(FHIRJSONError(key: "businessArrangement", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["coverageIdentifier"] { - presentKeys.insert("coverageIdentifier") - if let val = exist as? FHIRJSON { - self.coverageIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "coverageIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["coverageReference"] { - presentKeys.insert("coverageReference") - if let val = exist as? FHIRJSON { - self.coverageReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "coverageReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["created"] { presentKeys.insert("created") if let val = exist as? String { @@ -155,42 +59,6 @@ public class EligibilityRequest: DomainResource { errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["entererIdentifier"] { - presentKeys.insert("entererIdentifier") - if let val = exist as? FHIRJSON { - self.entererIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "entererIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["entererReference"] { - presentKeys.insert("entererReference") - if let val = exist as? FHIRJSON { - self.entererReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "entererReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["facilityIdentifier"] { - presentKeys.insert("facilityIdentifier") - if let val = exist as? FHIRJSON { - self.facilityIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "facilityIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["facilityReference"] { - presentKeys.insert("facilityReference") - if let val = exist as? FHIRJSON { - self.facilityReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "facilityReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { @@ -200,22 +68,13 @@ public class EligibilityRequest: DomainResource { errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["organizationIdentifier"] { - presentKeys.insert("organizationIdentifier") - if let val = exist as? FHIRJSON { - self.organizationIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "organizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organizationReference"] { - presentKeys.insert("organizationReference") + if let exist: AnyObject = js["organization"] { + presentKeys.insert("organization") if let val = exist as? FHIRJSON { - self.organizationReference = Reference(json: val, owner: self) + self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["originalRuleset"] { @@ -227,49 +86,13 @@ public class EligibilityRequest: DomainResource { errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["patientIdentifier"] { - presentKeys.insert("patientIdentifier") - if let val = exist as? FHIRJSON { - self.patientIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "patientIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["patientReference"] { - presentKeys.insert("patientReference") + if let exist: AnyObject = js["provider"] { + presentKeys.insert("provider") if let val = exist as? FHIRJSON { - self.patientReference = Reference(json: val, owner: self) + self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patientReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["priority"] { - presentKeys.insert("priority") - if let val = exist as? FHIRJSON { - self.priority = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["providerIdentifier"] { - presentKeys.insert("providerIdentifier") - if let val = exist as? FHIRJSON { - self.providerIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "providerIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["providerReference"] { - presentKeys.insert("providerReference") - if let val = exist as? FHIRJSON { - self.providerReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "providerReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["ruleset"] { @@ -281,40 +104,13 @@ public class EligibilityRequest: DomainResource { errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["servicedDate"] { - presentKeys.insert("servicedDate") - if let val = exist as? String { - self.servicedDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "servicedDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["servicedPeriod"] { - presentKeys.insert("servicedPeriod") - if let val = exist as? FHIRJSON { - self.servicedPeriod = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "servicedPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["targetIdentifier"] { - presentKeys.insert("targetIdentifier") + if let exist: AnyObject = js["target"] { + presentKeys.insert("target") if let val = exist as? FHIRJSON { - self.targetIdentifier = Identifier(json: val, owner: self) + self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "targetIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["targetReference"] { - presentKeys.insert("targetReference") - if let val = exist as? FHIRJSON { - self.targetReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "targetReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) } } } @@ -324,77 +120,26 @@ public class EligibilityRequest: DomainResource { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let benefitCategory = self.benefitCategory { - json["benefitCategory"] = benefitCategory.asJSON() - } - if let benefitSubCategory = self.benefitSubCategory { - json["benefitSubCategory"] = benefitSubCategory.asJSON() - } - if let businessArrangement = self.businessArrangement { - json["businessArrangement"] = businessArrangement.asJSON() - } - if let coverageIdentifier = self.coverageIdentifier { - json["coverageIdentifier"] = coverageIdentifier.asJSON() - } - if let coverageReference = self.coverageReference { - json["coverageReference"] = coverageReference.asJSON() - } if let created = self.created { json["created"] = created.asJSON() } - if let entererIdentifier = self.entererIdentifier { - json["entererIdentifier"] = entererIdentifier.asJSON() - } - if let entererReference = self.entererReference { - json["entererReference"] = entererReference.asJSON() - } - if let facilityIdentifier = self.facilityIdentifier { - json["facilityIdentifier"] = facilityIdentifier.asJSON() - } - if let facilityReference = self.facilityReference { - json["facilityReference"] = facilityReference.asJSON() - } if let identifier = self.identifier { json["identifier"] = Identifier.asJSONArray(identifier) } - if let organizationIdentifier = self.organizationIdentifier { - json["organizationIdentifier"] = organizationIdentifier.asJSON() - } - if let organizationReference = self.organizationReference { - json["organizationReference"] = organizationReference.asJSON() + if let organization = self.organization { + json["organization"] = organization.asJSON() } if let originalRuleset = self.originalRuleset { json["originalRuleset"] = originalRuleset.asJSON() } - if let patientIdentifier = self.patientIdentifier { - json["patientIdentifier"] = patientIdentifier.asJSON() - } - if let patientReference = self.patientReference { - json["patientReference"] = patientReference.asJSON() - } - if let priority = self.priority { - json["priority"] = priority.asJSON() - } - if let providerIdentifier = self.providerIdentifier { - json["providerIdentifier"] = providerIdentifier.asJSON() - } - if let providerReference = self.providerReference { - json["providerReference"] = providerReference.asJSON() + if let provider = self.provider { + json["provider"] = provider.asJSON() } if let ruleset = self.ruleset { json["ruleset"] = ruleset.asJSON() } - if let servicedDate = self.servicedDate { - json["servicedDate"] = servicedDate.asJSON() - } - if let servicedPeriod = self.servicedPeriod { - json["servicedPeriod"] = servicedPeriod.asJSON() - } - if let targetIdentifier = self.targetIdentifier { - json["targetIdentifier"] = targetIdentifier.asJSON() - } - if let targetReference = self.targetReference { - json["targetReference"] = targetReference.asJSON() + if let target = self.target { + json["target"] = target.asJSON() } return json diff --git a/Sources/Models/EligibilityResponse.swift b/Sources/Models/EligibilityResponse.swift index 569f3b6f..fbc12fe4 100644 --- a/Sources/Models/EligibilityResponse.swift +++ b/Sources/Models/EligibilityResponse.swift @@ -2,7 +2,7 @@ // EligibilityResponse.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/EligibilityResponse) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EligibilityResponse) on 2016-08-09. // 2016, SMART Health IT. // @@ -19,35 +19,17 @@ public class EligibilityResponse: DomainResource { get { return "EligibilityResponse" } } - /// Benefits by Category. - public var benefitBalance: [EligibilityResponseBenefitBalance]? - - /// Contract details. - public var contract: Reference? - /// Creation date. public var created: DateTime? /// Disposition Message. public var disposition: String? - /// Processing errors. - public var error: [EligibilityResponseError]? - - /// Printed Form Identifier. - public var form: Coding? - /// Business Identifier. public var identifier: [Identifier]? - /// Coverage inforce. - public var inforce: Bool? - - /// Insurer. - public var organizationIdentifier: Identifier? - /// Insurer. - public var organizationReference: Reference? + public var organization: Reference? /// Original version. public var originalRuleset: Coding? @@ -56,22 +38,13 @@ public class EligibilityResponse: DomainResource { public var outcome: String? /// Claim reference. - public var requestIdentifier: Identifier? - - /// Responsible organization. - public var requestOrganizationIdentifier: Identifier? + public var request: Reference? /// Responsible organization. - public var requestOrganizationReference: Reference? - - /// Responsible practitioner. - public var requestProviderIdentifier: Identifier? + public var requestOrganization: Reference? /// Responsible practitioner. - public var requestProviderReference: Reference? - - /// Claim reference. - public var requestReference: Reference? + public var requestProvider: Reference? /// Resource version. public var ruleset: Coding? @@ -85,24 +58,6 @@ public class EligibilityResponse: DomainResource { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["benefitBalance"] { - presentKeys.insert("benefitBalance") - if let val = exist as? [FHIRJSON] { - self.benefitBalance = EligibilityResponseBenefitBalance.instantiate(fromArray: val, owner: self) as? [EligibilityResponseBenefitBalance] - } - else { - errors.append(FHIRJSONError(key: "benefitBalance", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["contract"] { - presentKeys.insert("contract") - if let val = exist as? FHIRJSON { - self.contract = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "contract", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["created"] { presentKeys.insert("created") if let val = exist as? String { @@ -121,24 +76,6 @@ public class EligibilityResponse: DomainResource { errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["error"] { - presentKeys.insert("error") - if let val = exist as? [FHIRJSON] { - self.error = EligibilityResponseError.instantiate(fromArray: val, owner: self) as? [EligibilityResponseError] - } - else { - errors.append(FHIRJSONError(key: "error", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["form"] { - presentKeys.insert("form") - if let val = exist as? FHIRJSON { - self.form = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "form", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { @@ -148,31 +85,13 @@ public class EligibilityResponse: DomainResource { errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["inforce"] { - presentKeys.insert("inforce") - if let val = exist as? Bool { - self.inforce = val - } - else { - errors.append(FHIRJSONError(key: "inforce", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organizationIdentifier"] { - presentKeys.insert("organizationIdentifier") + if let exist: AnyObject = js["organization"] { + presentKeys.insert("organization") if let val = exist as? FHIRJSON { - self.organizationIdentifier = Identifier(json: val, owner: self) + self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organizationReference"] { - presentKeys.insert("organizationReference") - if let val = exist as? FHIRJSON { - self.organizationReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "organizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["originalRuleset"] { @@ -193,58 +112,31 @@ public class EligibilityResponse: DomainResource { errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestIdentifier"] { - presentKeys.insert("requestIdentifier") - if let val = exist as? FHIRJSON { - self.requestIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestOrganizationIdentifier"] { - presentKeys.insert("requestOrganizationIdentifier") - if let val = exist as? FHIRJSON { - self.requestOrganizationIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestOrganizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestOrganizationReference"] { - presentKeys.insert("requestOrganizationReference") + if let exist: AnyObject = js["request"] { + presentKeys.insert("request") if let val = exist as? FHIRJSON { - self.requestOrganizationReference = Reference(json: val, owner: self) + self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestOrganizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestProviderIdentifier"] { - presentKeys.insert("requestProviderIdentifier") + if let exist: AnyObject = js["requestOrganization"] { + presentKeys.insert("requestOrganization") if let val = exist as? FHIRJSON { - self.requestProviderIdentifier = Identifier(json: val, owner: self) + self.requestOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProviderIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestProviderReference"] { - presentKeys.insert("requestProviderReference") + if let exist: AnyObject = js["requestProvider"] { + presentKeys.insert("requestProvider") if let val = exist as? FHIRJSON { - self.requestProviderReference = Reference(json: val, owner: self) + self.requestProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProviderReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestReference"] { - presentKeys.insert("requestReference") - if let val = exist as? FHIRJSON { - self.requestReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["ruleset"] { @@ -263,35 +155,17 @@ public class EligibilityResponse: DomainResource { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let benefitBalance = self.benefitBalance { - json["benefitBalance"] = EligibilityResponseBenefitBalance.asJSONArray(benefitBalance) - } - if let contract = self.contract { - json["contract"] = contract.asJSON() - } if let created = self.created { json["created"] = created.asJSON() } if let disposition = self.disposition { json["disposition"] = disposition.asJSON() } - if let error = self.error { - json["error"] = EligibilityResponseError.asJSONArray(error) - } - if let form = self.form { - json["form"] = form.asJSON() - } if let identifier = self.identifier { json["identifier"] = Identifier.asJSONArray(identifier) } - if let inforce = self.inforce { - json["inforce"] = inforce.asJSON() - } - if let organizationIdentifier = self.organizationIdentifier { - json["organizationIdentifier"] = organizationIdentifier.asJSON() - } - if let organizationReference = self.organizationReference { - json["organizationReference"] = organizationReference.asJSON() + if let organization = self.organization { + json["organization"] = organization.asJSON() } if let originalRuleset = self.originalRuleset { json["originalRuleset"] = originalRuleset.asJSON() @@ -299,23 +173,14 @@ public class EligibilityResponse: DomainResource { if let outcome = self.outcome { json["outcome"] = outcome.asJSON() } - if let requestIdentifier = self.requestIdentifier { - json["requestIdentifier"] = requestIdentifier.asJSON() - } - if let requestOrganizationIdentifier = self.requestOrganizationIdentifier { - json["requestOrganizationIdentifier"] = requestOrganizationIdentifier.asJSON() - } - if let requestOrganizationReference = self.requestOrganizationReference { - json["requestOrganizationReference"] = requestOrganizationReference.asJSON() + if let request = self.request { + json["request"] = request.asJSON() } - if let requestProviderIdentifier = self.requestProviderIdentifier { - json["requestProviderIdentifier"] = requestProviderIdentifier.asJSON() + if let requestOrganization = self.requestOrganization { + json["requestOrganization"] = requestOrganization.asJSON() } - if let requestProviderReference = self.requestProviderReference { - json["requestProviderReference"] = requestProviderReference.asJSON() - } - if let requestReference = self.requestReference { - json["requestReference"] = requestReference.asJSON() + if let requestProvider = self.requestProvider { + json["requestProvider"] = requestProvider.asJSON() } if let ruleset = self.ruleset { json["ruleset"] = ruleset.asJSON() @@ -325,306 +190,3 @@ public class EligibilityResponse: DomainResource { } } - -/** - * Benefits by Category. - * - * Benefits and optionally current balances by Category. - */ -public class EligibilityResponseBenefitBalance: BackboneElement { - override public class var resourceName: String { - get { return "EligibilityResponseBenefitBalance" } - } - - /// Benefit Category. - public var category: Coding? - - /// Benefit Summary. - public var financial: [EligibilityResponseBenefitBalanceFinancial]? - - /// In or out of network. - public var network: Coding? - - /// Benefit SubCategory. - public var subCategory: Coding? - - /// Annual or lifetime. - public var term: Coding? - - /// Individual or family. - public var unit: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { - self.init(json: nil) - self.category = category - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") - if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["financial"] { - presentKeys.insert("financial") - if let val = exist as? [FHIRJSON] { - self.financial = EligibilityResponseBenefitBalanceFinancial.instantiate(fromArray: val, owner: self) as? [EligibilityResponseBenefitBalanceFinancial] - } - else { - errors.append(FHIRJSONError(key: "financial", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["network"] { - presentKeys.insert("network") - if let val = exist as? FHIRJSON { - self.network = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "network", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["subCategory"] { - presentKeys.insert("subCategory") - if let val = exist as? FHIRJSON { - self.subCategory = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "subCategory", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["term"] { - presentKeys.insert("term") - if let val = exist as? FHIRJSON { - self.term = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "term", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["unit"] { - presentKeys.insert("unit") - if let val = exist as? FHIRJSON { - self.unit = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "unit", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let category = self.category { - json["category"] = category.asJSON() - } - if let financial = self.financial { - json["financial"] = EligibilityResponseBenefitBalanceFinancial.asJSONArray(financial) - } - if let network = self.network { - json["network"] = network.asJSON() - } - if let subCategory = self.subCategory { - json["subCategory"] = subCategory.asJSON() - } - if let term = self.term { - json["term"] = term.asJSON() - } - if let unit = self.unit { - json["unit"] = unit.asJSON() - } - - return json - } -} - - -/** - * Benefit Summary. - * - * Benefits Used to date. - */ -public class EligibilityResponseBenefitBalanceFinancial: BackboneElement { - override public class var resourceName: String { - get { return "EligibilityResponseBenefitBalanceFinancial" } - } - - /// Benefits allowed. - public var benefitQuantity: Quantity? - - /// Benefits allowed. - public var benefitUnsignedInt: UInt? - - /// Benefits used. - public var benefitUsedQuantity: Quantity? - - /// Benefits used. - public var benefitUsedUnsignedInt: UInt? - - /// Deductable, visits, benefit amount. - public var type: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: Coding) { - self.init(json: nil) - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["benefitQuantity"] { - presentKeys.insert("benefitQuantity") - if let val = exist as? FHIRJSON { - self.benefitQuantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "benefitQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["benefitUnsignedInt"] { - presentKeys.insert("benefitUnsignedInt") - if let val = exist as? UInt { - self.benefitUnsignedInt = val - } - else { - errors.append(FHIRJSONError(key: "benefitUnsignedInt", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["benefitUsedQuantity"] { - presentKeys.insert("benefitUsedQuantity") - if let val = exist as? FHIRJSON { - self.benefitUsedQuantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "benefitUsedQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["benefitUsedUnsignedInt"] { - presentKeys.insert("benefitUsedUnsignedInt") - if let val = exist as? UInt { - self.benefitUsedUnsignedInt = val - } - else { - errors.append(FHIRJSONError(key: "benefitUsedUnsignedInt", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let benefitQuantity = self.benefitQuantity { - json["benefitQuantity"] = benefitQuantity.asJSON() - } - if let benefitUnsignedInt = self.benefitUnsignedInt { - json["benefitUnsignedInt"] = benefitUnsignedInt.asJSON() - } - if let benefitUsedQuantity = self.benefitUsedQuantity { - json["benefitUsedQuantity"] = benefitUsedQuantity.asJSON() - } - if let benefitUsedUnsignedInt = self.benefitUsedUnsignedInt { - json["benefitUsedUnsignedInt"] = benefitUsedUnsignedInt.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Processing errors. - * - * Mutually exclusive with Services Provided (Item). - */ -public class EligibilityResponseError: BackboneElement { - override public class var resourceName: String { - get { return "EligibilityResponseError" } - } - - /// Error code detailing processing issues. - public var code: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(code: Coding) { - self.init(json: nil) - self.code = code - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["code"] { - presentKeys.insert("code") - if let val = exist as? FHIRJSON { - self.code = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "code")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let code = self.code { - json["code"] = code.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Encounter.swift b/Sources/Models/Encounter.swift index c05f6d4c..cd2798d6 100644 --- a/Sources/Models/Encounter.swift +++ b/Sources/Models/Encounter.swift @@ -2,7 +2,7 @@ // Encounter.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Encounter) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Encounter) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/EnrollmentRequest.swift b/Sources/Models/EnrollmentRequest.swift index a272cb87..60c25737 100644 --- a/Sources/Models/EnrollmentRequest.swift +++ b/Sources/Models/EnrollmentRequest.swift @@ -2,7 +2,7 @@ // EnrollmentRequest.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/EnrollmentResponse.swift b/Sources/Models/EnrollmentResponse.swift index 67d1444a..ec0be5e0 100644 --- a/Sources/Models/EnrollmentResponse.swift +++ b/Sources/Models/EnrollmentResponse.swift @@ -2,7 +2,7 @@ // EnrollmentResponse.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/EpisodeOfCare.swift b/Sources/Models/EpisodeOfCare.swift index f8cb3737..baf1d708 100644 --- a/Sources/Models/EpisodeOfCare.swift +++ b/Sources/Models/EpisodeOfCare.swift @@ -2,7 +2,7 @@ // EpisodeOfCare.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) on 2016-08-09. // 2016, SMART Health IT. // @@ -24,6 +24,9 @@ public class EpisodeOfCare: DomainResource { /// Care manager/care co-ordinator for the patient. public var careManager: Reference? + /// Other practitioners facilitating this episode of care. + public var careTeam: [EpisodeOfCareCareTeam]? + /// Conditions/problems/diagnoses this episode of care is for. public var condition: [Reference]? @@ -48,9 +51,6 @@ public class EpisodeOfCare: DomainResource { /// Past list of status codes. public var statusHistory: [EpisodeOfCareStatusHistory]? - /// Other practitioners facilitating this episode of care. - public var team: [Reference]? - /// Type/class - e.g. specialist referral, disease management. public var type: [CodeableConcept]? @@ -79,6 +79,15 @@ public class EpisodeOfCare: DomainResource { errors.append(FHIRJSONError(key: "careManager", wants: FHIRJSON.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["careTeam"] { + presentKeys.insert("careTeam") + if let val = exist as? [FHIRJSON] { + self.careTeam = EpisodeOfCareCareTeam.instantiate(fromArray: val, owner: self) as? [EpisodeOfCareCareTeam] + } + else { + errors.append(FHIRJSONError(key: "careTeam", wants: Array.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["condition"] { presentKeys.insert("condition") if let val = exist as? [FHIRJSON] { @@ -157,15 +166,6 @@ public class EpisodeOfCare: DomainResource { errors.append(FHIRJSONError(key: "statusHistory", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["team"] { - presentKeys.insert("team") - if let val = exist as? [FHIRJSON] { - self.team = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "team", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["type"] { presentKeys.insert("type") if let val = exist as? [FHIRJSON] { @@ -185,6 +185,9 @@ public class EpisodeOfCare: DomainResource { if let careManager = self.careManager { json["careManager"] = careManager.asJSON() } + if let careTeam = self.careTeam { + json["careTeam"] = EpisodeOfCareCareTeam.asJSONArray(careTeam) + } if let condition = self.condition { json["condition"] = Reference.asJSONArray(condition) } @@ -209,9 +212,6 @@ public class EpisodeOfCare: DomainResource { if let statusHistory = self.statusHistory { json["statusHistory"] = EpisodeOfCareStatusHistory.asJSONArray(statusHistory) } - if let team = self.team { - json["team"] = Reference.asJSONArray(team) - } if let type = self.type { json["type"] = CodeableConcept.asJSONArray(type) } @@ -221,6 +221,83 @@ public class EpisodeOfCare: DomainResource { } +/** + * Other practitioners facilitating this episode of care. + * + * The list of practitioners that may be facilitating this episode of care for specific purposes. + */ +public class EpisodeOfCareCareTeam: BackboneElement { + override public class var resourceName: String { + get { return "EpisodeOfCareCareTeam" } + } + + /// The practitioner (or Organization) within the team. + public var member: Reference? + + /// Period of time for this role. + public var period: Period? + + /// Role taken by this team member. + public var role: [CodeableConcept]? + + + /** Initialize with a JSON object. */ + public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { + super.init(json: json, owner: owner) + } + + public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + if let js = json { + if let exist: AnyObject = js["member"] { + presentKeys.insert("member") + if let val = exist as? FHIRJSON { + self.member = Reference(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "member", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["period"] { + presentKeys.insert("period") + if let val = exist as? FHIRJSON { + self.period = Period(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["role"] { + presentKeys.insert("role") + if let val = exist as? [FHIRJSON] { + self.role = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] + } + else { + errors.append(FHIRJSONError(key: "role", wants: Array.self, has: exist.dynamicType)) + } + } + } + return errors.isEmpty ? nil : errors + } + + override public func asJSON() -> FHIRJSON { + var json = super.asJSON() + + if let member = self.member { + json["member"] = member.asJSON() + } + if let period = self.period { + json["period"] = period.asJSON() + } + if let role = self.role { + json["role"] = CodeableConcept.asJSONArray(role) + } + + return json + } +} + + /** * Past list of status codes. * diff --git a/Sources/Models/ExpansionProfile.swift b/Sources/Models/ExpansionProfile.swift deleted file mode 100644 index d847868c..00000000 --- a/Sources/Models/ExpansionProfile.swift +++ /dev/null @@ -1,1007 +0,0 @@ -// -// ExpansionProfile.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ExpansionProfile) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * Defines behaviour and contraints on the ValueSet Expansion operation. - * - * Resource to define constraints on the Expansion of a FHIR ValueSet. - */ -public class ExpansionProfile: DomainResource { - override public class var resourceName: String { - get { return "ExpansionProfile" } - } - - /// When the expansion profile imposes code system contraints. - public var codeSystem: ExpansionProfileCodeSystem? - - /// Contact details of the publisher. - public var contact: [ExpansionProfileContact]? - - /// Date for given status. - public var date: DateTime? - - /// Human language description of the expansion profile. - public var description_fhir: String? - - /// When the expansion profile imposes designation contraints. - public var designation: ExpansionProfileDesignation? - - /// Specify the language for the display element of codes in the value set expansion. - public var displayLanguage: String? - - /// Include or exclude nested codes in the value set expansion. - public var excludeNested: Bool? - - /// Include or exclude codes which cannot be rendered in user interfaces in the value set expansion. - public var excludeNotForUI: Bool? - - /// Include or exclude codes which are post coordinated expressions in the value set expansion. - public var excludePostCoordinated: Bool? - - /// If for testing purposes, not real usage. - public var experimental: Bool? - - /// Additional identifier for the expansion profile (e.g. an Object Identifier). - public var identifier: Identifier? - - /// Include or exclude the value set definition in the expansion. - public var includeDefinition: Bool? - - /// Whether the expansion should include concept designations. - public var includeDesignations: Bool? - - /// Include or exclude inactive concepts in the expansion. - public var includeInactive: Bool? - - /// Controls behaviour of the value set expand operation when value sets are too large to be completely expanded. - public var limitedExpansion: Bool? - - /// Informal name for this expansion profile. - public var name: String? - - /// Name of the publisher (organization or individual). - public var publisher: String? - - /// draft | active | retired. - public var status: String? - - /// Globally unique logical identifier for expansion profile. - public var url: URL? - - /// Logical identifier for this version of the expansion profile. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(status: String) { - self.init(json: nil) - self.status = status - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["codeSystem"] { - presentKeys.insert("codeSystem") - if let val = exist as? FHIRJSON { - self.codeSystem = ExpansionProfileCodeSystem(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "codeSystem", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["contact"] { - presentKeys.insert("contact") - if let val = exist as? [FHIRJSON] { - self.contact = ExpansionProfileContact.instantiate(fromArray: val, owner: self) as? [ExpansionProfileContact] - } - else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["date"] { - presentKeys.insert("date") - if let val = exist as? String { - self.date = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["designation"] { - presentKeys.insert("designation") - if let val = exist as? FHIRJSON { - self.designation = ExpansionProfileDesignation(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "designation", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["displayLanguage"] { - presentKeys.insert("displayLanguage") - if let val = exist as? String { - self.displayLanguage = val - } - else { - errors.append(FHIRJSONError(key: "displayLanguage", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["excludeNested"] { - presentKeys.insert("excludeNested") - if let val = exist as? Bool { - self.excludeNested = val - } - else { - errors.append(FHIRJSONError(key: "excludeNested", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["excludeNotForUI"] { - presentKeys.insert("excludeNotForUI") - if let val = exist as? Bool { - self.excludeNotForUI = val - } - else { - errors.append(FHIRJSONError(key: "excludeNotForUI", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["excludePostCoordinated"] { - presentKeys.insert("excludePostCoordinated") - if let val = exist as? Bool { - self.excludePostCoordinated = val - } - else { - errors.append(FHIRJSONError(key: "excludePostCoordinated", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["experimental"] { - presentKeys.insert("experimental") - if let val = exist as? Bool { - self.experimental = val - } - else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["includeDefinition"] { - presentKeys.insert("includeDefinition") - if let val = exist as? Bool { - self.includeDefinition = val - } - else { - errors.append(FHIRJSONError(key: "includeDefinition", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["includeDesignations"] { - presentKeys.insert("includeDesignations") - if let val = exist as? Bool { - self.includeDesignations = val - } - else { - errors.append(FHIRJSONError(key: "includeDesignations", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["includeInactive"] { - presentKeys.insert("includeInactive") - if let val = exist as? Bool { - self.includeInactive = val - } - else { - errors.append(FHIRJSONError(key: "includeInactive", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["limitedExpansion"] { - presentKeys.insert("limitedExpansion") - if let val = exist as? Bool { - self.limitedExpansion = val - } - else { - errors.append(FHIRJSONError(key: "limitedExpansion", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["publisher"] { - presentKeys.insert("publisher") - if let val = exist as? String { - self.publisher = val - } - else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["status"] { - presentKeys.insert("status") - if let val = exist as? String { - self.status = val - } - else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "status")) - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let codeSystem = self.codeSystem { - json["codeSystem"] = codeSystem.asJSON() - } - if let contact = self.contact { - json["contact"] = ExpansionProfileContact.asJSONArray(contact) - } - if let date = self.date { - json["date"] = date.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let designation = self.designation { - json["designation"] = designation.asJSON() - } - if let displayLanguage = self.displayLanguage { - json["displayLanguage"] = displayLanguage.asJSON() - } - if let excludeNested = self.excludeNested { - json["excludeNested"] = excludeNested.asJSON() - } - if let excludeNotForUI = self.excludeNotForUI { - json["excludeNotForUI"] = excludeNotForUI.asJSON() - } - if let excludePostCoordinated = self.excludePostCoordinated { - json["excludePostCoordinated"] = excludePostCoordinated.asJSON() - } - if let experimental = self.experimental { - json["experimental"] = experimental.asJSON() - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let includeDefinition = self.includeDefinition { - json["includeDefinition"] = includeDefinition.asJSON() - } - if let includeDesignations = self.includeDesignations { - json["includeDesignations"] = includeDesignations.asJSON() - } - if let includeInactive = self.includeInactive { - json["includeInactive"] = includeInactive.asJSON() - } - if let limitedExpansion = self.limitedExpansion { - json["limitedExpansion"] = limitedExpansion.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let publisher = self.publisher { - json["publisher"] = publisher.asJSON() - } - if let status = self.status { - json["status"] = status.asJSON() - } - if let url = self.url { - json["url"] = url.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * When the expansion profile imposes code system contraints. - * - * A set of criteria that provide the constraints imposed on the value set expansion by including or excluding codes - * from specific code systems (or versions). - */ -public class ExpansionProfileCodeSystem: BackboneElement { - override public class var resourceName: String { - get { return "ExpansionProfileCodeSystem" } - } - - /// Code systems to be excluded. - public var exclude: ExpansionProfileCodeSystemExclude? - - /// Code systems to be included. - public var include: ExpansionProfileCodeSystemInclude? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["exclude"] { - presentKeys.insert("exclude") - if let val = exist as? FHIRJSON { - self.exclude = ExpansionProfileCodeSystemExclude(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "exclude", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["include"] { - presentKeys.insert("include") - if let val = exist as? FHIRJSON { - self.include = ExpansionProfileCodeSystemInclude(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "include", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let exclude = self.exclude { - json["exclude"] = exclude.asJSON() - } - if let include = self.include { - json["include"] = include.asJSON() - } - - return json - } -} - - -/** - * Code systems to be excluded. - * - * Code systems to be excluded from value set expansions. - */ -public class ExpansionProfileCodeSystemExclude: BackboneElement { - override public class var resourceName: String { - get { return "ExpansionProfileCodeSystemExclude" } - } - - /// The code systems to be excluded. - public var codeSystem: [ExpansionProfileCodeSystemExcludeCodeSystem]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(codeSystem: [ExpansionProfileCodeSystemExcludeCodeSystem]) { - self.init(json: nil) - self.codeSystem = codeSystem - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["codeSystem"] { - presentKeys.insert("codeSystem") - if let val = exist as? [FHIRJSON] { - self.codeSystem = ExpansionProfileCodeSystemExcludeCodeSystem.instantiate(fromArray: val, owner: self) as? [ExpansionProfileCodeSystemExcludeCodeSystem] - } - else { - errors.append(FHIRJSONError(key: "codeSystem", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "codeSystem")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let codeSystem = self.codeSystem { - json["codeSystem"] = ExpansionProfileCodeSystemExcludeCodeSystem.asJSONArray(codeSystem) - } - - return json - } -} - - -/** - * The code systems to be excluded. - * - * A data group for each code system to be excluded. - */ -public class ExpansionProfileCodeSystemExcludeCodeSystem: BackboneElement { - override public class var resourceName: String { - get { return "ExpansionProfileCodeSystemExcludeCodeSystem" } - } - - /// The specific code system to be excluded. - public var system: URL? - - /// Specific version of the code system referred to. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(system: URL) { - self.init(json: nil) - self.system = system - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["system"] { - presentKeys.insert("system") - if let val = exist as? String { - self.system = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "system")) - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let system = self.system { - json["system"] = system.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * Code systems to be included. - * - * Code systems to be included in value set expansions. - */ -public class ExpansionProfileCodeSystemInclude: BackboneElement { - override public class var resourceName: String { - get { return "ExpansionProfileCodeSystemInclude" } - } - - /// The code systems to be included. - public var codeSystem: [ExpansionProfileCodeSystemIncludeCodeSystem]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(codeSystem: [ExpansionProfileCodeSystemIncludeCodeSystem]) { - self.init(json: nil) - self.codeSystem = codeSystem - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["codeSystem"] { - presentKeys.insert("codeSystem") - if let val = exist as? [FHIRJSON] { - self.codeSystem = ExpansionProfileCodeSystemIncludeCodeSystem.instantiate(fromArray: val, owner: self) as? [ExpansionProfileCodeSystemIncludeCodeSystem] - } - else { - errors.append(FHIRJSONError(key: "codeSystem", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "codeSystem")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let codeSystem = self.codeSystem { - json["codeSystem"] = ExpansionProfileCodeSystemIncludeCodeSystem.asJSONArray(codeSystem) - } - - return json - } -} - - -/** - * The code systems to be included. - * - * A data group for each code system to be included. - */ -public class ExpansionProfileCodeSystemIncludeCodeSystem: BackboneElement { - override public class var resourceName: String { - get { return "ExpansionProfileCodeSystemIncludeCodeSystem" } - } - - /// The specific code system to be included. - public var system: URL? - - /// Specific version of the code system referred to. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(system: URL) { - self.init(json: nil) - self.system = system - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["system"] { - presentKeys.insert("system") - if let val = exist as? String { - self.system = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "system")) - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let system = self.system { - json["system"] = system.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * Contact details of the publisher. - * - * Contacts to assist a user in finding and communicating with the publisher. - */ -public class ExpansionProfileContact: BackboneElement { - override public class var resourceName: String { - get { return "ExpansionProfileContact" } - } - - /// Name of an individual to contact. - public var name: String? - - /// Contact details for individual or publisher. - public var telecom: [ContactPoint]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["telecom"] { - presentKeys.insert("telecom") - if let val = exist as? [FHIRJSON] { - self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] - } - else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) - } - - return json - } -} - - -/** - * 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. - */ -public class ExpansionProfileDesignation: BackboneElement { - override public class var resourceName: String { - get { return "ExpansionProfileDesignation" } - } - - /// Designations to be excluded. - public var exclude: ExpansionProfileDesignationExclude? - - /// Designations to be included. - public var include: ExpansionProfileDesignationInclude? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["exclude"] { - presentKeys.insert("exclude") - if let val = exist as? FHIRJSON { - self.exclude = ExpansionProfileDesignationExclude(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "exclude", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["include"] { - presentKeys.insert("include") - if let val = exist as? FHIRJSON { - self.include = ExpansionProfileDesignationInclude(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "include", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let exclude = self.exclude { - json["exclude"] = exclude.asJSON() - } - if let include = self.include { - json["include"] = include.asJSON() - } - - return json - } -} - - -/** - * Designations to be excluded. - */ -public class ExpansionProfileDesignationExclude: BackboneElement { - override public class var resourceName: String { - get { return "ExpansionProfileDesignationExclude" } - } - - /// The designation to be excluded. - public var designation: [ExpansionProfileDesignationExcludeDesignation]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["designation"] { - presentKeys.insert("designation") - if let val = exist as? [FHIRJSON] { - self.designation = ExpansionProfileDesignationExcludeDesignation.instantiate(fromArray: val, owner: self) as? [ExpansionProfileDesignationExcludeDesignation] - } - else { - errors.append(FHIRJSONError(key: "designation", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let designation = self.designation { - json["designation"] = ExpansionProfileDesignationExcludeDesignation.asJSONArray(designation) - } - - return json - } -} - - -/** - * The designation to be excluded. - * - * A data group for each designation to be excluded. - */ -public class ExpansionProfileDesignationExcludeDesignation: BackboneElement { - override public class var resourceName: String { - get { return "ExpansionProfileDesignationExcludeDesignation" } - } - - /// Human language of the designation to be excluded. - public var language: String? - - /// Designation use. - public var use: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["language"] { - presentKeys.insert("language") - if let val = exist as? String { - self.language = val - } - else { - errors.append(FHIRJSONError(key: "language", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["use"] { - presentKeys.insert("use") - if let val = exist as? FHIRJSON { - self.use = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "use", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let language = self.language { - json["language"] = language.asJSON() - } - if let use = self.use { - json["use"] = use.asJSON() - } - - return json - } -} - - -/** - * Designations to be included. - */ -public class ExpansionProfileDesignationInclude: BackboneElement { - override public class var resourceName: String { - get { return "ExpansionProfileDesignationInclude" } - } - - /// The designation to be included. - public var designation: [ExpansionProfileDesignationIncludeDesignation]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["designation"] { - presentKeys.insert("designation") - if let val = exist as? [FHIRJSON] { - self.designation = ExpansionProfileDesignationIncludeDesignation.instantiate(fromArray: val, owner: self) as? [ExpansionProfileDesignationIncludeDesignation] - } - else { - errors.append(FHIRJSONError(key: "designation", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let designation = self.designation { - json["designation"] = ExpansionProfileDesignationIncludeDesignation.asJSONArray(designation) - } - - return json - } -} - - -/** - * The designation to be included. - * - * A data group for each designation to be included. - */ -public class ExpansionProfileDesignationIncludeDesignation: BackboneElement { - override public class var resourceName: String { - get { return "ExpansionProfileDesignationIncludeDesignation" } - } - - /// Human language of the designation to be included. - public var language: String? - - /// Designation use. - public var use: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["language"] { - presentKeys.insert("language") - if let val = exist as? String { - self.language = val - } - else { - errors.append(FHIRJSONError(key: "language", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["use"] { - presentKeys.insert("use") - if let val = exist as? FHIRJSON { - self.use = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "use", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let language = self.language { - json["language"] = language.asJSON() - } - if let use = self.use { - json["use"] = use.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/ExplanationOfBenefit.swift b/Sources/Models/ExplanationOfBenefit.swift index 3bb5a0a4..d20477e7 100644 --- a/Sources/Models/ExplanationOfBenefit.swift +++ b/Sources/Models/ExplanationOfBenefit.swift @@ -2,7 +2,7 @@ // ExplanationOfBenefit.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) on 2016-08-09. // 2016, SMART Health IT. // @@ -10,7 +10,7 @@ import Foundation /** - * Explanation of Benefit resource. + * Remittance 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. @@ -20,308 +20,45 @@ public class ExplanationOfBenefit: DomainResource { get { return "ExplanationOfBenefit" } } - /// When the accident occurred. - public var accidentDate: FHIRDate? - - /// Accident Place. - public var accidentLocationAddress: Address? - - /// Accident Place. - public var accidentLocationReference: Reference? - - /// The nature of the accident. - public var accidentType: Coding? - - /// Insurer added line items. - public var addItem: [ExplanationOfBenefitAddItem]? - - /// Balance by Benefit Category. - public var benefitBalance: [ExplanationOfBenefitBenefitBalance]? - - /// Period for charge submission. - public var billablePeriod: Period? - - /// Claim reference. - public var claimIdentifier: Identifier? - - /// Claim reference. - public var claimReference: Reference? - - /// Claim response reference. - public var claimResponseIdentifier: Identifier? - - /// Claim response reference. - public var claimResponseReference: Reference? - - /// Insurance or medical plan. - public var coverage: ExplanationOfBenefitCoverage? - /// Creation date. public var created: DateTime? - /// Diagnosis. - public var diagnosis: [ExplanationOfBenefitDiagnosis]? - /// Disposition Message. public var disposition: String? - /// Period unable to work. - public var employmentImpacted: Period? - - /// Servicing Facility. - public var facilityIdentifier: Identifier? - - /// Servicing Facility. - public var facilityReference: Reference? - - /// Printed Form Identifier. - public var form: Coding? - - /// Period in hospital. - public var hospitalization: Period? - /// Business Identifier. public var identifier: [Identifier]? - /// Intervention and exception code (Pharma). - public var interventionException: [Coding]? - - /// Goods and Services. - public var item: [ExplanationOfBenefitItem]? - - /// Only if type = oral. - public var missingTeeth: [ExplanationOfBenefitMissingTeeth]? - - /// Processing notes. - public var note: [ExplanationOfBenefitNote]? - - /// Occurrence Span Codes. - public var occurenceSpanCode: [Coding]? + /// Insurer. + public var organization: Reference? - /// Occurrence Codes. - public var occurrenceCode: [Coding]? - - /// Condition related Onset related dates and codes. - public var onset: [ExplanationOfBenefitOnset]? - - /// Responsible organization for the claim. - public var organizationIdentifier: Identifier? - - /// Responsible organization for the claim. - public var organizationReference: Reference? - - /// Original Prescription. - public var originalPrescriptionIdentifier: Identifier? - - /// Original Prescription. - public var originalPrescriptionReference: Reference? - - /// Original specification followed. + /// Original version. public var originalRuleset: Coding? - /// The subject of the Products and Services. - public var patientIdentifier: Identifier? - - /// The subject of the Products and Services. - public var patientReference: Reference? - - /// Payee. - public var payee: ExplanationOfBenefitPayee? + /// complete | error. + public var outcome: String? - /// Payment adjustment for non-Claim issues. - public var paymentAdjustment: Quantity? - - /// Reason for Payment adjustment. - public var paymentAdjustmentReason: Coding? - - /// Payment amount. - public var paymentAmount: Quantity? - - /// Expected data of Payment. - public var paymentDate: FHIRDate? - - /// Payment identifier. - public var paymentRef: Identifier? - - /// Precedence (primary, secondary, etc.). - public var precedence: UInt? - - /// Prescription. - public var prescriptionIdentifier: Identifier? - - /// Prescription. - public var prescriptionReference: Reference? - - /// Procedures performed. - public var procedure: [ExplanationOfBenefitProcedure]? - - /// Responsible provider for the claim. - public var providerIdentifier: Identifier? - - /// Responsible provider for the claim. - public var providerReference: Reference? - - /// Treatment Referral. - public var referralIdentifier: Identifier? - - /// Treatment Referral. - public var referralReference: Reference? + /// Claim reference. + public var request: Reference? - /// Related Claims which may be revelant to processing this claimn. - public var related: [ExplanationOfBenefitRelated]? + /// Responsible organization. + public var requestOrganization: Reference? - /// Funds reserved status. - public var reserved: Coding? + /// Responsible practitioner. + public var requestProvider: Reference? - /// Current specification followed. + /// Resource version. public var ruleset: Coding? - /// List of special Conditions. - public var specialCondition: [Coding]? - - /// Finer grained claim type information. - public var subType: [Coding]? - - /// Total benefit payable for the Claim. - public var totalBenefit: Quantity? - - /// Total Cost of service from the Claim. - public var totalCost: Quantity? - - /// Unallocated deductable. - public var unallocDeductable: Quantity? - - /// Value Codes. - public var valueCode: [Coding]? - /** Initialize with a JSON object. */ public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { super.init(json: json, owner: owner) } - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(coverage: ExplanationOfBenefitCoverage, patientIdentifier: Identifier, patientReference: Reference) { - self.init(json: nil) - self.coverage = coverage - self.patientIdentifier = patientIdentifier - self.patientReference = patientReference - } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["accidentDate"] { - presentKeys.insert("accidentDate") - if let val = exist as? String { - self.accidentDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "accidentDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["accidentLocationAddress"] { - presentKeys.insert("accidentLocationAddress") - if let val = exist as? FHIRJSON { - self.accidentLocationAddress = Address(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "accidentLocationAddress", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["accidentLocationReference"] { - presentKeys.insert("accidentLocationReference") - if let val = exist as? FHIRJSON { - self.accidentLocationReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "accidentLocationReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["accidentType"] { - presentKeys.insert("accidentType") - if let val = exist as? FHIRJSON { - self.accidentType = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "accidentType", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["addItem"] { - presentKeys.insert("addItem") - if let val = exist as? [FHIRJSON] { - self.addItem = ExplanationOfBenefitAddItem.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitAddItem] - } - else { - errors.append(FHIRJSONError(key: "addItem", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["benefitBalance"] { - presentKeys.insert("benefitBalance") - if let val = exist as? [FHIRJSON] { - self.benefitBalance = ExplanationOfBenefitBenefitBalance.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitBenefitBalance] - } - else { - errors.append(FHIRJSONError(key: "benefitBalance", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["billablePeriod"] { - presentKeys.insert("billablePeriod") - if let val = exist as? FHIRJSON { - self.billablePeriod = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "billablePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["claimIdentifier"] { - presentKeys.insert("claimIdentifier") - if let val = exist as? FHIRJSON { - self.claimIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "claimIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["claimReference"] { - presentKeys.insert("claimReference") - if let val = exist as? FHIRJSON { - self.claimReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "claimReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["claimResponseIdentifier"] { - presentKeys.insert("claimResponseIdentifier") - if let val = exist as? FHIRJSON { - self.claimResponseIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "claimResponseIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["claimResponseReference"] { - presentKeys.insert("claimResponseReference") - if let val = exist as? FHIRJSON { - self.claimResponseReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "claimResponseReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["coverage"] { - presentKeys.insert("coverage") - if let val = exist as? FHIRJSON { - self.coverage = ExplanationOfBenefitCoverage(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "coverage", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "coverage")) - } if let exist: AnyObject = js["created"] { presentKeys.insert("created") if let val = exist as? String { @@ -331,15 +68,6 @@ public class ExplanationOfBenefit: DomainResource { errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["diagnosis"] { - presentKeys.insert("diagnosis") - if let val = exist as? [FHIRJSON] { - self.diagnosis = ExplanationOfBenefitDiagnosis.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitDiagnosis] - } - else { - errors.append(FHIRJSONError(key: "diagnosis", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["disposition"] { presentKeys.insert("disposition") if let val = exist as? String { @@ -349,51 +77,6 @@ public class ExplanationOfBenefit: DomainResource { errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["employmentImpacted"] { - presentKeys.insert("employmentImpacted") - if let val = exist as? FHIRJSON { - self.employmentImpacted = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "employmentImpacted", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["facilityIdentifier"] { - presentKeys.insert("facilityIdentifier") - if let val = exist as? FHIRJSON { - self.facilityIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "facilityIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["facilityReference"] { - presentKeys.insert("facilityReference") - if let val = exist as? FHIRJSON { - self.facilityReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "facilityReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["form"] { - presentKeys.insert("form") - if let val = exist as? FHIRJSON { - self.form = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "form", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["hospitalization"] { - presentKeys.insert("hospitalization") - if let val = exist as? FHIRJSON { - self.hospitalization = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "hospitalization", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { @@ -403,103 +86,13 @@ public class ExplanationOfBenefit: DomainResource { errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["interventionException"] { - presentKeys.insert("interventionException") - if let val = exist as? [FHIRJSON] { - self.interventionException = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "interventionException", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["item"] { - presentKeys.insert("item") - if let val = exist as? [FHIRJSON] { - self.item = ExplanationOfBenefitItem.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitItem] - } - else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["missingTeeth"] { - presentKeys.insert("missingTeeth") - if let val = exist as? [FHIRJSON] { - self.missingTeeth = ExplanationOfBenefitMissingTeeth.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitMissingTeeth] - } - else { - errors.append(FHIRJSONError(key: "missingTeeth", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["note"] { - presentKeys.insert("note") - if let val = exist as? [FHIRJSON] { - self.note = ExplanationOfBenefitNote.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitNote] - } - else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["occurenceSpanCode"] { - presentKeys.insert("occurenceSpanCode") - if let val = exist as? [FHIRJSON] { - self.occurenceSpanCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "occurenceSpanCode", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["occurrenceCode"] { - presentKeys.insert("occurrenceCode") - if let val = exist as? [FHIRJSON] { - self.occurrenceCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "occurrenceCode", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["onset"] { - presentKeys.insert("onset") - if let val = exist as? [FHIRJSON] { - self.onset = ExplanationOfBenefitOnset.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitOnset] - } - else { - errors.append(FHIRJSONError(key: "onset", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organizationIdentifier"] { - presentKeys.insert("organizationIdentifier") - if let val = exist as? FHIRJSON { - self.organizationIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "organizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organizationReference"] { - presentKeys.insert("organizationReference") - if let val = exist as? FHIRJSON { - self.organizationReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "organizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["originalPrescriptionIdentifier"] { - presentKeys.insert("originalPrescriptionIdentifier") - if let val = exist as? FHIRJSON { - self.originalPrescriptionIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "originalPrescriptionIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["originalPrescriptionReference"] { - presentKeys.insert("originalPrescriptionReference") + if let exist: AnyObject = js["organization"] { + presentKeys.insert("organization") if let val = exist as? FHIRJSON { - self.originalPrescriptionReference = Reference(json: val, owner: self) + self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalPrescriptionReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["originalRuleset"] { @@ -511,236 +104,51 @@ public class ExplanationOfBenefit: DomainResource { errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["patientIdentifier"] { - presentKeys.insert("patientIdentifier") - if let val = exist as? FHIRJSON { - self.patientIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "patientIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["patientReference"] { - presentKeys.insert("patientReference") - if let val = exist as? FHIRJSON { - self.patientReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "patientReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["payee"] { - presentKeys.insert("payee") - if let val = exist as? FHIRJSON { - self.payee = ExplanationOfBenefitPayee(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "payee", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["paymentAdjustment"] { - presentKeys.insert("paymentAdjustment") - if let val = exist as? FHIRJSON { - self.paymentAdjustment = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "paymentAdjustment", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["paymentAdjustmentReason"] { - presentKeys.insert("paymentAdjustmentReason") - if let val = exist as? FHIRJSON { - self.paymentAdjustmentReason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "paymentAdjustmentReason", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["paymentAmount"] { - presentKeys.insert("paymentAmount") - if let val = exist as? FHIRJSON { - self.paymentAmount = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "paymentAmount", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["paymentDate"] { - presentKeys.insert("paymentDate") + if let exist: AnyObject = js["outcome"] { + presentKeys.insert("outcome") if let val = exist as? String { - self.paymentDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "paymentDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["paymentRef"] { - presentKeys.insert("paymentRef") - if let val = exist as? FHIRJSON { - self.paymentRef = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "paymentRef", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["precedence"] { - presentKeys.insert("precedence") - if let val = exist as? UInt { - self.precedence = val - } - else { - errors.append(FHIRJSONError(key: "precedence", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["prescriptionIdentifier"] { - presentKeys.insert("prescriptionIdentifier") - if let val = exist as? FHIRJSON { - self.prescriptionIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "prescriptionIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["prescriptionReference"] { - presentKeys.insert("prescriptionReference") - if let val = exist as? FHIRJSON { - self.prescriptionReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "prescriptionReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["procedure"] { - presentKeys.insert("procedure") - if let val = exist as? [FHIRJSON] { - self.procedure = ExplanationOfBenefitProcedure.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitProcedure] + self.outcome = val } else { - errors.append(FHIRJSONError(key: "procedure", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["providerIdentifier"] { - presentKeys.insert("providerIdentifier") + if let exist: AnyObject = js["request"] { + presentKeys.insert("request") if let val = exist as? FHIRJSON { - self.providerIdentifier = Identifier(json: val, owner: self) + self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "providerIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["providerReference"] { - presentKeys.insert("providerReference") + if let exist: AnyObject = js["requestOrganization"] { + presentKeys.insert("requestOrganization") if let val = exist as? FHIRJSON { - self.providerReference = Reference(json: val, owner: self) + self.requestOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "providerReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["referralIdentifier"] { - presentKeys.insert("referralIdentifier") + if let exist: AnyObject = js["requestProvider"] { + presentKeys.insert("requestProvider") if let val = exist as? FHIRJSON { - self.referralIdentifier = Identifier(json: val, owner: self) + self.requestProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "referralIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["referralReference"] { - presentKeys.insert("referralReference") + if let exist: AnyObject = js["ruleset"] { + presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { - self.referralReference = Reference(json: val, owner: self) + self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "referralReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["related"] { - presentKeys.insert("related") - if let val = exist as? [FHIRJSON] { - self.related = ExplanationOfBenefitRelated.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitRelated] - } - else { - errors.append(FHIRJSONError(key: "related", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["reserved"] { - presentKeys.insert("reserved") - if let val = exist as? FHIRJSON { - self.reserved = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reserved", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["ruleset"] { - presentKeys.insert("ruleset") - if let val = exist as? FHIRJSON { - self.ruleset = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["specialCondition"] { - presentKeys.insert("specialCondition") - if let val = exist as? [FHIRJSON] { - self.specialCondition = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "specialCondition", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["subType"] { - presentKeys.insert("subType") - if let val = exist as? [FHIRJSON] { - self.subType = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "subType", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["totalBenefit"] { - presentKeys.insert("totalBenefit") - if let val = exist as? FHIRJSON { - self.totalBenefit = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "totalBenefit", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["totalCost"] { - presentKeys.insert("totalCost") - if let val = exist as? FHIRJSON { - self.totalCost = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "totalCost", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["unallocDeductable"] { - presentKeys.insert("unallocDeductable") - if let val = exist as? FHIRJSON { - self.unallocDeductable = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "unallocDeductable", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCode"] { - presentKeys.insert("valueCode") - if let val = exist as? [FHIRJSON] { - self.valueCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "valueCode", wants: Array.self, has: exist.dynamicType)) - } - } - - // check if nonoptional expanded properties are present - if nil == self.patientIdentifier && nil == self.patientReference { - errors.append(FHIRJSONError(key: "patient*")) - } } return errors.isEmpty ? nil : errors } @@ -748,2823 +156,36 @@ public class ExplanationOfBenefit: DomainResource { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let accidentDate = self.accidentDate { - json["accidentDate"] = accidentDate.asJSON() - } - if let accidentLocationAddress = self.accidentLocationAddress { - json["accidentLocationAddress"] = accidentLocationAddress.asJSON() - } - if let accidentLocationReference = self.accidentLocationReference { - json["accidentLocationReference"] = accidentLocationReference.asJSON() - } - if let accidentType = self.accidentType { - json["accidentType"] = accidentType.asJSON() - } - if let addItem = self.addItem { - json["addItem"] = ExplanationOfBenefitAddItem.asJSONArray(addItem) - } - if let benefitBalance = self.benefitBalance { - json["benefitBalance"] = ExplanationOfBenefitBenefitBalance.asJSONArray(benefitBalance) - } - if let billablePeriod = self.billablePeriod { - json["billablePeriod"] = billablePeriod.asJSON() - } - if let claimIdentifier = self.claimIdentifier { - json["claimIdentifier"] = claimIdentifier.asJSON() - } - if let claimReference = self.claimReference { - json["claimReference"] = claimReference.asJSON() - } - if let claimResponseIdentifier = self.claimResponseIdentifier { - json["claimResponseIdentifier"] = claimResponseIdentifier.asJSON() - } - if let claimResponseReference = self.claimResponseReference { - json["claimResponseReference"] = claimResponseReference.asJSON() - } - if let coverage = self.coverage { - json["coverage"] = coverage.asJSON() - } if let created = self.created { json["created"] = created.asJSON() } - if let diagnosis = self.diagnosis { - json["diagnosis"] = ExplanationOfBenefitDiagnosis.asJSONArray(diagnosis) - } if let disposition = self.disposition { json["disposition"] = disposition.asJSON() } - if let employmentImpacted = self.employmentImpacted { - json["employmentImpacted"] = employmentImpacted.asJSON() - } - if let facilityIdentifier = self.facilityIdentifier { - json["facilityIdentifier"] = facilityIdentifier.asJSON() - } - if let facilityReference = self.facilityReference { - json["facilityReference"] = facilityReference.asJSON() - } - if let form = self.form { - json["form"] = form.asJSON() - } - if let hospitalization = self.hospitalization { - json["hospitalization"] = hospitalization.asJSON() - } if let identifier = self.identifier { json["identifier"] = Identifier.asJSONArray(identifier) } - if let interventionException = self.interventionException { - json["interventionException"] = Coding.asJSONArray(interventionException) - } - if let item = self.item { - json["item"] = ExplanationOfBenefitItem.asJSONArray(item) - } - if let missingTeeth = self.missingTeeth { - json["missingTeeth"] = ExplanationOfBenefitMissingTeeth.asJSONArray(missingTeeth) - } - if let note = self.note { - json["note"] = ExplanationOfBenefitNote.asJSONArray(note) - } - if let occurenceSpanCode = self.occurenceSpanCode { - json["occurenceSpanCode"] = Coding.asJSONArray(occurenceSpanCode) - } - if let occurrenceCode = self.occurrenceCode { - json["occurrenceCode"] = Coding.asJSONArray(occurrenceCode) - } - if let onset = self.onset { - json["onset"] = ExplanationOfBenefitOnset.asJSONArray(onset) - } - if let organizationIdentifier = self.organizationIdentifier { - json["organizationIdentifier"] = organizationIdentifier.asJSON() - } - if let organizationReference = self.organizationReference { - json["organizationReference"] = organizationReference.asJSON() - } - if let originalPrescriptionIdentifier = self.originalPrescriptionIdentifier { - json["originalPrescriptionIdentifier"] = originalPrescriptionIdentifier.asJSON() - } - if let originalPrescriptionReference = self.originalPrescriptionReference { - json["originalPrescriptionReference"] = originalPrescriptionReference.asJSON() + if let organization = self.organization { + json["organization"] = organization.asJSON() } if let originalRuleset = self.originalRuleset { json["originalRuleset"] = originalRuleset.asJSON() } - if let patientIdentifier = self.patientIdentifier { - json["patientIdentifier"] = patientIdentifier.asJSON() - } - if let patientReference = self.patientReference { - json["patientReference"] = patientReference.asJSON() - } - if let payee = self.payee { - json["payee"] = payee.asJSON() - } - if let paymentAdjustment = self.paymentAdjustment { - json["paymentAdjustment"] = paymentAdjustment.asJSON() - } - if let paymentAdjustmentReason = self.paymentAdjustmentReason { - json["paymentAdjustmentReason"] = paymentAdjustmentReason.asJSON() - } - if let paymentAmount = self.paymentAmount { - json["paymentAmount"] = paymentAmount.asJSON() + if let outcome = self.outcome { + json["outcome"] = outcome.asJSON() } - if let paymentDate = self.paymentDate { - json["paymentDate"] = paymentDate.asJSON() + if let request = self.request { + json["request"] = request.asJSON() } - if let paymentRef = self.paymentRef { - json["paymentRef"] = paymentRef.asJSON() + if let requestOrganization = self.requestOrganization { + json["requestOrganization"] = requestOrganization.asJSON() } - if let precedence = self.precedence { - json["precedence"] = precedence.asJSON() - } - if let prescriptionIdentifier = self.prescriptionIdentifier { - json["prescriptionIdentifier"] = prescriptionIdentifier.asJSON() - } - if let prescriptionReference = self.prescriptionReference { - json["prescriptionReference"] = prescriptionReference.asJSON() - } - if let procedure = self.procedure { - json["procedure"] = ExplanationOfBenefitProcedure.asJSONArray(procedure) - } - if let providerIdentifier = self.providerIdentifier { - json["providerIdentifier"] = providerIdentifier.asJSON() - } - if let providerReference = self.providerReference { - json["providerReference"] = providerReference.asJSON() - } - if let referralIdentifier = self.referralIdentifier { - json["referralIdentifier"] = referralIdentifier.asJSON() - } - if let referralReference = self.referralReference { - json["referralReference"] = referralReference.asJSON() - } - if let related = self.related { - json["related"] = ExplanationOfBenefitRelated.asJSONArray(related) - } - if let reserved = self.reserved { - json["reserved"] = reserved.asJSON() + if let requestProvider = self.requestProvider { + json["requestProvider"] = requestProvider.asJSON() } if let ruleset = self.ruleset { json["ruleset"] = ruleset.asJSON() } - if let specialCondition = self.specialCondition { - json["specialCondition"] = Coding.asJSONArray(specialCondition) - } - if let subType = self.subType { - json["subType"] = Coding.asJSONArray(subType) - } - if let totalBenefit = self.totalBenefit { - json["totalBenefit"] = totalBenefit.asJSON() - } - if let totalCost = self.totalCost { - json["totalCost"] = totalCost.asJSON() - } - if let unallocDeductable = self.unallocDeductable { - json["unallocDeductable"] = unallocDeductable.asJSON() - } - if let valueCode = self.valueCode { - json["valueCode"] = Coding.asJSONArray(valueCode) - } - - return json - } -} - - -/** - * Insurer added line items. - * - * The first tier service adjudications for payor added services. - */ -public class ExplanationOfBenefitAddItem: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitAddItem" } - } - - /// Added items adjudication. - public var adjudication: [ExplanationOfBenefitAddItemAdjudication]? - - /// Added items details. - public var detail: [ExplanationOfBenefitAddItemDetail]? - - /// Professional fee or Product charge. - public var fee: Quantity? - - /// List of note numbers which apply. - public var noteNumberLinkId: [UInt]? - - /// Service instances. - public var sequenceLinkId: [UInt]? - - /// Group, Service or Product. - public var service: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(service: Coding) { - self.init(json: nil) - self.service = service - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["adjudication"] { - presentKeys.insert("adjudication") - if let val = exist as? [FHIRJSON] { - self.adjudication = ExplanationOfBenefitAddItemAdjudication.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitAddItemAdjudication] - } - else { - errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["detail"] { - presentKeys.insert("detail") - if let val = exist as? [FHIRJSON] { - self.detail = ExplanationOfBenefitAddItemDetail.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitAddItemDetail] - } - else { - errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["fee"] { - presentKeys.insert("fee") - if let val = exist as? FHIRJSON { - self.fee = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "fee", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["noteNumberLinkId"] { - presentKeys.insert("noteNumberLinkId") - if let val = exist as? [UInt] { - self.noteNumberLinkId = val - } - else { - errors.append(FHIRJSONError(key: "noteNumberLinkId", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["sequenceLinkId"] { - presentKeys.insert("sequenceLinkId") - if let val = exist as? [UInt] { - self.sequenceLinkId = val - } - else { - errors.append(FHIRJSONError(key: "sequenceLinkId", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["service"] { - presentKeys.insert("service") - if let val = exist as? FHIRJSON { - self.service = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "service")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let adjudication = self.adjudication { - json["adjudication"] = ExplanationOfBenefitAddItemAdjudication.asJSONArray(adjudication) - } - if let detail = self.detail { - json["detail"] = ExplanationOfBenefitAddItemDetail.asJSONArray(detail) - } - if let fee = self.fee { - json["fee"] = fee.asJSON() - } - if let noteNumberLinkId = self.noteNumberLinkId { - var arr = [AnyObject]() - for val in noteNumberLinkId { - arr.append(val.asJSON()) - } - json["noteNumberLinkId"] = arr - } - if let sequenceLinkId = self.sequenceLinkId { - var arr = [AnyObject]() - for val in sequenceLinkId { - arr.append(val.asJSON()) - } - json["sequenceLinkId"] = arr - } - if let service = self.service { - json["service"] = service.asJSON() - } - - return json - } -} - - -/** - * Added items adjudication. - * - * The adjudications results. - */ -public class ExplanationOfBenefitAddItemAdjudication: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitAddItemAdjudication" } - } - - /// Monetary amount. - public var amount: Quantity? - - /// Adjudication category such as co-pay, eligible, benefit, etc.. - public var category: Coding? - - /// Adjudication reason. - public var reason: Coding? - - /// Non-monitory value. - public var value: NSDecimalNumber? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { - self.init(json: nil) - self.category = category - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["amount"] { - presentKeys.insert("amount") - if let val = exist as? FHIRJSON { - self.amount = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") - if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["reason"] { - presentKeys.insert("reason") - if let val = exist as? FHIRJSON { - self.reason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? NSNumber { - self.value = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let amount = self.amount { - json["amount"] = amount.asJSON() - } - if let category = self.category { - json["category"] = category.asJSON() - } - if let reason = self.reason { - json["reason"] = reason.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * Added items details. - * - * The second tier service adjudications for payor added services. - */ -public class ExplanationOfBenefitAddItemDetail: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitAddItemDetail" } - } - - /// Added items detail adjudication. - public var adjudication: [ExplanationOfBenefitAddItemDetailAdjudication]? - - /// Professional fee or Product charge. - public var fee: Quantity? - - /// Service or Product. - public var service: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(service: Coding) { - self.init(json: nil) - self.service = service - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["adjudication"] { - presentKeys.insert("adjudication") - if let val = exist as? [FHIRJSON] { - self.adjudication = ExplanationOfBenefitAddItemDetailAdjudication.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitAddItemDetailAdjudication] - } - else { - errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["fee"] { - presentKeys.insert("fee") - if let val = exist as? FHIRJSON { - self.fee = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "fee", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["service"] { - presentKeys.insert("service") - if let val = exist as? FHIRJSON { - self.service = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "service")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let adjudication = self.adjudication { - json["adjudication"] = ExplanationOfBenefitAddItemDetailAdjudication.asJSONArray(adjudication) - } - if let fee = self.fee { - json["fee"] = fee.asJSON() - } - if let service = self.service { - json["service"] = service.asJSON() - } - - return json - } -} - - -/** - * Added items detail adjudication. - * - * The adjudications results. - */ -public class ExplanationOfBenefitAddItemDetailAdjudication: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitAddItemDetailAdjudication" } - } - - /// Monetary amount. - public var amount: Quantity? - - /// Adjudication category such as co-pay, eligible, benefit, etc.. - public var category: Coding? - - /// Adjudication reason. - public var reason: Coding? - - /// Non-monitory value. - public var value: NSDecimalNumber? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { - self.init(json: nil) - self.category = category - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["amount"] { - presentKeys.insert("amount") - if let val = exist as? FHIRJSON { - self.amount = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") - if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["reason"] { - presentKeys.insert("reason") - if let val = exist as? FHIRJSON { - self.reason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? NSNumber { - self.value = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let amount = self.amount { - json["amount"] = amount.asJSON() - } - if let category = self.category { - json["category"] = category.asJSON() - } - if let reason = self.reason { - json["reason"] = reason.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * Balance by Benefit Category. - */ -public class ExplanationOfBenefitBenefitBalance: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitBenefitBalance" } - } - - /// Benefit Category. - public var category: Coding? - - /// Benefit Summary. - public var financial: [ExplanationOfBenefitBenefitBalanceFinancial]? - - /// In or out of network. - public var network: Coding? - - /// Benefit SubCategory. - public var subCategory: Coding? - - /// Annual or lifetime. - public var term: Coding? - - /// Individual or family. - public var unit: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { - self.init(json: nil) - self.category = category - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") - if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["financial"] { - presentKeys.insert("financial") - if let val = exist as? [FHIRJSON] { - self.financial = ExplanationOfBenefitBenefitBalanceFinancial.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitBenefitBalanceFinancial] - } - else { - errors.append(FHIRJSONError(key: "financial", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["network"] { - presentKeys.insert("network") - if let val = exist as? FHIRJSON { - self.network = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "network", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["subCategory"] { - presentKeys.insert("subCategory") - if let val = exist as? FHIRJSON { - self.subCategory = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "subCategory", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["term"] { - presentKeys.insert("term") - if let val = exist as? FHIRJSON { - self.term = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "term", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["unit"] { - presentKeys.insert("unit") - if let val = exist as? FHIRJSON { - self.unit = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "unit", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let category = self.category { - json["category"] = category.asJSON() - } - if let financial = self.financial { - json["financial"] = ExplanationOfBenefitBenefitBalanceFinancial.asJSONArray(financial) - } - if let network = self.network { - json["network"] = network.asJSON() - } - if let subCategory = self.subCategory { - json["subCategory"] = subCategory.asJSON() - } - if let term = self.term { - json["term"] = term.asJSON() - } - if let unit = self.unit { - json["unit"] = unit.asJSON() - } - - return json - } -} - - -/** - * Benefit Summary. - * - * Benefits Used to date. - */ -public class ExplanationOfBenefitBenefitBalanceFinancial: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitBenefitBalanceFinancial" } - } - - /// Benefits allowed. - public var benefitQuantity: Quantity? - - /// Benefits allowed. - public var benefitUnsignedInt: UInt? - - /// Benefits used. - public var benefitUsedQuantity: Quantity? - - /// Benefits used. - public var benefitUsedUnsignedInt: UInt? - - /// Deductable, visits, benefit amount. - public var type: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: Coding) { - self.init(json: nil) - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["benefitQuantity"] { - presentKeys.insert("benefitQuantity") - if let val = exist as? FHIRJSON { - self.benefitQuantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "benefitQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["benefitUnsignedInt"] { - presentKeys.insert("benefitUnsignedInt") - if let val = exist as? UInt { - self.benefitUnsignedInt = val - } - else { - errors.append(FHIRJSONError(key: "benefitUnsignedInt", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["benefitUsedQuantity"] { - presentKeys.insert("benefitUsedQuantity") - if let val = exist as? FHIRJSON { - self.benefitUsedQuantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "benefitUsedQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["benefitUsedUnsignedInt"] { - presentKeys.insert("benefitUsedUnsignedInt") - if let val = exist as? UInt { - self.benefitUsedUnsignedInt = val - } - else { - errors.append(FHIRJSONError(key: "benefitUsedUnsignedInt", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let benefitQuantity = self.benefitQuantity { - json["benefitQuantity"] = benefitQuantity.asJSON() - } - if let benefitUnsignedInt = self.benefitUnsignedInt { - json["benefitUnsignedInt"] = benefitUnsignedInt.asJSON() - } - if let benefitUsedQuantity = self.benefitUsedQuantity { - json["benefitUsedQuantity"] = benefitUsedQuantity.asJSON() - } - if let benefitUsedUnsignedInt = self.benefitUsedUnsignedInt { - json["benefitUsedUnsignedInt"] = benefitUsedUnsignedInt.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Insurance or medical plan. - * - * Financial instrument by which payment information for health care. - */ -public class ExplanationOfBenefitCoverage: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitCoverage" } - } - - /// Insurance information. - public var coverageIdentifier: Identifier? - - /// Insurance information. - public var coverageReference: Reference? - - /// Pre-Authorization/Determination Reference. - public var preAuthRef: [String]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(coverageIdentifier: Identifier, coverageReference: Reference) { - self.init(json: nil) - self.coverageIdentifier = coverageIdentifier - self.coverageReference = coverageReference - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["coverageIdentifier"] { - presentKeys.insert("coverageIdentifier") - if let val = exist as? FHIRJSON { - self.coverageIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "coverageIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["coverageReference"] { - presentKeys.insert("coverageReference") - if let val = exist as? FHIRJSON { - self.coverageReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "coverageReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["preAuthRef"] { - presentKeys.insert("preAuthRef") - if let val = exist as? [String] { - self.preAuthRef = val - } - else { - errors.append(FHIRJSONError(key: "preAuthRef", wants: Array.self, has: exist.dynamicType)) - } - } - - // check if nonoptional expanded properties are present - if nil == self.coverageIdentifier && nil == self.coverageReference { - errors.append(FHIRJSONError(key: "coverage*")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let coverageIdentifier = self.coverageIdentifier { - json["coverageIdentifier"] = coverageIdentifier.asJSON() - } - if let coverageReference = self.coverageReference { - json["coverageReference"] = coverageReference.asJSON() - } - if let preAuthRef = self.preAuthRef { - var arr = [AnyObject]() - for val in preAuthRef { - arr.append(val.asJSON()) - } - json["preAuthRef"] = arr - } - - return json - } -} - - -/** - * Diagnosis. - * - * Ordered list of patient diagnosis for which care is sought. - */ -public class ExplanationOfBenefitDiagnosis: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitDiagnosis" } - } - - /// Patient's list of diagnosis. - public var diagnosis: Coding? - - /// Number to covey order of diagnosis. - public var sequence: UInt? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(diagnosis: Coding, sequence: UInt) { - self.init(json: nil) - self.diagnosis = diagnosis - self.sequence = sequence - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["diagnosis"] { - presentKeys.insert("diagnosis") - if let val = exist as? FHIRJSON { - self.diagnosis = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "diagnosis", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "diagnosis")) - } - if let exist: AnyObject = js["sequence"] { - presentKeys.insert("sequence") - if let val = exist as? UInt { - self.sequence = val - } - else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "sequence")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let diagnosis = self.diagnosis { - json["diagnosis"] = diagnosis.asJSON() - } - if let sequence = self.sequence { - json["sequence"] = sequence.asJSON() - } - - return json - } -} - - -/** - * Goods and Services. - * - * First tier of goods and services. - */ -public class ExplanationOfBenefitItem: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitItem" } - } - - /// Adjudication details. - public var adjudication: [ExplanationOfBenefitItemAdjudication]? - - /// Service Location. - public var bodySite: Coding? - - /// Additional items. - public var detail: [ExplanationOfBenefitItemDetail]? - - /// Applicable diagnoses. - public var diagnosisLinkId: [UInt]? - - /// Price scaling factor. - public var factor: NSDecimalNumber? - - /// Service/Product billing modifiers. - public var modifier: [Coding]? - - /// Total item cost. - public var net: Quantity? - - /// List of note numbers which apply. - public var noteNumber: [UInt]? - - /// Place of service. - public var place: Coding? - - /// Difficulty scaling factor. - public var points: NSDecimalNumber? - - /// Program specific reason for item inclusion. - public var programCode: [Coding]? - - /// Prosthetic details. - public var prosthesis: ExplanationOfBenefitItemProsthesis? - - /// Responsible practitioner. - public var providerIdentifier: Identifier? - - /// Type, classification or Specialization. - public var providerQualification: Coding? - - /// Responsible practitioner. - public var providerReference: Reference? - - /// Count of Products or Services. - public var quantity: Quantity? - - /// Service instance. - public var sequence: UInt? - - /// Item Code. - public var service: Coding? - - /// Service/Product modifiers. - public var serviceModifier: [Coding]? - - /// Date or dates of Service. - public var servicedDate: FHIRDate? - - /// Date or dates of Service. - public var servicedPeriod: Period? - - /// Service Sub-location. - public var subSite: [Coding]? - - /// Supervising Practitioner. - public var supervisorIdentifier: Identifier? - - /// Supervising Practitioner. - public var supervisorReference: Reference? - - /// Group or type of product or service. - public var type: Coding? - - /// Unique Device Identifier. - public var udi: [Reference]? - - /// Fee, charge or cost per point. - public var unitPrice: Quantity? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(sequence: UInt, service: Coding, type: Coding) { - self.init(json: nil) - self.sequence = sequence - self.service = service - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["adjudication"] { - presentKeys.insert("adjudication") - if let val = exist as? [FHIRJSON] { - self.adjudication = ExplanationOfBenefitItemAdjudication.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitItemAdjudication] - } - else { - errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["bodySite"] { - presentKeys.insert("bodySite") - if let val = exist as? FHIRJSON { - self.bodySite = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "bodySite", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["detail"] { - presentKeys.insert("detail") - if let val = exist as? [FHIRJSON] { - self.detail = ExplanationOfBenefitItemDetail.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitItemDetail] - } - else { - errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["diagnosisLinkId"] { - presentKeys.insert("diagnosisLinkId") - if let val = exist as? [UInt] { - self.diagnosisLinkId = val - } - else { - errors.append(FHIRJSONError(key: "diagnosisLinkId", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["factor"] { - presentKeys.insert("factor") - if let val = exist as? NSNumber { - self.factor = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["modifier"] { - presentKeys.insert("modifier") - if let val = exist as? [FHIRJSON] { - self.modifier = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "modifier", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["net"] { - presentKeys.insert("net") - if let val = exist as? FHIRJSON { - self.net = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["noteNumber"] { - presentKeys.insert("noteNumber") - if let val = exist as? [UInt] { - self.noteNumber = val - } - else { - errors.append(FHIRJSONError(key: "noteNumber", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["place"] { - presentKeys.insert("place") - if let val = exist as? FHIRJSON { - self.place = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "place", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["points"] { - presentKeys.insert("points") - if let val = exist as? NSNumber { - self.points = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["programCode"] { - presentKeys.insert("programCode") - if let val = exist as? [FHIRJSON] { - self.programCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "programCode", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["prosthesis"] { - presentKeys.insert("prosthesis") - if let val = exist as? FHIRJSON { - self.prosthesis = ExplanationOfBenefitItemProsthesis(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "prosthesis", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["providerIdentifier"] { - presentKeys.insert("providerIdentifier") - if let val = exist as? FHIRJSON { - self.providerIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "providerIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["providerQualification"] { - presentKeys.insert("providerQualification") - if let val = exist as? FHIRJSON { - self.providerQualification = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "providerQualification", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["providerReference"] { - presentKeys.insert("providerReference") - if let val = exist as? FHIRJSON { - self.providerReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "providerReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["quantity"] { - presentKeys.insert("quantity") - if let val = exist as? FHIRJSON { - self.quantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["sequence"] { - presentKeys.insert("sequence") - if let val = exist as? UInt { - self.sequence = val - } - else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "sequence")) - } - if let exist: AnyObject = js["service"] { - presentKeys.insert("service") - if let val = exist as? FHIRJSON { - self.service = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "service")) - } - if let exist: AnyObject = js["serviceModifier"] { - presentKeys.insert("serviceModifier") - if let val = exist as? [FHIRJSON] { - self.serviceModifier = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "serviceModifier", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["servicedDate"] { - presentKeys.insert("servicedDate") - if let val = exist as? String { - self.servicedDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "servicedDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["servicedPeriod"] { - presentKeys.insert("servicedPeriod") - if let val = exist as? FHIRJSON { - self.servicedPeriod = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "servicedPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["subSite"] { - presentKeys.insert("subSite") - if let val = exist as? [FHIRJSON] { - self.subSite = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "subSite", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["supervisorIdentifier"] { - presentKeys.insert("supervisorIdentifier") - if let val = exist as? FHIRJSON { - self.supervisorIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "supervisorIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["supervisorReference"] { - presentKeys.insert("supervisorReference") - if let val = exist as? FHIRJSON { - self.supervisorReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "supervisorReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["udi"] { - presentKeys.insert("udi") - if let val = exist as? [FHIRJSON] { - self.udi = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "udi", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["unitPrice"] { - presentKeys.insert("unitPrice") - if let val = exist as? FHIRJSON { - self.unitPrice = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let adjudication = self.adjudication { - json["adjudication"] = ExplanationOfBenefitItemAdjudication.asJSONArray(adjudication) - } - if let bodySite = self.bodySite { - json["bodySite"] = bodySite.asJSON() - } - if let detail = self.detail { - json["detail"] = ExplanationOfBenefitItemDetail.asJSONArray(detail) - } - if let diagnosisLinkId = self.diagnosisLinkId { - var arr = [AnyObject]() - for val in diagnosisLinkId { - arr.append(val.asJSON()) - } - json["diagnosisLinkId"] = arr - } - if let factor = self.factor { - json["factor"] = factor.asJSON() - } - if let modifier = self.modifier { - json["modifier"] = Coding.asJSONArray(modifier) - } - if let net = self.net { - json["net"] = net.asJSON() - } - if let noteNumber = self.noteNumber { - var arr = [AnyObject]() - for val in noteNumber { - arr.append(val.asJSON()) - } - json["noteNumber"] = arr - } - if let place = self.place { - json["place"] = place.asJSON() - } - if let points = self.points { - json["points"] = points.asJSON() - } - if let programCode = self.programCode { - json["programCode"] = Coding.asJSONArray(programCode) - } - if let prosthesis = self.prosthesis { - json["prosthesis"] = prosthesis.asJSON() - } - if let providerIdentifier = self.providerIdentifier { - json["providerIdentifier"] = providerIdentifier.asJSON() - } - if let providerQualification = self.providerQualification { - json["providerQualification"] = providerQualification.asJSON() - } - if let providerReference = self.providerReference { - json["providerReference"] = providerReference.asJSON() - } - if let quantity = self.quantity { - json["quantity"] = quantity.asJSON() - } - if let sequence = self.sequence { - json["sequence"] = sequence.asJSON() - } - if let service = self.service { - json["service"] = service.asJSON() - } - if let serviceModifier = self.serviceModifier { - json["serviceModifier"] = Coding.asJSONArray(serviceModifier) - } - if let servicedDate = self.servicedDate { - json["servicedDate"] = servicedDate.asJSON() - } - if let servicedPeriod = self.servicedPeriod { - json["servicedPeriod"] = servicedPeriod.asJSON() - } - if let subSite = self.subSite { - json["subSite"] = Coding.asJSONArray(subSite) - } - if let supervisorIdentifier = self.supervisorIdentifier { - json["supervisorIdentifier"] = supervisorIdentifier.asJSON() - } - if let supervisorReference = self.supervisorReference { - json["supervisorReference"] = supervisorReference.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - if let udi = self.udi { - json["udi"] = Reference.asJSONArray(udi) - } - if let unitPrice = self.unitPrice { - json["unitPrice"] = unitPrice.asJSON() - } - - return json - } -} - - -/** - * Adjudication details. - * - * The adjudications results. - */ -public class ExplanationOfBenefitItemAdjudication: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitItemAdjudication" } - } - - /// Monetary amount. - public var amount: Quantity? - - /// Adjudication category such as co-pay, eligible, benefit, etc.. - public var category: Coding? - - /// Adjudication reason. - public var reason: Coding? - - /// Non-monitory value. - public var value: NSDecimalNumber? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { - self.init(json: nil) - self.category = category - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["amount"] { - presentKeys.insert("amount") - if let val = exist as? FHIRJSON { - self.amount = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") - if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["reason"] { - presentKeys.insert("reason") - if let val = exist as? FHIRJSON { - self.reason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? NSNumber { - self.value = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let amount = self.amount { - json["amount"] = amount.asJSON() - } - if let category = self.category { - json["category"] = category.asJSON() - } - if let reason = self.reason { - json["reason"] = reason.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * Additional items. - * - * Second tier of goods and services. - */ -public class ExplanationOfBenefitItemDetail: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitItemDetail" } - } - - /// Detail adjudication. - public var adjudication: [ExplanationOfBenefitItemDetailAdjudication]? - - /// Price scaling factor. - public var factor: NSDecimalNumber? - - /// Total additional item cost. - public var net: Quantity? - - /// Difficulty scaling factor. - public var points: NSDecimalNumber? - - /// Program specific reason for item inclusion. - public var programCode: [Coding]? - - /// Count of Products or Services. - public var quantity: Quantity? - - /// Service instance. - public var sequence: UInt? - - /// Additional item codes. - public var service: Coding? - - /// Additional items. - public var subDetail: [ExplanationOfBenefitItemDetailSubDetail]? - - /// Group or type of product or service. - public var type: Coding? - - /// Unique Device Identifier. - public var udi: [Reference]? - - /// Fee, charge or cost per point. - public var unitPrice: Quantity? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(sequence: UInt, service: Coding, type: Coding) { - self.init(json: nil) - self.sequence = sequence - self.service = service - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["adjudication"] { - presentKeys.insert("adjudication") - if let val = exist as? [FHIRJSON] { - self.adjudication = ExplanationOfBenefitItemDetailAdjudication.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitItemDetailAdjudication] - } - else { - errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["factor"] { - presentKeys.insert("factor") - if let val = exist as? NSNumber { - self.factor = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["net"] { - presentKeys.insert("net") - if let val = exist as? FHIRJSON { - self.net = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["points"] { - presentKeys.insert("points") - if let val = exist as? NSNumber { - self.points = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["programCode"] { - presentKeys.insert("programCode") - if let val = exist as? [FHIRJSON] { - self.programCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "programCode", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["quantity"] { - presentKeys.insert("quantity") - if let val = exist as? FHIRJSON { - self.quantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["sequence"] { - presentKeys.insert("sequence") - if let val = exist as? UInt { - self.sequence = val - } - else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "sequence")) - } - if let exist: AnyObject = js["service"] { - presentKeys.insert("service") - if let val = exist as? FHIRJSON { - self.service = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "service")) - } - if let exist: AnyObject = js["subDetail"] { - presentKeys.insert("subDetail") - if let val = exist as? [FHIRJSON] { - self.subDetail = ExplanationOfBenefitItemDetailSubDetail.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitItemDetailSubDetail] - } - else { - errors.append(FHIRJSONError(key: "subDetail", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["udi"] { - presentKeys.insert("udi") - if let val = exist as? [FHIRJSON] { - self.udi = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "udi", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["unitPrice"] { - presentKeys.insert("unitPrice") - if let val = exist as? FHIRJSON { - self.unitPrice = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let adjudication = self.adjudication { - json["adjudication"] = ExplanationOfBenefitItemDetailAdjudication.asJSONArray(adjudication) - } - if let factor = self.factor { - json["factor"] = factor.asJSON() - } - if let net = self.net { - json["net"] = net.asJSON() - } - if let points = self.points { - json["points"] = points.asJSON() - } - if let programCode = self.programCode { - json["programCode"] = Coding.asJSONArray(programCode) - } - if let quantity = self.quantity { - json["quantity"] = quantity.asJSON() - } - if let sequence = self.sequence { - json["sequence"] = sequence.asJSON() - } - if let service = self.service { - json["service"] = service.asJSON() - } - if let subDetail = self.subDetail { - json["subDetail"] = ExplanationOfBenefitItemDetailSubDetail.asJSONArray(subDetail) - } - if let type = self.type { - json["type"] = type.asJSON() - } - if let udi = self.udi { - json["udi"] = Reference.asJSONArray(udi) - } - if let unitPrice = self.unitPrice { - json["unitPrice"] = unitPrice.asJSON() - } - - return json - } -} - - -/** - * Detail adjudication. - * - * The adjudications results. - */ -public class ExplanationOfBenefitItemDetailAdjudication: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitItemDetailAdjudication" } - } - - /// Monetary amount. - public var amount: Quantity? - - /// Adjudication category such as co-pay, eligible, benefit, etc.. - public var category: Coding? - - /// Adjudication reason. - public var reason: Coding? - - /// Non-monitory value. - public var value: NSDecimalNumber? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { - self.init(json: nil) - self.category = category - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["amount"] { - presentKeys.insert("amount") - if let val = exist as? FHIRJSON { - self.amount = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") - if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["reason"] { - presentKeys.insert("reason") - if let val = exist as? FHIRJSON { - self.reason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? NSNumber { - self.value = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let amount = self.amount { - json["amount"] = amount.asJSON() - } - if let category = self.category { - json["category"] = category.asJSON() - } - if let reason = self.reason { - json["reason"] = reason.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * Additional items. - * - * Third tier of goods and services. - */ -public class ExplanationOfBenefitItemDetailSubDetail: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitItemDetailSubDetail" } - } - - /// SubDetail adjudication. - public var adjudication: [ExplanationOfBenefitItemDetailSubDetailAdjudication]? - - /// Price scaling factor. - public var factor: NSDecimalNumber? - - /// Net additional item cost. - public var net: Quantity? - - /// Difficulty scaling factor. - public var points: NSDecimalNumber? - - /// Program specific reason for item inclusion. - public var programCode: [Coding]? - - /// Count of Products or Services. - public var quantity: Quantity? - - /// Service instance. - public var sequence: UInt? - - /// Additional item codes. - public var service: Coding? - - /// Type of product or service. - public var type: Coding? - - /// Unique Device Identifier. - public var udi: [Reference]? - - /// Fee, charge or cost per point. - public var unitPrice: Quantity? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(sequence: UInt, service: Coding, type: Coding) { - self.init(json: nil) - self.sequence = sequence - self.service = service - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["adjudication"] { - presentKeys.insert("adjudication") - if let val = exist as? [FHIRJSON] { - self.adjudication = ExplanationOfBenefitItemDetailSubDetailAdjudication.instantiate(fromArray: val, owner: self) as? [ExplanationOfBenefitItemDetailSubDetailAdjudication] - } - else { - errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["factor"] { - presentKeys.insert("factor") - if let val = exist as? NSNumber { - self.factor = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["net"] { - presentKeys.insert("net") - if let val = exist as? FHIRJSON { - self.net = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["points"] { - presentKeys.insert("points") - if let val = exist as? NSNumber { - self.points = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["programCode"] { - presentKeys.insert("programCode") - if let val = exist as? [FHIRJSON] { - self.programCode = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "programCode", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["quantity"] { - presentKeys.insert("quantity") - if let val = exist as? FHIRJSON { - self.quantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["sequence"] { - presentKeys.insert("sequence") - if let val = exist as? UInt { - self.sequence = val - } - else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "sequence")) - } - if let exist: AnyObject = js["service"] { - presentKeys.insert("service") - if let val = exist as? FHIRJSON { - self.service = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "service")) - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["udi"] { - presentKeys.insert("udi") - if let val = exist as? [FHIRJSON] { - self.udi = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "udi", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["unitPrice"] { - presentKeys.insert("unitPrice") - if let val = exist as? FHIRJSON { - self.unitPrice = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let adjudication = self.adjudication { - json["adjudication"] = ExplanationOfBenefitItemDetailSubDetailAdjudication.asJSONArray(adjudication) - } - if let factor = self.factor { - json["factor"] = factor.asJSON() - } - if let net = self.net { - json["net"] = net.asJSON() - } - if let points = self.points { - json["points"] = points.asJSON() - } - if let programCode = self.programCode { - json["programCode"] = Coding.asJSONArray(programCode) - } - if let quantity = self.quantity { - json["quantity"] = quantity.asJSON() - } - if let sequence = self.sequence { - json["sequence"] = sequence.asJSON() - } - if let service = self.service { - json["service"] = service.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - if let udi = self.udi { - json["udi"] = Reference.asJSONArray(udi) - } - if let unitPrice = self.unitPrice { - json["unitPrice"] = unitPrice.asJSON() - } - - return json - } -} - - -/** - * SubDetail adjudication. - * - * The adjudications results. - */ -public class ExplanationOfBenefitItemDetailSubDetailAdjudication: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitItemDetailSubDetailAdjudication" } - } - - /// Monetary amount. - public var amount: Quantity? - - /// Adjudication category such as co-pay, eligible, benefit, etc.. - public var category: Coding? - - /// Adjudication reason. - public var reason: Coding? - - /// Non-monitory value. - public var value: NSDecimalNumber? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: Coding) { - self.init(json: nil) - self.category = category - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["amount"] { - presentKeys.insert("amount") - if let val = exist as? FHIRJSON { - self.amount = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") - if let val = exist as? FHIRJSON { - self.category = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["reason"] { - presentKeys.insert("reason") - if let val = exist as? FHIRJSON { - self.reason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? NSNumber { - self.value = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let amount = self.amount { - json["amount"] = amount.asJSON() - } - if let category = self.category { - json["category"] = category.asJSON() - } - if let reason = self.reason { - json["reason"] = reason.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * Prosthetic details. - * - * The materials and placement date of prior fixed prosthesis. - */ -public class ExplanationOfBenefitItemProsthesis: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitItemProsthesis" } - } - - /// Is this the initial service. - public var initial: Bool? - - /// Initial service Date. - public var priorDate: FHIRDate? - - /// Prosthetic Material. - public var priorMaterial: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["initial"] { - presentKeys.insert("initial") - if let val = exist as? Bool { - self.initial = val - } - else { - errors.append(FHIRJSONError(key: "initial", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["priorDate"] { - presentKeys.insert("priorDate") - if let val = exist as? String { - self.priorDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "priorDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["priorMaterial"] { - presentKeys.insert("priorMaterial") - if let val = exist as? FHIRJSON { - self.priorMaterial = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "priorMaterial", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let initial = self.initial { - json["initial"] = initial.asJSON() - } - if let priorDate = self.priorDate { - json["priorDate"] = priorDate.asJSON() - } - if let priorMaterial = self.priorMaterial { - json["priorMaterial"] = priorMaterial.asJSON() - } - - return json - } -} - - -/** - * Only if type = oral. - * - * A list of teeth which would be expected but are not found due to having been previously extracted or for other - * reasons. - */ -public class ExplanationOfBenefitMissingTeeth: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitMissingTeeth" } - } - - /// Date of Extraction. - public var extractionDate: FHIRDate? - - /// Reason for missing. - public var reason: Coding? - - /// Tooth Code. - public var tooth: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(tooth: Coding) { - self.init(json: nil) - self.tooth = tooth - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["extractionDate"] { - presentKeys.insert("extractionDate") - if let val = exist as? String { - self.extractionDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "extractionDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["reason"] { - presentKeys.insert("reason") - if let val = exist as? FHIRJSON { - self.reason = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["tooth"] { - presentKeys.insert("tooth") - if let val = exist as? FHIRJSON { - self.tooth = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "tooth", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "tooth")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let extractionDate = self.extractionDate { - json["extractionDate"] = extractionDate.asJSON() - } - if let reason = self.reason { - json["reason"] = reason.asJSON() - } - if let tooth = self.tooth { - json["tooth"] = tooth.asJSON() - } - - return json - } -} - - -/** - * Processing notes. - * - * Note text. - */ -public class ExplanationOfBenefitNote: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitNote" } - } - - /// Note Number for this note. - public var number: UInt? - - /// Note explanitory text. - public var text: String? - - /// display | print | printoper. - public var type: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["number"] { - presentKeys.insert("number") - if let val = exist as? UInt { - self.number = val - } - else { - errors.append(FHIRJSONError(key: "number", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["text"] { - presentKeys.insert("text") - if let val = exist as? String { - self.text = val - } - else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let number = self.number { - json["number"] = number.asJSON() - } - if let text = self.text { - json["text"] = text.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Condition related Onset related dates and codes. - * - * Period, start and last dates of aspects of the Condition or related services. - */ -public class ExplanationOfBenefitOnset: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitOnset" } - } - - /// Illness, injury or treatable condition date. - public var timeDate: FHIRDate? - - /// Illness, injury or treatable condition date. - public var timePeriod: Period? - - /// Onset of what. - public var type: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["timeDate"] { - presentKeys.insert("timeDate") - if let val = exist as? String { - self.timeDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "timeDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["timePeriod"] { - presentKeys.insert("timePeriod") - if let val = exist as? FHIRJSON { - self.timePeriod = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "timePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let timeDate = self.timeDate { - json["timeDate"] = timeDate.asJSON() - } - if let timePeriod = self.timePeriod { - json["timePeriod"] = timePeriod.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Payee. - * - * The party to be reimbursed for the services. - */ -public class ExplanationOfBenefitPayee: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitPayee" } - } - - /// Party to receive the payable. - public var partyIdentifier: Identifier? - - /// Party to receive the payable. - public var partyReference: Reference? - - /// Type of party: Subscriber, Provider, other. - public var type: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["partyIdentifier"] { - presentKeys.insert("partyIdentifier") - if let val = exist as? FHIRJSON { - self.partyIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "partyIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["partyReference"] { - presentKeys.insert("partyReference") - if let val = exist as? FHIRJSON { - self.partyReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "partyReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let partyIdentifier = self.partyIdentifier { - json["partyIdentifier"] = partyIdentifier.asJSON() - } - if let partyReference = self.partyReference { - json["partyReference"] = partyReference.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Procedures performed. - * - * Ordered list of patient procedures performed to support the adjudication. - */ -public class ExplanationOfBenefitProcedure: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitProcedure" } - } - - /// When the procedure was performed. - public var date: DateTime? - - /// Patient's list of procedures performed. - public var procedureCoding: Coding? - - /// Patient's list of procedures performed. - public var procedureReference: Reference? - - /// Procedure sequence for reference. - public var sequence: UInt? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(procedureCoding: Coding, procedureReference: Reference, sequence: UInt) { - self.init(json: nil) - self.procedureCoding = procedureCoding - self.procedureReference = procedureReference - self.sequence = sequence - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["date"] { - presentKeys.insert("date") - if let val = exist as? String { - self.date = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["procedureCoding"] { - presentKeys.insert("procedureCoding") - if let val = exist as? FHIRJSON { - self.procedureCoding = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "procedureCoding", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["procedureReference"] { - presentKeys.insert("procedureReference") - if let val = exist as? FHIRJSON { - self.procedureReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "procedureReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["sequence"] { - presentKeys.insert("sequence") - if let val = exist as? UInt { - self.sequence = val - } - else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "sequence")) - } - - // check if nonoptional expanded properties are present - if nil == self.procedureCoding && nil == self.procedureReference { - errors.append(FHIRJSONError(key: "procedure*")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let date = self.date { - json["date"] = date.asJSON() - } - if let procedureCoding = self.procedureCoding { - json["procedureCoding"] = procedureCoding.asJSON() - } - if let procedureReference = self.procedureReference { - json["procedureReference"] = procedureReference.asJSON() - } - if let sequence = self.sequence { - json["sequence"] = sequence.asJSON() - } - - return json - } -} - - -/** - * 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. - */ -public class ExplanationOfBenefitRelated: BackboneElement { - override public class var resourceName: String { - get { return "ExplanationOfBenefitRelated" } - } - - /// Reference to the related claim. - public var claimIdentifier: Identifier? - - /// Reference to the related claim. - public var claimReference: Reference? - - /// Related file or case reference. - public var reference: Identifier? - - /// How the reference claim is related. - public var relationship: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["claimIdentifier"] { - presentKeys.insert("claimIdentifier") - if let val = exist as? FHIRJSON { - self.claimIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "claimIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["claimReference"] { - presentKeys.insert("claimReference") - if let val = exist as? FHIRJSON { - self.claimReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "claimReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["reference"] { - presentKeys.insert("reference") - if let val = exist as? FHIRJSON { - self.reference = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["relationship"] { - presentKeys.insert("relationship") - if let val = exist as? FHIRJSON { - self.relationship = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let claimIdentifier = self.claimIdentifier { - json["claimIdentifier"] = claimIdentifier.asJSON() - } - if let claimReference = self.claimReference { - json["claimReference"] = claimReference.asJSON() - } - if let reference = self.reference { - json["reference"] = reference.asJSON() - } - if let relationship = self.relationship { - json["relationship"] = relationship.asJSON() - } return json } diff --git a/Sources/Models/Extension.swift b/Sources/Models/Extension.swift index 5505d2f1..740ef3f8 100644 --- a/Sources/Models/Extension.swift +++ b/Sources/Models/Extension.swift @@ -2,7 +2,7 @@ // Extension.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Extension) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Extension) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/FHIRAbstractBase+Factory.swift b/Sources/Models/FHIRAbstractBase+Factory.swift index 014bcf4e..0621d684 100644 --- a/Sources/Models/FHIRAbstractBase+Factory.swift +++ b/Sources/Models/FHIRAbstractBase+Factory.swift @@ -2,7 +2,7 @@ // FHIRAbstractBase+Factory.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -16,14 +16,6 @@ extension FHIRAbstractBase { switch className { case "Account": return Account(json: json, owner: owner) - case "ActionDefinition": - return ActionDefinition(json: json, owner: owner) - case "ActionDefinitionBehavior": - return ActionDefinitionBehavior(json: json, owner: owner) - case "ActionDefinitionCustomization": - return ActionDefinitionCustomization(json: json, owner: owner) - case "ActionDefinitionRelatedAction": - return ActionDefinitionRelatedAction(json: json, owner: owner) case "Address": return Address(json: json, owner: owner) case "Age": @@ -44,14 +36,16 @@ extension FHIRAbstractBase { return Attachment(json: json, owner: owner) case "AuditEvent": return AuditEvent(json: json, owner: owner) - case "AuditEventAgent": - return AuditEventAgent(json: json, owner: owner) - case "AuditEventAgentNetwork": - return AuditEventAgentNetwork(json: json, owner: owner) - case "AuditEventEntity": - return AuditEventEntity(json: json, owner: owner) - case "AuditEventEntityDetail": - return AuditEventEntityDetail(json: json, owner: owner) + case "AuditEventEvent": + return AuditEventEvent(json: json, owner: owner) + case "AuditEventObject": + return AuditEventObject(json: json, owner: owner) + case "AuditEventObjectDetail": + return AuditEventObjectDetail(json: json, owner: owner) + case "AuditEventParticipant": + return AuditEventParticipant(json: json, owner: owner) + case "AuditEventParticipantNetwork": + return AuditEventParticipantNetwork(json: json, owner: owner) case "AuditEventSource": return AuditEventSource(json: json, owner: owner) case "BackboneElement": @@ -84,10 +78,6 @@ extension FHIRAbstractBase { return CarePlanParticipant(json: json, owner: owner) case "CarePlanRelatedPlan": return CarePlanRelatedPlan(json: json, owner: owner) - case "CareTeam": - return CareTeam(json: json, owner: owner) - case "CareTeamParticipant": - return CareTeamParticipant(json: json, owner: owner) case "Claim": return Claim(json: json, owner: owner) case "ClaimCoverage": @@ -104,14 +94,8 @@ extension FHIRAbstractBase { return ClaimItemProsthesis(json: json, owner: owner) case "ClaimMissingTeeth": return ClaimMissingTeeth(json: json, owner: owner) - case "ClaimOnset": - return ClaimOnset(json: json, owner: owner) case "ClaimPayee": return ClaimPayee(json: json, owner: owner) - case "ClaimProcedure": - return ClaimProcedure(json: json, owner: owner) - case "ClaimRelated": - return ClaimRelated(json: json, owner: owner) case "ClaimResponse": return ClaimResponse(json: json, owner: owner) case "ClaimResponseAddItem": @@ -148,20 +132,6 @@ extension FHIRAbstractBase { return ClinicalImpressionInvestigations(json: json, owner: owner) case "ClinicalImpressionRuledOut": return ClinicalImpressionRuledOut(json: json, owner: owner) - case "CodeSystem": - return CodeSystem(json: json, owner: owner) - case "CodeSystemConcept": - return CodeSystemConcept(json: json, owner: owner) - case "CodeSystemConceptDesignation": - return CodeSystemConceptDesignation(json: json, owner: owner) - case "CodeSystemConceptProperty": - return CodeSystemConceptProperty(json: json, owner: owner) - case "CodeSystemContact": - return CodeSystemContact(json: json, owner: owner) - case "CodeSystemFilter": - return CodeSystemFilter(json: json, owner: owner) - case "CodeSystemProperty": - return CodeSystemProperty(json: json, owner: owner) case "CodeableConcept": return CodeableConcept(json: json, owner: owner) case "Coding": @@ -174,12 +144,6 @@ extension FHIRAbstractBase { return CommunicationRequest(json: json, owner: owner) case "CommunicationRequestPayload": return CommunicationRequestPayload(json: json, owner: owner) - case "CompartmentDefinition": - return CompartmentDefinition(json: json, owner: owner) - case "CompartmentDefinitionContact": - return CompartmentDefinitionContact(json: json, owner: owner) - case "CompartmentDefinitionResource": - return CompartmentDefinitionResource(json: json, owner: owner) case "Composition": return Composition(json: json, owner: owner) case "CompositionAttester": @@ -240,8 +204,8 @@ extension FHIRAbstractBase { return ContactPoint(json: json, owner: owner) case "Contract": return Contract(json: json, owner: owner) - case "ContractAgent": - return ContractAgent(json: json, owner: owner) + case "ContractActor": + return ContractActor(json: json, owner: owner) case "ContractFriendly": return ContractFriendly(json: json, owner: owner) case "ContractLegal": @@ -252,8 +216,8 @@ extension FHIRAbstractBase { return ContractSigner(json: json, owner: owner) case "ContractTerm": return ContractTerm(json: json, owner: owner) - case "ContractTermAgent": - return ContractTermAgent(json: json, owner: owner) + case "ContractTermActor": + return ContractTermActor(json: json, owner: owner) case "ContractTermValuedItem": return ContractTermValuedItem(json: json, owner: owner) case "ContractValuedItem": @@ -268,16 +232,6 @@ extension FHIRAbstractBase { return DataElementContact(json: json, owner: owner) case "DataElementMapping": return DataElementMapping(json: json, owner: owner) - case "DataRequirement": - return DataRequirement(json: json, owner: owner) - case "DataRequirementCodeFilter": - return DataRequirementCodeFilter(json: json, owner: owner) - case "DataRequirementDateFilter": - return DataRequirementDateFilter(json: json, owner: owner) - case "DecisionSupportRule": - return DecisionSupportRule(json: json, owner: owner) - case "DecisionSupportServiceModule": - return DecisionSupportServiceModule(json: json, owner: owner) case "DetectedIssue": return DetectedIssue(json: json, owner: owner) case "DetectedIssueMitigation": @@ -348,12 +302,6 @@ extension FHIRAbstractBase { return EligibilityRequest(json: json, owner: owner) case "EligibilityResponse": return EligibilityResponse(json: json, owner: owner) - case "EligibilityResponseBenefitBalance": - return EligibilityResponseBenefitBalance(json: json, owner: owner) - case "EligibilityResponseBenefitBalanceFinancial": - return EligibilityResponseBenefitBalanceFinancial(json: json, owner: owner) - case "EligibilityResponseError": - return EligibilityResponseError(json: json, owner: owner) case "Encounter": return Encounter(json: json, owner: owner) case "EncounterHospitalization": @@ -370,76 +318,12 @@ extension FHIRAbstractBase { return EnrollmentResponse(json: json, owner: owner) case "EpisodeOfCare": return EpisodeOfCare(json: json, owner: owner) + case "EpisodeOfCareCareTeam": + return EpisodeOfCareCareTeam(json: json, owner: owner) case "EpisodeOfCareStatusHistory": return EpisodeOfCareStatusHistory(json: json, owner: owner) - case "ExpansionProfile": - return ExpansionProfile(json: json, owner: owner) - case "ExpansionProfileCodeSystem": - return ExpansionProfileCodeSystem(json: json, owner: owner) - case "ExpansionProfileCodeSystemExclude": - return ExpansionProfileCodeSystemExclude(json: json, owner: owner) - case "ExpansionProfileCodeSystemExcludeCodeSystem": - return ExpansionProfileCodeSystemExcludeCodeSystem(json: json, owner: owner) - case "ExpansionProfileCodeSystemInclude": - return ExpansionProfileCodeSystemInclude(json: json, owner: owner) - case "ExpansionProfileCodeSystemIncludeCodeSystem": - return ExpansionProfileCodeSystemIncludeCodeSystem(json: json, owner: owner) - case "ExpansionProfileContact": - return ExpansionProfileContact(json: json, owner: owner) - case "ExpansionProfileDesignation": - return ExpansionProfileDesignation(json: json, owner: owner) - case "ExpansionProfileDesignationExclude": - return ExpansionProfileDesignationExclude(json: json, owner: owner) - case "ExpansionProfileDesignationExcludeDesignation": - return ExpansionProfileDesignationExcludeDesignation(json: json, owner: owner) - case "ExpansionProfileDesignationInclude": - return ExpansionProfileDesignationInclude(json: json, owner: owner) - case "ExpansionProfileDesignationIncludeDesignation": - return ExpansionProfileDesignationIncludeDesignation(json: json, owner: owner) case "ExplanationOfBenefit": return ExplanationOfBenefit(json: json, owner: owner) - case "ExplanationOfBenefitAddItem": - return ExplanationOfBenefitAddItem(json: json, owner: owner) - case "ExplanationOfBenefitAddItemAdjudication": - return ExplanationOfBenefitAddItemAdjudication(json: json, owner: owner) - case "ExplanationOfBenefitAddItemDetail": - return ExplanationOfBenefitAddItemDetail(json: json, owner: owner) - case "ExplanationOfBenefitAddItemDetailAdjudication": - return ExplanationOfBenefitAddItemDetailAdjudication(json: json, owner: owner) - case "ExplanationOfBenefitBenefitBalance": - return ExplanationOfBenefitBenefitBalance(json: json, owner: owner) - case "ExplanationOfBenefitBenefitBalanceFinancial": - return ExplanationOfBenefitBenefitBalanceFinancial(json: json, owner: owner) - case "ExplanationOfBenefitCoverage": - return ExplanationOfBenefitCoverage(json: json, owner: owner) - case "ExplanationOfBenefitDiagnosis": - return ExplanationOfBenefitDiagnosis(json: json, owner: owner) - case "ExplanationOfBenefitItem": - return ExplanationOfBenefitItem(json: json, owner: owner) - case "ExplanationOfBenefitItemAdjudication": - return ExplanationOfBenefitItemAdjudication(json: json, owner: owner) - case "ExplanationOfBenefitItemDetail": - return ExplanationOfBenefitItemDetail(json: json, owner: owner) - case "ExplanationOfBenefitItemDetailAdjudication": - return ExplanationOfBenefitItemDetailAdjudication(json: json, owner: owner) - case "ExplanationOfBenefitItemDetailSubDetail": - return ExplanationOfBenefitItemDetailSubDetail(json: json, owner: owner) - case "ExplanationOfBenefitItemDetailSubDetailAdjudication": - return ExplanationOfBenefitItemDetailSubDetailAdjudication(json: json, owner: owner) - case "ExplanationOfBenefitItemProsthesis": - return ExplanationOfBenefitItemProsthesis(json: json, owner: owner) - case "ExplanationOfBenefitMissingTeeth": - return ExplanationOfBenefitMissingTeeth(json: json, owner: owner) - case "ExplanationOfBenefitNote": - return ExplanationOfBenefitNote(json: json, owner: owner) - case "ExplanationOfBenefitOnset": - return ExplanationOfBenefitOnset(json: json, owner: owner) - case "ExplanationOfBenefitPayee": - return ExplanationOfBenefitPayee(json: json, owner: owner) - case "ExplanationOfBenefitProcedure": - return ExplanationOfBenefitProcedure(json: json, owner: owner) - case "ExplanationOfBenefitRelated": - return ExplanationOfBenefitRelated(json: json, owner: owner) case "Extension": return Extension(json: json, owner: owner) case "FamilyMemberHistory": @@ -458,40 +342,18 @@ extension FHIRAbstractBase { return GroupCharacteristic(json: json, owner: owner) case "GroupMember": return GroupMember(json: json, owner: owner) - case "GuidanceResponse": - return GuidanceResponse(json: json, owner: owner) - case "GuidanceResponseAction": - return GuidanceResponseAction(json: json, owner: owner) - case "GuidanceResponseActionBehavior": - return GuidanceResponseActionBehavior(json: json, owner: owner) - case "GuidanceResponseActionRelatedAction": - return GuidanceResponseActionRelatedAction(json: json, owner: owner) case "HealthcareService": return HealthcareService(json: json, owner: owner) case "HealthcareServiceAvailableTime": return HealthcareServiceAvailableTime(json: json, owner: owner) case "HealthcareServiceNotAvailable": return HealthcareServiceNotAvailable(json: json, owner: owner) + case "HealthcareServiceServiceType": + return HealthcareServiceServiceType(json: json, owner: owner) case "HumanName": return HumanName(json: json, owner: owner) case "Identifier": return Identifier(json: json, owner: owner) - case "ImagingExcerpt": - return ImagingExcerpt(json: json, owner: owner) - case "ImagingExcerptStudy": - return ImagingExcerptStudy(json: json, owner: owner) - case "ImagingExcerptStudyDicom": - return ImagingExcerptStudyDicom(json: json, owner: owner) - case "ImagingExcerptStudySeries": - return ImagingExcerptStudySeries(json: json, owner: owner) - case "ImagingExcerptStudySeriesDicom": - return ImagingExcerptStudySeriesDicom(json: json, owner: owner) - case "ImagingExcerptStudySeriesInstance": - return ImagingExcerptStudySeriesInstance(json: json, owner: owner) - case "ImagingExcerptStudySeriesInstanceDicom": - return ImagingExcerptStudySeriesInstanceDicom(json: json, owner: owner) - case "ImagingExcerptStudyViewable": - return ImagingExcerptStudyViewable(json: json, owner: owner) case "ImagingObjectSelection": return ImagingObjectSelection(json: json, owner: owner) case "ImagingObjectSelectionStudy": @@ -500,8 +362,8 @@ extension FHIRAbstractBase { return ImagingObjectSelectionStudySeries(json: json, owner: owner) case "ImagingObjectSelectionStudySeriesInstance": return ImagingObjectSelectionStudySeriesInstance(json: json, owner: owner) - case "ImagingObjectSelectionStudySeriesInstanceFrame": - return ImagingObjectSelectionStudySeriesInstanceFrame(json: json, owner: owner) + case "ImagingObjectSelectionStudySeriesInstanceFrames": + return ImagingObjectSelectionStudySeriesInstanceFrames(json: json, owner: owner) case "ImagingStudy": return ImagingStudy(json: json, owner: owner) case "ImagingStudySeries": @@ -538,20 +400,6 @@ extension FHIRAbstractBase { return ImplementationGuidePackageResource(json: json, owner: owner) case "ImplementationGuidePage": return ImplementationGuidePage(json: json, owner: owner) - case "Library": - return Library(json: json, owner: owner) - case "LibraryCodeSystem": - return LibraryCodeSystem(json: json, owner: owner) - case "LibraryLibrary": - return LibraryLibrary(json: json, owner: owner) - case "LibraryModel": - return LibraryModel(json: json, owner: owner) - case "LibraryValueSet": - return LibraryValueSet(json: json, owner: owner) - case "Linkage": - return Linkage(json: json, owner: owner) - case "LinkageItem": - return LinkageItem(json: json, owner: owner) case "List": return List(json: json, owner: owner) case "ListEntry": @@ -560,32 +408,6 @@ extension FHIRAbstractBase { return Location(json: json, owner: owner) case "LocationPosition": return LocationPosition(json: json, owner: owner) - case "Measure": - return Measure(json: json, owner: owner) - case "MeasureGroup": - return MeasureGroup(json: json, owner: owner) - case "MeasureGroupPopulation": - return MeasureGroupPopulation(json: json, owner: owner) - case "MeasureGroupStratifier": - return MeasureGroupStratifier(json: json, owner: owner) - case "MeasureReport": - return MeasureReport(json: json, owner: owner) - case "MeasureReportGroup": - return MeasureReportGroup(json: json, owner: owner) - case "MeasureReportGroupPopulation": - return MeasureReportGroupPopulation(json: json, owner: owner) - case "MeasureReportGroupStratifier": - return MeasureReportGroupStratifier(json: json, owner: owner) - case "MeasureReportGroupStratifierGroup": - return MeasureReportGroupStratifierGroup(json: json, owner: owner) - case "MeasureReportGroupStratifierGroupPopulation": - return MeasureReportGroupStratifierGroupPopulation(json: json, owner: owner) - case "MeasureReportGroupSupplementalData": - return MeasureReportGroupSupplementalData(json: json, owner: owner) - case "MeasureReportGroupSupplementalDataGroup": - return MeasureReportGroupSupplementalDataGroup(json: json, owner: owner) - case "MeasureSupplementalData": - return MeasureSupplementalData(json: json, owner: owner) case "Media": return Media(json: json, owner: owner) case "Medication": @@ -632,36 +454,6 @@ extension FHIRAbstractBase { return MessageHeaderSource(json: json, owner: owner) case "Meta": return Meta(json: json, owner: owner) - case "ModuleDefinition": - return ModuleDefinition(json: json, owner: owner) - case "ModuleDefinitionCodeSystem": - return ModuleDefinitionCodeSystem(json: json, owner: owner) - case "ModuleDefinitionData": - return ModuleDefinitionData(json: json, owner: owner) - case "ModuleDefinitionDataCodeFilter": - return ModuleDefinitionDataCodeFilter(json: json, owner: owner) - case "ModuleDefinitionDataDateFilter": - return ModuleDefinitionDataDateFilter(json: json, owner: owner) - case "ModuleDefinitionLibrary": - return ModuleDefinitionLibrary(json: json, owner: owner) - case "ModuleDefinitionModel": - return ModuleDefinitionModel(json: json, owner: owner) - case "ModuleDefinitionParameter": - return ModuleDefinitionParameter(json: json, owner: owner) - case "ModuleDefinitionValueSet": - return ModuleDefinitionValueSet(json: json, owner: owner) - case "ModuleMetadata": - return ModuleMetadata(json: json, owner: owner) - case "ModuleMetadataContact": - return ModuleMetadataContact(json: json, owner: owner) - case "ModuleMetadataContributor": - return ModuleMetadataContributor(json: json, owner: owner) - case "ModuleMetadataContributorContact": - return ModuleMetadataContributorContact(json: json, owner: owner) - case "ModuleMetadataCoverage": - return ModuleMetadataCoverage(json: json, owner: owner) - case "ModuleMetadataRelatedResource": - return ModuleMetadataRelatedResource(json: json, owner: owner) case "Money": return Money(json: json, owner: owner) case "NamingSystem": @@ -710,16 +502,12 @@ extension FHIRAbstractBase { return Order(json: json, owner: owner) case "OrderResponse": return OrderResponse(json: json, owner: owner) - case "OrderSet": - return OrderSet(json: json, owner: owner) case "OrderWhen": return OrderWhen(json: json, owner: owner) case "Organization": return Organization(json: json, owner: owner) case "OrganizationContact": return OrganizationContact(json: json, owner: owner) - case "ParameterDefinition": - return ParameterDefinition(json: json, owner: owner) case "Parameters": return Parameters(json: json, owner: owner) case "ParametersParameter": @@ -754,12 +542,6 @@ extension FHIRAbstractBase { return PractitionerPractitionerRole(json: json, owner: owner) case "PractitionerQualification": return PractitionerQualification(json: json, owner: owner) - case "PractitionerRole": - return PractitionerRole(json: json, owner: owner) - case "PractitionerRoleAvailableTime": - return PractitionerRoleAvailableTime(json: json, owner: owner) - case "PractitionerRoleNotAvailable": - return PractitionerRoleNotAvailable(json: json, owner: owner) case "Procedure": return Procedure(json: json, owner: owner) case "ProcedureFocalDevice": @@ -776,22 +558,6 @@ extension FHIRAbstractBase { return ProcessResponse(json: json, owner: owner) case "ProcessResponseNotes": return ProcessResponseNotes(json: json, owner: owner) - case "Protocol": - return ProtocolFHIR(json: json, owner: owner) - case "ProtocolFHIRStep": - return ProtocolFHIRStep(json: json, owner: owner) - case "ProtocolFHIRStepActivity": - return ProtocolFHIRStepActivity(json: json, owner: owner) - case "ProtocolFHIRStepActivityComponent": - return ProtocolFHIRStepActivityComponent(json: json, owner: owner) - case "ProtocolFHIRStepActivityDetail": - return ProtocolFHIRStepActivityDetail(json: json, owner: owner) - case "ProtocolFHIRStepNext": - return ProtocolFHIRStepNext(json: json, owner: owner) - case "ProtocolFHIRStepPrecondition": - return ProtocolFHIRStepPrecondition(json: json, owner: owner) - case "ProtocolFHIRStepPreconditionCondition": - return ProtocolFHIRStepPreconditionCondition(json: json, owner: owner) case "Provenance": return Provenance(json: json, owner: owner) case "ProvenanceAgent": @@ -804,18 +570,18 @@ extension FHIRAbstractBase { return Quantity(json: json, owner: owner) case "Questionnaire": return Questionnaire(json: json, owner: owner) - case "QuestionnaireItem": - return QuestionnaireItem(json: json, owner: owner) - case "QuestionnaireItemEnableWhen": - return QuestionnaireItemEnableWhen(json: json, owner: owner) - case "QuestionnaireItemOption": - return QuestionnaireItemOption(json: json, owner: owner) + case "QuestionnaireGroup": + return QuestionnaireGroup(json: json, owner: owner) + case "QuestionnaireGroupQuestion": + return QuestionnaireGroupQuestion(json: json, owner: owner) case "QuestionnaireResponse": return QuestionnaireResponse(json: json, owner: owner) - case "QuestionnaireResponseItem": - return QuestionnaireResponseItem(json: json, owner: owner) - case "QuestionnaireResponseItemAnswer": - return QuestionnaireResponseItemAnswer(json: json, owner: owner) + case "QuestionnaireResponseGroup": + return QuestionnaireResponseGroup(json: json, owner: owner) + case "QuestionnaireResponseGroupQuestion": + return QuestionnaireResponseGroupQuestion(json: json, owner: owner) + case "QuestionnaireResponseGroupQuestionAnswer": + return QuestionnaireResponseGroupQuestionAnswer(json: json, owner: owner) case "Range": return Range(json: json, owner: owner) case "Ratio": @@ -840,22 +606,6 @@ extension FHIRAbstractBase { return SearchParameter(json: json, owner: owner) case "SearchParameterContact": return SearchParameterContact(json: json, owner: owner) - case "Sequence": - return Sequence(json: json, owner: owner) - case "SequenceQuality": - return SequenceQuality(json: json, owner: owner) - case "SequenceReferenceSeq": - return SequenceReferenceSeq(json: json, owner: owner) - case "SequenceRepository": - return SequenceRepository(json: json, owner: owner) - case "SequenceStructureVariation": - return SequenceStructureVariation(json: json, owner: owner) - case "SequenceStructureVariationInner": - return SequenceStructureVariationInner(json: json, owner: owner) - case "SequenceStructureVariationOuter": - return SequenceStructureVariationOuter(json: json, owner: owner) - case "SequenceVariation": - return SequenceVariation(json: json, owner: owner) case "Signature": return Signature(json: json, owner: owner) case "Slot": @@ -878,26 +628,6 @@ extension FHIRAbstractBase { return StructureDefinitionMapping(json: json, owner: owner) case "StructureDefinitionSnapshot": return StructureDefinitionSnapshot(json: json, owner: owner) - case "StructureMap": - return StructureMap(json: json, owner: owner) - case "StructureMapContact": - return StructureMapContact(json: json, owner: owner) - case "StructureMapGroup": - return StructureMapGroup(json: json, owner: owner) - case "StructureMapGroupInput": - return StructureMapGroupInput(json: json, owner: owner) - case "StructureMapGroupRule": - return StructureMapGroupRule(json: json, owner: owner) - case "StructureMapGroupRuleDependent": - return StructureMapGroupRuleDependent(json: json, owner: owner) - case "StructureMapGroupRuleSource": - return StructureMapGroupRuleSource(json: json, owner: owner) - case "StructureMapGroupRuleTarget": - return StructureMapGroupRuleTarget(json: json, owner: owner) - case "StructureMapGroupRuleTargetParameter": - return StructureMapGroupRuleTargetParameter(json: json, owner: owner) - case "StructureMapStructure": - return StructureMapStructure(json: json, owner: owner) case "Subscription": return Subscription(json: json, owner: owner) case "SubscriptionChannel": @@ -914,18 +644,10 @@ extension FHIRAbstractBase { return SupplyRequest(json: json, owner: owner) case "SupplyRequestWhen": return SupplyRequestWhen(json: json, owner: owner) - case "Task": - return Task(json: json, owner: owner) - case "TaskInput": - return TaskInput(json: json, owner: owner) - case "TaskOutput": - return TaskOutput(json: json, owner: owner) case "TestScript": return TestScript(json: json, owner: owner) case "TestScriptContact": return TestScriptContact(json: json, owner: owner) - case "TestScriptDestination": - return TestScriptDestination(json: json, owner: owner) case "TestScriptFixture": return TestScriptFixture(json: json, owner: owner) case "TestScriptMetadata": @@ -934,34 +656,12 @@ extension FHIRAbstractBase { return TestScriptMetadataCapability(json: json, owner: owner) case "TestScriptMetadataLink": return TestScriptMetadataLink(json: json, owner: owner) - case "TestScriptOrigin": - return TestScriptOrigin(json: json, owner: owner) - case "TestScriptRule": - return TestScriptRule(json: json, owner: owner) - case "TestScriptRuleParam": - return TestScriptRuleParam(json: json, owner: owner) - case "TestScriptRuleset": - return TestScriptRuleset(json: json, owner: owner) - case "TestScriptRulesetRule": - return TestScriptRulesetRule(json: json, owner: owner) - case "TestScriptRulesetRuleParam": - return TestScriptRulesetRuleParam(json: json, owner: owner) case "TestScriptSetup": return TestScriptSetup(json: json, owner: owner) case "TestScriptSetupAction": return TestScriptSetupAction(json: json, owner: owner) case "TestScriptSetupActionAssert": return TestScriptSetupActionAssert(json: json, owner: owner) - case "TestScriptSetupActionAssertRule": - return TestScriptSetupActionAssertRule(json: json, owner: owner) - case "TestScriptSetupActionAssertRuleParam": - return TestScriptSetupActionAssertRuleParam(json: json, owner: owner) - case "TestScriptSetupActionAssertRuleset": - return TestScriptSetupActionAssertRuleset(json: json, owner: owner) - case "TestScriptSetupActionAssertRulesetRule": - return TestScriptSetupActionAssertRulesetRule(json: json, owner: owner) - case "TestScriptSetupActionAssertRulesetRuleParam": - return TestScriptSetupActionAssertRulesetRuleParam(json: json, owner: owner) case "TestScriptSetupActionOperation": return TestScriptSetupActionOperation(json: json, owner: owner) case "TestScriptSetupActionOperationRequestHeader": @@ -980,18 +680,20 @@ extension FHIRAbstractBase { return Timing(json: json, owner: owner) case "TimingRepeat": return TimingRepeat(json: json, owner: owner) - case "TriggerDefinition": - return TriggerDefinition(json: json, owner: owner) case "ValueSet": return ValueSet(json: json, owner: owner) + case "ValueSetCodeSystem": + return ValueSetCodeSystem(json: json, owner: owner) + case "ValueSetCodeSystemConcept": + return ValueSetCodeSystemConcept(json: json, owner: owner) + case "ValueSetCodeSystemConceptDesignation": + return ValueSetCodeSystemConceptDesignation(json: json, owner: owner) case "ValueSetCompose": return ValueSetCompose(json: json, owner: owner) case "ValueSetComposeInclude": return ValueSetComposeInclude(json: json, owner: owner) case "ValueSetComposeIncludeConcept": return ValueSetComposeIncludeConcept(json: json, owner: owner) - case "ValueSetComposeIncludeConceptDesignation": - return ValueSetComposeIncludeConceptDesignation(json: json, owner: owner) case "ValueSetComposeIncludeFilter": return ValueSetComposeIncludeFilter(json: json, owner: owner) case "ValueSetContact": diff --git a/Sources/Models/FamilyMemberHistory.swift b/Sources/Models/FamilyMemberHistory.swift index 87040198..b5abbc61 100644 --- a/Sources/Models/FamilyMemberHistory.swift +++ b/Sources/Models/FamilyMemberHistory.swift @@ -2,7 +2,7 @@ // FamilyMemberHistory.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Flag.swift b/Sources/Models/Flag.swift index 4db60364..5b670cd4 100644 --- a/Sources/Models/Flag.swift +++ b/Sources/Models/Flag.swift @@ -2,7 +2,7 @@ // Flag.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Flag) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Flag) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Goal.swift b/Sources/Models/Goal.swift index 3f8494ad..e06bc84b 100644 --- a/Sources/Models/Goal.swift +++ b/Sources/Models/Goal.swift @@ -2,7 +2,7 @@ // Goal.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Goal) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Goal) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Group.swift b/Sources/Models/Group.swift index 756fa5c1..421663a3 100644 --- a/Sources/Models/Group.swift +++ b/Sources/Models/Group.swift @@ -2,7 +2,7 @@ // Group.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Group) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Group) on 2016-08-09. // 2016, SMART Health IT. // @@ -21,9 +21,6 @@ public class Group: DomainResource { get { return "Group" } } - /// Whether this group's record is in active use. - public var active: Bool? - /// Descriptive or actual. public var actual: Bool? @@ -64,15 +61,6 @@ public class Group: DomainResource { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["active"] { - presentKeys.insert("active") - if let val = exist as? Bool { - self.active = val - } - else { - errors.append(FHIRJSONError(key: "active", wants: Bool.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["actual"] { presentKeys.insert("actual") if let val = exist as? Bool { @@ -158,9 +146,6 @@ public class Group: DomainResource { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let active = self.active { - json["active"] = active.asJSON() - } if let actual = self.actual { json["actual"] = actual.asJSON() } diff --git a/Sources/Models/GuidanceResponse.swift b/Sources/Models/GuidanceResponse.swift deleted file mode 100644 index 5c6df044..00000000 --- a/Sources/Models/GuidanceResponse.swift +++ /dev/null @@ -1,599 +0,0 @@ -// -// GuidanceResponse.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/GuidanceResponse) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * 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. - */ -public class GuidanceResponse: DomainResource { - override public class var resourceName: String { - get { return "GuidanceResponse" } - } - - /// Proposed actions, if any. - public var action: [GuidanceResponseAction]? - - /// Additional required data. - public var dataRequirement: [DataRequirement]? - - /// Messages resulting from the evaluation of the artifact or artifacts. - public var evaluationMessage: [Reference]? - - /// A reference to a knowledge module. - public var module: Reference? - - /// The output parameters of the evaluation, if any. - public var outputParameters: Reference? - - /// The id of the request associated with this response, if any. - public var requestId: String? - - /// success | data-requested | data-required | in-progress | failure. - public var status: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(module: Reference, status: String) { - self.init(json: nil) - self.module = module - self.status = status - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["action"] { - presentKeys.insert("action") - if let val = exist as? [FHIRJSON] { - self.action = GuidanceResponseAction.instantiate(fromArray: val, owner: self) as? [GuidanceResponseAction] - } - else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["dataRequirement"] { - presentKeys.insert("dataRequirement") - if let val = exist as? [FHIRJSON] { - self.dataRequirement = DataRequirement.instantiate(fromArray: val, owner: self) as? [DataRequirement] - } - else { - errors.append(FHIRJSONError(key: "dataRequirement", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["evaluationMessage"] { - presentKeys.insert("evaluationMessage") - if let val = exist as? [FHIRJSON] { - self.evaluationMessage = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "evaluationMessage", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["module"] { - presentKeys.insert("module") - if let val = exist as? FHIRJSON { - self.module = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "module", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "module")) - } - if let exist: AnyObject = js["outputParameters"] { - presentKeys.insert("outputParameters") - if let val = exist as? FHIRJSON { - self.outputParameters = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "outputParameters", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestId"] { - presentKeys.insert("requestId") - if let val = exist as? String { - self.requestId = val - } - else { - errors.append(FHIRJSONError(key: "requestId", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["status"] { - presentKeys.insert("status") - if let val = exist as? String { - self.status = val - } - else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "status")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let action = self.action { - json["action"] = GuidanceResponseAction.asJSONArray(action) - } - if let dataRequirement = self.dataRequirement { - json["dataRequirement"] = DataRequirement.asJSONArray(dataRequirement) - } - if let evaluationMessage = self.evaluationMessage { - json["evaluationMessage"] = Reference.asJSONArray(evaluationMessage) - } - if let module = self.module { - json["module"] = module.asJSON() - } - if let outputParameters = self.outputParameters { - json["outputParameters"] = outputParameters.asJSON() - } - if let requestId = self.requestId { - json["requestId"] = requestId.asJSON() - } - if let status = self.status { - json["status"] = status.asJSON() - } - - return json - } -} - - -/** - * Proposed actions, if any. - * - * The actions, if any, produced by the evaluation of the artifact. - */ -public class GuidanceResponseAction: BackboneElement { - override public class var resourceName: String { - get { return "GuidanceResponseAction" } - } - - /// Sub action. - public var action: [GuidanceResponseAction]? - - /// Unique identifier. - public var actionIdentifier: Identifier? - - /// Defines behaviors such as selection and grouping. - public var behavior: [GuidanceResponseActionBehavior]? - - /// The meaning of the action or its sub-actions. - public var concept: [CodeableConcept]? - - /// Short description of the action. - public var description_fhir: String? - - /// Supporting documentation for the intended performer of the action. - public var documentation: [Attachment]? - - /// User-visible label for the action (e.g. 1. or A.). - public var label: String? - - /// Participant. - public var participant: [Reference]? - - /// Relationship to another action. - public var relatedAction: GuidanceResponseActionRelatedAction? - - /// The target of the action. - public var resource: Reference? - - /// Evidence that supports taking the action. - public var supportingEvidence: [Attachment]? - - /// Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system. - public var textEquivalent: String? - - /// User-visible title. - public var title: String? - - /// create | update | remove | fire-event. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["action"] { - presentKeys.insert("action") - if let val = exist as? [FHIRJSON] { - self.action = GuidanceResponseAction.instantiate(fromArray: val, owner: self) as? [GuidanceResponseAction] - } - else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["actionIdentifier"] { - presentKeys.insert("actionIdentifier") - if let val = exist as? FHIRJSON { - self.actionIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "actionIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["behavior"] { - presentKeys.insert("behavior") - if let val = exist as? [FHIRJSON] { - self.behavior = GuidanceResponseActionBehavior.instantiate(fromArray: val, owner: self) as? [GuidanceResponseActionBehavior] - } - else { - errors.append(FHIRJSONError(key: "behavior", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["concept"] { - presentKeys.insert("concept") - if let val = exist as? [FHIRJSON] { - self.concept = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["documentation"] { - presentKeys.insert("documentation") - if let val = exist as? [FHIRJSON] { - self.documentation = Attachment.instantiate(fromArray: val, owner: self) as? [Attachment] - } - else { - errors.append(FHIRJSONError(key: "documentation", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["label"] { - presentKeys.insert("label") - if let val = exist as? String { - self.label = val - } - else { - errors.append(FHIRJSONError(key: "label", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["participant"] { - presentKeys.insert("participant") - if let val = exist as? [FHIRJSON] { - self.participant = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "participant", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["relatedAction"] { - presentKeys.insert("relatedAction") - if let val = exist as? FHIRJSON { - self.relatedAction = GuidanceResponseActionRelatedAction(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "relatedAction", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["resource"] { - presentKeys.insert("resource") - if let val = exist as? FHIRJSON { - self.resource = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["supportingEvidence"] { - presentKeys.insert("supportingEvidence") - if let val = exist as? [FHIRJSON] { - self.supportingEvidence = Attachment.instantiate(fromArray: val, owner: self) as? [Attachment] - } - else { - errors.append(FHIRJSONError(key: "supportingEvidence", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["textEquivalent"] { - presentKeys.insert("textEquivalent") - if let val = exist as? String { - self.textEquivalent = val - } - else { - errors.append(FHIRJSONError(key: "textEquivalent", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["title"] { - presentKeys.insert("title") - if let val = exist as? String { - self.title = val - } - else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let action = self.action { - json["action"] = GuidanceResponseAction.asJSONArray(action) - } - if let actionIdentifier = self.actionIdentifier { - json["actionIdentifier"] = actionIdentifier.asJSON() - } - if let behavior = self.behavior { - json["behavior"] = GuidanceResponseActionBehavior.asJSONArray(behavior) - } - if let concept = self.concept { - json["concept"] = CodeableConcept.asJSONArray(concept) - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let documentation = self.documentation { - json["documentation"] = Attachment.asJSONArray(documentation) - } - if let label = self.label { - json["label"] = label.asJSON() - } - if let participant = self.participant { - json["participant"] = Reference.asJSONArray(participant) - } - if let relatedAction = self.relatedAction { - json["relatedAction"] = relatedAction.asJSON() - } - if let resource = self.resource { - json["resource"] = resource.asJSON() - } - if let supportingEvidence = self.supportingEvidence { - json["supportingEvidence"] = Attachment.asJSONArray(supportingEvidence) - } - if let textEquivalent = self.textEquivalent { - json["textEquivalent"] = textEquivalent.asJSON() - } - if let title = self.title { - json["title"] = title.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Defines behaviors such as selection and grouping. - * - * A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the - * receiving environment. - */ -public class GuidanceResponseActionBehavior: BackboneElement { - override public class var resourceName: String { - get { return "GuidanceResponseActionBehavior" } - } - - /// The type of behavior (grouping, precheck, selection, cardinality, etc). - public var type: Coding? - - /// Specific behavior (e.g. required, at-most-one, single, etc). - public var value: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: Coding, value: Coding) { - self.init(json: nil) - self.type = type - self.value = value - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? FHIRJSON { - self.value = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "value", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "value")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let type = self.type { - json["type"] = type.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * Relationship to another action. - * - * A relationship to another action such as "before" or "30-60 minutes after start of". - */ -public class GuidanceResponseActionRelatedAction: BackboneElement { - override public class var resourceName: String { - get { return "GuidanceResponseActionRelatedAction" } - } - - /// Identifier of the related action. - public var actionIdentifier: Identifier? - - /// start | end. - public var anchor: String? - - /// Time offset for the relationship. - public var offsetQuantity: Quantity? - - /// Time offset for the relationship. - public var offsetRange: Range? - - /// before | after. - public var relationship: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(actionIdentifier: Identifier, relationship: String) { - self.init(json: nil) - self.actionIdentifier = actionIdentifier - self.relationship = relationship - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["actionIdentifier"] { - presentKeys.insert("actionIdentifier") - if let val = exist as? FHIRJSON { - self.actionIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "actionIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "actionIdentifier")) - } - if let exist: AnyObject = js["anchor"] { - presentKeys.insert("anchor") - if let val = exist as? String { - self.anchor = val - } - else { - errors.append(FHIRJSONError(key: "anchor", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["offsetQuantity"] { - presentKeys.insert("offsetQuantity") - if let val = exist as? FHIRJSON { - self.offsetQuantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "offsetQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["offsetRange"] { - presentKeys.insert("offsetRange") - if let val = exist as? FHIRJSON { - self.offsetRange = Range(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "offsetRange", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["relationship"] { - presentKeys.insert("relationship") - if let val = exist as? String { - self.relationship = val - } - else { - errors.append(FHIRJSONError(key: "relationship", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "relationship")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let actionIdentifier = self.actionIdentifier { - json["actionIdentifier"] = actionIdentifier.asJSON() - } - if let anchor = self.anchor { - json["anchor"] = anchor.asJSON() - } - if let offsetQuantity = self.offsetQuantity { - json["offsetQuantity"] = offsetQuantity.asJSON() - } - if let offsetRange = self.offsetRange { - json["offsetRange"] = offsetRange.asJSON() - } - if let relationship = self.relationship { - json["relationship"] = relationship.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/HealthcareService.swift b/Sources/Models/HealthcareService.swift index 993a2b43..55737be6 100644 --- a/Sources/Models/HealthcareService.swift +++ b/Sources/Models/HealthcareService.swift @@ -2,7 +2,7 @@ // HealthcareService.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/HealthcareService) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/HealthcareService) on 2016-08-09. // 2016, SMART Health IT. // @@ -47,8 +47,8 @@ public class HealthcareService: DomainResource { /// External identifiers for this item. public var identifier: [Identifier]? - /// Location(s) where service may be provided. - public var location: [Reference]? + /// Location where service may be provided. + public var location: Reference? /// Not available during this time due to provided reason. public var notAvailable: [HealthcareServiceNotAvailable]? @@ -77,11 +77,8 @@ public class HealthcareService: DomainResource { /// Conditions under which service is available/offered. public var serviceProvisionCode: [CodeableConcept]? - /// Type of service that may be delivered or performed. - public var serviceType: [CodeableConcept]? - - /// Specialties handled by the HealthcareService. - public var specialty: [CodeableConcept]? + /// Specific service delivered or performed. + public var serviceType: [HealthcareServiceServiceType]? /// Contacts related to the healthcare service. public var telecom: [ContactPoint]? @@ -92,6 +89,12 @@ public class HealthcareService: DomainResource { super.init(json: json, owner: owner) } + /** Convenience initializer, taking all required properties as arguments. */ + public convenience init(location: Reference) { + self.init(json: nil) + self.location = location + } + public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { @@ -187,13 +190,16 @@ public class HealthcareService: DomainResource { } if let exist: AnyObject = js["location"] { presentKeys.insert("location") - if let val = exist as? [FHIRJSON] { - self.location = Reference.instantiate(fromArray: val, owner: self) as? [Reference] + if let val = exist as? FHIRJSON { + self.location = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "location", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: exist.dynamicType)) } } + else { + errors.append(FHIRJSONError(key: "location")) + } if let exist: AnyObject = js["notAvailable"] { presentKeys.insert("notAvailable") if let val = exist as? [FHIRJSON] { @@ -278,21 +284,12 @@ public class HealthcareService: DomainResource { if let exist: AnyObject = js["serviceType"] { presentKeys.insert("serviceType") if let val = exist as? [FHIRJSON] { - self.serviceType = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] + self.serviceType = HealthcareServiceServiceType.instantiate(fromArray: val, owner: self) as? [HealthcareServiceServiceType] } else { errors.append(FHIRJSONError(key: "serviceType", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["specialty"] { - presentKeys.insert("specialty") - if let val = exist as? [FHIRJSON] { - self.specialty = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "specialty", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { @@ -340,7 +337,7 @@ public class HealthcareService: DomainResource { json["identifier"] = Identifier.asJSONArray(identifier) } if let location = self.location { - json["location"] = Reference.asJSONArray(location) + json["location"] = location.asJSON() } if let notAvailable = self.notAvailable { json["notAvailable"] = HealthcareServiceNotAvailable.asJSONArray(notAvailable) @@ -374,10 +371,7 @@ public class HealthcareService: DomainResource { json["serviceProvisionCode"] = CodeableConcept.asJSONArray(serviceProvisionCode) } if let serviceType = self.serviceType { - json["serviceType"] = CodeableConcept.asJSONArray(serviceType) - } - if let specialty = self.specialty { - json["specialty"] = CodeableConcept.asJSONArray(specialty) + json["serviceType"] = HealthcareServiceServiceType.asJSONArray(serviceType) } if let telecom = self.telecom { json["telecom"] = ContactPoint.asJSONArray(telecom) @@ -554,3 +548,74 @@ public class HealthcareServiceNotAvailable: BackboneElement { } } + +/** + * Specific service delivered or performed. + * + * A specific type of service that may be delivered or performed. + */ +public class HealthcareServiceServiceType: BackboneElement { + override public class var resourceName: String { + get { return "HealthcareServiceServiceType" } + } + + /// Specialties handled by the Service Site. + public var specialty: [CodeableConcept]? + + /// Type of service delivered or performed. + public var type: CodeableConcept? + + + /** Initialize with a JSON object. */ + public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { + super.init(json: json, owner: owner) + } + + /** Convenience initializer, taking all required properties as arguments. */ + public convenience init(type: CodeableConcept) { + self.init(json: nil) + self.type = type + } + + public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + if let js = json { + if let exist: AnyObject = js["specialty"] { + presentKeys.insert("specialty") + if let val = exist as? [FHIRJSON] { + self.specialty = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] + } + else { + errors.append(FHIRJSONError(key: "specialty", wants: Array.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["type"] { + presentKeys.insert("type") + if let val = exist as? FHIRJSON { + self.type = CodeableConcept(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "type")) + } + } + return errors.isEmpty ? nil : errors + } + + override public func asJSON() -> FHIRJSON { + var json = super.asJSON() + + if let specialty = self.specialty { + json["specialty"] = CodeableConcept.asJSONArray(specialty) + } + if let type = self.type { + json["type"] = type.asJSON() + } + + return json + } +} + diff --git a/Sources/Models/HumanName.swift b/Sources/Models/HumanName.swift index cd3af692..301173d0 100644 --- a/Sources/Models/HumanName.swift +++ b/Sources/Models/HumanName.swift @@ -2,7 +2,7 @@ // HumanName.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/HumanName) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/HumanName) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Identifier.swift b/Sources/Models/Identifier.swift index ddd905d2..c39080c1 100644 --- a/Sources/Models/Identifier.swift +++ b/Sources/Models/Identifier.swift @@ -2,7 +2,7 @@ // Identifier.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Identifier) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Identifier) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/ImagingExcerpt.swift b/Sources/Models/ImagingExcerpt.swift deleted file mode 100644 index ba241edf..00000000 --- a/Sources/Models/ImagingExcerpt.swift +++ /dev/null @@ -1,883 +0,0 @@ -// -// ImagingExcerpt.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ImagingExcerpt) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * Key Object Selection. - * - * A manifest of a set of DICOM Service-Object Pair Instances (SOP Instances). The referenced SOP Instances (images or - * other content) are for a single patient, and may be from one or more studies. The referenced SOP Instances have been - * selected for a purpose, such as quality assurance, conference, or consult. Reflecting that range of purposes, - * typical ImagingExcerpt resources may include all SOP Instances in a study (perhaps for sharing through a Health - * Information Exchange); key images from multiple studies (for reference by a referring or treating physician); a - * multi-frame ultrasound instance ("cine" video clip) and a set of measurements taken from that instance (for - * inclusion in a teaching file); and so on. - */ -public class ImagingExcerpt: DomainResource { - override public class var resourceName: String { - get { return "ImagingExcerpt" } - } - - /// Author (human or machine). - public var author: Reference? - - /// Time when the imaging object selection was created. - public var authoringTime: DateTime? - - /// Description text. - public var description_fhir: String? - - /// Patient of the selected objects. - public var patient: Reference? - - /// Study identity of the selected instances. - public var study: [ImagingExcerptStudy]? - - /// Reason for selection. - public var title: CodeableConcept? - - /// Instance UID. - public var uid: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(patient: Reference, study: [ImagingExcerptStudy], title: CodeableConcept, uid: String) { - self.init(json: nil) - self.patient = patient - self.study = study - self.title = title - self.uid = uid - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["author"] { - presentKeys.insert("author") - if let val = exist as? FHIRJSON { - self.author = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["authoringTime"] { - presentKeys.insert("authoringTime") - if let val = exist as? String { - self.authoringTime = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "authoringTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["patient"] { - presentKeys.insert("patient") - if let val = exist as? FHIRJSON { - self.patient = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "patient")) - } - if let exist: AnyObject = js["study"] { - presentKeys.insert("study") - if let val = exist as? [FHIRJSON] { - self.study = ImagingExcerptStudy.instantiate(fromArray: val, owner: self) as? [ImagingExcerptStudy] - } - else { - errors.append(FHIRJSONError(key: "study", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "study")) - } - if let exist: AnyObject = js["title"] { - presentKeys.insert("title") - if let val = exist as? FHIRJSON { - self.title = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "title", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "title")) - } - if let exist: AnyObject = js["uid"] { - presentKeys.insert("uid") - if let val = exist as? String { - self.uid = val - } - else { - errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "uid")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let author = self.author { - json["author"] = author.asJSON() - } - if let authoringTime = self.authoringTime { - json["authoringTime"] = authoringTime.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let patient = self.patient { - json["patient"] = patient.asJSON() - } - if let study = self.study { - json["study"] = ImagingExcerptStudy.asJSONArray(study) - } - if let title = self.title { - json["title"] = title.asJSON() - } - if let uid = self.uid { - json["uid"] = uid.asJSON() - } - - return json - } -} - - -/** - * Study identity of the selected instances. - * - * Study identity and locating information of the DICOM SOP instances in the selection. - */ -public class ImagingExcerptStudy: BackboneElement { - override public class var resourceName: String { - get { return "ImagingExcerptStudy" } - } - - /// Dicom web access. - public var dicom: [ImagingExcerptStudyDicom]? - - /// Reference to ImagingStudy. - public var imagingStudy: Reference? - - /// Series identity of the selected instances. - public var series: [ImagingExcerptStudySeries]? - - /// Study instance UID. - public var uid: String? - - /// Viewable format. - public var viewable: [ImagingExcerptStudyViewable]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(series: [ImagingExcerptStudySeries], uid: String) { - self.init(json: nil) - self.series = series - self.uid = uid - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["dicom"] { - presentKeys.insert("dicom") - if let val = exist as? [FHIRJSON] { - self.dicom = ImagingExcerptStudyDicom.instantiate(fromArray: val, owner: self) as? [ImagingExcerptStudyDicom] - } - else { - errors.append(FHIRJSONError(key: "dicom", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["imagingStudy"] { - presentKeys.insert("imagingStudy") - if let val = exist as? FHIRJSON { - self.imagingStudy = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "imagingStudy", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["series"] { - presentKeys.insert("series") - if let val = exist as? [FHIRJSON] { - self.series = ImagingExcerptStudySeries.instantiate(fromArray: val, owner: self) as? [ImagingExcerptStudySeries] - } - else { - errors.append(FHIRJSONError(key: "series", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "series")) - } - if let exist: AnyObject = js["uid"] { - presentKeys.insert("uid") - if let val = exist as? String { - self.uid = val - } - else { - errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "uid")) - } - if let exist: AnyObject = js["viewable"] { - presentKeys.insert("viewable") - if let val = exist as? [FHIRJSON] { - self.viewable = ImagingExcerptStudyViewable.instantiate(fromArray: val, owner: self) as? [ImagingExcerptStudyViewable] - } - else { - errors.append(FHIRJSONError(key: "viewable", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let dicom = self.dicom { - json["dicom"] = ImagingExcerptStudyDicom.asJSONArray(dicom) - } - if let imagingStudy = self.imagingStudy { - json["imagingStudy"] = imagingStudy.asJSON() - } - if let series = self.series { - json["series"] = ImagingExcerptStudySeries.asJSONArray(series) - } - if let uid = self.uid { - json["uid"] = uid.asJSON() - } - if let viewable = self.viewable { - json["viewable"] = ImagingExcerptStudyViewable.asJSONArray(viewable) - } - - return json - } -} - - -/** - * Dicom web access. - * - * Methods of accessing using DICOM web technologies. - */ -public class ImagingExcerptStudyDicom: BackboneElement { - override public class var resourceName: String { - get { return "ImagingExcerptStudyDicom" } - } - - /// WADO-RS | WADO-URI | IID | WADO-WS. - public var type: String? - - /// Retrieve study URL. - public var url: URL? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String, url: URL) { - self.init(json: nil) - self.type = type - self.url = url - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "url")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let type = self.type { - json["type"] = type.asJSON() - } - if let url = self.url { - json["url"] = url.asJSON() - } - - return json - } -} - - -/** - * Series identity of the selected instances. - * - * Series identity and locating information of the DICOM SOP instances in the selection. - */ -public class ImagingExcerptStudySeries: BackboneElement { - override public class var resourceName: String { - get { return "ImagingExcerptStudySeries" } - } - - /// Dicom web access. - public var dicom: [ImagingExcerptStudySeriesDicom]? - - /// The selected instance. - public var instance: [ImagingExcerptStudySeriesInstance]? - - /// Series instance UID. - public var uid: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(instance: [ImagingExcerptStudySeriesInstance], uid: String) { - self.init(json: nil) - self.instance = instance - self.uid = uid - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["dicom"] { - presentKeys.insert("dicom") - if let val = exist as? [FHIRJSON] { - self.dicom = ImagingExcerptStudySeriesDicom.instantiate(fromArray: val, owner: self) as? [ImagingExcerptStudySeriesDicom] - } - else { - errors.append(FHIRJSONError(key: "dicom", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["instance"] { - presentKeys.insert("instance") - if let val = exist as? [FHIRJSON] { - self.instance = ImagingExcerptStudySeriesInstance.instantiate(fromArray: val, owner: self) as? [ImagingExcerptStudySeriesInstance] - } - else { - errors.append(FHIRJSONError(key: "instance", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "instance")) - } - if let exist: AnyObject = js["uid"] { - presentKeys.insert("uid") - if let val = exist as? String { - self.uid = val - } - else { - errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "uid")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let dicom = self.dicom { - json["dicom"] = ImagingExcerptStudySeriesDicom.asJSONArray(dicom) - } - if let instance = self.instance { - json["instance"] = ImagingExcerptStudySeriesInstance.asJSONArray(instance) - } - if let uid = self.uid { - json["uid"] = uid.asJSON() - } - - return json - } -} - - -/** - * Dicom web access. - * - * Methods of accessing using DICOM web technologies. - */ -public class ImagingExcerptStudySeriesDicom: BackboneElement { - override public class var resourceName: String { - get { return "ImagingExcerptStudySeriesDicom" } - } - - /// WADO-RS | WADO-URI | IID | WADO-WS. - public var type: String? - - /// Retrieve study URL. - public var url: URL? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String, url: URL) { - self.init(json: nil) - self.type = type - self.url = url - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "url")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let type = self.type { - json["type"] = type.asJSON() - } - if let url = self.url { - json["url"] = url.asJSON() - } - - return json - } -} - - -/** - * The selected instance. - * - * Identity and locating information of the selected DICOM SOP instances. - */ -public class ImagingExcerptStudySeriesInstance: BackboneElement { - override public class var resourceName: String { - get { return "ImagingExcerptStudySeriesInstance" } - } - - /// Dicom web access. - public var dicom: [ImagingExcerptStudySeriesInstanceDicom]? - - /// Frame reference number. - public var frameNumbers: [UInt]? - - /// SOP class UID of instance. - public var sopClass: String? - - /// Selected instance UID. - public var uid: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(sopClass: String, uid: String) { - self.init(json: nil) - self.sopClass = sopClass - self.uid = uid - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["dicom"] { - presentKeys.insert("dicom") - if let val = exist as? [FHIRJSON] { - self.dicom = ImagingExcerptStudySeriesInstanceDicom.instantiate(fromArray: val, owner: self) as? [ImagingExcerptStudySeriesInstanceDicom] - } - else { - errors.append(FHIRJSONError(key: "dicom", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["frameNumbers"] { - presentKeys.insert("frameNumbers") - if let val = exist as? [UInt] { - self.frameNumbers = val - } - else { - errors.append(FHIRJSONError(key: "frameNumbers", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["sopClass"] { - presentKeys.insert("sopClass") - if let val = exist as? String { - self.sopClass = val - } - else { - errors.append(FHIRJSONError(key: "sopClass", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "sopClass")) - } - if let exist: AnyObject = js["uid"] { - presentKeys.insert("uid") - if let val = exist as? String { - self.uid = val - } - else { - errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "uid")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let dicom = self.dicom { - json["dicom"] = ImagingExcerptStudySeriesInstanceDicom.asJSONArray(dicom) - } - if let frameNumbers = self.frameNumbers { - var arr = [AnyObject]() - for val in frameNumbers { - arr.append(val.asJSON()) - } - json["frameNumbers"] = arr - } - if let sopClass = self.sopClass { - json["sopClass"] = sopClass.asJSON() - } - if let uid = self.uid { - json["uid"] = uid.asJSON() - } - - return json - } -} - - -/** - * Dicom web access. - * - * Methods of accessing using DICOM web technologies. - */ -public class ImagingExcerptStudySeriesInstanceDicom: BackboneElement { - override public class var resourceName: String { - get { return "ImagingExcerptStudySeriesInstanceDicom" } - } - - /// WADO-RS | WADO-URI | IID | WADO-WS. - public var type: String? - - /// Retrieve study URL. - public var url: URL? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String, url: URL) { - self.init(json: nil) - self.type = type - self.url = url - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "url")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let type = self.type { - json["type"] = type.asJSON() - } - if let url = self.url { - json["url"] = url.asJSON() - } - - return json - } -} - - -/** - * Viewable format. - * - * A set of viewable reference images of various types. - */ -public class ImagingExcerptStudyViewable: BackboneElement { - override public class var resourceName: String { - get { return "ImagingExcerptStudyViewable" } - } - - /// Mime type of the content, with charset etc.. - public var contentType: String? - - /// Length in seconds (audio / video). - public var duration: UInt? - - /// Number of frames if > 1 (photo). - public var frames: UInt? - - /// Height of the image in pixels (photo/video). - public var height: UInt? - - /// Number of bytes of content (if url provided). - public var size: UInt? - - /// Label to display in place of the data. - public var title: String? - - /// Uri where the data can be found. - public var url: URL? - - /// Width of the image in pixels (photo/video). - public var width: UInt? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(contentType: String, url: URL) { - self.init(json: nil) - self.contentType = contentType - self.url = url - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["contentType"] { - presentKeys.insert("contentType") - if let val = exist as? String { - self.contentType = val - } - else { - errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "contentType")) - } - if let exist: AnyObject = js["duration"] { - presentKeys.insert("duration") - if let val = exist as? UInt { - self.duration = val - } - else { - errors.append(FHIRJSONError(key: "duration", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["frames"] { - presentKeys.insert("frames") - if let val = exist as? UInt { - self.frames = val - } - else { - errors.append(FHIRJSONError(key: "frames", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["height"] { - presentKeys.insert("height") - if let val = exist as? UInt { - self.height = val - } - else { - errors.append(FHIRJSONError(key: "height", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["size"] { - presentKeys.insert("size") - if let val = exist as? UInt { - self.size = val - } - else { - errors.append(FHIRJSONError(key: "size", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["title"] { - presentKeys.insert("title") - if let val = exist as? String { - self.title = val - } - else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "url")) - } - if let exist: AnyObject = js["width"] { - presentKeys.insert("width") - if let val = exist as? UInt { - self.width = val - } - else { - errors.append(FHIRJSONError(key: "width", wants: UInt.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let contentType = self.contentType { - json["contentType"] = contentType.asJSON() - } - if let duration = self.duration { - json["duration"] = duration.asJSON() - } - if let frames = self.frames { - json["frames"] = frames.asJSON() - } - if let height = self.height { - json["height"] = height.asJSON() - } - if let size = self.size { - json["size"] = size.asJSON() - } - if let title = self.title { - json["title"] = title.asJSON() - } - if let url = self.url { - json["url"] = url.asJSON() - } - if let width = self.width { - json["width"] = width.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/ImagingObjectSelection.swift b/Sources/Models/ImagingObjectSelection.swift index 8d6c8a1e..9c0663a7 100644 --- a/Sources/Models/ImagingObjectSelection.swift +++ b/Sources/Models/ImagingObjectSelection.swift @@ -2,7 +2,7 @@ // ImagingObjectSelection.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ImagingObjectSelection) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImagingObjectSelection) on 2016-08-09. // 2016, SMART Health IT. // @@ -28,7 +28,7 @@ public class ImagingObjectSelection: DomainResource { /// Author (human or machine). public var author: Reference? - /// Time when the imaging object selection was created. + /// Authoring time of the selection. public var authoringTime: DateTime? /// Description text. @@ -304,10 +304,9 @@ public class ImagingObjectSelectionStudySeries: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(instance: [ImagingObjectSelectionStudySeriesInstance], uid: String) { + public convenience init(instance: [ImagingObjectSelectionStudySeriesInstance]) { self.init(json: nil) self.instance = instance - self.uid = uid } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { @@ -334,9 +333,6 @@ public class ImagingObjectSelectionStudySeries: BackboneElement { errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "uid")) - } if let exist: AnyObject = js["url"] { presentKeys.insert("url") if let val = exist as? String { @@ -379,7 +375,7 @@ public class ImagingObjectSelectionStudySeriesInstance: BackboneElement { } /// The frame set. - public var frame: [ImagingObjectSelectionStudySeriesInstanceFrame]? + public var frames: [ImagingObjectSelectionStudySeriesInstanceFrames]? /// SOP class UID of instance. public var sopClass: String? @@ -407,13 +403,13 @@ public class ImagingObjectSelectionStudySeriesInstance: BackboneElement { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["frame"] { - presentKeys.insert("frame") + if let exist: AnyObject = js["frames"] { + presentKeys.insert("frames") if let val = exist as? [FHIRJSON] { - self.frame = ImagingObjectSelectionStudySeriesInstanceFrame.instantiate(fromArray: val, owner: self) as? [ImagingObjectSelectionStudySeriesInstanceFrame] + self.frames = ImagingObjectSelectionStudySeriesInstanceFrames.instantiate(fromArray: val, owner: self) as? [ImagingObjectSelectionStudySeriesInstanceFrames] } else { - errors.append(FHIRJSONError(key: "frame", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "frames", wants: Array.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["sopClass"] { @@ -459,8 +455,8 @@ public class ImagingObjectSelectionStudySeriesInstance: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let frame = self.frame { - json["frame"] = ImagingObjectSelectionStudySeriesInstanceFrame.asJSONArray(frame) + if let frames = self.frames { + json["frames"] = ImagingObjectSelectionStudySeriesInstanceFrames.asJSONArray(frames) } if let sopClass = self.sopClass { json["sopClass"] = sopClass.asJSON() @@ -482,13 +478,13 @@ public class ImagingObjectSelectionStudySeriesInstance: BackboneElement { * * Identity and location information of the frames in the selected instance. */ -public class ImagingObjectSelectionStudySeriesInstanceFrame: BackboneElement { +public class ImagingObjectSelectionStudySeriesInstanceFrames: BackboneElement { override public class var resourceName: String { - get { return "ImagingObjectSelectionStudySeriesInstanceFrame" } + get { return "ImagingObjectSelectionStudySeriesInstanceFrames" } } - /// Frame reference number. - public var number: [UInt]? + /// Frame numbers. + public var frameNumbers: [UInt]? /// Retrieve frame URL. public var url: URL? @@ -500,26 +496,26 @@ public class ImagingObjectSelectionStudySeriesInstanceFrame: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(number: [UInt], url: URL) { + public convenience init(frameNumbers: [UInt], url: URL) { self.init(json: nil) - self.number = number + self.frameNumbers = frameNumbers self.url = url } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["number"] { - presentKeys.insert("number") + if let exist: AnyObject = js["frameNumbers"] { + presentKeys.insert("frameNumbers") if let val = exist as? [UInt] { - self.number = val + self.frameNumbers = val } else { - errors.append(FHIRJSONError(key: "number", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "frameNumbers", wants: Array.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "number")) + errors.append(FHIRJSONError(key: "frameNumbers")) } if let exist: AnyObject = js["url"] { presentKeys.insert("url") @@ -540,12 +536,12 @@ public class ImagingObjectSelectionStudySeriesInstanceFrame: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let number = self.number { + if let frameNumbers = self.frameNumbers { var arr = [AnyObject]() - for val in number { + for val in frameNumbers { arr.append(val.asJSON()) } - json["number"] = arr + json["frameNumbers"] = arr } if let url = self.url { json["url"] = url.asJSON() diff --git a/Sources/Models/ImagingStudy.swift b/Sources/Models/ImagingStudy.swift index 988dcff2..1be1dce2 100644 --- a/Sources/Models/ImagingStudy.swift +++ b/Sources/Models/ImagingStudy.swift @@ -2,7 +2,7 @@ // ImagingStudy.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ImagingStudy) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImagingStudy) on 2016-08-09. // 2016, SMART Health IT. // @@ -321,7 +321,7 @@ public class ImagingStudySeries: BackboneElement { /// Body part examined. public var bodySite: Coding? - /// A short human readable summary of the series. + /// A description of the series. public var description_fhir: String? /// A single SOP instance from the series. @@ -529,7 +529,7 @@ public class ImagingStudySeriesInstance: BackboneElement { get { return "ImagingStudySeriesInstance" } } - /// The instance payload, such as the image binary data or URL to it. + /// Content of the instance. public var content: [Attachment]? /// The number of this instance in the series. diff --git a/Sources/Models/Immunization.swift b/Sources/Models/Immunization.swift index 7203f198..59315f18 100644 --- a/Sources/Models/Immunization.swift +++ b/Sources/Models/Immunization.swift @@ -2,7 +2,7 @@ // Immunization.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Immunization) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Immunization) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/ImmunizationRecommendation.swift b/Sources/Models/ImmunizationRecommendation.swift index 04520dea..85c5d86c 100644 --- a/Sources/Models/ImmunizationRecommendation.swift +++ b/Sources/Models/ImmunizationRecommendation.swift @@ -2,7 +2,7 @@ // ImmunizationRecommendation.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/ImplementationGuide.swift b/Sources/Models/ImplementationGuide.swift index 2ae9fbb6..67904517 100644 --- a/Sources/Models/ImplementationGuide.swift +++ b/Sources/Models/ImplementationGuide.swift @@ -2,7 +2,7 @@ // ImplementationGuide.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ImplementationGuide) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImplementationGuide) on 2016-08-09. // 2016, SMART Health IT. // @@ -336,7 +336,7 @@ public class ImplementationGuideContact: BackboneElement { get { return "ImplementationGuideContact" } } - /// Name of an individual to contact. + /// Name of a individual to contact. public var name: String? /// Contact details for individual or publisher. @@ -647,15 +647,15 @@ public class ImplementationGuidePackageResource: BackboneElement { /// Reason why included in guide. public var description_fhir: String? - /// If not an example, has it's normal meaning. - public var example: Bool? - /// Resource this is an example of (if applicable). public var exampleFor: Reference? /// Human Name for the resource. public var name: String? + /// example | terminology | profile | extension | dictionary | logical. + public var purpose: String? + /// Location of the resource. public var sourceReference: Reference? @@ -669,9 +669,9 @@ public class ImplementationGuidePackageResource: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(example: Bool, sourceReference: Reference, sourceUri: URL) { + public convenience init(purpose: String, sourceReference: Reference, sourceUri: URL) { self.init(json: nil) - self.example = example + self.purpose = purpose self.sourceReference = sourceReference self.sourceUri = sourceUri } @@ -697,18 +697,6 @@ public class ImplementationGuidePackageResource: BackboneElement { errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["example"] { - presentKeys.insert("example") - if let val = exist as? Bool { - self.example = val - } - else { - errors.append(FHIRJSONError(key: "example", wants: Bool.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "example")) - } if let exist: AnyObject = js["exampleFor"] { presentKeys.insert("exampleFor") if let val = exist as? FHIRJSON { @@ -727,6 +715,18 @@ public class ImplementationGuidePackageResource: BackboneElement { errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["purpose"] { + presentKeys.insert("purpose") + if let val = exist as? String { + self.purpose = val + } + else { + errors.append(FHIRJSONError(key: "purpose", wants: String.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "purpose")) + } if let exist: AnyObject = js["sourceReference"] { presentKeys.insert("sourceReference") if let val = exist as? FHIRJSON { @@ -763,15 +763,15 @@ public class ImplementationGuidePackageResource: BackboneElement { if let description_fhir = self.description_fhir { json["description"] = description_fhir.asJSON() } - if let example = self.example { - json["example"] = example.asJSON() - } if let exampleFor = self.exampleFor { json["exampleFor"] = exampleFor.asJSON() } if let name = self.name { json["name"] = name.asJSON() } + if let purpose = self.purpose { + json["purpose"] = purpose.asJSON() + } if let sourceReference = self.sourceReference { json["sourceReference"] = sourceReference.asJSON() } diff --git a/Sources/Models/Library.swift b/Sources/Models/Library.swift deleted file mode 100644 index d1be2f3d..00000000 --- a/Sources/Models/Library.swift +++ /dev/null @@ -1,565 +0,0 @@ -// -// Library.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Library) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * Represents a library of quality improvement components. - * - * The Library resource provides a representation container for knowledge artifact component definitions. It is - * effectively an exposure of the header information for a CQL/ELM library. - */ -public class Library: DomainResource { - override public class var resourceName: String { - get { return "Library" } - } - - /// A code system used by the library. - public var codeSystem: [LibraryCodeSystem]? - - /// Data requirements of the library. - public var dataRequirement: [DataRequirement]? - - /// The content of the library. - public var document: Attachment? - - /// A library referenced by this library. - public var library: [LibraryLibrary]? - - /// A model used by the library. - public var model: [LibraryModel]? - - /// The metadata information for the library. - public var moduleMetadata: ModuleMetadata? - - /// Parameters defined by the library. - public var parameter: [ParameterDefinition]? - - /// A value set used by the library. - public var valueSet: [LibraryValueSet]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(document: Attachment) { - self.init(json: nil) - self.document = document - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["codeSystem"] { - presentKeys.insert("codeSystem") - if let val = exist as? [FHIRJSON] { - self.codeSystem = LibraryCodeSystem.instantiate(fromArray: val, owner: self) as? [LibraryCodeSystem] - } - else { - errors.append(FHIRJSONError(key: "codeSystem", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["dataRequirement"] { - presentKeys.insert("dataRequirement") - if let val = exist as? [FHIRJSON] { - self.dataRequirement = DataRequirement.instantiate(fromArray: val, owner: self) as? [DataRequirement] - } - else { - errors.append(FHIRJSONError(key: "dataRequirement", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["document"] { - presentKeys.insert("document") - if let val = exist as? FHIRJSON { - self.document = Attachment(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "document", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "document")) - } - if let exist: AnyObject = js["library"] { - presentKeys.insert("library") - if let val = exist as? [FHIRJSON] { - self.library = LibraryLibrary.instantiate(fromArray: val, owner: self) as? [LibraryLibrary] - } - else { - errors.append(FHIRJSONError(key: "library", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["model"] { - presentKeys.insert("model") - if let val = exist as? [FHIRJSON] { - self.model = LibraryModel.instantiate(fromArray: val, owner: self) as? [LibraryModel] - } - else { - errors.append(FHIRJSONError(key: "model", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["moduleMetadata"] { - presentKeys.insert("moduleMetadata") - if let val = exist as? FHIRJSON { - self.moduleMetadata = ModuleMetadata(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "moduleMetadata", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["parameter"] { - presentKeys.insert("parameter") - if let val = exist as? [FHIRJSON] { - self.parameter = ParameterDefinition.instantiate(fromArray: val, owner: self) as? [ParameterDefinition] - } - else { - errors.append(FHIRJSONError(key: "parameter", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueSet"] { - presentKeys.insert("valueSet") - if let val = exist as? [FHIRJSON] { - self.valueSet = LibraryValueSet.instantiate(fromArray: val, owner: self) as? [LibraryValueSet] - } - else { - errors.append(FHIRJSONError(key: "valueSet", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let codeSystem = self.codeSystem { - json["codeSystem"] = LibraryCodeSystem.asJSONArray(codeSystem) - } - if let dataRequirement = self.dataRequirement { - json["dataRequirement"] = DataRequirement.asJSONArray(dataRequirement) - } - if let document = self.document { - json["document"] = document.asJSON() - } - if let library = self.library { - json["library"] = LibraryLibrary.asJSONArray(library) - } - if let model = self.model { - json["model"] = LibraryModel.asJSONArray(model) - } - if let moduleMetadata = self.moduleMetadata { - json["moduleMetadata"] = moduleMetadata.asJSON() - } - if let parameter = self.parameter { - json["parameter"] = ParameterDefinition.asJSONArray(parameter) - } - if let valueSet = self.valueSet { - json["valueSet"] = LibraryValueSet.asJSONArray(valueSet) - } - - return json - } -} - - -/** - * A code system used by the library. - * - * A code system definition used within the library. - */ -public class LibraryCodeSystem: BackboneElement { - override public class var resourceName: String { - get { return "LibraryCodeSystem" } - } - - /// The identifier of the code system. - public var identifier: String? - - /// Name of the code system. - public var name: String? - - /// The version of the code system, if any. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: String) { - self.init(json: nil) - self.identifier = identifier - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? String { - self.identifier = val - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * A library referenced by this library. - * - * A library element describes a library referenced by this library. - */ -public class LibraryLibrary: BackboneElement { - override public class var resourceName: String { - get { return "LibraryLibrary" } - } - - /// The content of the library. - public var documentAttachment: Attachment? - - /// The content of the library. - public var documentReference: Reference? - - /// The identifier of the library. - public var identifier: String? - - /// Name of the library. - public var name: String? - - /// The version of the library, if any. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: String) { - self.init(json: nil) - self.identifier = identifier - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["documentAttachment"] { - presentKeys.insert("documentAttachment") - if let val = exist as? FHIRJSON { - self.documentAttachment = Attachment(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "documentAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["documentReference"] { - presentKeys.insert("documentReference") - if let val = exist as? FHIRJSON { - self.documentReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "documentReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? String { - self.identifier = val - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let documentAttachment = self.documentAttachment { - json["documentAttachment"] = documentAttachment.asJSON() - } - if let documentReference = self.documentReference { - json["documentReference"] = documentReference.asJSON() - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * A model used by the library. - * - * A model element describes the model and version used by the library. - */ -public class LibraryModel: BackboneElement { - override public class var resourceName: String { - get { return "LibraryModel" } - } - - /// The identifier of the model. - public var identifier: String? - - /// Name of the model. - public var name: String? - - /// The version of the model, if any. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: String) { - self.init(json: nil) - self.identifier = identifier - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? String { - self.identifier = val - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * A value set used by the library. - * - * A value set definition referenced by the library. - */ -public class LibraryValueSet: BackboneElement { - override public class var resourceName: String { - get { return "LibraryValueSet" } - } - - /// The code system binding for this value set definition. - public var codeSystem: [String]? - - /// The identifier of the value set. - public var identifier: String? - - /// Name of the value set. - public var name: String? - - /// The version of the value set. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: String) { - self.init(json: nil) - self.identifier = identifier - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["codeSystem"] { - presentKeys.insert("codeSystem") - if let val = exist as? [String] { - self.codeSystem = val - } - else { - errors.append(FHIRJSONError(key: "codeSystem", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? String { - self.identifier = val - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let codeSystem = self.codeSystem { - var arr = [AnyObject]() - for val in codeSystem { - arr.append(val.asJSON()) - } - json["codeSystem"] = arr - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Linkage.swift b/Sources/Models/Linkage.swift deleted file mode 100644 index 3ecc3eb1..00000000 --- a/Sources/Models/Linkage.swift +++ /dev/null @@ -1,157 +0,0 @@ -// -// Linkage.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Linkage) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * Links records for 'same' item. - * - * Identifies two or more records (resource instances) that are referring to the same real-world "occurrence". - */ -public class Linkage: DomainResource { - override public class var resourceName: String { - get { return "Linkage" } - } - - /// Who is responsible for linkages. - public var author: Reference? - - /// Item to be linked. - public var item: [LinkageItem]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(item: [LinkageItem]) { - self.init(json: nil) - self.item = item - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["author"] { - presentKeys.insert("author") - if let val = exist as? FHIRJSON { - self.author = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["item"] { - presentKeys.insert("item") - if let val = exist as? [FHIRJSON] { - self.item = LinkageItem.instantiate(fromArray: val, owner: self) as? [LinkageItem] - } - else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "item")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let author = self.author { - json["author"] = author.asJSON() - } - if let item = self.item { - json["item"] = LinkageItem.asJSONArray(item) - } - - return json - } -} - - -/** - * 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. - */ -public class LinkageItem: BackboneElement { - override public class var resourceName: String { - get { return "LinkageItem" } - } - - /// Resource being linked. - public var resource: Reference? - - /// source | alternate | historical. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(resource: Reference, type: String) { - self.init(json: nil) - self.resource = resource - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["resource"] { - presentKeys.insert("resource") - if let val = exist as? FHIRJSON { - self.resource = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "resource")) - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let resource = self.resource { - json["resource"] = resource.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/List.swift b/Sources/Models/List.swift index 2ce791bd..cd13a38f 100644 --- a/Sources/Models/List.swift +++ b/Sources/Models/List.swift @@ -2,7 +2,7 @@ // List.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/List) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/List) on 2016-08-09. // 2016, SMART Health IT. // @@ -41,7 +41,7 @@ public class List: DomainResource { public var mode: String? /// Comments about the list. - public var note: [Annotation]? + public var note: String? /// What order the list has. public var orderedBy: CodeableConcept? @@ -142,11 +142,11 @@ public class List: DomainResource { } if let exist: AnyObject = js["note"] { presentKeys.insert("note") - if let val = exist as? [FHIRJSON] { - self.note = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] + if let val = exist as? String { + self.note = val } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["orderedBy"] { @@ -226,7 +226,7 @@ public class List: DomainResource { json["mode"] = mode.asJSON() } if let note = self.note { - json["note"] = Annotation.asJSONArray(note) + json["note"] = note.asJSON() } if let orderedBy = self.orderedBy { json["orderedBy"] = orderedBy.asJSON() diff --git a/Sources/Models/Location.swift b/Sources/Models/Location.swift index 22b6fa16..65c8d67a 100644 --- a/Sources/Models/Location.swift +++ b/Sources/Models/Location.swift @@ -2,7 +2,7 @@ // Location.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Location) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Location) on 2016-08-09. // 2016, SMART Health IT. // @@ -23,7 +23,7 @@ public class Location: DomainResource { /// Physical location. public var address: Address? - /// Additional details about the location that could be displayed as further information to identify the location beyond its name. + /// Description of the location. public var description_fhir: String? /// Unique code or number identifying the location to its users. diff --git a/Sources/Models/Measure.swift b/Sources/Models/Measure.swift deleted file mode 100644 index 2ee64566..00000000 --- a/Sources/Models/Measure.swift +++ /dev/null @@ -1,704 +0,0 @@ -// -// Measure.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Measure) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * A quality measure. - * - * The Measure resource provides the definition of a quality measure. - */ -public class Measure: DomainResource { - override public class var resourceName: String { - get { return "Measure" } - } - - /// Clinical recommendation. - public var clinicalRecommendationStatement: String? - - /// A natural language definition of the measure. - public var definition: String? - - /// Disclaimer for the measure. - public var disclaimer: String? - - /// Population criteria group. - public var group: [MeasureGroup]? - - /// The guidance for the measure. - public var guidance: String? - - /// Improvement notation for the measure, e.g. higher score indicates better quality. - public var improvementNotation: String? - - /// Logic used by the measure. - public var library: [Reference]? - - /// Metadata for the measure. - public var moduleMetadata: ModuleMetadata? - - /// How is rate aggregation performed for this measure. - public var rateAggregation: String? - - /// Why does this measure exist. - public var rationale: String? - - /// How is risk adjustment applied for this measure. - public var riskAdjustment: String? - - /// proportion | ratio | continuous-variable | cohort. - public var scoring: String? - - /// The measure set, e.g. Preventive Care and Screening. - public var set: String? - - /// Supplemental data. - public var supplementalData: [MeasureSupplementalData]? - - /// process | outcome. - public var type: [String]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["clinicalRecommendationStatement"] { - presentKeys.insert("clinicalRecommendationStatement") - if let val = exist as? String { - self.clinicalRecommendationStatement = val - } - else { - errors.append(FHIRJSONError(key: "clinicalRecommendationStatement", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["definition"] { - presentKeys.insert("definition") - if let val = exist as? String { - self.definition = val - } - else { - errors.append(FHIRJSONError(key: "definition", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["disclaimer"] { - presentKeys.insert("disclaimer") - if let val = exist as? String { - self.disclaimer = val - } - else { - errors.append(FHIRJSONError(key: "disclaimer", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["group"] { - presentKeys.insert("group") - if let val = exist as? [FHIRJSON] { - self.group = MeasureGroup.instantiate(fromArray: val, owner: self) as? [MeasureGroup] - } - else { - errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["guidance"] { - presentKeys.insert("guidance") - if let val = exist as? String { - self.guidance = val - } - else { - errors.append(FHIRJSONError(key: "guidance", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["improvementNotation"] { - presentKeys.insert("improvementNotation") - if let val = exist as? String { - self.improvementNotation = val - } - else { - errors.append(FHIRJSONError(key: "improvementNotation", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["library"] { - presentKeys.insert("library") - if let val = exist as? [FHIRJSON] { - self.library = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "library", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["moduleMetadata"] { - presentKeys.insert("moduleMetadata") - if let val = exist as? FHIRJSON { - self.moduleMetadata = ModuleMetadata(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "moduleMetadata", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["rateAggregation"] { - presentKeys.insert("rateAggregation") - if let val = exist as? String { - self.rateAggregation = val - } - else { - errors.append(FHIRJSONError(key: "rateAggregation", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["rationale"] { - presentKeys.insert("rationale") - if let val = exist as? String { - self.rationale = val - } - else { - errors.append(FHIRJSONError(key: "rationale", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["riskAdjustment"] { - presentKeys.insert("riskAdjustment") - if let val = exist as? String { - self.riskAdjustment = val - } - else { - errors.append(FHIRJSONError(key: "riskAdjustment", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["scoring"] { - presentKeys.insert("scoring") - if let val = exist as? String { - self.scoring = val - } - else { - errors.append(FHIRJSONError(key: "scoring", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["set"] { - presentKeys.insert("set") - if let val = exist as? String { - self.set = val - } - else { - errors.append(FHIRJSONError(key: "set", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["supplementalData"] { - presentKeys.insert("supplementalData") - if let val = exist as? [FHIRJSON] { - self.supplementalData = MeasureSupplementalData.instantiate(fromArray: val, owner: self) as? [MeasureSupplementalData] - } - else { - errors.append(FHIRJSONError(key: "supplementalData", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? [String] { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let clinicalRecommendationStatement = self.clinicalRecommendationStatement { - json["clinicalRecommendationStatement"] = clinicalRecommendationStatement.asJSON() - } - if let definition = self.definition { - json["definition"] = definition.asJSON() - } - if let disclaimer = self.disclaimer { - json["disclaimer"] = disclaimer.asJSON() - } - if let group = self.group { - json["group"] = MeasureGroup.asJSONArray(group) - } - if let guidance = self.guidance { - json["guidance"] = guidance.asJSON() - } - if let improvementNotation = self.improvementNotation { - json["improvementNotation"] = improvementNotation.asJSON() - } - if let library = self.library { - json["library"] = Reference.asJSONArray(library) - } - if let moduleMetadata = self.moduleMetadata { - json["moduleMetadata"] = moduleMetadata.asJSON() - } - if let rateAggregation = self.rateAggregation { - json["rateAggregation"] = rateAggregation.asJSON() - } - if let rationale = self.rationale { - json["rationale"] = rationale.asJSON() - } - if let riskAdjustment = self.riskAdjustment { - json["riskAdjustment"] = riskAdjustment.asJSON() - } - if let scoring = self.scoring { - json["scoring"] = scoring.asJSON() - } - if let set = self.set { - json["set"] = set.asJSON() - } - if let supplementalData = self.supplementalData { - json["supplementalData"] = MeasureSupplementalData.asJSONArray(supplementalData) - } - if let type = self.type { - var arr = [AnyObject]() - for val in type { - arr.append(val.asJSON()) - } - json["type"] = arr - } - - return json - } -} - - -/** - * Population criteria group. - * - * A group of population criteria for the measure. - */ -public class MeasureGroup: BackboneElement { - override public class var resourceName: String { - get { return "MeasureGroup" } - } - - /// Summary description. - public var description_fhir: String? - - /// Unique identifier. - public var identifier: Identifier? - - /// Short name. - public var name: String? - - /// Population criteria. - public var population: [MeasureGroupPopulation]? - - /// Stratifier criteria for the measure. - public var stratifier: [MeasureGroupStratifier]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: Identifier) { - self.init(json: nil) - self.identifier = identifier - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["population"] { - presentKeys.insert("population") - if let val = exist as? [FHIRJSON] { - self.population = MeasureGroupPopulation.instantiate(fromArray: val, owner: self) as? [MeasureGroupPopulation] - } - else { - errors.append(FHIRJSONError(key: "population", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["stratifier"] { - presentKeys.insert("stratifier") - if let val = exist as? [FHIRJSON] { - self.stratifier = MeasureGroupStratifier.instantiate(fromArray: val, owner: self) as? [MeasureGroupStratifier] - } - else { - errors.append(FHIRJSONError(key: "stratifier", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let population = self.population { - json["population"] = MeasureGroupPopulation.asJSONArray(population) - } - if let stratifier = self.stratifier { - json["stratifier"] = MeasureGroupStratifier.asJSONArray(stratifier) - } - - return json - } -} - - -/** - * Population criteria. - * - * A population criteria for the measure. - */ -public class MeasureGroupPopulation: BackboneElement { - override public class var resourceName: String { - get { return "MeasureGroupPopulation" } - } - - /// The name of a valid referenced CQL expression (may be namespaced) that defines this population criteria. - public var criteria: String? - - /// The human readable description of this population criteria. - public var description_fhir: String? - - /// Unique identifier. - public var identifier: Identifier? - - /// Short name. - public var name: String? - - /// initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-score. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(criteria: String, identifier: Identifier, type: String) { - self.init(json: nil) - self.criteria = criteria - self.identifier = identifier - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["criteria"] { - presentKeys.insert("criteria") - if let val = exist as? String { - self.criteria = val - } - else { - errors.append(FHIRJSONError(key: "criteria", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "criteria")) - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let criteria = self.criteria { - json["criteria"] = criteria.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * 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. - */ -public class MeasureGroupStratifier: BackboneElement { - override public class var resourceName: String { - get { return "MeasureGroupStratifier" } - } - - /// Stratifier criteria. - public var criteria: String? - - /// The identifier for the stratifier used to coordinate the reported data back to this stratifier. - public var identifier: Identifier? - - /// Path to the stratifier. - public var path: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: Identifier) { - self.init(json: nil) - self.identifier = identifier - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["criteria"] { - presentKeys.insert("criteria") - if let val = exist as? String { - self.criteria = val - } - else { - errors.append(FHIRJSONError(key: "criteria", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["path"] { - presentKeys.insert("path") - if let val = exist as? String { - self.path = val - } - else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let criteria = self.criteria { - json["criteria"] = criteria.asJSON() - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let path = self.path { - json["path"] = path.asJSON() - } - - return json - } -} - - -/** - * Supplemental data. - * - * 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. - */ -public class MeasureSupplementalData: BackboneElement { - override public class var resourceName: String { - get { return "MeasureSupplementalData" } - } - - /// Supplemental data criteria. - public var criteria: String? - - /// Identifier, unique within the measure. - public var identifier: Identifier? - - /// Path to the supplemental data element. - public var path: String? - - /// supplemental-data | risk-adjustment-factor. - public var usage: [String]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: Identifier) { - self.init(json: nil) - self.identifier = identifier - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["criteria"] { - presentKeys.insert("criteria") - if let val = exist as? String { - self.criteria = val - } - else { - errors.append(FHIRJSONError(key: "criteria", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["path"] { - presentKeys.insert("path") - if let val = exist as? String { - self.path = val - } - else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["usage"] { - presentKeys.insert("usage") - if let val = exist as? [String] { - self.usage = val - } - else { - errors.append(FHIRJSONError(key: "usage", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let criteria = self.criteria { - json["criteria"] = criteria.asJSON() - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let path = self.path { - json["path"] = path.asJSON() - } - if let usage = self.usage { - var arr = [AnyObject]() - for val in usage { - arr.append(val.asJSON()) - } - json["usage"] = arr - } - - return json - } -} - diff --git a/Sources/Models/MeasureReport.swift b/Sources/Models/MeasureReport.swift deleted file mode 100644 index b39e7674..00000000 --- a/Sources/Models/MeasureReport.swift +++ /dev/null @@ -1,804 +0,0 @@ -// -// MeasureReport.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/MeasureReport) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * Results of a measure evaluation. - * - * The MeasureReport resource contains the results of evaluating a measure. - */ -public class MeasureReport: DomainResource { - override public class var resourceName: String { - get { return "MeasureReport" } - } - - /// Date the report was generated. - public var date: DateTime? - - /// Evaluated Resources. - public var evaluatedResources: Reference? - - /// Measure results for each group. - public var group: [MeasureReportGroup]? - - /// Measure that was evaluated. - public var measure: Reference? - - /// Optional Patient. - public var patient: Reference? - - /// Reporting period. - public var period: Period? - - /// Reporting Organization. - public var reportingOrganization: Reference? - - /// complete | pending | error. - public var status: String? - - /// individual | patient-list | summary. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(measure: Reference, period: Period, status: String, type: String) { - self.init(json: nil) - self.measure = measure - self.period = period - self.status = status - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["date"] { - presentKeys.insert("date") - if let val = exist as? String { - self.date = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["evaluatedResources"] { - presentKeys.insert("evaluatedResources") - if let val = exist as? FHIRJSON { - self.evaluatedResources = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "evaluatedResources", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["group"] { - presentKeys.insert("group") - if let val = exist as? [FHIRJSON] { - self.group = MeasureReportGroup.instantiate(fromArray: val, owner: self) as? [MeasureReportGroup] - } - else { - errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["measure"] { - presentKeys.insert("measure") - if let val = exist as? FHIRJSON { - self.measure = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "measure", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "measure")) - } - if let exist: AnyObject = js["patient"] { - presentKeys.insert("patient") - if let val = exist as? FHIRJSON { - self.patient = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["period"] { - presentKeys.insert("period") - if let val = exist as? FHIRJSON { - self.period = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "period")) - } - if let exist: AnyObject = js["reportingOrganization"] { - presentKeys.insert("reportingOrganization") - if let val = exist as? FHIRJSON { - self.reportingOrganization = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "reportingOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["status"] { - presentKeys.insert("status") - if let val = exist as? String { - self.status = val - } - else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "status")) - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let date = self.date { - json["date"] = date.asJSON() - } - if let evaluatedResources = self.evaluatedResources { - json["evaluatedResources"] = evaluatedResources.asJSON() - } - if let group = self.group { - json["group"] = MeasureReportGroup.asJSONArray(group) - } - if let measure = self.measure { - json["measure"] = measure.asJSON() - } - if let patient = self.patient { - json["patient"] = patient.asJSON() - } - if let period = self.period { - json["period"] = period.asJSON() - } - if let reportingOrganization = self.reportingOrganization { - json["reportingOrganization"] = reportingOrganization.asJSON() - } - if let status = self.status { - json["status"] = status.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Measure results for each group. - * - * The results of the calculation, one for each population group in the measure. - */ -public class MeasureReportGroup: BackboneElement { - override public class var resourceName: String { - get { return "MeasureReportGroup" } - } - - /// Identifier of the population group being reported. - public var identifier: Identifier? - - /// The measure score. - public var measureScore: NSDecimalNumber? - - /// The populations in the group. - public var population: [MeasureReportGroupPopulation]? - - /// Stratification results. - public var stratifier: [MeasureReportGroupStratifier]? - - /// Supplemental data elements for the measure. - public var supplementalData: [MeasureReportGroupSupplementalData]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: Identifier) { - self.init(json: nil) - self.identifier = identifier - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["measureScore"] { - presentKeys.insert("measureScore") - if let val = exist as? NSNumber { - self.measureScore = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "measureScore", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["population"] { - presentKeys.insert("population") - if let val = exist as? [FHIRJSON] { - self.population = MeasureReportGroupPopulation.instantiate(fromArray: val, owner: self) as? [MeasureReportGroupPopulation] - } - else { - errors.append(FHIRJSONError(key: "population", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["stratifier"] { - presentKeys.insert("stratifier") - if let val = exist as? [FHIRJSON] { - self.stratifier = MeasureReportGroupStratifier.instantiate(fromArray: val, owner: self) as? [MeasureReportGroupStratifier] - } - else { - errors.append(FHIRJSONError(key: "stratifier", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["supplementalData"] { - presentKeys.insert("supplementalData") - if let val = exist as? [FHIRJSON] { - self.supplementalData = MeasureReportGroupSupplementalData.instantiate(fromArray: val, owner: self) as? [MeasureReportGroupSupplementalData] - } - else { - errors.append(FHIRJSONError(key: "supplementalData", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let measureScore = self.measureScore { - json["measureScore"] = measureScore.asJSON() - } - if let population = self.population { - json["population"] = MeasureReportGroupPopulation.asJSONArray(population) - } - if let stratifier = self.stratifier { - json["stratifier"] = MeasureReportGroupStratifier.asJSONArray(stratifier) - } - if let supplementalData = self.supplementalData { - json["supplementalData"] = MeasureReportGroupSupplementalData.asJSONArray(supplementalData) - } - - return json - } -} - - -/** - * The populations in the group. - * - * The populations that make up the population group, one for each type of population appropriate for the measure. - */ -public class MeasureReportGroupPopulation: BackboneElement { - override public class var resourceName: String { - get { return "MeasureReportGroupPopulation" } - } - - /// Size of the population. - public var count: Int? - - /// For patient-list reports, the patients in this population. - public var patients: Reference? - - /// initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-score. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String) { - self.init(json: nil) - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["count"] { - presentKeys.insert("count") - if let val = exist as? Int { - self.count = val - } - else { - errors.append(FHIRJSONError(key: "count", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["patients"] { - presentKeys.insert("patients") - if let val = exist as? FHIRJSON { - self.patients = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "patients", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let count = self.count { - json["count"] = count.asJSON() - } - if let patients = self.patients { - json["patients"] = patients.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Stratification results. - * - * When a measure includes multiple stratifiers, there will be a stratifier group for each stratifier defined by the - * measure. - */ -public class MeasureReportGroupStratifier: BackboneElement { - override public class var resourceName: String { - get { return "MeasureReportGroupStratifier" } - } - - /// Stratum results, one for each unique value in the stratifier. - public var group: [MeasureReportGroupStratifierGroup]? - - /// Identifier of the stratifier. - public var identifier: Identifier? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: Identifier) { - self.init(json: nil) - self.identifier = identifier - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["group"] { - presentKeys.insert("group") - if let val = exist as? [FHIRJSON] { - self.group = MeasureReportGroupStratifierGroup.instantiate(fromArray: val, owner: self) as? [MeasureReportGroupStratifierGroup] - } - else { - errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let group = self.group { - json["group"] = MeasureReportGroupStratifierGroup.asJSONArray(group) - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - - return json - } -} - - -/** - * 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. - */ -public class MeasureReportGroupStratifierGroup: BackboneElement { - override public class var resourceName: String { - get { return "MeasureReportGroupStratifierGroup" } - } - - /// The measure score. - public var measureScore: NSDecimalNumber? - - /// Population results in this stratum. - public var population: [MeasureReportGroupStratifierGroupPopulation]? - - /// The stratum value, e.g. male. - public var value: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(value: String) { - self.init(json: nil) - self.value = value - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["measureScore"] { - presentKeys.insert("measureScore") - if let val = exist as? NSNumber { - self.measureScore = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "measureScore", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["population"] { - presentKeys.insert("population") - if let val = exist as? [FHIRJSON] { - self.population = MeasureReportGroupStratifierGroupPopulation.instantiate(fromArray: val, owner: self) as? [MeasureReportGroupStratifierGroupPopulation] - } - else { - errors.append(FHIRJSONError(key: "population", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? String { - self.value = val - } - else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "value")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let measureScore = self.measureScore { - json["measureScore"] = measureScore.asJSON() - } - if let population = self.population { - json["population"] = MeasureReportGroupStratifierGroupPopulation.asJSONArray(population) - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * Population results in this stratum. - * - * The populations that make up the stratum, one for each type of population appropriate to the measure. - */ -public class MeasureReportGroupStratifierGroupPopulation: BackboneElement { - override public class var resourceName: String { - get { return "MeasureReportGroupStratifierGroupPopulation" } - } - - /// Size of the population. - public var count: Int? - - /// For patient-list reports, the patients in this population. - public var patients: Reference? - - /// initial-population | numerator | numerator-exclusion | denominator | denominator-exclusion | denominator-exception | measure-population | measure-population-exclusion | measure-score. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String) { - self.init(json: nil) - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["count"] { - presentKeys.insert("count") - if let val = exist as? Int { - self.count = val - } - else { - errors.append(FHIRJSONError(key: "count", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["patients"] { - presentKeys.insert("patients") - if let val = exist as? FHIRJSON { - self.patients = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "patients", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let count = self.count { - json["count"] = count.asJSON() - } - if let patients = self.patients { - json["patients"] = patients.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Supplemental data elements for the measure. - * - * Supplemental data elements for the measure provide additional information requested by the measure for each patient - * involved in the populations. - */ -public class MeasureReportGroupSupplementalData: BackboneElement { - override public class var resourceName: String { - get { return "MeasureReportGroupSupplementalData" } - } - - /// Supplemental data results, one for each unique supplemental data value. - public var group: [MeasureReportGroupSupplementalDataGroup]? - - /// Identifier of the supplemental data element. - public var identifier: Identifier? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: Identifier) { - self.init(json: nil) - self.identifier = identifier - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["group"] { - presentKeys.insert("group") - if let val = exist as? [FHIRJSON] { - self.group = MeasureReportGroupSupplementalDataGroup.instantiate(fromArray: val, owner: self) as? [MeasureReportGroupSupplementalDataGroup] - } - else { - errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let group = self.group { - json["group"] = MeasureReportGroupSupplementalDataGroup.asJSONArray(group) - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - - return json - } -} - - -/** - * Supplemental data results, one for each unique supplemental data value. - * - * This element contains the results for a single value within the supplemental data. For example, when reporting - * supplemental data for administrative gender, there will be four groups, one for each possible gender value. - */ -public class MeasureReportGroupSupplementalDataGroup: BackboneElement { - override public class var resourceName: String { - get { return "MeasureReportGroupSupplementalDataGroup" } - } - - /// Number of members in the group. - public var count: Int? - - /// For patient-list reports, the patients in this population. - public var patients: Reference? - - /// The data value, e.g. male. - public var value: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(value: String) { - self.init(json: nil) - self.value = value - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["count"] { - presentKeys.insert("count") - if let val = exist as? Int { - self.count = val - } - else { - errors.append(FHIRJSONError(key: "count", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["patients"] { - presentKeys.insert("patients") - if let val = exist as? FHIRJSON { - self.patients = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "patients", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? String { - self.value = val - } - else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "value")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let count = self.count { - json["count"] = count.asJSON() - } - if let patients = self.patients { - json["patients"] = patients.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Media.swift b/Sources/Models/Media.swift index dd477f37..a2c4becd 100644 --- a/Sources/Models/Media.swift +++ b/Sources/Models/Media.swift @@ -2,7 +2,7 @@ // Media.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Media) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Media) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Medication.swift b/Sources/Models/Medication.swift index e294fd34..163f0aef 100644 --- a/Sources/Models/Medication.swift +++ b/Sources/Models/Medication.swift @@ -2,7 +2,7 @@ // Medication.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Medication) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Medication) on 2016-08-09. // 2016, SMART Health IT. // @@ -192,11 +192,8 @@ public class MedicationPackageContent: BackboneElement { /// Quantity present in the package. public var amount: Quantity? - /// The item in the package. - public var itemCodeableConcept: CodeableConcept? - - /// The item in the package. - public var itemReference: Reference? + /// A product in the package. + public var item: Reference? /** Initialize with a JSON object. */ @@ -205,10 +202,9 @@ public class MedicationPackageContent: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(itemCodeableConcept: CodeableConcept, itemReference: Reference) { + public convenience init(item: Reference) { self.init(json: nil) - self.itemCodeableConcept = itemCodeableConcept - self.itemReference = itemReference + self.item = item } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { @@ -223,28 +219,17 @@ public class MedicationPackageContent: BackboneElement { errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["itemCodeableConcept"] { - presentKeys.insert("itemCodeableConcept") - if let val = exist as? FHIRJSON { - self.itemCodeableConcept = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "itemCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["itemReference"] { - presentKeys.insert("itemReference") + if let exist: AnyObject = js["item"] { + presentKeys.insert("item") if let val = exist as? FHIRJSON { - self.itemReference = Reference(json: val, owner: self) + self.item = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "itemReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: exist.dynamicType)) } } - - // check if nonoptional expanded properties are present - if nil == self.itemCodeableConcept && nil == self.itemReference { - errors.append(FHIRJSONError(key: "item*")) + else { + errors.append(FHIRJSONError(key: "item")) } } return errors.isEmpty ? nil : errors @@ -256,11 +241,8 @@ public class MedicationPackageContent: BackboneElement { if let amount = self.amount { json["amount"] = amount.asJSON() } - if let itemCodeableConcept = self.itemCodeableConcept { - json["itemCodeableConcept"] = itemCodeableConcept.asJSON() - } - if let itemReference = self.itemReference { - json["itemReference"] = itemReference.asJSON() + if let item = self.item { + json["item"] = item.asJSON() } return json @@ -421,10 +403,7 @@ public class MedicationProductIngredient: BackboneElement { public var amount: Ratio? /// The product contained. - public var itemCodeableConcept: CodeableConcept? - - /// The product contained. - public var itemReference: Reference? + public var item: Reference? /** Initialize with a JSON object. */ @@ -433,10 +412,9 @@ public class MedicationProductIngredient: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(itemCodeableConcept: CodeableConcept, itemReference: Reference) { + public convenience init(item: Reference) { self.init(json: nil) - self.itemCodeableConcept = itemCodeableConcept - self.itemReference = itemReference + self.item = item } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { @@ -451,28 +429,17 @@ public class MedicationProductIngredient: BackboneElement { errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["itemCodeableConcept"] { - presentKeys.insert("itemCodeableConcept") + if let exist: AnyObject = js["item"] { + presentKeys.insert("item") if let val = exist as? FHIRJSON { - self.itemCodeableConcept = CodeableConcept(json: val, owner: self) + self.item = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "itemCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["itemReference"] { - presentKeys.insert("itemReference") - if let val = exist as? FHIRJSON { - self.itemReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "itemReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - - // check if nonoptional expanded properties are present - if nil == self.itemCodeableConcept && nil == self.itemReference { - errors.append(FHIRJSONError(key: "item*")) + else { + errors.append(FHIRJSONError(key: "item")) } } return errors.isEmpty ? nil : errors @@ -484,11 +451,8 @@ public class MedicationProductIngredient: BackboneElement { if let amount = self.amount { json["amount"] = amount.asJSON() } - if let itemCodeableConcept = self.itemCodeableConcept { - json["itemCodeableConcept"] = itemCodeableConcept.asJSON() - } - if let itemReference = self.itemReference { - json["itemReference"] = itemReference.asJSON() + if let item = self.item { + json["item"] = item.asJSON() } return json diff --git a/Sources/Models/MedicationAdministration.swift b/Sources/Models/MedicationAdministration.swift index 287f0855..7a50ada4 100644 --- a/Sources/Models/MedicationAdministration.swift +++ b/Sources/Models/MedicationAdministration.swift @@ -2,7 +2,7 @@ // MedicationAdministration.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/MedicationAdministration) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationAdministration) on 2016-08-09. // 2016, SMART Health IT. // @@ -46,7 +46,7 @@ public class MedicationAdministration: DomainResource { public var medicationReference: Reference? /// Information about the administration. - public var note: [Annotation]? + public var note: String? /// Who received medication. public var patient: Reference? @@ -163,11 +163,11 @@ public class MedicationAdministration: DomainResource { } if let exist: AnyObject = js["note"] { presentKeys.insert("note") - if let val = exist as? [FHIRJSON] { - self.note = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] + if let val = exist as? String { + self.note = val } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["patient"] { @@ -279,7 +279,7 @@ public class MedicationAdministration: DomainResource { json["medicationReference"] = medicationReference.asJSON() } if let note = self.note { - json["note"] = Annotation.asJSONArray(note) + json["note"] = note.asJSON() } if let patient = self.patient { json["patient"] = patient.asJSON() @@ -339,7 +339,7 @@ public class MedicationAdministrationDosage: BackboneElement { /// Body site administered to. public var siteReference: Reference? - /// Free text dosage instructions e.g. SIG. + /// Dosage Instructions. public var text: String? diff --git a/Sources/Models/MedicationDispense.swift b/Sources/Models/MedicationDispense.swift index e7204bf4..9db613ba 100644 --- a/Sources/Models/MedicationDispense.swift +++ b/Sources/Models/MedicationDispense.swift @@ -2,7 +2,7 @@ // MedicationDispense.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/MedicationDispense) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationDispense) on 2016-08-09. // 2016, SMART Health IT. // @@ -24,7 +24,7 @@ public class MedicationDispense: DomainResource { /// Medication order that authorizes the dispense. public var authorizingPrescription: [Reference]? - /// Amount of medication expressed as a timing amount. + /// Days Supply. public var daysSupply: Quantity? /// Where the medication was sent. @@ -46,7 +46,7 @@ public class MedicationDispense: DomainResource { public var medicationReference: Reference? /// Information about the dispense. - public var note: [Annotation]? + public var note: String? /// Who the dispense is for. public var patient: Reference? @@ -162,11 +162,11 @@ public class MedicationDispense: DomainResource { } if let exist: AnyObject = js["note"] { presentKeys.insert("note") - if let val = exist as? [FHIRJSON] { - self.note = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] + if let val = exist as? String { + self.note = val } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["patient"] { @@ -278,7 +278,7 @@ public class MedicationDispense: DomainResource { json["medicationReference"] = medicationReference.asJSON() } if let note = self.note { - json["note"] = Annotation.asJSONArray(note) + json["note"] = note.asJSON() } if let patient = self.patient { json["patient"] = patient.asJSON() @@ -313,8 +313,7 @@ public class MedicationDispense: DomainResource { /** * Medicine administration instructions to the patient/caregiver. * - * Indicates how the medication is to be used by the patient. The pharmacist reviews the medication order prior to - * dispense and updates the dosageInstruction based on the actual product being dispensed. + * Indicates how the medication is to be used by the patient. */ public class MedicationDispenseDosageInstruction: BackboneElement { override public class var resourceName: String { @@ -357,7 +356,7 @@ public class MedicationDispenseDosageInstruction: BackboneElement { /// Body site to administer to. public var siteReference: Reference? - /// Free text dosage instructions e.g. SIG. + /// Dosage Instructions. public var text: String? /// When medication should be administered. @@ -571,7 +570,7 @@ public class MedicationDispenseSubstitution: BackboneElement { /// Who is responsible for the substitution. public var responsibleParty: [Reference]? - /// Code signifying whether a different drug was dispensed from what was prescribed. + /// Type of substitution. public var type: CodeableConcept? diff --git a/Sources/Models/MedicationOrder.swift b/Sources/Models/MedicationOrder.swift index 28b0c0be..665b298e 100644 --- a/Sources/Models/MedicationOrder.swift +++ b/Sources/Models/MedicationOrder.swift @@ -2,7 +2,7 @@ // MedicationOrder.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/MedicationOrder) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationOrder) on 2016-08-09. // 2016, SMART Health IT. // @@ -46,7 +46,7 @@ public class MedicationOrder: DomainResource { public var medicationReference: Reference? /// Information about the prescription. - public var note: [Annotation]? + public var note: String? /// Who prescription is for. public var patient: Reference? @@ -58,13 +58,13 @@ public class MedicationOrder: DomainResource { public var priorPrescription: Reference? /// Reason or indication for writing the prescription. - public var reasonCode: [CodeableConcept]? + public var reasonCodeableConcept: CodeableConcept? /// Why prescription was stopped. public var reasonEnded: CodeableConcept? - /// Condition that supports why the prescription is being written. - public var reasonReference: [Reference]? + /// Reason or indication for writing the prescription. + public var reasonReference: Reference? /// active | on-hold | completed | entered-in-error | stopped | draft. public var status: String? @@ -162,11 +162,11 @@ public class MedicationOrder: DomainResource { } if let exist: AnyObject = js["note"] { presentKeys.insert("note") - if let val = exist as? [FHIRJSON] { - self.note = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] + if let val = exist as? String { + self.note = val } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["patient"] { @@ -196,13 +196,13 @@ public class MedicationOrder: DomainResource { errors.append(FHIRJSONError(key: "priorPrescription", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["reasonCode"] { - presentKeys.insert("reasonCode") - if let val = exist as? [FHIRJSON] { - self.reasonCode = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] + if let exist: AnyObject = js["reasonCodeableConcept"] { + presentKeys.insert("reasonCodeableConcept") + if let val = exist as? FHIRJSON { + self.reasonCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonCode", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["reasonEnded"] { @@ -216,11 +216,11 @@ public class MedicationOrder: DomainResource { } if let exist: AnyObject = js["reasonReference"] { presentKeys.insert("reasonReference") - if let val = exist as? [FHIRJSON] { - self.reasonReference = Reference.instantiate(fromArray: val, owner: self) as? [Reference] + if let val = exist as? FHIRJSON { + self.reasonReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonReference", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["status"] { @@ -278,7 +278,7 @@ public class MedicationOrder: DomainResource { json["medicationReference"] = medicationReference.asJSON() } if let note = self.note { - json["note"] = Annotation.asJSONArray(note) + json["note"] = note.asJSON() } if let patient = self.patient { json["patient"] = patient.asJSON() @@ -289,14 +289,14 @@ public class MedicationOrder: DomainResource { if let priorPrescription = self.priorPrescription { json["priorPrescription"] = priorPrescription.asJSON() } - if let reasonCode = self.reasonCode { - json["reasonCode"] = CodeableConcept.asJSONArray(reasonCode) + if let reasonCodeableConcept = self.reasonCodeableConcept { + json["reasonCodeableConcept"] = reasonCodeableConcept.asJSON() } if let reasonEnded = self.reasonEnded { json["reasonEnded"] = reasonEnded.asJSON() } if let reasonReference = self.reasonReference { - json["reasonReference"] = Reference.asJSONArray(reasonReference) + json["reasonReference"] = reasonReference.asJSON() } if let status = self.status { json["status"] = status.asJSON() @@ -466,9 +466,6 @@ public class MedicationOrderDosageInstruction: BackboneElement { /// Technique for administering medication. public var method: CodeableConcept? - /// Amount of medication per unit of time. - public var rateQuantity: Quantity? - /// Amount of medication per unit of time. public var rateRange: Range? @@ -484,7 +481,7 @@ public class MedicationOrderDosageInstruction: BackboneElement { /// Body site to administer to. public var siteReference: Reference? - /// Free text dosage instructions e.g. SIG. + /// Dosage instructions expressed as text. public var text: String? /// When medication should be administered. @@ -562,15 +559,6 @@ public class MedicationOrderDosageInstruction: BackboneElement { errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["rateQuantity"] { - presentKeys.insert("rateQuantity") - if let val = exist as? FHIRJSON { - self.rateQuantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "rateQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["rateRange"] { presentKeys.insert("rateRange") if let val = exist as? FHIRJSON { @@ -662,9 +650,6 @@ public class MedicationOrderDosageInstruction: BackboneElement { if let method = self.method { json["method"] = method.asJSON() } - if let rateQuantity = self.rateQuantity { - json["rateQuantity"] = rateQuantity.asJSON() - } if let rateRange = self.rateRange { json["rateRange"] = rateRange.asJSON() } diff --git a/Sources/Models/MedicationStatement.swift b/Sources/Models/MedicationStatement.swift index e5880b09..3b3a4055 100644 --- a/Sources/Models/MedicationStatement.swift +++ b/Sources/Models/MedicationStatement.swift @@ -2,7 +2,7 @@ // MedicationStatement.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/MedicationStatement) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationStatement) on 2016-08-09. // 2016, SMART Health IT. // @@ -47,7 +47,7 @@ public class MedicationStatement: DomainResource { /// External identifier. public var identifier: [Identifier]? - /// Person who provided the information about the taking of this medication. + /// None. public var informationSource: Reference? /// What medication was taken. @@ -57,7 +57,7 @@ public class MedicationStatement: DomainResource { public var medicationReference: Reference? /// Further information about the statement. - public var note: [Annotation]? + public var note: String? /// Who is/was taking the medication. public var patient: Reference? @@ -172,11 +172,11 @@ public class MedicationStatement: DomainResource { } if let exist: AnyObject = js["note"] { presentKeys.insert("note") - if let val = exist as? [FHIRJSON] { - self.note = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] + if let val = exist as? String { + self.note = val } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["patient"] { @@ -285,7 +285,7 @@ public class MedicationStatement: DomainResource { json["medicationReference"] = medicationReference.asJSON() } if let note = self.note { - json["note"] = Annotation.asJSONArray(note) + json["note"] = note.asJSON() } if let patient = self.patient { json["patient"] = patient.asJSON() @@ -357,7 +357,7 @@ public class MedicationStatementDosage: BackboneElement { /// Where (on body) medication is/was administered. public var siteReference: Reference? - /// Free text dosage instructions as reported by the information source. + /// Reported dosage information. public var text: String? /// When/how often was medication taken. diff --git a/Sources/Models/MessageHeader.swift b/Sources/Models/MessageHeader.swift index 99a403be..a4f8ffeb 100644 --- a/Sources/Models/MessageHeader.swift +++ b/Sources/Models/MessageHeader.swift @@ -2,7 +2,7 @@ // MessageHeader.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/MessageHeader) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MessageHeader) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Meta.swift b/Sources/Models/Meta.swift index f693097c..37d6645d 100644 --- a/Sources/Models/Meta.swift +++ b/Sources/Models/Meta.swift @@ -2,7 +2,7 @@ // Meta.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Meta) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Meta) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/ModuleDefinition.swift b/Sources/Models/ModuleDefinition.swift deleted file mode 100644 index 4bbc530b..00000000 --- a/Sources/Models/ModuleDefinition.swift +++ /dev/null @@ -1,986 +0,0 @@ -// -// ModuleDefinition.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ModuleDefinition) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * Defines the data requirements information for a quality artifact. - * - * The ModuleDefinition resource defines the data requirements for a quality artifact. - */ -public class ModuleDefinition: DomainResource { - override public class var resourceName: String { - get { return "ModuleDefinition" } - } - - /// None. - public var codeSystem: [ModuleDefinitionCodeSystem]? - - /// Describes a required data item. - public var data: [ModuleDefinitionData]? - - /// Logical identifier. - public var identifier: [Identifier]? - - /// A library referenced by the module. - public var library: [ModuleDefinitionLibrary]? - - /// None. - public var model: [ModuleDefinitionModel]? - - /// None. - public var parameter: [ModuleDefinitionParameter]? - - /// None. - public var valueSet: [ModuleDefinitionValueSet]? - - /// The version of the module, if any. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["codeSystem"] { - presentKeys.insert("codeSystem") - if let val = exist as? [FHIRJSON] { - self.codeSystem = ModuleDefinitionCodeSystem.instantiate(fromArray: val, owner: self) as? [ModuleDefinitionCodeSystem] - } - else { - errors.append(FHIRJSONError(key: "codeSystem", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["data"] { - presentKeys.insert("data") - if let val = exist as? [FHIRJSON] { - self.data = ModuleDefinitionData.instantiate(fromArray: val, owner: self) as? [ModuleDefinitionData] - } - else { - errors.append(FHIRJSONError(key: "data", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? [FHIRJSON] { - self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["library"] { - presentKeys.insert("library") - if let val = exist as? [FHIRJSON] { - self.library = ModuleDefinitionLibrary.instantiate(fromArray: val, owner: self) as? [ModuleDefinitionLibrary] - } - else { - errors.append(FHIRJSONError(key: "library", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["model"] { - presentKeys.insert("model") - if let val = exist as? [FHIRJSON] { - self.model = ModuleDefinitionModel.instantiate(fromArray: val, owner: self) as? [ModuleDefinitionModel] - } - else { - errors.append(FHIRJSONError(key: "model", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["parameter"] { - presentKeys.insert("parameter") - if let val = exist as? [FHIRJSON] { - self.parameter = ModuleDefinitionParameter.instantiate(fromArray: val, owner: self) as? [ModuleDefinitionParameter] - } - else { - errors.append(FHIRJSONError(key: "parameter", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueSet"] { - presentKeys.insert("valueSet") - if let val = exist as? [FHIRJSON] { - self.valueSet = ModuleDefinitionValueSet.instantiate(fromArray: val, owner: self) as? [ModuleDefinitionValueSet] - } - else { - errors.append(FHIRJSONError(key: "valueSet", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let codeSystem = self.codeSystem { - json["codeSystem"] = ModuleDefinitionCodeSystem.asJSONArray(codeSystem) - } - if let data = self.data { - json["data"] = ModuleDefinitionData.asJSONArray(data) - } - if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) - } - if let library = self.library { - json["library"] = ModuleDefinitionLibrary.asJSONArray(library) - } - if let model = self.model { - json["model"] = ModuleDefinitionModel.asJSONArray(model) - } - if let parameter = self.parameter { - json["parameter"] = ModuleDefinitionParameter.asJSONArray(parameter) - } - if let valueSet = self.valueSet { - json["valueSet"] = ModuleDefinitionValueSet.asJSONArray(valueSet) - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * None. - * - * A code system definition used within the knowledge module. - */ -public class ModuleDefinitionCodeSystem: BackboneElement { - override public class var resourceName: String { - get { return "ModuleDefinitionCodeSystem" } - } - - /// None. - public var identifier: String? - - /// None. - public var name: String? - - /// None. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: String, name: String) { - self.init(json: nil) - self.identifier = identifier - self.name = name - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? String { - self.identifier = val - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * 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. - */ -public class ModuleDefinitionData: BackboneElement { - override public class var resourceName: String { - get { return "ModuleDefinitionData" } - } - - /// None. - public var codeFilter: [ModuleDefinitionDataCodeFilter]? - - /// None. - public var dateFilter: [ModuleDefinitionDataDateFilter]? - - /// Indicates that specific structure elements are referenced by the knowledge module. - public var mustSupport: [String]? - - /// The profile of the required data. - public var profile: Reference? - - /// The type of the required data. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String) { - self.init(json: nil) - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["codeFilter"] { - presentKeys.insert("codeFilter") - if let val = exist as? [FHIRJSON] { - self.codeFilter = ModuleDefinitionDataCodeFilter.instantiate(fromArray: val, owner: self) as? [ModuleDefinitionDataCodeFilter] - } - else { - errors.append(FHIRJSONError(key: "codeFilter", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["dateFilter"] { - presentKeys.insert("dateFilter") - if let val = exist as? [FHIRJSON] { - self.dateFilter = ModuleDefinitionDataDateFilter.instantiate(fromArray: val, owner: self) as? [ModuleDefinitionDataDateFilter] - } - else { - errors.append(FHIRJSONError(key: "dateFilter", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["mustSupport"] { - presentKeys.insert("mustSupport") - if let val = exist as? [String] { - self.mustSupport = val - } - else { - errors.append(FHIRJSONError(key: "mustSupport", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["profile"] { - presentKeys.insert("profile") - if let val = exist as? FHIRJSON { - self.profile = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let codeFilter = self.codeFilter { - json["codeFilter"] = ModuleDefinitionDataCodeFilter.asJSONArray(codeFilter) - } - if let dateFilter = self.dateFilter { - json["dateFilter"] = ModuleDefinitionDataDateFilter.asJSONArray(dateFilter) - } - if let mustSupport = self.mustSupport { - var arr = [AnyObject]() - for val in mustSupport { - arr.append(val.asJSON()) - } - json["mustSupport"] = arr - } - if let profile = self.profile { - json["profile"] = profile.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * None. - * - * Code filters for the required data, if any. - */ -public class ModuleDefinitionDataCodeFilter: BackboneElement { - override public class var resourceName: String { - get { return "ModuleDefinitionDataCodeFilter" } - } - - /// The codeableConcepts for the filter. - public var codeableConcept: [CodeableConcept]? - - /// The code-valued attribute of the filter. - public var path: String? - - /// The valueset for the code filter. - public var valueSetReference: Reference? - - /// The valueset for the code filter. - public var valueSetString: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(path: String) { - self.init(json: nil) - self.path = path - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["codeableConcept"] { - presentKeys.insert("codeableConcept") - if let val = exist as? [FHIRJSON] { - self.codeableConcept = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "codeableConcept", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["path"] { - presentKeys.insert("path") - if let val = exist as? String { - self.path = val - } - else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "path")) - } - if let exist: AnyObject = js["valueSetReference"] { - presentKeys.insert("valueSetReference") - if let val = exist as? FHIRJSON { - self.valueSetReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueSetReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueSetString"] { - presentKeys.insert("valueSetString") - if let val = exist as? String { - self.valueSetString = val - } - else { - errors.append(FHIRJSONError(key: "valueSetString", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let codeableConcept = self.codeableConcept { - json["codeableConcept"] = CodeableConcept.asJSONArray(codeableConcept) - } - if let path = self.path { - json["path"] = path.asJSON() - } - if let valueSetReference = self.valueSetReference { - json["valueSetReference"] = valueSetReference.asJSON() - } - if let valueSetString = self.valueSetString { - json["valueSetString"] = valueSetString.asJSON() - } - - return json - } -} - - -/** - * None. - * - * Date filters for the required data, if any. - */ -public class ModuleDefinitionDataDateFilter: BackboneElement { - override public class var resourceName: String { - get { return "ModuleDefinitionDataDateFilter" } - } - - /// The date-valued attribute of the filter. - public var path: String? - - /// The value of the filter, as a Period or dateTime value. - public var valueDateTime: DateTime? - - /// The value of the filter, as a Period or dateTime value. - public var valuePeriod: Period? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(path: String) { - self.init(json: nil) - self.path = path - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["path"] { - presentKeys.insert("path") - if let val = exist as? String { - self.path = val - } - else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "path")) - } - if let exist: AnyObject = js["valueDateTime"] { - presentKeys.insert("valueDateTime") - if let val = exist as? String { - self.valueDateTime = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valuePeriod"] { - presentKeys.insert("valuePeriod") - if let val = exist as? FHIRJSON { - self.valuePeriod = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let path = self.path { - json["path"] = path.asJSON() - } - if let valueDateTime = self.valueDateTime { - json["valueDateTime"] = valueDateTime.asJSON() - } - if let valuePeriod = self.valuePeriod { - json["valuePeriod"] = valuePeriod.asJSON() - } - - return json - } -} - - -/** - * A library referenced by the module. - * - * A library referenced by the module. The reference must consist of either an id, or a document reference. - */ -public class ModuleDefinitionLibrary: BackboneElement { - override public class var resourceName: String { - get { return "ModuleDefinitionLibrary" } - } - - /// None. - public var documentAttachment: Attachment? - - /// None. - public var documentReference: Reference? - - /// None. - public var identifier: String? - - /// The local name for the library. - public var name: String? - - /// None. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["documentAttachment"] { - presentKeys.insert("documentAttachment") - if let val = exist as? FHIRJSON { - self.documentAttachment = Attachment(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "documentAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["documentReference"] { - presentKeys.insert("documentReference") - if let val = exist as? FHIRJSON { - self.documentReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "documentReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? String { - self.identifier = val - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let documentAttachment = self.documentAttachment { - json["documentAttachment"] = documentAttachment.asJSON() - } - if let documentReference = self.documentReference { - json["documentReference"] = documentReference.asJSON() - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * None. - * - * A model reference used by the content. - */ -public class ModuleDefinitionModel: BackboneElement { - override public class var resourceName: String { - get { return "ModuleDefinitionModel" } - } - - /// None. - public var identifier: String? - - /// None. - public var name: String? - - /// None. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: String) { - self.init(json: nil) - self.identifier = identifier - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? String { - self.identifier = val - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * None. - * - * Parameters to the module. - */ -public class ModuleDefinitionParameter: BackboneElement { - override public class var resourceName: String { - get { return "ModuleDefinitionParameter" } - } - - /// None. - public var documentation: String? - - /// None. - public var name: String? - - /// None. - public var profile: Reference? - - /// None. - public var type: String? - - /// None. - public var use: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(name: String, type: String, use: String) { - self.init(json: nil) - self.name = name - self.type = type - self.use = use - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["documentation"] { - presentKeys.insert("documentation") - if let val = exist as? String { - self.documentation = val - } - else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["profile"] { - presentKeys.insert("profile") - if let val = exist as? FHIRJSON { - self.profile = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["use"] { - presentKeys.insert("use") - if let val = exist as? String { - self.use = val - } - else { - errors.append(FHIRJSONError(key: "use", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "use")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let documentation = self.documentation { - json["documentation"] = documentation.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let profile = self.profile { - json["profile"] = profile.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - if let use = self.use { - json["use"] = use.asJSON() - } - - return json - } -} - - -/** - * None. - * - * A value set definition used by the knowledge module. - */ -public class ModuleDefinitionValueSet: BackboneElement { - override public class var resourceName: String { - get { return "ModuleDefinitionValueSet" } - } - - /// None. - public var codeSystem: [String]? - - /// None. - public var identifier: String? - - /// None. - public var name: String? - - /// None. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(identifier: String, name: String) { - self.init(json: nil) - self.identifier = identifier - self.name = name - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["codeSystem"] { - presentKeys.insert("codeSystem") - if let val = exist as? [String] { - self.codeSystem = val - } - else { - errors.append(FHIRJSONError(key: "codeSystem", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? String { - self.identifier = val - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "identifier")) - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let codeSystem = self.codeSystem { - var arr = [AnyObject]() - for val in codeSystem { - arr.append(val.asJSON()) - } - json["codeSystem"] = arr - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/ModuleMetadata.swift b/Sources/Models/ModuleMetadata.swift deleted file mode 100644 index 66231c4a..00000000 --- a/Sources/Models/ModuleMetadata.swift +++ /dev/null @@ -1,748 +0,0 @@ -// -// ModuleMetadata.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ModuleMetadata) on 2016-07-08. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * Defines common metadata used by quality artifacts. - * - * The ModuleMetadata structure defines the common metadata elements used by quality improvement artifacts. This - * information includes descriptive and topical metadata to enable repository searches, as well as governance and - * evidentiary support information. - */ -public class ModuleMetadata: Element { - override public class var resourceName: String { - get { return "ModuleMetadata" } - } - - /// Contact details of the publisher. - public var contact: [ModuleMetadataContact]? - - /// A content contributor. - public var contributor: [ModuleMetadataContributor]? - - /// Use and/or publishing restrictions. - public var copyright: String? - - /// Describes the context of use for this module. - public var coverage: [ModuleMetadataCoverage]? - - /// Natural language description of the module. - public var description_fhir: String? - - /// The effective date range for the module. - public var effectivePeriod: Period? - - /// If for testing purposes, not real usage. - public var experimental: Bool? - - /// Logical identifier(s) for the module. - public var identifier: [Identifier]? - - /// Last review date for the module. - public var lastReviewDate: FHIRDate? - - /// A machine-friendly name for the module. - public var name: String? - - /// Publication date for this version of the module. - public var publicationDate: FHIRDate? - - /// Name of the publisher (Organization or individual). - public var publisher: String? - - /// Describes the purpose of the module. - public var purpose: String? - - /// Related resources for the module. - public var relatedResource: [ModuleMetadataRelatedResource]? - - /// draft | active | inactive. - public var status: String? - - /// A user-friendly title for the module. - public var title: String? - - /// Descriptional topics for the module. - public var topic: [CodeableConcept]? - - /// module | library | decision-support-rule | documentation-template | order-set. - public var type: String? - - /// Logical URL to reference this module. - public var url: URL? - - /// Describes the clinical usage of the module. - public var usage: String? - - /// The version of the module, if any. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(status: String, type: String) { - self.init(json: nil) - self.status = status - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["contact"] { - presentKeys.insert("contact") - if let val = exist as? [FHIRJSON] { - self.contact = ModuleMetadataContact.instantiate(fromArray: val, owner: self) as? [ModuleMetadataContact] - } - else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["contributor"] { - presentKeys.insert("contributor") - if let val = exist as? [FHIRJSON] { - self.contributor = ModuleMetadataContributor.instantiate(fromArray: val, owner: self) as? [ModuleMetadataContributor] - } - else { - errors.append(FHIRJSONError(key: "contributor", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["copyright"] { - presentKeys.insert("copyright") - if let val = exist as? String { - self.copyright = val - } - else { - errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["coverage"] { - presentKeys.insert("coverage") - if let val = exist as? [FHIRJSON] { - self.coverage = ModuleMetadataCoverage.instantiate(fromArray: val, owner: self) as? [ModuleMetadataCoverage] - } - else { - errors.append(FHIRJSONError(key: "coverage", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["effectivePeriod"] { - presentKeys.insert("effectivePeriod") - if let val = exist as? FHIRJSON { - self.effectivePeriod = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "effectivePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["experimental"] { - presentKeys.insert("experimental") - if let val = exist as? Bool { - self.experimental = val - } - else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? [FHIRJSON] { - self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["lastReviewDate"] { - presentKeys.insert("lastReviewDate") - if let val = exist as? String { - self.lastReviewDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "lastReviewDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["publicationDate"] { - presentKeys.insert("publicationDate") - if let val = exist as? String { - self.publicationDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "publicationDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["publisher"] { - presentKeys.insert("publisher") - if let val = exist as? String { - self.publisher = val - } - else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["purpose"] { - presentKeys.insert("purpose") - if let val = exist as? String { - self.purpose = val - } - else { - errors.append(FHIRJSONError(key: "purpose", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["relatedResource"] { - presentKeys.insert("relatedResource") - if let val = exist as? [FHIRJSON] { - self.relatedResource = ModuleMetadataRelatedResource.instantiate(fromArray: val, owner: self) as? [ModuleMetadataRelatedResource] - } - else { - errors.append(FHIRJSONError(key: "relatedResource", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["status"] { - presentKeys.insert("status") - if let val = exist as? String { - self.status = val - } - else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "status")) - } - if let exist: AnyObject = js["title"] { - presentKeys.insert("title") - if let val = exist as? String { - self.title = val - } - else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["topic"] { - presentKeys.insert("topic") - if let val = exist as? [FHIRJSON] { - self.topic = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "topic", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["usage"] { - presentKeys.insert("usage") - if let val = exist as? String { - self.usage = val - } - else { - errors.append(FHIRJSONError(key: "usage", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let contact = self.contact { - json["contact"] = ModuleMetadataContact.asJSONArray(contact) - } - if let contributor = self.contributor { - json["contributor"] = ModuleMetadataContributor.asJSONArray(contributor) - } - if let copyright = self.copyright { - json["copyright"] = copyright.asJSON() - } - if let coverage = self.coverage { - json["coverage"] = ModuleMetadataCoverage.asJSONArray(coverage) - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let effectivePeriod = self.effectivePeriod { - json["effectivePeriod"] = effectivePeriod.asJSON() - } - if let experimental = self.experimental { - json["experimental"] = experimental.asJSON() - } - if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) - } - if let lastReviewDate = self.lastReviewDate { - json["lastReviewDate"] = lastReviewDate.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let publicationDate = self.publicationDate { - json["publicationDate"] = publicationDate.asJSON() - } - if let publisher = self.publisher { - json["publisher"] = publisher.asJSON() - } - if let purpose = self.purpose { - json["purpose"] = purpose.asJSON() - } - if let relatedResource = self.relatedResource { - json["relatedResource"] = ModuleMetadataRelatedResource.asJSONArray(relatedResource) - } - if let status = self.status { - json["status"] = status.asJSON() - } - if let title = self.title { - json["title"] = title.asJSON() - } - if let topic = self.topic { - json["topic"] = CodeableConcept.asJSONArray(topic) - } - if let type = self.type { - json["type"] = type.asJSON() - } - if let url = self.url { - json["url"] = url.asJSON() - } - if let usage = self.usage { - json["usage"] = usage.asJSON() - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * Contact details of the publisher. - * - * Contacts to assist a user in finding and communicating with the publisher. - */ -public class ModuleMetadataContact: Element { - override public class var resourceName: String { - get { return "ModuleMetadataContact" } - } - - /// Name of an individual to contact. - public var name: String? - - /// Contact details for an individual or publisher. - public var telecom: [ContactPoint]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["telecom"] { - presentKeys.insert("telecom") - if let val = exist as? [FHIRJSON] { - self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] - } - else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) - } - - return json - } -} - - -/** - * A content contributor. - * - * A contributor to the content of the module, including authors, editors, reviewers, and endorsers. - */ -public class ModuleMetadataContributor: Element { - override public class var resourceName: String { - get { return "ModuleMetadataContributor" } - } - - /// Contact details of the contributor. - public var contact: [ModuleMetadataContributorContact]? - - /// Name of the contributor. - public var name: String? - - /// author | editor | reviewer | endorser. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(name: String, type: String) { - self.init(json: nil) - self.name = name - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["contact"] { - presentKeys.insert("contact") - if let val = exist as? [FHIRJSON] { - self.contact = ModuleMetadataContributorContact.instantiate(fromArray: val, owner: self) as? [ModuleMetadataContributorContact] - } - else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let contact = self.contact { - json["contact"] = ModuleMetadataContributorContact.asJSONArray(contact) - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Contact details of the contributor. - * - * Contacts to assist a user in finding and communicating with the contributor. - */ -public class ModuleMetadataContributorContact: Element { - override public class var resourceName: String { - get { return "ModuleMetadataContributorContact" } - } - - /// Name of an individual to contact. - public var name: String? - - /// Contact details for an individual or contributor. - public var telecom: [ContactPoint]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["telecom"] { - presentKeys.insert("telecom") - if let val = exist as? [FHIRJSON] { - self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] - } - else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) - } - - return json - } -} - - -/** - * Describes the context of use for this module. - * - * Specifies various attributes of the patient population for whom and/or environment of care in which, the knowledge - * module is applicable. - */ -public class ModuleMetadataCoverage: Element { - override public class var resourceName: String { - get { return "ModuleMetadataCoverage" } - } - - /// patient-gender | patient-age-group | clinical-focus | target-user | workflow-setting | workflow-task | clinical-venue | jurisdiction. - public var focus: Coding? - - /// Value of the coverage attribute. - public var value: CodeableConcept? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(focus: Coding, value: CodeableConcept) { - self.init(json: nil) - self.focus = focus - self.value = value - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["focus"] { - presentKeys.insert("focus") - if let val = exist as? FHIRJSON { - self.focus = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "focus", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "focus")) - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? FHIRJSON { - self.value = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "value", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "value")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let focus = self.focus { - json["focus"] = focus.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * Related resources for the module. - * - * Related resources such as additional documentation, justification, or bibliographic references. - */ -public class ModuleMetadataRelatedResource: Element { - override public class var resourceName: String { - get { return "ModuleMetadataRelatedResource" } - } - - /// The related document. - public var document: Attachment? - - /// The related resource. - public var resource: Reference? - - /// documentation | justification | citation | predecessor | successor | derived-from. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String) { - self.init(json: nil) - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["document"] { - presentKeys.insert("document") - if let val = exist as? FHIRJSON { - self.document = Attachment(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "document", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["resource"] { - presentKeys.insert("resource") - if let val = exist as? FHIRJSON { - self.resource = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let document = self.document { - json["document"] = document.asJSON() - } - if let resource = self.resource { - json["resource"] = resource.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Money.swift b/Sources/Models/Money.swift index be8a5003..6bbe14b5 100644 --- a/Sources/Models/Money.swift +++ b/Sources/Models/Money.swift @@ -2,7 +2,7 @@ // Money.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Money) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Money) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/NamingSystem.swift b/Sources/Models/NamingSystem.swift index 0427439d..aee73ab8 100644 --- a/Sources/Models/NamingSystem.swift +++ b/Sources/Models/NamingSystem.swift @@ -2,7 +2,7 @@ // NamingSystem.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/NamingSystem) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/NamingSystem) on 2016-08-09. // 2016, SMART Health IT. // @@ -272,7 +272,7 @@ public class NamingSystemContact: BackboneElement { get { return "NamingSystemContact" } } - /// Name of an individual to contact. + /// Name of a individual to contact. public var name: String? /// Contact details for individual or publisher. diff --git a/Sources/Models/Narrative.swift b/Sources/Models/Narrative.swift index 1e62d1bf..5bd26bbd 100644 --- a/Sources/Models/Narrative.swift +++ b/Sources/Models/Narrative.swift @@ -2,7 +2,7 @@ // Narrative.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Narrative) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Narrative) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/NutritionOrder.swift b/Sources/Models/NutritionOrder.swift index d2abeab4..e9cbcc09 100644 --- a/Sources/Models/NutritionOrder.swift +++ b/Sources/Models/NutritionOrder.swift @@ -2,7 +2,7 @@ // NutritionOrder.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/NutritionOrder) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/NutritionOrder) on 2016-08-09. // 2016, SMART Health IT. // @@ -49,7 +49,7 @@ public class NutritionOrder: DomainResource { /// The person who requires the diet, formula or nutritional supplement. public var patient: Reference? - /// proposed | draft | planned | requested | active | on-hold | completed | cancelled | entered-in-error. + /// proposed | draft | planned | requested | active | on-hold | completed | cancelled. public var status: String? /// Supplement components. diff --git a/Sources/Models/Observation.swift b/Sources/Models/Observation.swift index a3b21be7..19dc1032 100644 --- a/Sources/Models/Observation.swift +++ b/Sources/Models/Observation.swift @@ -2,7 +2,7 @@ // Observation.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Observation) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Observation) on 2016-08-09. // 2016, SMART Health IT. // @@ -29,7 +29,7 @@ public class Observation: DomainResource { public var code: CodeableConcept? /// Comments about result. - public var comment: String? + public var comments: String? /// Component results. public var component: [ObservationComponent]? @@ -155,13 +155,13 @@ public class Observation: DomainResource { else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["comment"] { - presentKeys.insert("comment") + if let exist: AnyObject = js["comments"] { + presentKeys.insert("comments") if let val = exist as? String { - self.comment = val + self.comments = val } else { - errors.append(FHIRJSONError(key: "comment", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comments", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["component"] { @@ -417,8 +417,8 @@ public class Observation: DomainResource { if let code = self.code { json["code"] = code.asJSON() } - if let comment = self.comment { - json["comment"] = comment.asJSON() + if let comments = self.comments { + json["comments"] = comments.asJSON() } if let component = self.component { json["component"] = ObservationComponent.asJSONArray(component) diff --git a/Sources/Models/OperationDefinition.swift b/Sources/Models/OperationDefinition.swift index 0f59cf67..7b25a491 100644 --- a/Sources/Models/OperationDefinition.swift +++ b/Sources/Models/OperationDefinition.swift @@ -2,7 +2,7 @@ // OperationDefinition.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/OperationDefinition) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OperationDefinition) on 2016-08-09. // 2016, SMART Health IT. // @@ -26,9 +26,6 @@ public class OperationDefinition: DomainResource { /// Name used to invoke the operation. public var code: String? - /// Additional information about use. - public var comment: String? - /// Contact details of the publisher. public var contact: [OperationDefinitionContact]? @@ -41,7 +38,7 @@ public class OperationDefinition: DomainResource { /// If for testing purposes, not real usage. public var experimental: Bool? - /// Whether content is unchanged by the operation. + /// Whether content is unchanged by operation. public var idempotent: Bool? /// Invoke on an instance?. @@ -53,13 +50,16 @@ public class OperationDefinition: DomainResource { /// Informal name for this operation. public var name: String? + /// Additional information about use. + public var notes: String? + /// Parameters for the operation/query. public var parameter: [OperationDefinitionParameter]? /// Name of the publisher (Organization or individual). public var publisher: String? - /// Why this resource has been created. + /// Why is this needed?. public var requirements: String? /// draft | active | retired. @@ -74,9 +74,6 @@ public class OperationDefinition: DomainResource { /// Logical URL to reference this operation definition. public var url: URL? - /// Content intends to support these contexts. - public var useContext: [CodeableConcept]? - /// Logical id for this version of the operation definition. public var version: String? @@ -121,15 +118,6 @@ public class OperationDefinition: DomainResource { else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["comment"] { - presentKeys.insert("comment") - if let val = exist as? String { - self.comment = val - } - else { - errors.append(FHIRJSONError(key: "comment", wants: String.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { @@ -211,6 +199,15 @@ public class OperationDefinition: DomainResource { else { errors.append(FHIRJSONError(key: "name")) } + if let exist: AnyObject = js["notes"] { + presentKeys.insert("notes") + if let val = exist as? String { + self.notes = val + } + else { + errors.append(FHIRJSONError(key: "notes", wants: String.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["parameter"] { presentKeys.insert("parameter") if let val = exist as? [FHIRJSON] { @@ -280,15 +277,6 @@ public class OperationDefinition: DomainResource { errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["useContext"] { - presentKeys.insert("useContext") - if let val = exist as? [FHIRJSON] { - self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["version"] { presentKeys.insert("version") if let val = exist as? String { @@ -311,9 +299,6 @@ public class OperationDefinition: DomainResource { if let code = self.code { json["code"] = code.asJSON() } - if let comment = self.comment { - json["comment"] = comment.asJSON() - } if let contact = self.contact { json["contact"] = OperationDefinitionContact.asJSONArray(contact) } @@ -338,6 +323,9 @@ public class OperationDefinition: DomainResource { if let name = self.name { json["name"] = name.asJSON() } + if let notes = self.notes { + json["notes"] = notes.asJSON() + } if let parameter = self.parameter { json["parameter"] = OperationDefinitionParameter.asJSONArray(parameter) } @@ -363,9 +351,6 @@ public class OperationDefinition: DomainResource { if let url = self.url { json["url"] = url.asJSON() } - if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) - } if let version = self.version { json["version"] = version.asJSON() } @@ -385,7 +370,7 @@ public class OperationDefinitionContact: BackboneElement { get { return "OperationDefinitionContact" } } - /// Name of an individual to contact. + /// Name of a individual to contact. public var name: String? /// Contact details for individual or publisher. @@ -468,9 +453,6 @@ public class OperationDefinitionParameter: BackboneElement { /// Profile on the type. public var profile: Reference? - /// number | date | string | token | reference | composite | quantity | uri. - public var searchType: String? - /// What type this parameter has. public var type: String? @@ -567,15 +549,6 @@ public class OperationDefinitionParameter: BackboneElement { errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["searchType"] { - presentKeys.insert("searchType") - if let val = exist as? String { - self.searchType = val - } - else { - errors.append(FHIRJSONError(key: "searchType", wants: String.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["type"] { presentKeys.insert("type") if let val = exist as? String { @@ -625,9 +598,6 @@ public class OperationDefinitionParameter: BackboneElement { if let profile = self.profile { json["profile"] = profile.asJSON() } - if let searchType = self.searchType { - json["searchType"] = searchType.asJSON() - } if let type = self.type { json["type"] = type.asJSON() } diff --git a/Sources/Models/OperationOutcome.swift b/Sources/Models/OperationOutcome.swift index 63ed4acc..6f88e2bd 100644 --- a/Sources/Models/OperationOutcome.swift +++ b/Sources/Models/OperationOutcome.swift @@ -2,7 +2,7 @@ // OperationOutcome.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/OperationOutcome) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OperationOutcome) on 2016-08-09. // 2016, SMART Health IT. // @@ -84,9 +84,6 @@ public class OperationOutcomeIssue: BackboneElement { /// Additional diagnostic information about the issue. public var diagnostics: String? - /// FluentPath of element(s) related to issue. - public var expression: [String]? - /// XPath of element(s) related to issue. public var location: [String]? @@ -139,15 +136,6 @@ public class OperationOutcomeIssue: BackboneElement { errors.append(FHIRJSONError(key: "diagnostics", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["expression"] { - presentKeys.insert("expression") - if let val = exist as? [String] { - self.expression = val - } - else { - errors.append(FHIRJSONError(key: "expression", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["location"] { presentKeys.insert("location") if let val = exist as? [String] { @@ -185,13 +173,6 @@ public class OperationOutcomeIssue: BackboneElement { if let diagnostics = self.diagnostics { json["diagnostics"] = diagnostics.asJSON() } - if let expression = self.expression { - var arr = [AnyObject]() - for val in expression { - arr.append(val.asJSON()) - } - json["expression"] = arr - } if let location = self.location { var arr = [AnyObject]() for val in location { diff --git a/Sources/Models/Order.swift b/Sources/Models/Order.swift index 96002492..d1afc588 100644 --- a/Sources/Models/Order.swift +++ b/Sources/Models/Order.swift @@ -2,7 +2,7 @@ // Order.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Order) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Order) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/OrderResponse.swift b/Sources/Models/OrderResponse.swift index 9fb385a1..5ed51a74 100644 --- a/Sources/Models/OrderResponse.swift +++ b/Sources/Models/OrderResponse.swift @@ -2,7 +2,7 @@ // OrderResponse.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/OrderResponse) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OrderResponse) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/OrderSet.swift b/Sources/Models/OrderSet.swift deleted file mode 100644 index 6c33eb52..00000000 --- a/Sources/Models/OrderSet.swift +++ /dev/null @@ -1,88 +0,0 @@ -// -// OrderSet.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/OrderSet) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * The definition of an order set. - * - * This resource allows for the definition of an order set as a sharable, consumable, and executable artifact in - * support of clinical decision support. - */ -public class OrderSet: DomainResource { - override public class var resourceName: String { - get { return "OrderSet" } - } - - /// Groups, sections, and line items of the order set. - public var action: [ActionDefinition]? - - /// Logic used by the orderset. - public var library: [Reference]? - - /// The metadata for the orderset. - public var moduleMetadata: ModuleMetadata? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["action"] { - presentKeys.insert("action") - if let val = exist as? [FHIRJSON] { - self.action = ActionDefinition.instantiate(fromArray: val, owner: self) as? [ActionDefinition] - } - else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["library"] { - presentKeys.insert("library") - if let val = exist as? [FHIRJSON] { - self.library = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "library", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["moduleMetadata"] { - presentKeys.insert("moduleMetadata") - if let val = exist as? FHIRJSON { - self.moduleMetadata = ModuleMetadata(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "moduleMetadata", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let action = self.action { - json["action"] = ActionDefinition.asJSONArray(action) - } - if let library = self.library { - json["library"] = Reference.asJSONArray(library) - } - if let moduleMetadata = self.moduleMetadata { - json["moduleMetadata"] = moduleMetadata.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Organization.swift b/Sources/Models/Organization.swift index 406f42a4..225c6cf1 100644 --- a/Sources/Models/Organization.swift +++ b/Sources/Models/Organization.swift @@ -2,7 +2,7 @@ // Organization.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Organization) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Organization) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/ParameterDefinition.swift b/Sources/Models/ParameterDefinition.swift deleted file mode 100644 index 9ccb8e50..00000000 --- a/Sources/Models/ParameterDefinition.swift +++ /dev/null @@ -1,161 +0,0 @@ -// -// ParameterDefinition.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ParameterDefinition) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * 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. - */ -public class ParameterDefinition: Element { - override public class var resourceName: String { - get { return "ParameterDefinition" } - } - - /// A brief description of the parameter. - public var documentation: String? - - /// Maximum cardinality (a number of *). - public var max: String? - - /// Minimum cardinality. - public var min: Int? - - /// Parameter name. - public var name: String? - - /// The profile of the parameter, any. - public var profile: Reference? - - /// None. - public var type: String? - - /// None. - public var use: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String, use: String) { - self.init(json: nil) - self.type = type - self.use = use - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["documentation"] { - presentKeys.insert("documentation") - if let val = exist as? String { - self.documentation = val - } - else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["max"] { - presentKeys.insert("max") - if let val = exist as? String { - self.max = val - } - else { - errors.append(FHIRJSONError(key: "max", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["min"] { - presentKeys.insert("min") - if let val = exist as? Int { - self.min = val - } - else { - errors.append(FHIRJSONError(key: "min", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["profile"] { - presentKeys.insert("profile") - if let val = exist as? FHIRJSON { - self.profile = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["use"] { - presentKeys.insert("use") - if let val = exist as? String { - self.use = val - } - else { - errors.append(FHIRJSONError(key: "use", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "use")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let documentation = self.documentation { - json["documentation"] = documentation.asJSON() - } - if let max = self.max { - json["max"] = max.asJSON() - } - if let min = self.min { - json["min"] = min.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let profile = self.profile { - json["profile"] = profile.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - if let use = self.use { - json["use"] = use.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Parameters.swift b/Sources/Models/Parameters.swift index b45ed699..1946dbee 100644 --- a/Sources/Models/Parameters.swift +++ b/Sources/Models/Parameters.swift @@ -2,7 +2,7 @@ // Parameters.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Parameters) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Parameters) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Patient.swift b/Sources/Models/Patient.swift index f8760930..56efd9de 100644 --- a/Sources/Models/Patient.swift +++ b/Sources/Models/Patient.swift @@ -2,7 +2,7 @@ // Patient.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Patient) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Patient) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/PaymentNotice.swift b/Sources/Models/PaymentNotice.swift index 6903db3f..012e1ca5 100644 --- a/Sources/Models/PaymentNotice.swift +++ b/Sources/Models/PaymentNotice.swift @@ -2,7 +2,7 @@ // PaymentNotice.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/PaymentNotice) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/PaymentNotice) on 2016-08-09. // 2016, SMART Health IT. // @@ -27,10 +27,7 @@ public class PaymentNotice: DomainResource { public var identifier: [Identifier]? /// Responsible organization. - public var organizationIdentifier: Identifier? - - /// Responsible organization. - public var organizationReference: Reference? + public var organization: Reference? /// Original version. public var originalRuleset: Coding? @@ -39,34 +36,19 @@ public class PaymentNotice: DomainResource { public var paymentStatus: Coding? /// Responsible practitioner. - public var providerIdentifier: Identifier? - - /// Responsible practitioner. - public var providerReference: Reference? - - /// Request reference. - public var requestIdentifier: Identifier? + public var provider: Reference? /// Request reference. - public var requestReference: Reference? + public var request: Reference? /// Response reference. - public var responseIdentifier: Identifier? - - /// Response reference. - public var responseReference: Reference? + public var response: Reference? /// Resource version. public var ruleset: Coding? - /// Payment or clearing date. - public var statusDate: FHIRDate? - /// Insurer or Regulatory body. - public var targetIdentifier: Identifier? - - /// Insurer or Regulatory body. - public var targetReference: Reference? + public var target: Reference? /** Initialize with a JSON object. */ @@ -101,22 +83,13 @@ public class PaymentNotice: DomainResource { errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["organizationIdentifier"] { - presentKeys.insert("organizationIdentifier") - if let val = exist as? FHIRJSON { - self.organizationIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "organizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organizationReference"] { - presentKeys.insert("organizationReference") + if let exist: AnyObject = js["organization"] { + presentKeys.insert("organization") if let val = exist as? FHIRJSON { - self.organizationReference = Reference(json: val, owner: self) + self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["originalRuleset"] { @@ -140,58 +113,31 @@ public class PaymentNotice: DomainResource { else { errors.append(FHIRJSONError(key: "paymentStatus")) } - if let exist: AnyObject = js["providerIdentifier"] { - presentKeys.insert("providerIdentifier") - if let val = exist as? FHIRJSON { - self.providerIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "providerIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["providerReference"] { - presentKeys.insert("providerReference") + if let exist: AnyObject = js["provider"] { + presentKeys.insert("provider") if let val = exist as? FHIRJSON { - self.providerReference = Reference(json: val, owner: self) + self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "providerReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestIdentifier"] { - presentKeys.insert("requestIdentifier") + if let exist: AnyObject = js["request"] { + presentKeys.insert("request") if let val = exist as? FHIRJSON { - self.requestIdentifier = Identifier(json: val, owner: self) + self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestReference"] { - presentKeys.insert("requestReference") + if let exist: AnyObject = js["response"] { + presentKeys.insert("response") if let val = exist as? FHIRJSON { - self.requestReference = Reference(json: val, owner: self) + self.response = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["responseIdentifier"] { - presentKeys.insert("responseIdentifier") - if let val = exist as? FHIRJSON { - self.responseIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "responseIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["responseReference"] { - presentKeys.insert("responseReference") - if let val = exist as? FHIRJSON { - self.responseReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "responseReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["ruleset"] { @@ -203,31 +149,13 @@ public class PaymentNotice: DomainResource { errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["statusDate"] { - presentKeys.insert("statusDate") - if let val = exist as? String { - self.statusDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "statusDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["targetIdentifier"] { - presentKeys.insert("targetIdentifier") + if let exist: AnyObject = js["target"] { + presentKeys.insert("target") if let val = exist as? FHIRJSON { - self.targetIdentifier = Identifier(json: val, owner: self) + self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "targetIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["targetReference"] { - presentKeys.insert("targetReference") - if let val = exist as? FHIRJSON { - self.targetReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "targetReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) } } } @@ -243,11 +171,8 @@ public class PaymentNotice: DomainResource { if let identifier = self.identifier { json["identifier"] = Identifier.asJSONArray(identifier) } - if let organizationIdentifier = self.organizationIdentifier { - json["organizationIdentifier"] = organizationIdentifier.asJSON() - } - if let organizationReference = self.organizationReference { - json["organizationReference"] = organizationReference.asJSON() + if let organization = self.organization { + json["organization"] = organization.asJSON() } if let originalRuleset = self.originalRuleset { json["originalRuleset"] = originalRuleset.asJSON() @@ -255,35 +180,20 @@ public class PaymentNotice: DomainResource { if let paymentStatus = self.paymentStatus { json["paymentStatus"] = paymentStatus.asJSON() } - if let providerIdentifier = self.providerIdentifier { - json["providerIdentifier"] = providerIdentifier.asJSON() + if let provider = self.provider { + json["provider"] = provider.asJSON() } - if let providerReference = self.providerReference { - json["providerReference"] = providerReference.asJSON() + if let request = self.request { + json["request"] = request.asJSON() } - if let requestIdentifier = self.requestIdentifier { - json["requestIdentifier"] = requestIdentifier.asJSON() - } - if let requestReference = self.requestReference { - json["requestReference"] = requestReference.asJSON() - } - if let responseIdentifier = self.responseIdentifier { - json["responseIdentifier"] = responseIdentifier.asJSON() - } - if let responseReference = self.responseReference { - json["responseReference"] = responseReference.asJSON() + if let response = self.response { + json["response"] = response.asJSON() } if let ruleset = self.ruleset { json["ruleset"] = ruleset.asJSON() } - if let statusDate = self.statusDate { - json["statusDate"] = statusDate.asJSON() - } - if let targetIdentifier = self.targetIdentifier { - json["targetIdentifier"] = targetIdentifier.asJSON() - } - if let targetReference = self.targetReference { - json["targetReference"] = targetReference.asJSON() + if let target = self.target { + json["target"] = target.asJSON() } return json diff --git a/Sources/Models/PaymentReconciliation.swift b/Sources/Models/PaymentReconciliation.swift index c8dd5f89..2e301c50 100644 --- a/Sources/Models/PaymentReconciliation.swift +++ b/Sources/Models/PaymentReconciliation.swift @@ -2,7 +2,7 @@ // PaymentReconciliation.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) on 2016-08-09. // 2016, SMART Health IT. // @@ -38,10 +38,7 @@ public class PaymentReconciliation: DomainResource { public var note: [PaymentReconciliationNote]? /// Insurer. - public var organizationIdentifier: Identifier? - - /// Insurer. - public var organizationReference: Reference? + public var organization: Reference? /// Original version. public var originalRuleset: Coding? @@ -53,22 +50,13 @@ public class PaymentReconciliation: DomainResource { public var period: Period? /// Claim reference. - public var requestIdentifier: Identifier? - - /// Responsible organization. - public var requestOrganizationIdentifier: Identifier? + public var request: Reference? /// Responsible organization. - public var requestOrganizationReference: Reference? + public var requestOrganization: Reference? /// Responsible practitioner. - public var requestProviderIdentifier: Identifier? - - /// Responsible practitioner. - public var requestProviderReference: Reference? - - /// Claim reference. - public var requestReference: Reference? + public var requestProvider: Reference? /// Resource version. public var ruleset: Coding? @@ -145,22 +133,13 @@ public class PaymentReconciliation: DomainResource { errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["organizationIdentifier"] { - presentKeys.insert("organizationIdentifier") + if let exist: AnyObject = js["organization"] { + presentKeys.insert("organization") if let val = exist as? FHIRJSON { - self.organizationIdentifier = Identifier(json: val, owner: self) + self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organizationReference"] { - presentKeys.insert("organizationReference") - if let val = exist as? FHIRJSON { - self.organizationReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "organizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["originalRuleset"] { @@ -190,58 +169,31 @@ public class PaymentReconciliation: DomainResource { errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestIdentifier"] { - presentKeys.insert("requestIdentifier") - if let val = exist as? FHIRJSON { - self.requestIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestOrganizationIdentifier"] { - presentKeys.insert("requestOrganizationIdentifier") - if let val = exist as? FHIRJSON { - self.requestOrganizationIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestOrganizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestOrganizationReference"] { - presentKeys.insert("requestOrganizationReference") - if let val = exist as? FHIRJSON { - self.requestOrganizationReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestOrganizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestProviderIdentifier"] { - presentKeys.insert("requestProviderIdentifier") + if let exist: AnyObject = js["request"] { + presentKeys.insert("request") if let val = exist as? FHIRJSON { - self.requestProviderIdentifier = Identifier(json: val, owner: self) + self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProviderIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestProviderReference"] { - presentKeys.insert("requestProviderReference") + if let exist: AnyObject = js["requestOrganization"] { + presentKeys.insert("requestOrganization") if let val = exist as? FHIRJSON { - self.requestProviderReference = Reference(json: val, owner: self) + self.requestOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProviderReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestReference"] { - presentKeys.insert("requestReference") + if let exist: AnyObject = js["requestProvider"] { + presentKeys.insert("requestProvider") if let val = exist as? FHIRJSON { - self.requestReference = Reference(json: val, owner: self) + self.requestProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["ruleset"] { @@ -290,11 +242,8 @@ public class PaymentReconciliation: DomainResource { if let note = self.note { json["note"] = PaymentReconciliationNote.asJSONArray(note) } - if let organizationIdentifier = self.organizationIdentifier { - json["organizationIdentifier"] = organizationIdentifier.asJSON() - } - if let organizationReference = self.organizationReference { - json["organizationReference"] = organizationReference.asJSON() + if let organization = self.organization { + json["organization"] = organization.asJSON() } if let originalRuleset = self.originalRuleset { json["originalRuleset"] = originalRuleset.asJSON() @@ -305,23 +254,14 @@ public class PaymentReconciliation: DomainResource { if let period = self.period { json["period"] = period.asJSON() } - if let requestIdentifier = self.requestIdentifier { - json["requestIdentifier"] = requestIdentifier.asJSON() - } - if let requestOrganizationIdentifier = self.requestOrganizationIdentifier { - json["requestOrganizationIdentifier"] = requestOrganizationIdentifier.asJSON() - } - if let requestOrganizationReference = self.requestOrganizationReference { - json["requestOrganizationReference"] = requestOrganizationReference.asJSON() - } - if let requestProviderIdentifier = self.requestProviderIdentifier { - json["requestProviderIdentifier"] = requestProviderIdentifier.asJSON() + if let request = self.request { + json["request"] = request.asJSON() } - if let requestProviderReference = self.requestProviderReference { - json["requestProviderReference"] = requestProviderReference.asJSON() + if let requestOrganization = self.requestOrganization { + json["requestOrganization"] = requestOrganization.asJSON() } - if let requestReference = self.requestReference { - json["requestReference"] = requestReference.asJSON() + if let requestProvider = self.requestProvider { + json["requestProvider"] = requestProvider.asJSON() } if let ruleset = self.ruleset { json["ruleset"] = ruleset.asJSON() @@ -352,28 +292,16 @@ public class PaymentReconciliationDetail: BackboneElement { public var date: FHIRDate? /// Payee. - public var payeeIdentifier: Identifier? - - /// Payee. - public var payeeReference: Reference? - - /// Claim. - public var requestIdentifier: Identifier? + public var payee: Reference? /// Claim. - public var requestReference: Reference? + public var request: Reference? /// Claim Response. - public var responceIdentifier: Identifier? - - /// Claim Response. - public var responceReference: Reference? - - /// Submitter. - public var submitterIdentifier: Identifier? + public var responce: Reference? /// Submitter. - public var submitterReference: Reference? + public var submitter: Reference? /// Type code. public var type: Coding? @@ -411,76 +339,40 @@ public class PaymentReconciliationDetail: BackboneElement { errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["payeeIdentifier"] { - presentKeys.insert("payeeIdentifier") - if let val = exist as? FHIRJSON { - self.payeeIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "payeeIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["payeeReference"] { - presentKeys.insert("payeeReference") - if let val = exist as? FHIRJSON { - self.payeeReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "payeeReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestIdentifier"] { - presentKeys.insert("requestIdentifier") - if let val = exist as? FHIRJSON { - self.requestIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestReference"] { - presentKeys.insert("requestReference") - if let val = exist as? FHIRJSON { - self.requestReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["responceIdentifier"] { - presentKeys.insert("responceIdentifier") + if let exist: AnyObject = js["payee"] { + presentKeys.insert("payee") if let val = exist as? FHIRJSON { - self.responceIdentifier = Identifier(json: val, owner: self) + self.payee = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "responceIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "payee", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["responceReference"] { - presentKeys.insert("responceReference") + if let exist: AnyObject = js["request"] { + presentKeys.insert("request") if let val = exist as? FHIRJSON { - self.responceReference = Reference(json: val, owner: self) + self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "responceReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["submitterIdentifier"] { - presentKeys.insert("submitterIdentifier") + if let exist: AnyObject = js["responce"] { + presentKeys.insert("responce") if let val = exist as? FHIRJSON { - self.submitterIdentifier = Identifier(json: val, owner: self) + self.responce = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "submitterIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "responce", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["submitterReference"] { - presentKeys.insert("submitterReference") + if let exist: AnyObject = js["submitter"] { + presentKeys.insert("submitter") if let val = exist as? FHIRJSON { - self.submitterReference = Reference(json: val, owner: self) + self.submitter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "submitterReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "submitter", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["type"] { @@ -508,29 +400,17 @@ public class PaymentReconciliationDetail: BackboneElement { if let date = self.date { json["date"] = date.asJSON() } - if let payeeIdentifier = self.payeeIdentifier { - json["payeeIdentifier"] = payeeIdentifier.asJSON() - } - if let payeeReference = self.payeeReference { - json["payeeReference"] = payeeReference.asJSON() - } - if let requestIdentifier = self.requestIdentifier { - json["requestIdentifier"] = requestIdentifier.asJSON() - } - if let requestReference = self.requestReference { - json["requestReference"] = requestReference.asJSON() - } - if let responceIdentifier = self.responceIdentifier { - json["responceIdentifier"] = responceIdentifier.asJSON() + if let payee = self.payee { + json["payee"] = payee.asJSON() } - if let responceReference = self.responceReference { - json["responceReference"] = responceReference.asJSON() + if let request = self.request { + json["request"] = request.asJSON() } - if let submitterIdentifier = self.submitterIdentifier { - json["submitterIdentifier"] = submitterIdentifier.asJSON() + if let responce = self.responce { + json["responce"] = responce.asJSON() } - if let submitterReference = self.submitterReference { - json["submitterReference"] = submitterReference.asJSON() + if let submitter = self.submitter { + json["submitter"] = submitter.asJSON() } if let type = self.type { json["type"] = type.asJSON() diff --git a/Sources/Models/Period.swift b/Sources/Models/Period.swift index 9b3abf64..711cefc6 100644 --- a/Sources/Models/Period.swift +++ b/Sources/Models/Period.swift @@ -2,7 +2,7 @@ // Period.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Period) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Period) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Person.swift b/Sources/Models/Person.swift index de3f701b..d21a4cd3 100644 --- a/Sources/Models/Person.swift +++ b/Sources/Models/Person.swift @@ -2,7 +2,7 @@ // Person.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Person) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Person) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Practitioner.swift b/Sources/Models/Practitioner.swift index b96c953e..b0ac95c7 100644 --- a/Sources/Models/Practitioner.swift +++ b/Sources/Models/Practitioner.swift @@ -2,7 +2,7 @@ // Practitioner.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Practitioner) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Practitioner) on 2016-08-09. // 2016, SMART Health IT. // @@ -22,7 +22,7 @@ public class Practitioner: DomainResource { /// Whether this practitioner's record is in active use. public var active: Bool? - /// Address(es) of the practitioner that are not role specific (typically home address). + /// Where practitioner can be found/visited. public var address: [Address]? /// The date on which the practitioner was born. @@ -37,8 +37,8 @@ public class Practitioner: DomainResource { /// A identifier for the person as this agent. public var identifier: [Identifier]? - /// The name(s) associated with the practitioner. - public var name: [HumanName]? + /// A name associated with the person. + public var name: HumanName? /// Image of the person. public var photo: [Attachment]? @@ -49,7 +49,7 @@ public class Practitioner: DomainResource { /// Qualifications obtained by training and certification. public var qualification: [PractitionerQualification]? - /// A contact detail for the practitioner (that apply to all roles). + /// A contact detail for the practitioner. public var telecom: [ContactPoint]? @@ -117,11 +117,11 @@ public class Practitioner: DomainResource { } if let exist: AnyObject = js["name"] { presentKeys.insert("name") - if let val = exist as? [FHIRJSON] { - self.name = HumanName.instantiate(fromArray: val, owner: self) as? [HumanName] + if let val = exist as? FHIRJSON { + self.name = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "name", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["photo"] { @@ -186,7 +186,7 @@ public class Practitioner: DomainResource { json["identifier"] = Identifier.asJSONArray(identifier) } if let name = self.name { - json["name"] = HumanName.asJSONArray(name) + json["name"] = name.asJSON() } if let photo = self.photo { json["photo"] = Attachment.asJSONArray(photo) @@ -219,14 +219,11 @@ public class PractitionerPractitionerRole: BackboneElement { /// The list of healthcare services that this worker provides for this role's Organization/Location(s). public var healthcareService: [Reference]? - /// Business Identifiers that are specific to a role/location. - public var identifier: [Identifier]? - /// The location(s) at which this practitioner provides care. public var location: [Reference]? /// Organization where the roles are performed. - public var organization: Reference? + public var managingOrganization: Reference? /// The period during which the practitioner is authorized to perform in these role(s). public var period: Period? @@ -237,9 +234,6 @@ public class PractitionerPractitionerRole: BackboneElement { /// Specific specialty of the practitioner. public var specialty: [CodeableConcept]? - /// Contact details that are specific to the role/location/service. - public var telecom: [ContactPoint]? - /** Initialize with a JSON object. */ public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { @@ -258,15 +252,6 @@ public class PractitionerPractitionerRole: BackboneElement { errors.append(FHIRJSONError(key: "healthcareService", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? [FHIRJSON] { - self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["location"] { presentKeys.insert("location") if let val = exist as? [FHIRJSON] { @@ -276,13 +261,13 @@ public class PractitionerPractitionerRole: BackboneElement { errors.append(FHIRJSONError(key: "location", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["organization"] { - presentKeys.insert("organization") + if let exist: AnyObject = js["managingOrganization"] { + presentKeys.insert("managingOrganization") if let val = exist as? FHIRJSON { - self.organization = Reference(json: val, owner: self) + self.managingOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["period"] { @@ -312,15 +297,6 @@ public class PractitionerPractitionerRole: BackboneElement { errors.append(FHIRJSONError(key: "specialty", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["telecom"] { - presentKeys.insert("telecom") - if let val = exist as? [FHIRJSON] { - self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] - } - else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) - } - } } return errors.isEmpty ? nil : errors } @@ -331,14 +307,11 @@ public class PractitionerPractitionerRole: BackboneElement { if let healthcareService = self.healthcareService { json["healthcareService"] = Reference.asJSONArray(healthcareService) } - if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) - } if let location = self.location { json["location"] = Reference.asJSONArray(location) } - if let organization = self.organization { - json["organization"] = organization.asJSON() + if let managingOrganization = self.managingOrganization { + json["managingOrganization"] = managingOrganization.asJSON() } if let period = self.period { json["period"] = period.asJSON() @@ -349,9 +322,6 @@ public class PractitionerPractitionerRole: BackboneElement { if let specialty = self.specialty { json["specialty"] = CodeableConcept.asJSONArray(specialty) } - if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) - } return json } diff --git a/Sources/Models/PractitionerRole.swift b/Sources/Models/PractitionerRole.swift deleted file mode 100644 index 31684094..00000000 --- a/Sources/Models/PractitionerRole.swift +++ /dev/null @@ -1,405 +0,0 @@ -// -// PractitionerRole.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/PractitionerRole) on 2016-07-08. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * 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. - */ -public class PractitionerRole: DomainResource { - override public class var resourceName: String { - get { return "PractitionerRole" } - } - - /// Whether this practitioner's record is in active use. - public var active: Bool? - - /// Description of availability exceptions. - public var availabilityExceptions: String? - - /// Times the Service Site is available. - public var availableTime: [PractitionerRoleAvailableTime]? - - /// The list of healthcare services that this worker provides for this role's Organization/Location(s). - public var healthcareService: [Reference]? - - /// Business Identifiers that are specific to a role/location. - public var identifier: [Identifier]? - - /// The location(s) at which this practitioner provides care. - public var location: [Reference]? - - /// Not available during this time due to provided reason. - public var notAvailable: [PractitionerRoleNotAvailable]? - - /// Organization where the roles are available. - public var organization: Reference? - - /// 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? - - /// Roles which this practitioner may perform. - public var role: [CodeableConcept]? - - /// Specific specialty of the practitioner. - public var specialty: [CodeableConcept]? - - /// Contact details that are specific to the role/location/service. - public var telecom: [ContactPoint]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["active"] { - presentKeys.insert("active") - if let val = exist as? Bool { - self.active = val - } - else { - errors.append(FHIRJSONError(key: "active", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["availabilityExceptions"] { - presentKeys.insert("availabilityExceptions") - if let val = exist as? String { - self.availabilityExceptions = val - } - else { - errors.append(FHIRJSONError(key: "availabilityExceptions", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["availableTime"] { - presentKeys.insert("availableTime") - if let val = exist as? [FHIRJSON] { - self.availableTime = PractitionerRoleAvailableTime.instantiate(fromArray: val, owner: self) as? [PractitionerRoleAvailableTime] - } - else { - errors.append(FHIRJSONError(key: "availableTime", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["healthcareService"] { - presentKeys.insert("healthcareService") - if let val = exist as? [FHIRJSON] { - self.healthcareService = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "healthcareService", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? [FHIRJSON] { - self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["location"] { - presentKeys.insert("location") - if let val = exist as? [FHIRJSON] { - self.location = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "location", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["notAvailable"] { - presentKeys.insert("notAvailable") - if let val = exist as? [FHIRJSON] { - self.notAvailable = PractitionerRoleNotAvailable.instantiate(fromArray: val, owner: self) as? [PractitionerRoleNotAvailable] - } - else { - errors.append(FHIRJSONError(key: "notAvailable", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organization"] { - presentKeys.insert("organization") - if let val = exist as? FHIRJSON { - self.organization = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["period"] { - presentKeys.insert("period") - if let val = exist as? FHIRJSON { - self.period = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["practitioner"] { - presentKeys.insert("practitioner") - if let val = exist as? FHIRJSON { - self.practitioner = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "practitioner", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["role"] { - presentKeys.insert("role") - if let val = exist as? [FHIRJSON] { - self.role = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "role", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["specialty"] { - presentKeys.insert("specialty") - if let val = exist as? [FHIRJSON] { - self.specialty = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "specialty", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["telecom"] { - presentKeys.insert("telecom") - if let val = exist as? [FHIRJSON] { - self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] - } - else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let active = self.active { - json["active"] = active.asJSON() - } - if let availabilityExceptions = self.availabilityExceptions { - json["availabilityExceptions"] = availabilityExceptions.asJSON() - } - if let availableTime = self.availableTime { - json["availableTime"] = PractitionerRoleAvailableTime.asJSONArray(availableTime) - } - if let healthcareService = self.healthcareService { - json["healthcareService"] = Reference.asJSONArray(healthcareService) - } - if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) - } - if let location = self.location { - json["location"] = Reference.asJSONArray(location) - } - if let notAvailable = self.notAvailable { - json["notAvailable"] = PractitionerRoleNotAvailable.asJSONArray(notAvailable) - } - if let organization = self.organization { - json["organization"] = organization.asJSON() - } - if let period = self.period { - json["period"] = period.asJSON() - } - if let practitioner = self.practitioner { - json["practitioner"] = practitioner.asJSON() - } - if let role = self.role { - json["role"] = CodeableConcept.asJSONArray(role) - } - if let specialty = self.specialty { - json["specialty"] = CodeableConcept.asJSONArray(specialty) - } - if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) - } - - return json - } -} - - -/** - * Times the Service Site is available. - * - * A collection of times that the Service Site is available. - */ -public class PractitionerRoleAvailableTime: BackboneElement { - override public class var resourceName: String { - get { return "PractitionerRoleAvailableTime" } - } - - /// Always available? e.g. 24 hour service. - public var allDay: Bool? - - /// Closing time of day (ignored if allDay = true). - public var availableEndTime: FHIRTime? - - /// Opening time of day (ignored if allDay = true). - public var availableStartTime: FHIRTime? - - /// mon | tue | wed | thu | fri | sat | sun. - public var daysOfWeek: [String]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["allDay"] { - presentKeys.insert("allDay") - if let val = exist as? Bool { - self.allDay = val - } - else { - errors.append(FHIRJSONError(key: "allDay", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["availableEndTime"] { - presentKeys.insert("availableEndTime") - if let val = exist as? String { - self.availableEndTime = FHIRTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "availableEndTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["availableStartTime"] { - presentKeys.insert("availableStartTime") - if let val = exist as? String { - self.availableStartTime = FHIRTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "availableStartTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["daysOfWeek"] { - presentKeys.insert("daysOfWeek") - if let val = exist as? [String] { - self.daysOfWeek = val - } - else { - errors.append(FHIRJSONError(key: "daysOfWeek", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let allDay = self.allDay { - json["allDay"] = allDay.asJSON() - } - if let availableEndTime = self.availableEndTime { - json["availableEndTime"] = availableEndTime.asJSON() - } - if let availableStartTime = self.availableStartTime { - json["availableStartTime"] = availableStartTime.asJSON() - } - if let daysOfWeek = self.daysOfWeek { - var arr = [AnyObject]() - for val in daysOfWeek { - arr.append(val.asJSON()) - } - json["daysOfWeek"] = arr - } - - return json - } -} - - -/** - * Not available during this time due to provided reason. - * - * The HealthcareService is not available during this period of time due to the provided reason. - */ -public class PractitionerRoleNotAvailable: BackboneElement { - override public class var resourceName: String { - get { return "PractitionerRoleNotAvailable" } - } - - /// Reason presented to the user explaining why time not available. - public var description_fhir: String? - - /// Service not availablefrom this date. - public var during: Period? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(description_fhir: String) { - self.init(json: nil) - self.description_fhir = description_fhir - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "description")) - } - if let exist: AnyObject = js["during"] { - presentKeys.insert("during") - if let val = exist as? FHIRJSON { - self.during = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "during", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let during = self.during { - json["during"] = during.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Procedure.swift b/Sources/Models/Procedure.swift index e35de176..43c19332 100644 --- a/Sources/Models/Procedure.swift +++ b/Sources/Models/Procedure.swift @@ -2,7 +2,7 @@ // Procedure.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Procedure) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Procedure) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/ProcedureRequest.swift b/Sources/Models/ProcedureRequest.swift index 60c78586..1267626f 100644 --- a/Sources/Models/ProcedureRequest.swift +++ b/Sources/Models/ProcedureRequest.swift @@ -2,7 +2,7 @@ // ProcedureRequest.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ProcedureRequest) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcedureRequest) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/ProcessRequest.swift b/Sources/Models/ProcessRequest.swift index 9f41a952..6835f924 100644 --- a/Sources/Models/ProcessRequest.swift +++ b/Sources/Models/ProcessRequest.swift @@ -2,7 +2,7 @@ // ProcessRequest.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ProcessRequest) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcessRequest) on 2016-08-09. // 2016, SMART Health IT. // @@ -42,10 +42,7 @@ public class ProcessRequest: DomainResource { public var nullify: Bool? /// Responsible organization. - public var organizationIdentifier: Identifier? - - /// Responsible organization. - public var organizationReference: Reference? + public var organization: Reference? /// Original version. public var originalRuleset: Coding? @@ -54,34 +51,22 @@ public class ProcessRequest: DomainResource { public var period: Period? /// Responsible practitioner. - public var providerIdentifier: Identifier? - - /// Responsible practitioner. - public var providerReference: Reference? + public var provider: Reference? /// Reference number/string. public var reference: String? /// Request reference. - public var requestIdentifier: Identifier? - - /// Request reference. - public var requestReference: Reference? - - /// Response reference. - public var responseIdentifier: Identifier? + public var request: Reference? /// Response reference. - public var responseReference: Reference? + public var response: Reference? /// Resource version. public var ruleset: Coding? /// Target of the request. - public var targetIdentifier: Identifier? - - /// Target of the request. - public var targetReference: Reference? + public var target: Reference? /** Initialize with a JSON object. */ @@ -164,22 +149,13 @@ public class ProcessRequest: DomainResource { errors.append(FHIRJSONError(key: "nullify", wants: Bool.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["organizationIdentifier"] { - presentKeys.insert("organizationIdentifier") + if let exist: AnyObject = js["organization"] { + presentKeys.insert("organization") if let val = exist as? FHIRJSON { - self.organizationIdentifier = Identifier(json: val, owner: self) + self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organizationReference"] { - presentKeys.insert("organizationReference") - if let val = exist as? FHIRJSON { - self.organizationReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "organizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["originalRuleset"] { @@ -200,22 +176,13 @@ public class ProcessRequest: DomainResource { errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["providerIdentifier"] { - presentKeys.insert("providerIdentifier") - if let val = exist as? FHIRJSON { - self.providerIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "providerIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["providerReference"] { - presentKeys.insert("providerReference") + if let exist: AnyObject = js["provider"] { + presentKeys.insert("provider") if let val = exist as? FHIRJSON { - self.providerReference = Reference(json: val, owner: self) + self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "providerReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["reference"] { @@ -227,40 +194,22 @@ public class ProcessRequest: DomainResource { errors.append(FHIRJSONError(key: "reference", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestIdentifier"] { - presentKeys.insert("requestIdentifier") + if let exist: AnyObject = js["request"] { + presentKeys.insert("request") if let val = exist as? FHIRJSON { - self.requestIdentifier = Identifier(json: val, owner: self) + self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestReference"] { - presentKeys.insert("requestReference") + if let exist: AnyObject = js["response"] { + presentKeys.insert("response") if let val = exist as? FHIRJSON { - self.requestReference = Reference(json: val, owner: self) + self.response = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["responseIdentifier"] { - presentKeys.insert("responseIdentifier") - if let val = exist as? FHIRJSON { - self.responseIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "responseIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["responseReference"] { - presentKeys.insert("responseReference") - if let val = exist as? FHIRJSON { - self.responseReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "responseReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["ruleset"] { @@ -272,22 +221,13 @@ public class ProcessRequest: DomainResource { errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["targetIdentifier"] { - presentKeys.insert("targetIdentifier") + if let exist: AnyObject = js["target"] { + presentKeys.insert("target") if let val = exist as? FHIRJSON { - self.targetIdentifier = Identifier(json: val, owner: self) + self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "targetIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["targetReference"] { - presentKeys.insert("targetReference") - if let val = exist as? FHIRJSON { - self.targetReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "targetReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) } } } @@ -326,11 +266,8 @@ public class ProcessRequest: DomainResource { if let nullify = self.nullify { json["nullify"] = nullify.asJSON() } - if let organizationIdentifier = self.organizationIdentifier { - json["organizationIdentifier"] = organizationIdentifier.asJSON() - } - if let organizationReference = self.organizationReference { - json["organizationReference"] = organizationReference.asJSON() + if let organization = self.organization { + json["organization"] = organization.asJSON() } if let originalRuleset = self.originalRuleset { json["originalRuleset"] = originalRuleset.asJSON() @@ -338,35 +275,23 @@ public class ProcessRequest: DomainResource { if let period = self.period { json["period"] = period.asJSON() } - if let providerIdentifier = self.providerIdentifier { - json["providerIdentifier"] = providerIdentifier.asJSON() - } - if let providerReference = self.providerReference { - json["providerReference"] = providerReference.asJSON() + if let provider = self.provider { + json["provider"] = provider.asJSON() } if let reference = self.reference { json["reference"] = reference.asJSON() } - if let requestIdentifier = self.requestIdentifier { - json["requestIdentifier"] = requestIdentifier.asJSON() - } - if let requestReference = self.requestReference { - json["requestReference"] = requestReference.asJSON() + if let request = self.request { + json["request"] = request.asJSON() } - if let responseIdentifier = self.responseIdentifier { - json["responseIdentifier"] = responseIdentifier.asJSON() - } - if let responseReference = self.responseReference { - json["responseReference"] = responseReference.asJSON() + if let response = self.response { + json["response"] = response.asJSON() } if let ruleset = self.ruleset { json["ruleset"] = ruleset.asJSON() } - if let targetIdentifier = self.targetIdentifier { - json["targetIdentifier"] = targetIdentifier.asJSON() - } - if let targetReference = self.targetReference { - json["targetReference"] = targetReference.asJSON() + if let target = self.target { + json["target"] = target.asJSON() } return json diff --git a/Sources/Models/ProcessResponse.swift b/Sources/Models/ProcessResponse.swift index 3a8de478..cd2e680e 100644 --- a/Sources/Models/ProcessResponse.swift +++ b/Sources/Models/ProcessResponse.swift @@ -2,7 +2,7 @@ // ProcessResponse.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ProcessResponse) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcessResponse) on 2016-08-09. // 2016, SMART Health IT. // @@ -38,10 +38,7 @@ public class ProcessResponse: DomainResource { public var notes: [ProcessResponseNotes]? /// Authoring Organization. - public var organizationIdentifier: Identifier? - - /// Authoring Organization. - public var organizationReference: Reference? + public var organization: Reference? /// Original version. public var originalRuleset: Coding? @@ -50,22 +47,13 @@ public class ProcessResponse: DomainResource { public var outcome: Coding? /// Request reference. - public var requestIdentifier: Identifier? - - /// Responsible organization. - public var requestOrganizationIdentifier: Identifier? + public var request: Reference? /// Responsible organization. - public var requestOrganizationReference: Reference? + public var requestOrganization: Reference? /// Responsible Practitioner. - public var requestProviderIdentifier: Identifier? - - /// Responsible Practitioner. - public var requestProviderReference: Reference? - - /// Request reference. - public var requestReference: Reference? + public var requestProvider: Reference? /// Resource version. public var ruleset: Coding? @@ -133,22 +121,13 @@ public class ProcessResponse: DomainResource { errors.append(FHIRJSONError(key: "notes", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["organizationIdentifier"] { - presentKeys.insert("organizationIdentifier") + if let exist: AnyObject = js["organization"] { + presentKeys.insert("organization") if let val = exist as? FHIRJSON { - self.organizationIdentifier = Identifier(json: val, owner: self) + self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["organizationReference"] { - presentKeys.insert("organizationReference") - if let val = exist as? FHIRJSON { - self.organizationReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "organizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["originalRuleset"] { @@ -169,58 +148,31 @@ public class ProcessResponse: DomainResource { errors.append(FHIRJSONError(key: "outcome", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestIdentifier"] { - presentKeys.insert("requestIdentifier") - if let val = exist as? FHIRJSON { - self.requestIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestOrganizationIdentifier"] { - presentKeys.insert("requestOrganizationIdentifier") - if let val = exist as? FHIRJSON { - self.requestOrganizationIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestOrganizationIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestOrganizationReference"] { - presentKeys.insert("requestOrganizationReference") - if let val = exist as? FHIRJSON { - self.requestOrganizationReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "requestOrganizationReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requestProviderIdentifier"] { - presentKeys.insert("requestProviderIdentifier") + if let exist: AnyObject = js["request"] { + presentKeys.insert("request") if let val = exist as? FHIRJSON { - self.requestProviderIdentifier = Identifier(json: val, owner: self) + self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProviderIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestProviderReference"] { - presentKeys.insert("requestProviderReference") + if let exist: AnyObject = js["requestOrganization"] { + presentKeys.insert("requestOrganization") if let val = exist as? FHIRJSON { - self.requestProviderReference = Reference(json: val, owner: self) + self.requestOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProviderReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["requestReference"] { - presentKeys.insert("requestReference") + if let exist: AnyObject = js["requestProvider"] { + presentKeys.insert("requestProvider") if let val = exist as? FHIRJSON { - self.requestReference = Reference(json: val, owner: self) + self.requestProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["ruleset"] { @@ -257,11 +209,8 @@ public class ProcessResponse: DomainResource { if let notes = self.notes { json["notes"] = ProcessResponseNotes.asJSONArray(notes) } - if let organizationIdentifier = self.organizationIdentifier { - json["organizationIdentifier"] = organizationIdentifier.asJSON() - } - if let organizationReference = self.organizationReference { - json["organizationReference"] = organizationReference.asJSON() + if let organization = self.organization { + json["organization"] = organization.asJSON() } if let originalRuleset = self.originalRuleset { json["originalRuleset"] = originalRuleset.asJSON() @@ -269,23 +218,14 @@ public class ProcessResponse: DomainResource { if let outcome = self.outcome { json["outcome"] = outcome.asJSON() } - if let requestIdentifier = self.requestIdentifier { - json["requestIdentifier"] = requestIdentifier.asJSON() - } - if let requestOrganizationIdentifier = self.requestOrganizationIdentifier { - json["requestOrganizationIdentifier"] = requestOrganizationIdentifier.asJSON() - } - if let requestOrganizationReference = self.requestOrganizationReference { - json["requestOrganizationReference"] = requestOrganizationReference.asJSON() - } - if let requestProviderIdentifier = self.requestProviderIdentifier { - json["requestProviderIdentifier"] = requestProviderIdentifier.asJSON() + if let request = self.request { + json["request"] = request.asJSON() } - if let requestProviderReference = self.requestProviderReference { - json["requestProviderReference"] = requestProviderReference.asJSON() + if let requestOrganization = self.requestOrganization { + json["requestOrganization"] = requestOrganization.asJSON() } - if let requestReference = self.requestReference { - json["requestReference"] = requestReference.asJSON() + if let requestProvider = self.requestProvider { + json["requestProvider"] = requestProvider.asJSON() } if let ruleset = self.ruleset { json["ruleset"] = ruleset.asJSON() diff --git a/Sources/Models/ProtocolFHIR.swift b/Sources/Models/ProtocolFHIR.swift deleted file mode 100644 index 0d4e209b..00000000 --- a/Sources/Models/ProtocolFHIR.swift +++ /dev/null @@ -1,1010 +0,0 @@ -// -// ProtocolFHIR.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Protocol) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * Contextual set of behaviors. - * - * A definition of behaviors to be taken in particular circumstances, often including conditions, options and other - * decision points. - */ -public class ProtocolFHIR: DomainResource { - override public class var resourceName: String { - get { return "Protocol" } - } - - /// Who wrote protocol?. - public var author: Reference? - - /// To whom does Protocol apply?. - public var group: Reference? - - /// Unique Id for this particular protocol. - public var identifier: [Identifier]? - - /// When is protocol to be used?. - public var purpose: String? - - /// draft | testing | review | active | withdrawn | superseded. - public var status: String? - - /// What's done as part of protocol. - public var step: [ProtocolFHIRStep]? - - /// What does protocol deal with?. - public var subject: Reference? - - /// Name of protocol. - public var title: String? - - /// condition | device | drug | study. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(purpose: String, status: String, type: String) { - self.init(json: nil) - self.purpose = purpose - self.status = status - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["author"] { - presentKeys.insert("author") - if let val = exist as? FHIRJSON { - self.author = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["group"] { - presentKeys.insert("group") - if let val = exist as? FHIRJSON { - self.group = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "group", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? [FHIRJSON] { - self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["purpose"] { - presentKeys.insert("purpose") - if let val = exist as? String { - self.purpose = val - } - else { - errors.append(FHIRJSONError(key: "purpose", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "purpose")) - } - if let exist: AnyObject = js["status"] { - presentKeys.insert("status") - if let val = exist as? String { - self.status = val - } - else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "status")) - } - if let exist: AnyObject = js["step"] { - presentKeys.insert("step") - if let val = exist as? [FHIRJSON] { - self.step = ProtocolFHIRStep.instantiate(fromArray: val, owner: self) as? [ProtocolFHIRStep] - } - else { - errors.append(FHIRJSONError(key: "step", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["subject"] { - presentKeys.insert("subject") - if let val = exist as? FHIRJSON { - self.subject = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["title"] { - presentKeys.insert("title") - if let val = exist as? String { - self.title = val - } - else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let author = self.author { - json["author"] = author.asJSON() - } - if let group = self.group { - json["group"] = group.asJSON() - } - if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) - } - if let purpose = self.purpose { - json["purpose"] = purpose.asJSON() - } - if let status = self.status { - json["status"] = status.asJSON() - } - if let step = self.step { - json["step"] = ProtocolFHIRStep.asJSONArray(step) - } - if let subject = self.subject { - json["subject"] = subject.asJSON() - } - if let title = self.title { - json["title"] = title.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * What's done as part of protocol. - */ -public class ProtocolFHIRStep: BackboneElement { - override public class var resourceName: String { - get { return "ProtocolFHIRStep" } - } - - /// Activities that occur within timepoint. - public var activity: [ProtocolFHIRStepActivity]? - - /// Human description of activity. - public var description_fhir: String? - - /// How long does step last?. - public var duration: Quantity? - - /// Rules prior to completion. - public var exit: ProtocolFHIRStepPrecondition? - - /// First activity within timepoint. - public var firstActivity: URL? - - /// Label for step. - public var name: String? - - /// What happens next?. - public var next: [ProtocolFHIRStepNext]? - - /// Rules prior to execution. - public var precondition: ProtocolFHIRStepPrecondition? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["activity"] { - presentKeys.insert("activity") - if let val = exist as? [FHIRJSON] { - self.activity = ProtocolFHIRStepActivity.instantiate(fromArray: val, owner: self) as? [ProtocolFHIRStepActivity] - } - else { - errors.append(FHIRJSONError(key: "activity", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["duration"] { - presentKeys.insert("duration") - if let val = exist as? FHIRJSON { - self.duration = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "duration", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["exit"] { - presentKeys.insert("exit") - if let val = exist as? FHIRJSON { - self.exit = ProtocolFHIRStepPrecondition(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "exit", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["firstActivity"] { - presentKeys.insert("firstActivity") - if let val = exist as? String { - self.firstActivity = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "firstActivity", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["next"] { - presentKeys.insert("next") - if let val = exist as? [FHIRJSON] { - self.next = ProtocolFHIRStepNext.instantiate(fromArray: val, owner: self) as? [ProtocolFHIRStepNext] - } - else { - errors.append(FHIRJSONError(key: "next", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["precondition"] { - presentKeys.insert("precondition") - if let val = exist as? FHIRJSON { - self.precondition = ProtocolFHIRStepPrecondition(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "precondition", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let activity = self.activity { - json["activity"] = ProtocolFHIRStepActivity.asJSONArray(activity) - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let duration = self.duration { - json["duration"] = duration.asJSON() - } - if let exit = self.exit { - json["exit"] = exit.asJSON() - } - if let firstActivity = self.firstActivity { - json["firstActivity"] = firstActivity.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let next = self.next { - json["next"] = ProtocolFHIRStepNext.asJSONArray(next) - } - if let precondition = self.precondition { - json["precondition"] = precondition.asJSON() - } - - return json - } -} - - -/** - * Activities that occur within timepoint. - */ -public class ProtocolFHIRStepActivity: BackboneElement { - override public class var resourceName: String { - get { return "ProtocolFHIRStepActivity" } - } - - /// What can be done instead?. - public var alternative: [URL]? - - /// Activities that are part of this activity. - public var component: [ProtocolFHIRStepActivityComponent]? - - /// Details of activity. - public var detail: ProtocolFHIRStepActivityDetail? - - /// What happens next. - public var following: [URL]? - - /// Pause before start. - public var wait: Quantity? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(detail: ProtocolFHIRStepActivityDetail) { - self.init(json: nil) - self.detail = detail - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["alternative"] { - presentKeys.insert("alternative") - if let val = exist as? [String] { - self.alternative = URL.instantiate(fromArray: val) - } - else { - errors.append(FHIRJSONError(key: "alternative", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["component"] { - presentKeys.insert("component") - if let val = exist as? [FHIRJSON] { - self.component = ProtocolFHIRStepActivityComponent.instantiate(fromArray: val, owner: self) as? [ProtocolFHIRStepActivityComponent] - } - else { - errors.append(FHIRJSONError(key: "component", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["detail"] { - presentKeys.insert("detail") - if let val = exist as? FHIRJSON { - self.detail = ProtocolFHIRStepActivityDetail(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "detail", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "detail")) - } - if let exist: AnyObject = js["following"] { - presentKeys.insert("following") - if let val = exist as? [String] { - self.following = URL.instantiate(fromArray: val) - } - else { - errors.append(FHIRJSONError(key: "following", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["wait"] { - presentKeys.insert("wait") - if let val = exist as? FHIRJSON { - self.wait = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "wait", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let alternative = self.alternative { - var arr = [AnyObject]() - for val in alternative { - arr.append(val.asJSON()) - } - json["alternative"] = arr - } - if let component = self.component { - json["component"] = ProtocolFHIRStepActivityComponent.asJSONArray(component) - } - if let detail = self.detail { - json["detail"] = detail.asJSON() - } - if let following = self.following { - var arr = [AnyObject]() - for val in following { - arr.append(val.asJSON()) - } - json["following"] = arr - } - if let wait = self.wait { - json["wait"] = wait.asJSON() - } - - return json - } -} - - -/** - * Activities that are part of this activity. - */ -public class ProtocolFHIRStepActivityComponent: BackboneElement { - override public class var resourceName: String { - get { return "ProtocolFHIRStepActivityComponent" } - } - - /// Component activity. - public var activity: URL? - - /// Order of occurrence. - public var sequence: Int? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(activity: URL) { - self.init(json: nil) - self.activity = activity - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["activity"] { - presentKeys.insert("activity") - if let val = exist as? String { - self.activity = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "activity", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "activity")) - } - if let exist: AnyObject = js["sequence"] { - presentKeys.insert("sequence") - if let val = exist as? Int { - self.sequence = val - } - else { - errors.append(FHIRJSONError(key: "sequence", wants: Int.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let activity = self.activity { - json["activity"] = activity.asJSON() - } - if let sequence = self.sequence { - json["sequence"] = sequence.asJSON() - } - - return json - } -} - - -/** - * Details of activity. - * - * Information about the nature of the activity, including type, timing and other qualifiers. - */ -public class ProtocolFHIRStepActivityDetail: BackboneElement { - override public class var resourceName: String { - get { return "ProtocolFHIRStepActivityDetail" } - } - - /// diet | drug | encounter | observation +. - public var category: String? - - /// Detail type of activity. - public var code: CodeableConcept? - - /// Extra info on activity occurrence. - public var description_fhir: String? - - /// Where it should happen. - public var location: Reference? - - /// Who's responsible?. - public var performer: [Reference]? - - /// What's administered/supplied. - public var product: Reference? - - /// How much is administered/consumed/supplied. - public var quantity: Quantity? - - /// When activity is to occur. - public var timingCodeableConcept: CodeableConcept? - - /// When activity is to occur. - public var timingTiming: Timing? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") - if let val = exist as? String { - self.category = val - } - else { - errors.append(FHIRJSONError(key: "category", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["code"] { - presentKeys.insert("code") - if let val = exist as? FHIRJSON { - self.code = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["location"] { - presentKeys.insert("location") - if let val = exist as? FHIRJSON { - self.location = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["performer"] { - presentKeys.insert("performer") - if let val = exist as? [FHIRJSON] { - self.performer = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "performer", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["product"] { - presentKeys.insert("product") - if let val = exist as? FHIRJSON { - self.product = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "product", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["quantity"] { - presentKeys.insert("quantity") - if let val = exist as? FHIRJSON { - self.quantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["timingCodeableConcept"] { - presentKeys.insert("timingCodeableConcept") - if let val = exist as? FHIRJSON { - self.timingCodeableConcept = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "timingCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["timingTiming"] { - presentKeys.insert("timingTiming") - if let val = exist as? FHIRJSON { - self.timingTiming = Timing(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "timingTiming", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let category = self.category { - json["category"] = category.asJSON() - } - if let code = self.code { - json["code"] = code.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let location = self.location { - json["location"] = location.asJSON() - } - if let performer = self.performer { - json["performer"] = Reference.asJSONArray(performer) - } - if let product = self.product { - json["product"] = product.asJSON() - } - if let quantity = self.quantity { - json["quantity"] = quantity.asJSON() - } - if let timingCodeableConcept = self.timingCodeableConcept { - json["timingCodeableConcept"] = timingCodeableConcept.asJSON() - } - if let timingTiming = self.timingTiming { - json["timingTiming"] = timingTiming.asJSON() - } - - return json - } -} - - -/** - * What happens next?. - * - * What happens next? - */ -public class ProtocolFHIRStepNext: BackboneElement { - override public class var resourceName: String { - get { return "ProtocolFHIRStepNext" } - } - - /// Condition in which next step is executed. - public var condition: ProtocolFHIRStepPrecondition? - - /// Description of what happens next. - public var description_fhir: String? - - /// Id of following step. - public var reference: URL? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["condition"] { - presentKeys.insert("condition") - if let val = exist as? FHIRJSON { - self.condition = ProtocolFHIRStepPrecondition(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "condition", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["reference"] { - presentKeys.insert("reference") - if let val = exist as? String { - self.reference = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "reference", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let condition = self.condition { - json["condition"] = condition.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let reference = self.reference { - json["reference"] = reference.asJSON() - } - - return json - } -} - - -/** - * Rules prior to execution. - */ -public class ProtocolFHIRStepPrecondition: BackboneElement { - override public class var resourceName: String { - get { return "ProtocolFHIRStepPrecondition" } - } - - /// Condition evaluated. - public var condition: ProtocolFHIRStepPreconditionCondition? - - /// Description of condition. - public var description_fhir: String? - - /// Not conditions. - public var exclude: [ProtocolFHIRStepPrecondition]? - - /// And conditions. - public var intersection: [ProtocolFHIRStepPrecondition]? - - /// Or conditions. - public var union: [ProtocolFHIRStepPrecondition]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["condition"] { - presentKeys.insert("condition") - if let val = exist as? FHIRJSON { - self.condition = ProtocolFHIRStepPreconditionCondition(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "condition", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["exclude"] { - presentKeys.insert("exclude") - if let val = exist as? [FHIRJSON] { - self.exclude = ProtocolFHIRStepPrecondition.instantiate(fromArray: val, owner: self) as? [ProtocolFHIRStepPrecondition] - } - else { - errors.append(FHIRJSONError(key: "exclude", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["intersection"] { - presentKeys.insert("intersection") - if let val = exist as? [FHIRJSON] { - self.intersection = ProtocolFHIRStepPrecondition.instantiate(fromArray: val, owner: self) as? [ProtocolFHIRStepPrecondition] - } - else { - errors.append(FHIRJSONError(key: "intersection", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["union"] { - presentKeys.insert("union") - if let val = exist as? [FHIRJSON] { - self.union = ProtocolFHIRStepPrecondition.instantiate(fromArray: val, owner: self) as? [ProtocolFHIRStepPrecondition] - } - else { - errors.append(FHIRJSONError(key: "union", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let condition = self.condition { - json["condition"] = condition.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let exclude = self.exclude { - json["exclude"] = ProtocolFHIRStepPrecondition.asJSONArray(exclude) - } - if let intersection = self.intersection { - json["intersection"] = ProtocolFHIRStepPrecondition.asJSONArray(intersection) - } - if let union = self.union { - json["union"] = ProtocolFHIRStepPrecondition.asJSONArray(union) - } - - return json - } -} - - -/** - * Condition evaluated. - * - * Defines the name/value pair that must hold for the condition to be met. - */ -public class ProtocolFHIRStepPreconditionCondition: BackboneElement { - override public class var resourceName: String { - get { return "ProtocolFHIRStepPreconditionCondition" } - } - - /// Observation / test / assertion. - public var type: CodeableConcept? - - /// Value needed to satisfy condition. - public var valueBoolean: Bool? - - /// Value needed to satisfy condition. - public var valueCodeableConcept: CodeableConcept? - - /// Value needed to satisfy condition. - public var valueQuantity: Quantity? - - /// Value needed to satisfy condition. - public var valueRange: Range? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: CodeableConcept, valueBoolean: Bool, valueCodeableConcept: CodeableConcept, valueQuantity: Quantity, valueRange: Range) { - self.init(json: nil) - self.type = type - self.valueBoolean = valueBoolean - self.valueCodeableConcept = valueCodeableConcept - self.valueQuantity = valueQuantity - self.valueRange = valueRange - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["valueBoolean"] { - presentKeys.insert("valueBoolean") - if let val = exist as? Bool { - self.valueBoolean = val - } - else { - errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCodeableConcept"] { - presentKeys.insert("valueCodeableConcept") - if let val = exist as? FHIRJSON { - self.valueCodeableConcept = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueQuantity"] { - presentKeys.insert("valueQuantity") - if let val = exist as? FHIRJSON { - self.valueQuantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueRange"] { - presentKeys.insert("valueRange") - if let val = exist as? FHIRJSON { - self.valueRange = Range(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - - // check if nonoptional expanded properties are present - if nil == self.valueCodeableConcept && nil == self.valueBoolean && nil == self.valueQuantity && nil == self.valueRange { - errors.append(FHIRJSONError(key: "value*")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let type = self.type { - json["type"] = type.asJSON() - } - if let valueBoolean = self.valueBoolean { - json["valueBoolean"] = valueBoolean.asJSON() - } - if let valueCodeableConcept = self.valueCodeableConcept { - json["valueCodeableConcept"] = valueCodeableConcept.asJSON() - } - if let valueQuantity = self.valueQuantity { - json["valueQuantity"] = valueQuantity.asJSON() - } - if let valueRange = self.valueRange { - json["valueRange"] = valueRange.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Provenance.swift b/Sources/Models/Provenance.swift index 2489298f..1e90d8df 100644 --- a/Sources/Models/Provenance.swift +++ b/Sources/Models/Provenance.swift @@ -2,7 +2,7 @@ // Provenance.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Provenance) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Provenance) on 2016-08-09. // 2016, SMART Health IT. // @@ -26,9 +26,9 @@ public class Provenance: DomainResource { } /// Activity that occurred. - public var activity: Coding? + public var activity: CodeableConcept? - /// Actor involved. + /// Agents involved in creating resource. public var agent: [ProvenanceAgent]? /// An entity used in this activity. @@ -44,7 +44,7 @@ public class Provenance: DomainResource { public var policy: [URL]? /// Reason the activity is occurring. - public var reason: [Coding]? + public var reason: [CodeableConcept]? /// When the activity was recorded / updated. public var recorded: Instant? @@ -62,9 +62,8 @@ public class Provenance: DomainResource { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(agent: [ProvenanceAgent], recorded: Instant, target: [Reference]) { + public convenience init(recorded: Instant, target: [Reference]) { self.init(json: nil) - self.agent = agent self.recorded = recorded self.target = target } @@ -75,7 +74,7 @@ public class Provenance: DomainResource { if let exist: AnyObject = js["activity"] { presentKeys.insert("activity") if let val = exist as? FHIRJSON { - self.activity = Coding(json: val, owner: self) + self.activity = CodeableConcept(json: val, owner: self) } else { errors.append(FHIRJSONError(key: "activity", wants: FHIRJSON.self, has: exist.dynamicType)) @@ -90,9 +89,6 @@ public class Provenance: DomainResource { errors.append(FHIRJSONError(key: "agent", wants: Array.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "agent")) - } if let exist: AnyObject = js["entity"] { presentKeys.insert("entity") if let val = exist as? [FHIRJSON] { @@ -132,7 +128,7 @@ public class Provenance: DomainResource { if let exist: AnyObject = js["reason"] { presentKeys.insert("reason") if let val = exist as? [FHIRJSON] { - self.reason = Coding.instantiate(fromArray: val, owner: self) as? [Coding] + self.reason = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: exist.dynamicType)) @@ -201,7 +197,7 @@ public class Provenance: DomainResource { json["policy"] = arr } if let reason = self.reason { - json["reason"] = Coding.asJSONArray(reason) + json["reason"] = CodeableConcept.asJSONArray(reason) } if let recorded = self.recorded { json["recorded"] = recorded.asJSON() @@ -219,10 +215,11 @@ public class Provenance: DomainResource { /** - * Actor involved. + * Agents involved in creating resource. * - * An actor taking a role in an activity for which it can be assigned some degree of responsibility for the activity - * taking place. + * An agent takes a role in an activity such that the agent can be assigned some degree of responsibility for the + * activity taking place. An agent can be a person, an organization, software, or other entities that may be ascribed + * responsibility. */ public class ProvenanceAgent: BackboneElement { override public class var resourceName: String { @@ -414,7 +411,7 @@ public class ProvenanceEntity: BackboneElement { /// Identity of entity. public var reference: URL? - /// derivation | revision | quotation | source | removal. + /// derivation | revision | quotation | source. public var role: String? /// The type of resource in this entity. diff --git a/Sources/Models/Quantity.swift b/Sources/Models/Quantity.swift index bb6c7af7..eb8a6c9b 100644 --- a/Sources/Models/Quantity.swift +++ b/Sources/Models/Quantity.swift @@ -2,7 +2,7 @@ // Quantity.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Quantity) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Quantity) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Questionnaire.swift b/Sources/Models/Questionnaire.swift index b5c57ae6..863632a9 100644 --- a/Sources/Models/Questionnaire.swift +++ b/Sources/Models/Questionnaire.swift @@ -2,7 +2,7 @@ // Questionnaire.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Questionnaire) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Questionnaire) on 2016-08-09. // 2016, SMART Health IT. // @@ -20,18 +20,15 @@ public class Questionnaire: DomainResource { get { return "Questionnaire" } } - /// Concept that represents the overall questionnaire. - public var concept: [Coding]? - /// Date this version was authored. public var date: DateTime? + /// Grouped questions. + public var group: QuestionnaireGroup? + /// External identifiers for this questionnaire. public var identifier: [Identifier]? - /// Questions and sections within the Questionnaire. - public var item: [QuestionnaireItem]? - /// Organization/individual who designed the questionnaire. public var publisher: String? @@ -44,15 +41,6 @@ public class Questionnaire: DomainResource { /// Contact information of the publisher. public var telecom: [ContactPoint]? - /// Name for the questionnaire. - public var title: String? - - /// Globally unique logical identifier for questionnaire. - public var url: URL? - - /// Questionnaire intends to support these contexts. - public var useContext: [CodeableConcept]? - /// Logical identifier for this version of Questionnaire. public var version: String? @@ -63,23 +51,15 @@ public class Questionnaire: DomainResource { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(status: String) { + public convenience init(group: QuestionnaireGroup, status: String) { self.init(json: nil) + self.group = group self.status = status } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["concept"] { - presentKeys.insert("concept") - if let val = exist as? [FHIRJSON] { - self.concept = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["date"] { presentKeys.insert("date") if let val = exist as? String { @@ -89,22 +69,25 @@ public class Questionnaire: DomainResource { errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? [FHIRJSON] { - self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] + if let exist: AnyObject = js["group"] { + presentKeys.insert("group") + if let val = exist as? FHIRJSON { + self.group = QuestionnaireGroup(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["item"] { - presentKeys.insert("item") + else { + errors.append(FHIRJSONError(key: "group")) + } + if let exist: AnyObject = js["identifier"] { + presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { - self.item = QuestionnaireItem.instantiate(fromArray: val, owner: self) as? [QuestionnaireItem] + self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["publisher"] { @@ -146,33 +129,6 @@ public class Questionnaire: DomainResource { errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["title"] { - presentKeys.insert("title") - if let val = exist as? String { - self.title = val - } - else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["useContext"] { - presentKeys.insert("useContext") - if let val = exist as? [FHIRJSON] { - self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["version"] { presentKeys.insert("version") if let val = exist as? String { @@ -189,18 +145,15 @@ public class Questionnaire: DomainResource { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let concept = self.concept { - json["concept"] = Coding.asJSONArray(concept) - } if let date = self.date { json["date"] = date.asJSON() } + if let group = self.group { + json["group"] = group.asJSON() + } if let identifier = self.identifier { json["identifier"] = Identifier.asJSONArray(identifier) } - if let item = self.item { - json["item"] = QuestionnaireItem.asJSONArray(item) - } if let publisher = self.publisher { json["publisher"] = publisher.asJSON() } @@ -217,15 +170,6 @@ public class Questionnaire: DomainResource { if let telecom = self.telecom { json["telecom"] = ContactPoint.asJSONArray(telecom) } - if let title = self.title { - json["title"] = title.asJSON() - } - if let url = self.url { - json["url"] = url.asJSON() - } - if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) - } if let version = self.version { json["version"] = version.asJSON() } @@ -236,92 +180,38 @@ public class Questionnaire: DomainResource { /** - * Questions and sections within the Questionnaire. + * Grouped questions. * - * The questions and groupings of questions that make up the questionnaire. + * A collection of related questions (or further groupings of questions). */ -public class QuestionnaireItem: BackboneElement { +public class QuestionnaireGroup: BackboneElement { override public class var resourceName: String { - get { return "QuestionnaireItem" } + get { return "QuestionnaireGroup" } } - /// Concept that represents this item within in a questionnaire. + /// Concept that represents this section in a questionnaire. public var concept: [Coding]? - /// Only allow data when:. - public var enableWhen: [QuestionnaireItemEnableWhen]? - - /// Initial presumed answer for question. - public var initialAttachment: Attachment? - - /// Initial presumed answer for question. - public var initialBoolean: Bool? - - /// Initial presumed answer for question. - public var initialCoding: Coding? - - /// Initial presumed answer for question. - public var initialDate: FHIRDate? - - /// Initial presumed answer for question. - public var initialDateTime: DateTime? - - /// Initial presumed answer for question. - public var initialDecimal: NSDecimalNumber? - - /// Initial presumed answer for question. - public var initialInstant: Instant? - - /// Initial presumed answer for question. - public var initialInteger: Int? - - /// Initial presumed answer for question. - public var initialQuantity: Quantity? - - /// Initial presumed answer for question. - public var initialReference: Reference? - - /// Initial presumed answer for question. - public var initialString: String? - - /// Initial presumed answer for question. - public var initialTime: FHIRTime? - - /// Initial presumed answer for question. - public var initialUri: URL? - - /// Nested questionnaire items. - public var item: [QuestionnaireItem]? + /// Nested questionnaire group. + public var group: [QuestionnaireGroup]? /// To link questionnaire with questionnaire response. public var linkId: String? - /// No more than this many characters. - public var maxLength: Int? - - /// Permitted answer. - public var option: [QuestionnaireItemOption]? - - /// Valueset containing permitted answers. - public var options: Reference? - - /// E.g. "1(a)", "2.5.3". - public var prefix: String? - - /// Don't allow human editing. - public var readOnly: Bool? + /// Questions in this group. + public var question: [QuestionnaireGroupQuestion]? - /// Whether the item may repeat. + /// Whether the group may repeat. public var repeats: Bool? - /// Whether the item must be included in data results. + /// Whether the group must be included in data results. public var required: Bool? - /// Primary text for the item. + /// Additional text for the group. public var text: String? - /// group | display | boolean | decimal | integer | date | dateTime +. - public var type: String? + /// Name to be displayed for group. + public var title: String? /** Initialize with a JSON object. */ @@ -329,12 +219,6 @@ public class QuestionnaireItem: BackboneElement { super.init(json: json, owner: owner) } - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String) { - self.init(json: nil) - self.type = type - } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { @@ -347,139 +231,13 @@ public class QuestionnaireItem: BackboneElement { errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["enableWhen"] { - presentKeys.insert("enableWhen") - if let val = exist as? [FHIRJSON] { - self.enableWhen = QuestionnaireItemEnableWhen.instantiate(fromArray: val, owner: self) as? [QuestionnaireItemEnableWhen] - } - else { - errors.append(FHIRJSONError(key: "enableWhen", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialAttachment"] { - presentKeys.insert("initialAttachment") - if let val = exist as? FHIRJSON { - self.initialAttachment = Attachment(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "initialAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialBoolean"] { - presentKeys.insert("initialBoolean") - if let val = exist as? Bool { - self.initialBoolean = val - } - else { - errors.append(FHIRJSONError(key: "initialBoolean", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialCoding"] { - presentKeys.insert("initialCoding") - if let val = exist as? FHIRJSON { - self.initialCoding = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "initialCoding", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialDate"] { - presentKeys.insert("initialDate") - if let val = exist as? String { - self.initialDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "initialDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialDateTime"] { - presentKeys.insert("initialDateTime") - if let val = exist as? String { - self.initialDateTime = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "initialDateTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialDecimal"] { - presentKeys.insert("initialDecimal") - if let val = exist as? NSNumber { - self.initialDecimal = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "initialDecimal", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialInstant"] { - presentKeys.insert("initialInstant") - if let val = exist as? String { - self.initialInstant = Instant(string: val) - } - else { - errors.append(FHIRJSONError(key: "initialInstant", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialInteger"] { - presentKeys.insert("initialInteger") - if let val = exist as? Int { - self.initialInteger = val - } - else { - errors.append(FHIRJSONError(key: "initialInteger", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialQuantity"] { - presentKeys.insert("initialQuantity") - if let val = exist as? FHIRJSON { - self.initialQuantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "initialQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialReference"] { - presentKeys.insert("initialReference") - if let val = exist as? FHIRJSON { - self.initialReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "initialReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialString"] { - presentKeys.insert("initialString") - if let val = exist as? String { - self.initialString = val - } - else { - errors.append(FHIRJSONError(key: "initialString", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialTime"] { - presentKeys.insert("initialTime") - if let val = exist as? String { - self.initialTime = FHIRTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "initialTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["initialUri"] { - presentKeys.insert("initialUri") - if let val = exist as? String { - self.initialUri = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "initialUri", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["item"] { - presentKeys.insert("item") + if let exist: AnyObject = js["group"] { + presentKeys.insert("group") if let val = exist as? [FHIRJSON] { - self.item = QuestionnaireItem.instantiate(fromArray: val, owner: self) as? [QuestionnaireItem] + self.group = QuestionnaireGroup.instantiate(fromArray: val, owner: self) as? [QuestionnaireGroup] } else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["linkId"] { @@ -491,49 +249,13 @@ public class QuestionnaireItem: BackboneElement { errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["maxLength"] { - presentKeys.insert("maxLength") - if let val = exist as? Int { - self.maxLength = val - } - else { - errors.append(FHIRJSONError(key: "maxLength", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["option"] { - presentKeys.insert("option") + if let exist: AnyObject = js["question"] { + presentKeys.insert("question") if let val = exist as? [FHIRJSON] { - self.option = QuestionnaireItemOption.instantiate(fromArray: val, owner: self) as? [QuestionnaireItemOption] - } - else { - errors.append(FHIRJSONError(key: "option", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["options"] { - presentKeys.insert("options") - if let val = exist as? FHIRJSON { - self.options = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "options", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["prefix"] { - presentKeys.insert("prefix") - if let val = exist as? String { - self.prefix = val + self.question = QuestionnaireGroupQuestion.instantiate(fromArray: val, owner: self) as? [QuestionnaireGroupQuestion] } else { - errors.append(FHIRJSONError(key: "prefix", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["readOnly"] { - presentKeys.insert("readOnly") - if let val = exist as? Bool { - self.readOnly = val - } - else { - errors.append(FHIRJSONError(key: "readOnly", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "question", wants: Array.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["repeats"] { @@ -563,18 +285,15 @@ public class QuestionnaireItem: BackboneElement { errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") + if let exist: AnyObject = js["title"] { + presentKeys.insert("title") if let val = exist as? String { - self.type = val + self.title = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "type")) - } } return errors.isEmpty ? nil : errors } @@ -585,68 +304,14 @@ public class QuestionnaireItem: BackboneElement { if let concept = self.concept { json["concept"] = Coding.asJSONArray(concept) } - if let enableWhen = self.enableWhen { - json["enableWhen"] = QuestionnaireItemEnableWhen.asJSONArray(enableWhen) - } - if let initialAttachment = self.initialAttachment { - json["initialAttachment"] = initialAttachment.asJSON() - } - if let initialBoolean = self.initialBoolean { - json["initialBoolean"] = initialBoolean.asJSON() - } - if let initialCoding = self.initialCoding { - json["initialCoding"] = initialCoding.asJSON() - } - if let initialDate = self.initialDate { - json["initialDate"] = initialDate.asJSON() - } - if let initialDateTime = self.initialDateTime { - json["initialDateTime"] = initialDateTime.asJSON() - } - if let initialDecimal = self.initialDecimal { - json["initialDecimal"] = initialDecimal.asJSON() - } - if let initialInstant = self.initialInstant { - json["initialInstant"] = initialInstant.asJSON() - } - if let initialInteger = self.initialInteger { - json["initialInteger"] = initialInteger.asJSON() - } - if let initialQuantity = self.initialQuantity { - json["initialQuantity"] = initialQuantity.asJSON() - } - if let initialReference = self.initialReference { - json["initialReference"] = initialReference.asJSON() - } - if let initialString = self.initialString { - json["initialString"] = initialString.asJSON() - } - if let initialTime = self.initialTime { - json["initialTime"] = initialTime.asJSON() - } - if let initialUri = self.initialUri { - json["initialUri"] = initialUri.asJSON() - } - if let item = self.item { - json["item"] = QuestionnaireItem.asJSONArray(item) + if let group = self.group { + json["group"] = QuestionnaireGroup.asJSONArray(group) } if let linkId = self.linkId { json["linkId"] = linkId.asJSON() } - if let maxLength = self.maxLength { - json["maxLength"] = maxLength.asJSON() - } - if let option = self.option { - json["option"] = QuestionnaireItemOption.asJSONArray(option) - } - if let options = self.options { - json["options"] = options.asJSON() - } - if let prefix = self.prefix { - json["prefix"] = prefix.asJSON() - } - if let readOnly = self.readOnly { - json["readOnly"] = readOnly.asJSON() + if let question = self.question { + json["question"] = QuestionnaireGroupQuestion.asJSONArray(question) } if let repeats = self.repeats { json["repeats"] = repeats.asJSON() @@ -657,8 +322,8 @@ public class QuestionnaireItem: BackboneElement { if let text = self.text { json["text"] = text.asJSON() } - if let type = self.type { - json["type"] = type.asJSON() + if let title = self.title { + json["title"] = title.asJSON() } return json @@ -667,60 +332,41 @@ public class QuestionnaireItem: BackboneElement { /** - * Only allow data when:. + * Questions in this group. * - * If present, indicates that this item should only be enabled (displayed/allow answers to be captured) when the - * specified condition is true. + * Set of questions within this group. The order of questions within the group is relevant. */ -public class QuestionnaireItemEnableWhen: BackboneElement { +public class QuestionnaireGroupQuestion: BackboneElement { override public class var resourceName: String { - get { return "QuestionnaireItemEnableWhen" } + get { return "QuestionnaireGroupQuestion" } } - /// Value question must have. - public var answerAttachment: Attachment? - - /// Value question must have. - public var answerBoolean: Bool? - - /// Value question must have. - public var answerCoding: Coding? - - /// Value question must have. - public var answerDate: FHIRDate? - - /// Value question must have. - public var answerDateTime: DateTime? - - /// Value question must have. - public var answerDecimal: NSDecimalNumber? - - /// Value question must have. - public var answerInstant: Instant? + /// Concept that represents this question on a questionnaire. + public var concept: [Coding]? - /// Value question must have. - public var answerInteger: Int? + /// Nested questionnaire group. + public var group: [QuestionnaireGroup]? - /// Value question must have. - public var answerQuantity: Quantity? + /// To link questionnaire with questionnaire response. + public var linkId: String? - /// Value question must have. - public var answerReference: Reference? + /// Permitted answer. + public var option: [Coding]? - /// Value question must have. - public var answerString: String? + /// Valueset containing permitted answers. + public var options: Reference? - /// Value question must have. - public var answerTime: FHIRTime? + /// Whether the question can have multiple answers. + public var repeats: Bool? - /// Value question must have. - public var answerUri: URL? + /// Whether the question must be answered in data results. + public var required: Bool? - /// Enable when answered or not. - public var answered: Bool? + /// Text of the question as it is shown to the user. + public var text: String? - /// Question that determines whether item is enabled. - public var question: String? + /// boolean | decimal | integer | date | dateTime +. + public var type: String? /** Initialize with a JSON object. */ @@ -728,153 +374,90 @@ public class QuestionnaireItemEnableWhen: BackboneElement { super.init(json: json, owner: owner) } - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(question: String) { - self.init(json: nil) - self.question = question - } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["answerAttachment"] { - presentKeys.insert("answerAttachment") - if let val = exist as? FHIRJSON { - self.answerAttachment = Attachment(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "answerAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["answerBoolean"] { - presentKeys.insert("answerBoolean") - if let val = exist as? Bool { - self.answerBoolean = val - } - else { - errors.append(FHIRJSONError(key: "answerBoolean", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["answerCoding"] { - presentKeys.insert("answerCoding") - if let val = exist as? FHIRJSON { - self.answerCoding = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "answerCoding", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["answerDate"] { - presentKeys.insert("answerDate") - if let val = exist as? String { - self.answerDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "answerDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["answerDateTime"] { - presentKeys.insert("answerDateTime") - if let val = exist as? String { - self.answerDateTime = DateTime(string: val) + if let exist: AnyObject = js["concept"] { + presentKeys.insert("concept") + if let val = exist as? [FHIRJSON] { + self.concept = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "answerDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["answerDecimal"] { - presentKeys.insert("answerDecimal") - if let val = exist as? NSNumber { - self.answerDecimal = NSDecimalNumber(json: val) + if let exist: AnyObject = js["group"] { + presentKeys.insert("group") + if let val = exist as? [FHIRJSON] { + self.group = QuestionnaireGroup.instantiate(fromArray: val, owner: self) as? [QuestionnaireGroup] } else { - errors.append(FHIRJSONError(key: "answerDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["answerInstant"] { - presentKeys.insert("answerInstant") + if let exist: AnyObject = js["linkId"] { + presentKeys.insert("linkId") if let val = exist as? String { - self.answerInstant = Instant(string: val) - } - else { - errors.append(FHIRJSONError(key: "answerInstant", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["answerInteger"] { - presentKeys.insert("answerInteger") - if let val = exist as? Int { - self.answerInteger = val + self.linkId = val } else { - errors.append(FHIRJSONError(key: "answerInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["answerQuantity"] { - presentKeys.insert("answerQuantity") - if let val = exist as? FHIRJSON { - self.answerQuantity = Quantity(json: val, owner: self) + if let exist: AnyObject = js["option"] { + presentKeys.insert("option") + if let val = exist as? [FHIRJSON] { + self.option = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "answerQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "option", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["answerReference"] { - presentKeys.insert("answerReference") + if let exist: AnyObject = js["options"] { + presentKeys.insert("options") if let val = exist as? FHIRJSON { - self.answerReference = Reference(json: val, owner: self) + self.options = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "answerReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "options", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["answerString"] { - presentKeys.insert("answerString") - if let val = exist as? String { - self.answerString = val + if let exist: AnyObject = js["repeats"] { + presentKeys.insert("repeats") + if let val = exist as? Bool { + self.repeats = val } else { - errors.append(FHIRJSONError(key: "answerString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "repeats", wants: Bool.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["answerTime"] { - presentKeys.insert("answerTime") - if let val = exist as? String { - self.answerTime = FHIRTime(string: val) + if let exist: AnyObject = js["required"] { + presentKeys.insert("required") + if let val = exist as? Bool { + self.required = val } else { - errors.append(FHIRJSONError(key: "answerTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "required", wants: Bool.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["answerUri"] { - presentKeys.insert("answerUri") + if let exist: AnyObject = js["text"] { + presentKeys.insert("text") if let val = exist as? String { - self.answerUri = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "answerUri", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["answered"] { - presentKeys.insert("answered") - if let val = exist as? Bool { - self.answered = val + self.text = val } else { - errors.append(FHIRJSONError(key: "answered", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["question"] { - presentKeys.insert("question") + if let exist: AnyObject = js["type"] { + presentKeys.insert("type") if let val = exist as? String { - self.question = val + self.type = val } else { - errors.append(FHIRJSONError(key: "question", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "question")) - } } return errors.isEmpty ? nil : errors } @@ -882,172 +465,32 @@ public class QuestionnaireItemEnableWhen: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let answerAttachment = self.answerAttachment { - json["answerAttachment"] = answerAttachment.asJSON() - } - if let answerBoolean = self.answerBoolean { - json["answerBoolean"] = answerBoolean.asJSON() - } - if let answerCoding = self.answerCoding { - json["answerCoding"] = answerCoding.asJSON() - } - if let answerDate = self.answerDate { - json["answerDate"] = answerDate.asJSON() - } - if let answerDateTime = self.answerDateTime { - json["answerDateTime"] = answerDateTime.asJSON() - } - if let answerDecimal = self.answerDecimal { - json["answerDecimal"] = answerDecimal.asJSON() - } - if let answerInstant = self.answerInstant { - json["answerInstant"] = answerInstant.asJSON() - } - if let answerInteger = self.answerInteger { - json["answerInteger"] = answerInteger.asJSON() - } - if let answerQuantity = self.answerQuantity { - json["answerQuantity"] = answerQuantity.asJSON() - } - if let answerReference = self.answerReference { - json["answerReference"] = answerReference.asJSON() - } - if let answerString = self.answerString { - json["answerString"] = answerString.asJSON() - } - if let answerTime = self.answerTime { - json["answerTime"] = answerTime.asJSON() - } - if let answerUri = self.answerUri { - json["answerUri"] = answerUri.asJSON() + if let concept = self.concept { + json["concept"] = Coding.asJSONArray(concept) } - if let answered = self.answered { - json["answered"] = answered.asJSON() + if let group = self.group { + json["group"] = QuestionnaireGroup.asJSONArray(group) } - if let question = self.question { - json["question"] = question.asJSON() + if let linkId = self.linkId { + json["linkId"] = linkId.asJSON() } - - return json - } -} - - -/** - * Permitted answer. - * - * For a "choice" question, identifies one of the permitted answers for the question. - */ -public class QuestionnaireItemOption: BackboneElement { - override public class var resourceName: String { - get { return "QuestionnaireItemOption" } - } - - /// Answer value. - public var valueCoding: Coding? - - /// Answer value. - public var valueDate: FHIRDate? - - /// Answer value. - public var valueInteger: Int? - - /// Answer value. - public var valueString: String? - - /// Answer value. - public var valueTime: FHIRTime? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(valueCoding: Coding, valueDate: FHIRDate, valueInteger: Int, valueString: String, valueTime: FHIRTime) { - self.init(json: nil) - self.valueCoding = valueCoding - self.valueDate = valueDate - self.valueInteger = valueInteger - self.valueString = valueString - self.valueTime = valueTime - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["valueCoding"] { - presentKeys.insert("valueCoding") - if let val = exist as? FHIRJSON { - self.valueCoding = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueCoding", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueDate"] { - presentKeys.insert("valueDate") - if let val = exist as? String { - self.valueDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueInteger"] { - presentKeys.insert("valueInteger") - if let val = exist as? Int { - self.valueInteger = val - } - else { - errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueString"] { - presentKeys.insert("valueString") - if let val = exist as? String { - self.valueString = val - } - else { - errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueTime"] { - presentKeys.insert("valueTime") - if let val = exist as? String { - self.valueTime = FHIRTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: exist.dynamicType)) - } - } - - // check if nonoptional expanded properties are present - if nil == self.valueInteger && nil == self.valueDate && nil == self.valueTime && nil == self.valueString && nil == self.valueCoding { - errors.append(FHIRJSONError(key: "value*")) - } + if let option = self.option { + json["option"] = Coding.asJSONArray(option) } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let valueCoding = self.valueCoding { - json["valueCoding"] = valueCoding.asJSON() + if let options = self.options { + json["options"] = options.asJSON() } - if let valueDate = self.valueDate { - json["valueDate"] = valueDate.asJSON() + if let repeats = self.repeats { + json["repeats"] = repeats.asJSON() } - if let valueInteger = self.valueInteger { - json["valueInteger"] = valueInteger.asJSON() + if let required = self.required { + json["required"] = required.asJSON() } - if let valueString = self.valueString { - json["valueString"] = valueString.asJSON() + if let text = self.text { + json["text"] = text.asJSON() } - if let valueTime = self.valueTime { - json["valueTime"] = valueTime.asJSON() + if let type = self.type { + json["type"] = type.asJSON() } return json diff --git a/Sources/Models/QuestionnaireResponse.swift b/Sources/Models/QuestionnaireResponse.swift index 44d12a10..f96f4ad1 100644 --- a/Sources/Models/QuestionnaireResponse.swift +++ b/Sources/Models/QuestionnaireResponse.swift @@ -2,7 +2,7 @@ // QuestionnaireResponse.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) on 2016-08-09. // 2016, SMART Health IT. // @@ -29,12 +29,12 @@ public class QuestionnaireResponse: DomainResource { /// Primary encounter during which the answers were collected. public var encounter: Reference? + /// Grouped questions. + public var group: QuestionnaireResponseGroup? + /// Unique id for this set of answers. public var identifier: Identifier? - /// Groups and questions. - public var item: [QuestionnaireResponseItem]? - /// Form being answered. public var questionnaire: Reference? @@ -89,22 +89,22 @@ public class QuestionnaireResponse: DomainResource { errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") + if let exist: AnyObject = js["group"] { + presentKeys.insert("group") if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) + self.group = QuestionnaireResponseGroup(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["item"] { - presentKeys.insert("item") - if let val = exist as? [FHIRJSON] { - self.item = QuestionnaireResponseItem.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseItem] + if let exist: AnyObject = js["identifier"] { + presentKeys.insert("identifier") + if let val = exist as? FHIRJSON { + self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["questionnaire"] { @@ -162,12 +162,12 @@ public class QuestionnaireResponse: DomainResource { if let encounter = self.encounter { json["encounter"] = encounter.asJSON() } + if let group = self.group { + json["group"] = group.asJSON() + } if let identifier = self.identifier { json["identifier"] = identifier.asJSON() } - if let item = self.item { - json["item"] = QuestionnaireResponseItem.asJSONArray(item) - } if let questionnaire = self.questionnaire { json["questionnaire"] = questionnaire.asJSON() } @@ -187,30 +187,33 @@ public class QuestionnaireResponse: DomainResource { /** - * Groups and questions. + * Grouped questions. * - * Corresponds to a group or question item from the original questionnaire. + * A group of questions to a possibly similarly grouped set of questions in the questionnaire response. */ -public class QuestionnaireResponseItem: BackboneElement { +public class QuestionnaireResponseGroup: BackboneElement { override public class var resourceName: String { - get { return "QuestionnaireResponseItem" } + get { return "QuestionnaireResponseGroup" } } - /// The response(s) to the question. - public var answer: [QuestionnaireResponseItemAnswer]? - - /// Nested questionnaire response items. - public var item: [QuestionnaireResponseItem]? + /// Nested questionnaire response group. + public var group: [QuestionnaireResponseGroup]? - /// Corresponding item within Questionnaire. + /// Corresponding group within Questionnaire. public var linkId: String? + /// Questions in this group. + public var question: [QuestionnaireResponseGroupQuestion]? + /// The subject this group's answers are about. public var subject: Reference? - /// Name for group or question text. + /// Additional text for the group. public var text: String? + /// Name for this group. + public var title: String? + /** Initialize with a JSON object. */ public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { @@ -220,22 +223,13 @@ public class QuestionnaireResponseItem: BackboneElement { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["answer"] { - presentKeys.insert("answer") + if let exist: AnyObject = js["group"] { + presentKeys.insert("group") if let val = exist as? [FHIRJSON] { - self.answer = QuestionnaireResponseItemAnswer.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseItemAnswer] + self.group = QuestionnaireResponseGroup.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseGroup] } else { - errors.append(FHIRJSONError(key: "answer", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["item"] { - presentKeys.insert("item") - if let val = exist as? [FHIRJSON] { - self.item = QuestionnaireResponseItem.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseItem] - } - else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["linkId"] { @@ -247,6 +241,15 @@ public class QuestionnaireResponseItem: BackboneElement { errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["question"] { + presentKeys.insert("question") + if let val = exist as? [FHIRJSON] { + self.question = QuestionnaireResponseGroupQuestion.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseGroupQuestion] + } + else { + errors.append(FHIRJSONError(key: "question", wants: Array.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { @@ -265,6 +268,15 @@ public class QuestionnaireResponseItem: BackboneElement { errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["title"] { + presentKeys.insert("title") + if let val = exist as? String { + self.title = val + } + else { + errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) + } + } } return errors.isEmpty ? nil : errors } @@ -272,21 +284,101 @@ public class QuestionnaireResponseItem: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let answer = self.answer { - json["answer"] = QuestionnaireResponseItemAnswer.asJSONArray(answer) - } - if let item = self.item { - json["item"] = QuestionnaireResponseItem.asJSONArray(item) + if let group = self.group { + json["group"] = QuestionnaireResponseGroup.asJSONArray(group) } if let linkId = self.linkId { json["linkId"] = linkId.asJSON() } + if let question = self.question { + json["question"] = QuestionnaireResponseGroupQuestion.asJSONArray(question) + } if let subject = self.subject { json["subject"] = subject.asJSON() } if let text = self.text { json["text"] = text.asJSON() } + if let title = self.title { + json["title"] = title.asJSON() + } + + return json + } +} + + +/** + * Questions in this group. + * + * Set of questions within this group. The order of questions within the group is relevant. + */ +public class QuestionnaireResponseGroupQuestion: BackboneElement { + override public class var resourceName: String { + get { return "QuestionnaireResponseGroupQuestion" } + } + + /// The response(s) to the question. + public var answer: [QuestionnaireResponseGroupQuestionAnswer]? + + /// Corresponding question within Questionnaire. + public var linkId: String? + + /// Text of the question as it is shown to the user. + public var text: String? + + + /** Initialize with a JSON object. */ + public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { + super.init(json: json, owner: owner) + } + + public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + if let js = json { + if let exist: AnyObject = js["answer"] { + presentKeys.insert("answer") + if let val = exist as? [FHIRJSON] { + self.answer = QuestionnaireResponseGroupQuestionAnswer.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseGroupQuestionAnswer] + } + else { + errors.append(FHIRJSONError(key: "answer", wants: Array.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["linkId"] { + presentKeys.insert("linkId") + if let val = exist as? String { + self.linkId = val + } + else { + errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["text"] { + presentKeys.insert("text") + if let val = exist as? String { + self.text = val + } + else { + errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + } + } + } + return errors.isEmpty ? nil : errors + } + + override public func asJSON() -> FHIRJSON { + var json = super.asJSON() + + if let answer = self.answer { + json["answer"] = QuestionnaireResponseGroupQuestionAnswer.asJSONArray(answer) + } + if let linkId = self.linkId { + json["linkId"] = linkId.asJSON() + } + if let text = self.text { + json["text"] = text.asJSON() + } return json } @@ -298,13 +390,13 @@ public class QuestionnaireResponseItem: BackboneElement { * * The respondent's answer(s) to the question. */ -public class QuestionnaireResponseItemAnswer: BackboneElement { +public class QuestionnaireResponseGroupQuestionAnswer: BackboneElement { override public class var resourceName: String { - get { return "QuestionnaireResponseItemAnswer" } + get { return "QuestionnaireResponseGroupQuestionAnswer" } } - /// Nested groups and questions. - public var item: [QuestionnaireResponseItem]? + /// Nested questionnaire group. + public var group: [QuestionnaireResponseGroup]? /// Single-valued answer to the question. public var valueAttachment: Attachment? @@ -354,13 +446,13 @@ public class QuestionnaireResponseItemAnswer: BackboneElement { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["item"] { - presentKeys.insert("item") + if let exist: AnyObject = js["group"] { + presentKeys.insert("group") if let val = exist as? [FHIRJSON] { - self.item = QuestionnaireResponseItem.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseItem] + self.group = QuestionnaireResponseGroup.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseGroup] } else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["valueAttachment"] { @@ -487,8 +579,8 @@ public class QuestionnaireResponseItemAnswer: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let item = self.item { - json["item"] = QuestionnaireResponseItem.asJSONArray(item) + if let group = self.group { + json["group"] = QuestionnaireResponseGroup.asJSONArray(group) } if let valueAttachment = self.valueAttachment { json["valueAttachment"] = valueAttachment.asJSON() diff --git a/Sources/Models/Range.swift b/Sources/Models/Range.swift index f023a02d..e6073095 100644 --- a/Sources/Models/Range.swift +++ b/Sources/Models/Range.swift @@ -2,7 +2,7 @@ // Range.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Range) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Range) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Ratio.swift b/Sources/Models/Ratio.swift index f9520d6f..7b3846dd 100644 --- a/Sources/Models/Ratio.swift +++ b/Sources/Models/Ratio.swift @@ -2,7 +2,7 @@ // Ratio.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Ratio) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Ratio) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Reference.swift b/Sources/Models/Reference.swift index d1b1320d..52d33782 100644 --- a/Sources/Models/Reference.swift +++ b/Sources/Models/Reference.swift @@ -2,7 +2,7 @@ // Reference.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Reference) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Reference) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/ReferralRequest.swift b/Sources/Models/ReferralRequest.swift index 1ca3c452..e6b7ee81 100644 --- a/Sources/Models/ReferralRequest.swift +++ b/Sources/Models/ReferralRequest.swift @@ -2,7 +2,7 @@ // ReferralRequest.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ReferralRequest) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ReferralRequest) on 2016-08-09. // 2016, SMART Health IT. // @@ -21,29 +21,23 @@ public class ReferralRequest: DomainResource { } /// Date of creation/activation. - public var authored: DateTime? + public var date: DateTime? - /// Request fulfilled by this request. - public var basedOn: [Reference]? - - /// proposal | plan | request. - public var category: String? - - /// Originating encounter. - public var context: Reference? + /// Date referral/transfer of care request is sent. + public var dateSent: DateTime? /// A textual description of the referral. public var description_fhir: String? + /// Originating encounter. + public var encounter: Reference? + /// Requested service(s) fulfillment time. public var fulfillmentTime: Period? /// Business identifier. public var identifier: [Identifier]? - /// Composite request this is part of. - public var parent: Identifier? - /// Patient referred to care or transfer. public var patient: Reference? @@ -65,7 +59,7 @@ public class ReferralRequest: DomainResource { /// The clinical specialty (discipline) that the referral is requested for. public var specialty: CodeableConcept? - /// draft | active | cancelled | completed | entered-in-error. + /// draft | requested | active | cancelled | accepted | rejected | completed. public var status: String? /// Additonal information to support referral or transfer of care request. @@ -81,52 +75,30 @@ public class ReferralRequest: DomainResource { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(category: String, status: String) { + public convenience init(status: String) { self.init(json: nil) - self.category = category self.status = status } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["authored"] { - presentKeys.insert("authored") + if let exist: AnyObject = js["date"] { + presentKeys.insert("date") if let val = exist as? String { - self.authored = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "authored", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["basedOn"] { - presentKeys.insert("basedOn") - if let val = exist as? [FHIRJSON] { - self.basedOn = Reference.instantiate(fromArray: val, owner: self) as? [Reference] + self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "basedOn", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["category"] { - presentKeys.insert("category") + if let exist: AnyObject = js["dateSent"] { + presentKeys.insert("dateSent") if let val = exist as? String { - self.category = val - } - else { - errors.append(FHIRJSONError(key: "category", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "category")) - } - if let exist: AnyObject = js["context"] { - presentKeys.insert("context") - if let val = exist as? FHIRJSON { - self.context = Reference(json: val, owner: self) + self.dateSent = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "context", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateSent", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["description"] { @@ -138,6 +110,15 @@ public class ReferralRequest: DomainResource { errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["encounter"] { + presentKeys.insert("encounter") + if let val = exist as? FHIRJSON { + self.encounter = Reference(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["fulfillmentTime"] { presentKeys.insert("fulfillmentTime") if let val = exist as? FHIRJSON { @@ -156,15 +137,6 @@ public class ReferralRequest: DomainResource { errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["parent"] { - presentKeys.insert("parent") - if let val = exist as? FHIRJSON { - self.parent = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "parent", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { @@ -265,30 +237,24 @@ public class ReferralRequest: DomainResource { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let authored = self.authored { - json["authored"] = authored.asJSON() + if let date = self.date { + json["date"] = date.asJSON() } - if let basedOn = self.basedOn { - json["basedOn"] = Reference.asJSONArray(basedOn) - } - if let category = self.category { - json["category"] = category.asJSON() - } - if let context = self.context { - json["context"] = context.asJSON() + if let dateSent = self.dateSent { + json["dateSent"] = dateSent.asJSON() } if let description_fhir = self.description_fhir { json["description"] = description_fhir.asJSON() } + if let encounter = self.encounter { + json["encounter"] = encounter.asJSON() + } if let fulfillmentTime = self.fulfillmentTime { json["fulfillmentTime"] = fulfillmentTime.asJSON() } if let identifier = self.identifier { json["identifier"] = Identifier.asJSONArray(identifier) } - if let parent = self.parent { - json["parent"] = parent.asJSON() - } if let patient = self.patient { json["patient"] = patient.asJSON() } diff --git a/Sources/Models/RelatedPerson.swift b/Sources/Models/RelatedPerson.swift index 4e803fa3..d6d85ced 100644 --- a/Sources/Models/RelatedPerson.swift +++ b/Sources/Models/RelatedPerson.swift @@ -2,7 +2,7 @@ // RelatedPerson.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/RelatedPerson) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/RelatedPerson) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Resource.swift b/Sources/Models/Resource.swift index 0719c3e5..8b61e959 100644 --- a/Sources/Models/Resource.swift +++ b/Sources/Models/Resource.swift @@ -2,7 +2,7 @@ // Resource.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Resource) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Resource) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/RiskAssessment.swift b/Sources/Models/RiskAssessment.swift index ef381ee0..816cc50d 100644 --- a/Sources/Models/RiskAssessment.swift +++ b/Sources/Models/RiskAssessment.swift @@ -2,7 +2,7 @@ // RiskAssessment.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/RiskAssessment) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/RiskAssessment) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/SampledData.swift b/Sources/Models/SampledData.swift index b3b6dc27..2fc5ffae 100644 --- a/Sources/Models/SampledData.swift +++ b/Sources/Models/SampledData.swift @@ -2,7 +2,7 @@ // SampledData.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/SampledData) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SampledData) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Schedule.swift b/Sources/Models/Schedule.swift index ccd900ef..0d250bfc 100644 --- a/Sources/Models/Schedule.swift +++ b/Sources/Models/Schedule.swift @@ -2,7 +2,7 @@ // Schedule.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Schedule) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Schedule) on 2016-08-09. // 2016, SMART Health IT. // @@ -29,14 +29,8 @@ public class Schedule: DomainResource { /// 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? - /// 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 schedule type can be used for the categorization of healthcare services or other appointment types. + public var type: [CodeableConcept]? /** Initialize with a JSON object. */ @@ -92,31 +86,13 @@ public class Schedule: DomainResource { errors.append(FHIRJSONError(key: "planningHorizon", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["serviceCategory"] { - presentKeys.insert("serviceCategory") - if let val = exist as? FHIRJSON { - self.serviceCategory = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "serviceCategory", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["serviceType"] { - presentKeys.insert("serviceType") + if let exist: AnyObject = js["type"] { + presentKeys.insert("type") if let val = exist as? [FHIRJSON] { - self.serviceType = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] + self.type = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "serviceType", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["specialty"] { - presentKeys.insert("specialty") - if let val = exist as? [FHIRJSON] { - self.specialty = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "specialty", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) } } } @@ -138,14 +114,8 @@ public class Schedule: DomainResource { if let planningHorizon = self.planningHorizon { json["planningHorizon"] = planningHorizon.asJSON() } - if let serviceCategory = self.serviceCategory { - json["serviceCategory"] = serviceCategory.asJSON() - } - if let serviceType = self.serviceType { - json["serviceType"] = CodeableConcept.asJSONArray(serviceType) - } - if let specialty = self.specialty { - json["specialty"] = CodeableConcept.asJSONArray(specialty) + if let type = self.type { + json["type"] = CodeableConcept.asJSONArray(type) } return json diff --git a/Sources/Models/SearchParameter.swift b/Sources/Models/SearchParameter.swift index 0a692678..72cc8873 100644 --- a/Sources/Models/SearchParameter.swift +++ b/Sources/Models/SearchParameter.swift @@ -2,7 +2,7 @@ // SearchParameter.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/SearchParameter) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SearchParameter) on 2016-08-09. // 2016, SMART Health IT. // @@ -37,9 +37,6 @@ public class SearchParameter: DomainResource { /// If for testing purposes, not real usage. public var experimental: Bool? - /// FluentPath expression that extracts the values. - public var expression: String? - /// Informal name for this search parameter. public var name: String? @@ -61,9 +58,6 @@ public class SearchParameter: DomainResource { /// Absolute URL used to reference this search parameter. public var url: URL? - /// Content intends to support these contexts. - public var useContext: [CodeableConcept]? - /// XPath that extracts the values. public var xpath: String? @@ -153,15 +147,6 @@ public class SearchParameter: DomainResource { errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["expression"] { - presentKeys.insert("expression") - if let val = exist as? String { - self.expression = val - } - else { - errors.append(FHIRJSONError(key: "expression", wants: String.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["name"] { presentKeys.insert("name") if let val = exist as? String { @@ -234,15 +219,6 @@ public class SearchParameter: DomainResource { else { errors.append(FHIRJSONError(key: "url")) } - if let exist: AnyObject = js["useContext"] { - presentKeys.insert("useContext") - if let val = exist as? [FHIRJSON] { - self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["xpath"] { presentKeys.insert("xpath") if let val = exist as? String { @@ -286,9 +262,6 @@ public class SearchParameter: DomainResource { if let experimental = self.experimental { json["experimental"] = experimental.asJSON() } - if let expression = self.expression { - json["expression"] = expression.asJSON() - } if let name = self.name { json["name"] = name.asJSON() } @@ -314,9 +287,6 @@ public class SearchParameter: DomainResource { if let url = self.url { json["url"] = url.asJSON() } - if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) - } if let xpath = self.xpath { json["xpath"] = xpath.asJSON() } @@ -339,7 +309,7 @@ public class SearchParameterContact: BackboneElement { get { return "SearchParameterContact" } } - /// Name of an individual to contact. + /// Name of a individual to contact. public var name: String? /// Contact details for individual or publisher. diff --git a/Sources/Models/Sequence.swift b/Sources/Models/Sequence.swift deleted file mode 100644 index b6396374..00000000 --- a/Sources/Models/Sequence.swift +++ /dev/null @@ -1,998 +0,0 @@ -// -// Sequence.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Sequence) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * A Sequence. - * - * Variation and Sequence data. - */ -public class Sequence: DomainResource { - override public class var resourceName: String { - get { return "Sequence" } - } - - /// Allele frequencies. - public var allelicFrequency: NSDecimalNumber? - - /// The level of occurrence of a single DNA Sequence Variation within a set of chromosomes: Heteroplasmic / Homoplasmic / Homozygous / Heterozygous / Hemizygous. - public var allelicState: CodeableConcept? - - /// Copy Number Event: Values: amplificaiton / deletion / LOH. - public var copyNumberEvent: CodeableConcept? - - /// The method for sequencing. - public var device: Reference? - - /// Observation-genetics. - public var observation: Reference? - - /// Observed Sequence. - public var observedSeq: String? - - /// Who and/or what this is about. - public var patient: Reference? - - /// Pointer to next atomic sequence. - public var pointer: [Reference]? - - /// Sequence Quality. - public var quality: [SequenceQuality]? - - /// Quantity of the sequence. - public var quantity: Quantity? - - /// Average number of reads representing a given nucleotide in the reconstructed sequence. - public var readCoverage: Int? - - /// Reference sequence. - public var referenceSeq: [SequenceReferenceSeq]? - - /// External repository. - public var repository: [SequenceRepository]? - - /// Supporting tests of human, viruses, and bacteria. - public var species: CodeableConcept? - - /// Specimen used for sequencing. - public var specimen: Reference? - - /// None. - public var structureVariation: SequenceStructureVariation? - - /// AA | DNA | RNA. - public var type: String? - - /// Variation info in this sequence. - public var variation: SequenceVariation? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String) { - self.init(json: nil) - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["allelicFrequency"] { - presentKeys.insert("allelicFrequency") - if let val = exist as? NSNumber { - self.allelicFrequency = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "allelicFrequency", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["allelicState"] { - presentKeys.insert("allelicState") - if let val = exist as? FHIRJSON { - self.allelicState = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "allelicState", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["copyNumberEvent"] { - presentKeys.insert("copyNumberEvent") - if let val = exist as? FHIRJSON { - self.copyNumberEvent = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "copyNumberEvent", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["device"] { - presentKeys.insert("device") - if let val = exist as? FHIRJSON { - self.device = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "device", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["observation"] { - presentKeys.insert("observation") - if let val = exist as? FHIRJSON { - self.observation = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "observation", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["observedSeq"] { - presentKeys.insert("observedSeq") - if let val = exist as? String { - self.observedSeq = val - } - else { - errors.append(FHIRJSONError(key: "observedSeq", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["patient"] { - presentKeys.insert("patient") - if let val = exist as? FHIRJSON { - self.patient = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["pointer"] { - presentKeys.insert("pointer") - if let val = exist as? [FHIRJSON] { - self.pointer = Reference.instantiate(fromArray: val, owner: self) as? [Reference] - } - else { - errors.append(FHIRJSONError(key: "pointer", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["quality"] { - presentKeys.insert("quality") - if let val = exist as? [FHIRJSON] { - self.quality = SequenceQuality.instantiate(fromArray: val, owner: self) as? [SequenceQuality] - } - else { - errors.append(FHIRJSONError(key: "quality", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["quantity"] { - presentKeys.insert("quantity") - if let val = exist as? FHIRJSON { - self.quantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["readCoverage"] { - presentKeys.insert("readCoverage") - if let val = exist as? Int { - self.readCoverage = val - } - else { - errors.append(FHIRJSONError(key: "readCoverage", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["referenceSeq"] { - presentKeys.insert("referenceSeq") - if let val = exist as? [FHIRJSON] { - self.referenceSeq = SequenceReferenceSeq.instantiate(fromArray: val, owner: self) as? [SequenceReferenceSeq] - } - else { - errors.append(FHIRJSONError(key: "referenceSeq", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["repository"] { - presentKeys.insert("repository") - if let val = exist as? [FHIRJSON] { - self.repository = SequenceRepository.instantiate(fromArray: val, owner: self) as? [SequenceRepository] - } - else { - errors.append(FHIRJSONError(key: "repository", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["species"] { - presentKeys.insert("species") - if let val = exist as? FHIRJSON { - self.species = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "species", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["specimen"] { - presentKeys.insert("specimen") - if let val = exist as? FHIRJSON { - self.specimen = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "specimen", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["structureVariation"] { - presentKeys.insert("structureVariation") - if let val = exist as? FHIRJSON { - self.structureVariation = SequenceStructureVariation(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "structureVariation", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - if let exist: AnyObject = js["variation"] { - presentKeys.insert("variation") - if let val = exist as? FHIRJSON { - self.variation = SequenceVariation(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "variation", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let allelicFrequency = self.allelicFrequency { - json["allelicFrequency"] = allelicFrequency.asJSON() - } - if let allelicState = self.allelicState { - json["allelicState"] = allelicState.asJSON() - } - if let copyNumberEvent = self.copyNumberEvent { - json["copyNumberEvent"] = copyNumberEvent.asJSON() - } - if let device = self.device { - json["device"] = device.asJSON() - } - if let observation = self.observation { - json["observation"] = observation.asJSON() - } - if let observedSeq = self.observedSeq { - json["observedSeq"] = observedSeq.asJSON() - } - if let patient = self.patient { - json["patient"] = patient.asJSON() - } - if let pointer = self.pointer { - json["pointer"] = Reference.asJSONArray(pointer) - } - if let quality = self.quality { - json["quality"] = SequenceQuality.asJSONArray(quality) - } - if let quantity = self.quantity { - json["quantity"] = quantity.asJSON() - } - if let readCoverage = self.readCoverage { - json["readCoverage"] = readCoverage.asJSON() - } - if let referenceSeq = self.referenceSeq { - json["referenceSeq"] = SequenceReferenceSeq.asJSONArray(referenceSeq) - } - if let repository = self.repository { - json["repository"] = SequenceRepository.asJSONArray(repository) - } - if let species = self.species { - json["species"] = species.asJSON() - } - if let specimen = self.specimen { - json["specimen"] = specimen.asJSON() - } - if let structureVariation = self.structureVariation { - json["structureVariation"] = structureVariation.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - if let variation = self.variation { - json["variation"] = variation.asJSON() - } - - return json - } -} - - -/** - * Sequence Quality. - * - * Quality for sequence quality vary by platform reflecting differences in sequencing chemistry and digital processing. - */ -public class SequenceQuality: BackboneElement { - override public class var resourceName: String { - get { return "SequenceQuality" } - } - - /// 0-based end position (exclusive) of the sequence. - public var end: Int? - - /// Method for quality. - public var method: String? - - /// Quality score. - public var score: Quantity? - - /// 0-based start position (inclusive) of the sequence. - public var start: Int? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["end"] { - presentKeys.insert("end") - if let val = exist as? Int { - self.end = val - } - else { - errors.append(FHIRJSONError(key: "end", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["method"] { - presentKeys.insert("method") - if let val = exist as? String { - self.method = val - } - else { - errors.append(FHIRJSONError(key: "method", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["score"] { - presentKeys.insert("score") - if let val = exist as? FHIRJSON { - self.score = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "score", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["start"] { - presentKeys.insert("start") - if let val = exist as? Int { - self.start = val - } - else { - errors.append(FHIRJSONError(key: "start", wants: Int.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let end = self.end { - json["end"] = end.asJSON() - } - if let method = self.method { - json["method"] = method.asJSON() - } - if let score = self.score { - json["score"] = score.asJSON() - } - if let start = self.start { - json["start"] = start.asJSON() - } - - return json - } -} - - -/** - * Reference sequence. - * - * Reference Sequence. It can be described in two ways. One is provide the unique identifier of reference sequence - * submitted to NCBI. The start and end position of window on reference sequence should be defined. The other way is - * using genome build, chromosome number,and also the start, end position of window (this method is specifically for - * DNA reference sequence) . - */ -public class SequenceReferenceSeq: BackboneElement { - override public class var resourceName: String { - get { return "SequenceReferenceSeq" } - } - - /// The chromosome containing the genetic finding. - public var chromosome: CodeableConcept? - - /// The Genome Build used for reference, following GRCh build versions e.g. 'GRCh 37'. - public var genomeBuild: String? - - /// Reference identifier. - public var referenceSeqId: CodeableConcept? - - /// A Pointer to another Sequence entity as refence sequence. - public var referenceSeqPointer: Reference? - - /// A Reference Sequence string. - public var referenceSeqString: String? - - /// 0-based end position (exclusive) of the window on the reference sequence. - public var windowEnd: Int? - - /// 0-based start position (inclusive) of the window on the reference sequence. - public var windowStart: Int? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(referenceSeqId: CodeableConcept, windowEnd: Int, windowStart: Int) { - self.init(json: nil) - self.referenceSeqId = referenceSeqId - self.windowEnd = windowEnd - self.windowStart = windowStart - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["chromosome"] { - presentKeys.insert("chromosome") - if let val = exist as? FHIRJSON { - self.chromosome = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "chromosome", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["genomeBuild"] { - presentKeys.insert("genomeBuild") - if let val = exist as? String { - self.genomeBuild = val - } - else { - errors.append(FHIRJSONError(key: "genomeBuild", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["referenceSeqId"] { - presentKeys.insert("referenceSeqId") - if let val = exist as? FHIRJSON { - self.referenceSeqId = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "referenceSeqId", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "referenceSeqId")) - } - if let exist: AnyObject = js["referenceSeqPointer"] { - presentKeys.insert("referenceSeqPointer") - if let val = exist as? FHIRJSON { - self.referenceSeqPointer = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "referenceSeqPointer", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["referenceSeqString"] { - presentKeys.insert("referenceSeqString") - if let val = exist as? String { - self.referenceSeqString = val - } - else { - errors.append(FHIRJSONError(key: "referenceSeqString", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["windowEnd"] { - presentKeys.insert("windowEnd") - if let val = exist as? Int { - self.windowEnd = val - } - else { - errors.append(FHIRJSONError(key: "windowEnd", wants: Int.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "windowEnd")) - } - if let exist: AnyObject = js["windowStart"] { - presentKeys.insert("windowStart") - if let val = exist as? Int { - self.windowStart = val - } - else { - errors.append(FHIRJSONError(key: "windowStart", wants: Int.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "windowStart")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let chromosome = self.chromosome { - json["chromosome"] = chromosome.asJSON() - } - if let genomeBuild = self.genomeBuild { - json["genomeBuild"] = genomeBuild.asJSON() - } - if let referenceSeqId = self.referenceSeqId { - json["referenceSeqId"] = referenceSeqId.asJSON() - } - if let referenceSeqPointer = self.referenceSeqPointer { - json["referenceSeqPointer"] = referenceSeqPointer.asJSON() - } - if let referenceSeqString = self.referenceSeqString { - json["referenceSeqString"] = referenceSeqString.asJSON() - } - if let windowEnd = self.windowEnd { - json["windowEnd"] = windowEnd.asJSON() - } - if let windowStart = self.windowStart { - json["windowStart"] = windowStart.asJSON() - } - - return json - } -} - - -/** - * External repository. - * - * Configurations of the external repository. - */ -public class SequenceRepository: BackboneElement { - override public class var resourceName: String { - get { return "SequenceRepository" } - } - - /// Name of the repository. - public var name: String? - - /// Id of the read. - public var readId: String? - - /// URI of the repository. - public var url: URL? - - /// Id of the variant. - public var variantId: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["readId"] { - presentKeys.insert("readId") - if let val = exist as? String { - self.readId = val - } - else { - errors.append(FHIRJSONError(key: "readId", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["variantId"] { - presentKeys.insert("variantId") - if let val = exist as? String { - self.variantId = val - } - else { - errors.append(FHIRJSONError(key: "variantId", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let readId = self.readId { - json["readId"] = readId.asJSON() - } - if let url = self.url { - json["url"] = url.asJSON() - } - if let variantId = self.variantId { - json["variantId"] = variantId.asJSON() - } - - return json - } -} - - -/** - * None. - * - * Structural variant. - */ -public class SequenceStructureVariation: BackboneElement { - override public class var resourceName: String { - get { return "SequenceStructureVariation" } - } - - /// None. - public var inner: SequenceStructureVariationInner? - - /// Structural Variant Length. - public var length: Int? - - /// None. - public var outer: SequenceStructureVariationOuter? - - /// Precision of boundaries. - public var precisionOfBoundaries: String? - - /// Structural Variant reported aCGH ratio. - public var reportedaCGHRatio: NSDecimalNumber? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["inner"] { - presentKeys.insert("inner") - if let val = exist as? FHIRJSON { - self.inner = SequenceStructureVariationInner(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "inner", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["length"] { - presentKeys.insert("length") - if let val = exist as? Int { - self.length = val - } - else { - errors.append(FHIRJSONError(key: "length", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["outer"] { - presentKeys.insert("outer") - if let val = exist as? FHIRJSON { - self.outer = SequenceStructureVariationOuter(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "outer", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["precisionOfBoundaries"] { - presentKeys.insert("precisionOfBoundaries") - if let val = exist as? String { - self.precisionOfBoundaries = val - } - else { - errors.append(FHIRJSONError(key: "precisionOfBoundaries", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["reportedaCGHRatio"] { - presentKeys.insert("reportedaCGHRatio") - if let val = exist as? NSNumber { - self.reportedaCGHRatio = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "reportedaCGHRatio", wants: NSNumber.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let inner = self.inner { - json["inner"] = inner.asJSON() - } - if let length = self.length { - json["length"] = length.asJSON() - } - if let outer = self.outer { - json["outer"] = outer.asJSON() - } - if let precisionOfBoundaries = self.precisionOfBoundaries { - json["precisionOfBoundaries"] = precisionOfBoundaries.asJSON() - } - if let reportedaCGHRatio = self.reportedaCGHRatio { - json["reportedaCGHRatio"] = reportedaCGHRatio.asJSON() - } - - return json - } -} - - -/** - * None. - * - * Structural variant inner. - */ -public class SequenceStructureVariationInner: BackboneElement { - override public class var resourceName: String { - get { return "SequenceStructureVariationInner" } - } - - /// Structural Variant Inner Start-End. - public var end: Int? - - /// Structural Variant Inner Start-End. - public var start: Int? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["end"] { - presentKeys.insert("end") - if let val = exist as? Int { - self.end = val - } - else { - errors.append(FHIRJSONError(key: "end", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["start"] { - presentKeys.insert("start") - if let val = exist as? Int { - self.start = val - } - else { - errors.append(FHIRJSONError(key: "start", wants: Int.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let end = self.end { - json["end"] = end.asJSON() - } - if let start = self.start { - json["start"] = start.asJSON() - } - - return json - } -} - - -/** - * None. - * - * Structural variant outer. - */ -public class SequenceStructureVariationOuter: BackboneElement { - override public class var resourceName: String { - get { return "SequenceStructureVariationOuter" } - } - - /// Structural Variant Outer Start-End. - public var end: Int? - - /// Structural Variant Outer Start-End. - public var start: Int? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["end"] { - presentKeys.insert("end") - if let val = exist as? Int { - self.end = val - } - else { - errors.append(FHIRJSONError(key: "end", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["start"] { - presentKeys.insert("start") - if let val = exist as? Int { - self.start = val - } - else { - errors.append(FHIRJSONError(key: "start", wants: Int.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let end = self.end { - json["end"] = end.asJSON() - } - if let start = self.start { - json["start"] = start.asJSON() - } - - return json - } -} - - -/** - * Variation info in this sequence. - */ -public class SequenceVariation: BackboneElement { - override public class var resourceName: String { - get { return "SequenceVariation" } - } - - /// Extended CIGAR string for aligning the sequence with reference bases. - public var cigar: String? - - /// 0-based end position (exclusive) of the variation on the reference sequence. - public var end: Int? - - /// Nucleotide(s)/amino acids from start position to stop position of observed variation. - public var observedAllele: String? - - /// Nucleotide(s)/amino acids from start position to stop position of reference variation. - public var referenceAllele: String? - - /// 0-based start position (inclusive) of the variation on the reference sequence. - public var start: Int? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["cigar"] { - presentKeys.insert("cigar") - if let val = exist as? String { - self.cigar = val - } - else { - errors.append(FHIRJSONError(key: "cigar", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["end"] { - presentKeys.insert("end") - if let val = exist as? Int { - self.end = val - } - else { - errors.append(FHIRJSONError(key: "end", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["observedAllele"] { - presentKeys.insert("observedAllele") - if let val = exist as? String { - self.observedAllele = val - } - else { - errors.append(FHIRJSONError(key: "observedAllele", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["referenceAllele"] { - presentKeys.insert("referenceAllele") - if let val = exist as? String { - self.referenceAllele = val - } - else { - errors.append(FHIRJSONError(key: "referenceAllele", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["start"] { - presentKeys.insert("start") - if let val = exist as? Int { - self.start = val - } - else { - errors.append(FHIRJSONError(key: "start", wants: Int.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let cigar = self.cigar { - json["cigar"] = cigar.asJSON() - } - if let end = self.end { - json["end"] = end.asJSON() - } - if let observedAllele = self.observedAllele { - json["observedAllele"] = observedAllele.asJSON() - } - if let referenceAllele = self.referenceAllele { - json["referenceAllele"] = referenceAllele.asJSON() - } - if let start = self.start { - json["start"] = start.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Signature.swift b/Sources/Models/Signature.swift index 4ed2f0da..32c483f3 100644 --- a/Sources/Models/Signature.swift +++ b/Sources/Models/Signature.swift @@ -2,7 +2,7 @@ // Signature.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Signature) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Signature) on 2016-08-09. // 2016, SMART Health IT. // @@ -46,8 +46,10 @@ public class Signature: Element { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: [Coding], when: Instant, whoReference: Reference, whoUri: URL) { + public convenience init(blob: Base64Binary, contentType: String, type: [Coding], when: Instant, whoReference: Reference, whoUri: URL) { self.init(json: nil) + self.blob = blob + self.contentType = contentType self.type = type self.when = when self.whoReference = whoReference @@ -66,6 +68,9 @@ public class Signature: Element { errors.append(FHIRJSONError(key: "blob", wants: String.self, has: exist.dynamicType)) } } + else { + errors.append(FHIRJSONError(key: "blob")) + } if let exist: AnyObject = js["contentType"] { presentKeys.insert("contentType") if let val = exist as? String { @@ -75,6 +80,9 @@ public class Signature: Element { errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: exist.dynamicType)) } } + else { + errors.append(FHIRJSONError(key: "contentType")) + } if let exist: AnyObject = js["type"] { presentKeys.insert("type") if let val = exist as? [FHIRJSON] { diff --git a/Sources/Models/Slot.swift b/Sources/Models/Slot.swift index 28d806a9..6c4d87cb 100644 --- a/Sources/Models/Slot.swift +++ b/Sources/Models/Slot.swift @@ -2,7 +2,7 @@ // Slot.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Slot) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Slot) on 2016-08-09. // 2016, SMART Health IT. // @@ -17,15 +17,15 @@ public class Slot: DomainResource { get { return "Slot" } } - /// The style of appointment or patient that has been booked in the slot (not service type). - public var appointmentType: CodeableConcept? - /// Comments on the slot to describe any extended information. Such as custom constraints on the slot. public var comment: String? /// Date/Time that the slot is to conclude. public var end: Instant? + /// busy | free | busy-unavailable | busy-tentative. + public var freeBusyType: String? + /// External Ids for this item. public var identifier: [Identifier]? @@ -35,20 +35,11 @@ public class Slot: DomainResource { /// The schedule resource that this slot defines an interval of status information. public var schedule: Reference? - /// 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]? - /// Date/Time that the slot is to begin. public var start: Instant? - /// busy | free | busy-unavailable | busy-tentative. - public var status: String? + /// 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 type: CodeableConcept? /** Initialize with a JSON object. */ @@ -57,26 +48,17 @@ public class Slot: DomainResource { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(end: Instant, schedule: Reference, start: Instant, status: String) { + public convenience init(end: Instant, freeBusyType: String, schedule: Reference, start: Instant) { self.init(json: nil) self.end = end + self.freeBusyType = freeBusyType self.schedule = schedule self.start = start - self.status = status } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["appointmentType"] { - presentKeys.insert("appointmentType") - if let val = exist as? FHIRJSON { - self.appointmentType = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "appointmentType", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["comment"] { presentKeys.insert("comment") if let val = exist as? String { @@ -98,6 +80,18 @@ public class Slot: DomainResource { else { errors.append(FHIRJSONError(key: "end")) } + if let exist: AnyObject = js["freeBusyType"] { + presentKeys.insert("freeBusyType") + if let val = exist as? String { + self.freeBusyType = val + } + else { + errors.append(FHIRJSONError(key: "freeBusyType", wants: String.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "freeBusyType")) + } if let exist: AnyObject = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { @@ -128,33 +122,6 @@ public class Slot: DomainResource { else { errors.append(FHIRJSONError(key: "schedule")) } - if let exist: AnyObject = js["serviceCategory"] { - presentKeys.insert("serviceCategory") - if let val = exist as? FHIRJSON { - self.serviceCategory = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "serviceCategory", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["serviceType"] { - presentKeys.insert("serviceType") - if let val = exist as? [FHIRJSON] { - self.serviceType = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "serviceType", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["specialty"] { - presentKeys.insert("specialty") - if let val = exist as? [FHIRJSON] { - self.specialty = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "specialty", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["start"] { presentKeys.insert("start") if let val = exist as? String { @@ -167,18 +134,15 @@ public class Slot: DomainResource { else { errors.append(FHIRJSONError(key: "start")) } - if let exist: AnyObject = js["status"] { - presentKeys.insert("status") - if let val = exist as? String { - self.status = val + if let exist: AnyObject = js["type"] { + presentKeys.insert("type") + if let val = exist as? FHIRJSON { + self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "status")) - } } return errors.isEmpty ? nil : errors } @@ -186,15 +150,15 @@ public class Slot: DomainResource { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let appointmentType = self.appointmentType { - json["appointmentType"] = appointmentType.asJSON() - } if let comment = self.comment { json["comment"] = comment.asJSON() } if let end = self.end { json["end"] = end.asJSON() } + if let freeBusyType = self.freeBusyType { + json["freeBusyType"] = freeBusyType.asJSON() + } if let identifier = self.identifier { json["identifier"] = Identifier.asJSONArray(identifier) } @@ -204,20 +168,11 @@ public class Slot: DomainResource { if let schedule = self.schedule { json["schedule"] = schedule.asJSON() } - if let serviceCategory = self.serviceCategory { - json["serviceCategory"] = serviceCategory.asJSON() - } - if let serviceType = self.serviceType { - json["serviceType"] = CodeableConcept.asJSONArray(serviceType) - } - if let specialty = self.specialty { - json["specialty"] = CodeableConcept.asJSONArray(specialty) - } if let start = self.start { json["start"] = start.asJSON() } - if let status = self.status { - json["status"] = status.asJSON() + if let type = self.type { + json["type"] = type.asJSON() } return json diff --git a/Sources/Models/Specimen.swift b/Sources/Models/Specimen.swift index b08b6a6d..83894548 100644 --- a/Sources/Models/Specimen.swift +++ b/Sources/Models/Specimen.swift @@ -2,7 +2,7 @@ // Specimen.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Specimen) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Specimen) on 2016-08-09. // 2016, SMART Health IT. // @@ -223,7 +223,7 @@ public class SpecimenCollection: BackboneElement { public var collector: Reference? /// Collector comments. - public var comment: String? + public var comment: [String]? /// Technique used to perform collection. public var method: CodeableConcept? @@ -278,11 +278,11 @@ public class SpecimenCollection: BackboneElement { } if let exist: AnyObject = js["comment"] { presentKeys.insert("comment") - if let val = exist as? String { + if let val = exist as? [String] { self.comment = val } else { - errors.append(FHIRJSONError(key: "comment", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comment", wants: Array.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["method"] { @@ -323,7 +323,11 @@ public class SpecimenCollection: BackboneElement { json["collector"] = collector.asJSON() } if let comment = self.comment { - json["comment"] = comment.asJSON() + var arr = [AnyObject]() + for val in comment { + arr.append(val.asJSON()) + } + json["comment"] = arr } if let method = self.method { json["method"] = method.asJSON() diff --git a/Sources/Models/StructureDefinition.swift b/Sources/Models/StructureDefinition.swift index 173a2efd..c7cf0070 100644 --- a/Sources/Models/StructureDefinition.swift +++ b/Sources/Models/StructureDefinition.swift @@ -2,7 +2,7 @@ // StructureDefinition.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/StructureDefinition) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/StructureDefinition) on 2016-08-09. // 2016, SMART Health IT. // @@ -23,22 +23,22 @@ public class StructureDefinition: DomainResource { /// Whether the structure is abstract. public var abstract: Bool? - /// Definition that this type is constrained/specialized from. - public var baseDefinition: URL? - - /// Any datatype or resource, including abstract ones. - public var baseType: String? + /// Structure that this set of constraints applies to. + public var base: URL? /// Assist with indexing and finding. public var code: [Coding]? + /// Any datatype or resource, including abstract ones. + public var constrainedType: String? + /// Contact details of the publisher. public var contact: [StructureDefinitionContact]? /// Where the extension can be used in instances. public var context: [String]? - /// resource | datatype | extension. + /// resource | datatype | mapping | extension. public var contextType: String? /// Use and/or publishing restrictions. @@ -47,9 +47,6 @@ public class StructureDefinition: DomainResource { /// Date for this version of the StructureDefinition. public var date: DateTime? - /// specialization | constraint - How relates to base definition. - public var derivation: String? - /// Natural language description of the StructureDefinition. public var description_fhir: String? @@ -129,22 +126,13 @@ public class StructureDefinition: DomainResource { else { errors.append(FHIRJSONError(key: "abstract")) } - if let exist: AnyObject = js["baseDefinition"] { - presentKeys.insert("baseDefinition") - if let val = exist as? String { - self.baseDefinition = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "baseDefinition", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["baseType"] { - presentKeys.insert("baseType") + if let exist: AnyObject = js["base"] { + presentKeys.insert("base") if let val = exist as? String { - self.baseType = val + self.base = URL(string: val) } else { - errors.append(FHIRJSONError(key: "baseType", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "base", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["code"] { @@ -156,6 +144,15 @@ public class StructureDefinition: DomainResource { errors.append(FHIRJSONError(key: "code", wants: Array.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["constrainedType"] { + presentKeys.insert("constrainedType") + if let val = exist as? String { + self.constrainedType = val + } + else { + errors.append(FHIRJSONError(key: "constrainedType", wants: String.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { @@ -201,15 +198,6 @@ public class StructureDefinition: DomainResource { errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["derivation"] { - presentKeys.insert("derivation") - if let val = exist as? String { - self.derivation = val - } - else { - errors.append(FHIRJSONError(key: "derivation", wants: String.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["description"] { presentKeys.insert("description") if let val = exist as? String { @@ -376,15 +364,15 @@ public class StructureDefinition: DomainResource { if let abstract = self.abstract { json["abstract"] = abstract.asJSON() } - if let baseDefinition = self.baseDefinition { - json["baseDefinition"] = baseDefinition.asJSON() - } - if let baseType = self.baseType { - json["baseType"] = baseType.asJSON() + if let base = self.base { + json["base"] = base.asJSON() } if let code = self.code { json["code"] = Coding.asJSONArray(code) } + if let constrainedType = self.constrainedType { + json["constrainedType"] = constrainedType.asJSON() + } if let contact = self.contact { json["contact"] = StructureDefinitionContact.asJSONArray(contact) } @@ -404,9 +392,6 @@ public class StructureDefinition: DomainResource { if let date = self.date { json["date"] = date.asJSON() } - if let derivation = self.derivation { - json["derivation"] = derivation.asJSON() - } if let description_fhir = self.description_fhir { json["description"] = description_fhir.asJSON() } @@ -471,7 +456,7 @@ public class StructureDefinitionContact: BackboneElement { get { return "StructureDefinitionContact" } } - /// Name of an individual to contact. + /// Name of a individual to contact. public var name: String? /// Contact details for individual or publisher. diff --git a/Sources/Models/StructureMap.swift b/Sources/Models/StructureMap.swift deleted file mode 100644 index a36fdd3a..00000000 --- a/Sources/Models/StructureMap.swift +++ /dev/null @@ -1,1349 +0,0 @@ -// -// StructureMap.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/StructureMap) on 2016-07-07. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * A Map of relationships between 2 structures that can be used to transform data. - */ -public class StructureMap: DomainResource { - override public class var resourceName: String { - get { return "StructureMap" } - } - - /// Contact details of the publisher. - public var contact: [StructureMapContact]? - - /// Use and/or publishing restrictions. - public var copyright: String? - - /// Date for this version of the StructureMap. - public var date: DateTime? - - /// Natural language description of the StructureMap. - public var description_fhir: String? - - /// If for testing purposes, not real usage. - public var experimental: Bool? - - /// Named sections for reader convenience. - public var group: [StructureMapGroup]? - - /// Other identifiers for the StructureMap. - public var identifier: [Identifier]? - - /// Other maps used by this map (canonical URLs). - public var import_fhir: [URL]? - - /// Informal name for this StructureMap. - public var name: String? - - /// Name of the publisher (Organization or individual). - public var publisher: String? - - /// Scope and Usage this structure map is for. - public var requirements: String? - - /// draft | active | retired. - public var status: String? - - /// Structure Definition used by this map. - public var structure: [StructureMapStructure]? - - /// Absolute URL used to reference this StructureMap. - public var url: URL? - - /// Content intends to support these contexts. - public var useContext: [CodeableConcept]? - - /// Logical id for this version of the StructureMap. - public var version: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(group: [StructureMapGroup], name: String, status: String, url: URL) { - self.init(json: nil) - self.group = group - self.name = name - self.status = status - self.url = url - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["contact"] { - presentKeys.insert("contact") - if let val = exist as? [FHIRJSON] { - self.contact = StructureMapContact.instantiate(fromArray: val, owner: self) as? [StructureMapContact] - } - else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["copyright"] { - presentKeys.insert("copyright") - if let val = exist as? String { - self.copyright = val - } - else { - errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["date"] { - presentKeys.insert("date") - if let val = exist as? String { - self.date = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["experimental"] { - presentKeys.insert("experimental") - if let val = exist as? Bool { - self.experimental = val - } - else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["group"] { - presentKeys.insert("group") - if let val = exist as? [FHIRJSON] { - self.group = StructureMapGroup.instantiate(fromArray: val, owner: self) as? [StructureMapGroup] - } - else { - errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "group")) - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? [FHIRJSON] { - self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["import"] { - presentKeys.insert("import") - if let val = exist as? [String] { - self.import_fhir = URL.instantiate(fromArray: val) - } - else { - errors.append(FHIRJSONError(key: "import", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["publisher"] { - presentKeys.insert("publisher") - if let val = exist as? String { - self.publisher = val - } - else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["requirements"] { - presentKeys.insert("requirements") - if let val = exist as? String { - self.requirements = val - } - else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["status"] { - presentKeys.insert("status") - if let val = exist as? String { - self.status = val - } - else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "status")) - } - if let exist: AnyObject = js["structure"] { - presentKeys.insert("structure") - if let val = exist as? [FHIRJSON] { - self.structure = StructureMapStructure.instantiate(fromArray: val, owner: self) as? [StructureMapStructure] - } - else { - errors.append(FHIRJSONError(key: "structure", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "url")) - } - if let exist: AnyObject = js["useContext"] { - presentKeys.insert("useContext") - if let val = exist as? [FHIRJSON] { - self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] - } - else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["version"] { - presentKeys.insert("version") - if let val = exist as? String { - self.version = val - } - else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let contact = self.contact { - json["contact"] = StructureMapContact.asJSONArray(contact) - } - if let copyright = self.copyright { - json["copyright"] = copyright.asJSON() - } - if let date = self.date { - json["date"] = date.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let experimental = self.experimental { - json["experimental"] = experimental.asJSON() - } - if let group = self.group { - json["group"] = StructureMapGroup.asJSONArray(group) - } - if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) - } - if let import_fhir = self.import_fhir { - var arr = [AnyObject]() - for val in import_fhir { - arr.append(val.asJSON()) - } - json["import"] = arr - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let publisher = self.publisher { - json["publisher"] = publisher.asJSON() - } - if let requirements = self.requirements { - json["requirements"] = requirements.asJSON() - } - if let status = self.status { - json["status"] = status.asJSON() - } - if let structure = self.structure { - json["structure"] = StructureMapStructure.asJSONArray(structure) - } - if let url = self.url { - json["url"] = url.asJSON() - } - if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) - } - if let version = self.version { - json["version"] = version.asJSON() - } - - return json - } -} - - -/** - * Contact details of the publisher. - * - * Contacts to assist a user in finding and communicating with the publisher. - */ -public class StructureMapContact: BackboneElement { - override public class var resourceName: String { - get { return "StructureMapContact" } - } - - /// Name of an individual to contact. - public var name: String? - - /// Contact details for individual or publisher. - public var telecom: [ContactPoint]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["telecom"] { - presentKeys.insert("telecom") - if let val = exist as? [FHIRJSON] { - self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] - } - else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) - } - - return json - } -} - - -/** - * Named sections for reader convenience. - */ -public class StructureMapGroup: BackboneElement { - override public class var resourceName: String { - get { return "StructureMapGroup" } - } - - /// Documentation for this group. - public var documentation: String? - - /// Another group that this group adds rules to. - public var extends: String? - - /// Named instance provided when invoking the map. - public var input: [StructureMapGroupInput]? - - /// Descriptive name for a user. - public var name: String? - - /// Transform Rule from source to target. - public var rule: [StructureMapGroupRule]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(input: [StructureMapGroupInput], name: String, rule: [StructureMapGroupRule]) { - self.init(json: nil) - self.input = input - self.name = name - self.rule = rule - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["documentation"] { - presentKeys.insert("documentation") - if let val = exist as? String { - self.documentation = val - } - else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["extends"] { - presentKeys.insert("extends") - if let val = exist as? String { - self.extends = val - } - else { - errors.append(FHIRJSONError(key: "extends", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["input"] { - presentKeys.insert("input") - if let val = exist as? [FHIRJSON] { - self.input = StructureMapGroupInput.instantiate(fromArray: val, owner: self) as? [StructureMapGroupInput] - } - else { - errors.append(FHIRJSONError(key: "input", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "input")) - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["rule"] { - presentKeys.insert("rule") - if let val = exist as? [FHIRJSON] { - self.rule = StructureMapGroupRule.instantiate(fromArray: val, owner: self) as? [StructureMapGroupRule] - } - else { - errors.append(FHIRJSONError(key: "rule", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "rule")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let documentation = self.documentation { - json["documentation"] = documentation.asJSON() - } - if let extends = self.extends { - json["extends"] = extends.asJSON() - } - if let input = self.input { - json["input"] = StructureMapGroupInput.asJSONArray(input) - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let rule = self.rule { - json["rule"] = StructureMapGroupRule.asJSONArray(rule) - } - - return json - } -} - - -/** - * 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. - */ -public class StructureMapGroupInput: BackboneElement { - override public class var resourceName: String { - get { return "StructureMapGroupInput" } - } - - /// Documentation for this instance of data. - public var documentation: String? - - /// source | target. - public var mode: String? - - /// Name for this instance of data. - public var name: String? - - /// Type for this instance of data. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(mode: String, name: String) { - self.init(json: nil) - self.mode = mode - self.name = name - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["documentation"] { - presentKeys.insert("documentation") - if let val = exist as? String { - self.documentation = val - } - else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["mode"] { - presentKeys.insert("mode") - if let val = exist as? String { - self.mode = val - } - else { - errors.append(FHIRJSONError(key: "mode", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "mode")) - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let documentation = self.documentation { - json["documentation"] = documentation.asJSON() - } - if let mode = self.mode { - json["mode"] = mode.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Transform Rule from source to target. - */ -public class StructureMapGroupRule: BackboneElement { - override public class var resourceName: String { - get { return "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: String? - - /// Name of the rule for internal references. - public var name: String? - - /// Rules contained in this rule. - public var rule: [StructureMapGroupRule]? - - /// Source inputs to the mapping. - public var source: [StructureMapGroupRuleSource]? - - /// Content to create because of this mapping rule. - public var target: [StructureMapGroupRuleTarget]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(name: String, source: [StructureMapGroupRuleSource]) { - self.init(json: nil) - self.name = name - self.source = source - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["dependent"] { - presentKeys.insert("dependent") - if let val = exist as? [FHIRJSON] { - self.dependent = StructureMapGroupRuleDependent.instantiate(fromArray: val, owner: self) as? [StructureMapGroupRuleDependent] - } - else { - errors.append(FHIRJSONError(key: "dependent", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["documentation"] { - presentKeys.insert("documentation") - if let val = exist as? String { - self.documentation = val - } - else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["rule"] { - presentKeys.insert("rule") - if let val = exist as? [FHIRJSON] { - self.rule = StructureMapGroupRule.instantiate(fromArray: val, owner: self) as? [StructureMapGroupRule] - } - else { - errors.append(FHIRJSONError(key: "rule", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["source"] { - presentKeys.insert("source") - if let val = exist as? [FHIRJSON] { - self.source = StructureMapGroupRuleSource.instantiate(fromArray: val, owner: self) as? [StructureMapGroupRuleSource] - } - else { - errors.append(FHIRJSONError(key: "source", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "source")) - } - if let exist: AnyObject = js["target"] { - presentKeys.insert("target") - if let val = exist as? [FHIRJSON] { - self.target = StructureMapGroupRuleTarget.instantiate(fromArray: val, owner: self) as? [StructureMapGroupRuleTarget] - } - else { - errors.append(FHIRJSONError(key: "target", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let dependent = self.dependent { - json["dependent"] = StructureMapGroupRuleDependent.asJSONArray(dependent) - } - if let documentation = self.documentation { - json["documentation"] = documentation.asJSON() - } - if let name = self.name { - json["name"] = name.asJSON() - } - if let rule = self.rule { - json["rule"] = StructureMapGroupRule.asJSONArray(rule) - } - if let source = self.source { - json["source"] = StructureMapGroupRuleSource.asJSONArray(source) - } - if let target = self.target { - json["target"] = StructureMapGroupRuleTarget.asJSONArray(target) - } - - return json - } -} - - -/** - * Which other rules to apply in the context of this rule. - */ -public class StructureMapGroupRuleDependent: BackboneElement { - override public class var resourceName: String { - get { return "StructureMapGroupRuleDependent" } - } - - /// Name of a rule or group to apply. - public var name: String? - - /// Names of variables to pass to the rule or group. - public var variable: [String]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(name: String, variable: [String]) { - self.init(json: nil) - self.name = name - self.variable = variable - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["variable"] { - presentKeys.insert("variable") - if let val = exist as? [String] { - self.variable = val - } - else { - errors.append(FHIRJSONError(key: "variable", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "variable")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let variable = self.variable { - var arr = [AnyObject]() - for val in variable { - arr.append(val.asJSON()) - } - json["variable"] = arr - } - - return json - } -} - - -/** - * Source inputs to the mapping. - */ -public class StructureMapGroupRuleSource: BackboneElement { - override public class var resourceName: String { - get { return "StructureMapGroupRuleSource" } - } - - /// FluentPath expression - must be true or the mapping engine throws an error instead of completing. - public var check: String? - - /// FluentPath expression - must be true or the rule does not apply. - public var condition: String? - - /// Type or variable this rule applies to. - public var context: String? - - /// type | variable. - public var contextType: String? - - /// Optional field for this source. - public var element: String? - - /// first | share | last. - public var listMode: String? - - /// Whether this rule applies if the source isn't found. - public var required: Bool? - - /// Named context for field, if a field is specified. - public var variable: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(context: String, contextType: String, required: Bool) { - self.init(json: nil) - self.context = context - self.contextType = contextType - self.required = required - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["check"] { - presentKeys.insert("check") - if let val = exist as? String { - self.check = val - } - else { - errors.append(FHIRJSONError(key: "check", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["condition"] { - presentKeys.insert("condition") - if let val = exist as? String { - self.condition = val - } - else { - errors.append(FHIRJSONError(key: "condition", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["context"] { - presentKeys.insert("context") - if let val = exist as? String { - self.context = val - } - else { - errors.append(FHIRJSONError(key: "context", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "context")) - } - if let exist: AnyObject = js["contextType"] { - presentKeys.insert("contextType") - if let val = exist as? String { - self.contextType = val - } - else { - errors.append(FHIRJSONError(key: "contextType", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "contextType")) - } - if let exist: AnyObject = js["element"] { - presentKeys.insert("element") - if let val = exist as? String { - self.element = val - } - else { - errors.append(FHIRJSONError(key: "element", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["listMode"] { - presentKeys.insert("listMode") - if let val = exist as? String { - self.listMode = val - } - else { - errors.append(FHIRJSONError(key: "listMode", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["required"] { - presentKeys.insert("required") - if let val = exist as? Bool { - self.required = val - } - else { - errors.append(FHIRJSONError(key: "required", wants: Bool.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "required")) - } - if let exist: AnyObject = js["variable"] { - presentKeys.insert("variable") - if let val = exist as? String { - self.variable = val - } - else { - errors.append(FHIRJSONError(key: "variable", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let check = self.check { - json["check"] = check.asJSON() - } - if let condition = self.condition { - json["condition"] = condition.asJSON() - } - if let context = self.context { - json["context"] = context.asJSON() - } - if let contextType = self.contextType { - json["contextType"] = contextType.asJSON() - } - if let element = self.element { - json["element"] = element.asJSON() - } - if let listMode = self.listMode { - json["listMode"] = listMode.asJSON() - } - if let required = self.required { - json["required"] = required.asJSON() - } - if let variable = self.variable { - json["variable"] = variable.asJSON() - } - - return json - } -} - - -/** - * Content to create because of this mapping rule. - */ -public class StructureMapGroupRuleTarget: BackboneElement { - override public class var resourceName: String { - get { return "StructureMapGroupRuleTarget" } - } - - /// Type or variable this rule applies to. - public var context: String? - - /// type | variable. - public var contextType: String? - - /// Field to create in the context. - public var element: String? - - /// first | share | last. - public var listMode: [String]? - - /// Internal rule reference for shared list items. - public var listRuleId: String? - - /// Parameters to the transform. - public var parameter: [StructureMapGroupRuleTargetParameter]? - - /// create | copy +. - public var transform: String? - - /// Named context for field, if desired, and a field is specified. - public var variable: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(context: String, contextType: String) { - self.init(json: nil) - self.context = context - self.contextType = contextType - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["context"] { - presentKeys.insert("context") - if let val = exist as? String { - self.context = val - } - else { - errors.append(FHIRJSONError(key: "context", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "context")) - } - if let exist: AnyObject = js["contextType"] { - presentKeys.insert("contextType") - if let val = exist as? String { - self.contextType = val - } - else { - errors.append(FHIRJSONError(key: "contextType", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "contextType")) - } - if let exist: AnyObject = js["element"] { - presentKeys.insert("element") - if let val = exist as? String { - self.element = val - } - else { - errors.append(FHIRJSONError(key: "element", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["listMode"] { - presentKeys.insert("listMode") - if let val = exist as? [String] { - self.listMode = val - } - else { - errors.append(FHIRJSONError(key: "listMode", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["listRuleId"] { - presentKeys.insert("listRuleId") - if let val = exist as? String { - self.listRuleId = val - } - else { - errors.append(FHIRJSONError(key: "listRuleId", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["parameter"] { - presentKeys.insert("parameter") - if let val = exist as? [FHIRJSON] { - self.parameter = StructureMapGroupRuleTargetParameter.instantiate(fromArray: val, owner: self) as? [StructureMapGroupRuleTargetParameter] - } - else { - errors.append(FHIRJSONError(key: "parameter", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["transform"] { - presentKeys.insert("transform") - if let val = exist as? String { - self.transform = val - } - else { - errors.append(FHIRJSONError(key: "transform", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["variable"] { - presentKeys.insert("variable") - if let val = exist as? String { - self.variable = val - } - else { - errors.append(FHIRJSONError(key: "variable", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let context = self.context { - json["context"] = context.asJSON() - } - if let contextType = self.contextType { - json["contextType"] = contextType.asJSON() - } - if let element = self.element { - json["element"] = element.asJSON() - } - if let listMode = self.listMode { - var arr = [AnyObject]() - for val in listMode { - arr.append(val.asJSON()) - } - json["listMode"] = arr - } - if let listRuleId = self.listRuleId { - json["listRuleId"] = listRuleId.asJSON() - } - if let parameter = self.parameter { - json["parameter"] = StructureMapGroupRuleTargetParameter.asJSONArray(parameter) - } - if let transform = self.transform { - json["transform"] = transform.asJSON() - } - if let variable = self.variable { - json["variable"] = variable.asJSON() - } - - return json - } -} - - -/** - * Parameters to the transform. - */ -public class StructureMapGroupRuleTargetParameter: BackboneElement { - override public class var resourceName: String { - get { return "StructureMapGroupRuleTargetParameter" } - } - - /// Parameter value - variable or literal. - public var valueBoolean: Bool? - - /// Parameter value - variable or literal. - public var valueDecimal: NSDecimalNumber? - - /// Parameter value - variable or literal. - public var valueId: String? - - /// Parameter value - variable or literal. - public var valueInteger: Int? - - /// Parameter value - variable or literal. - public var valueString: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(valueBoolean: Bool, valueDecimal: NSDecimalNumber, valueId: String, valueInteger: Int, valueString: String) { - self.init(json: nil) - self.valueBoolean = valueBoolean - self.valueDecimal = valueDecimal - self.valueId = valueId - self.valueInteger = valueInteger - self.valueString = valueString - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["valueBoolean"] { - presentKeys.insert("valueBoolean") - if let val = exist as? Bool { - self.valueBoolean = val - } - else { - errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueDecimal"] { - presentKeys.insert("valueDecimal") - if let val = exist as? NSNumber { - self.valueDecimal = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "valueDecimal", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueId"] { - presentKeys.insert("valueId") - if let val = exist as? String { - self.valueId = val - } - else { - errors.append(FHIRJSONError(key: "valueId", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueInteger"] { - presentKeys.insert("valueInteger") - if let val = exist as? Int { - self.valueInteger = val - } - else { - errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueString"] { - presentKeys.insert("valueString") - if let val = exist as? String { - self.valueString = val - } - else { - errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: exist.dynamicType)) - } - } - - // check if nonoptional expanded properties are present - if nil == self.valueId && nil == self.valueString && nil == self.valueBoolean && nil == self.valueInteger && nil == self.valueDecimal { - errors.append(FHIRJSONError(key: "value*")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let valueBoolean = self.valueBoolean { - json["valueBoolean"] = valueBoolean.asJSON() - } - if let valueDecimal = self.valueDecimal { - json["valueDecimal"] = valueDecimal.asJSON() - } - if let valueId = self.valueId { - json["valueId"] = valueId.asJSON() - } - if let valueInteger = self.valueInteger { - json["valueInteger"] = valueInteger.asJSON() - } - if let valueString = self.valueString { - json["valueString"] = valueString.asJSON() - } - - return json - } -} - - -/** - * 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. - */ -public class StructureMapStructure: BackboneElement { - override public class var resourceName: String { - get { return "StructureMapStructure" } - } - - /// Documentation on use of structure. - public var documentation: String? - - /// source | queried | target | produced. - public var mode: String? - - /// Canonical URL for structure definition. - public var url: URL? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(mode: String, url: URL) { - self.init(json: nil) - self.mode = mode - self.url = url - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["documentation"] { - presentKeys.insert("documentation") - if let val = exist as? String { - self.documentation = val - } - else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["mode"] { - presentKeys.insert("mode") - if let val = exist as? String { - self.mode = val - } - else { - errors.append(FHIRJSONError(key: "mode", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "mode")) - } - if let exist: AnyObject = js["url"] { - presentKeys.insert("url") - if let val = exist as? String { - self.url = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "url")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let documentation = self.documentation { - json["documentation"] = documentation.asJSON() - } - if let mode = self.mode { - json["mode"] = mode.asJSON() - } - if let url = self.url { - json["url"] = url.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/Subscription.swift b/Sources/Models/Subscription.swift index 2106e868..2a71c837 100644 --- a/Sources/Models/Subscription.swift +++ b/Sources/Models/Subscription.swift @@ -2,7 +2,7 @@ // Subscription.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Subscription) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Subscription) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Substance.swift b/Sources/Models/Substance.swift index 53cf3bee..ca81ab92 100644 --- a/Sources/Models/Substance.swift +++ b/Sources/Models/Substance.swift @@ -2,7 +2,7 @@ // Substance.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Substance) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Substance) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/SupplyDelivery.swift b/Sources/Models/SupplyDelivery.swift index bcfeef98..ae4bee6e 100644 --- a/Sources/Models/SupplyDelivery.swift +++ b/Sources/Models/SupplyDelivery.swift @@ -2,7 +2,7 @@ // SupplyDelivery.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/SupplyDelivery) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SupplyDelivery) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/SupplyRequest.swift b/Sources/Models/SupplyRequest.swift index d7a6e497..053223ad 100644 --- a/Sources/Models/SupplyRequest.swift +++ b/Sources/Models/SupplyRequest.swift @@ -2,7 +2,7 @@ // SupplyRequest.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/SupplyRequest) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SupplyRequest) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Sources/Models/Task.swift b/Sources/Models/Task.swift deleted file mode 100644 index 6b72fad4..00000000 --- a/Sources/Models/Task.swift +++ /dev/null @@ -1,1494 +0,0 @@ -// -// Task.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Task) on 2016-07-08. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * A task to be performed. - */ -public class Task: DomainResource { - override public class var resourceName: String { - get { return "Task" } - } - - /// Task Creation Date. - public var created: DateTime? - - /// Task Creator. - public var creator: Reference? - - /// Task Definition. - public var definition: URL? - - /// Task Description. - public var description_fhir: String? - - /// Task Failure Reason. - public var failureReason: CodeableConcept? - - /// Beneficiary of the Task. - public var for_fhir: Reference? - - /// Task Instance Identifier. - public var identifier: Identifier? - - /// Task Input. - public var input: [TaskInput]? - - /// Task Last Modified Date. - public var lastModified: DateTime? - - /// Task Output. - public var output: [TaskOutput]? - - /// Task Owner. - public var owner: Reference? - - /// Composite task. - public var parent: Reference? - - /// requester | dispatcher | scheduler | performer | monitor | manager | acquirer | reviewer. - public var performerType: [Coding]? - - /// low | normal | high. - public var priority: String? - - /// draft | requested | received | accepted | +. - public var status: String? - - /// Task Subject. - public var subject: Reference? - - /// Task Type. - public var type: CodeableConcept? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(created: DateTime, creator: Reference, lastModified: DateTime, status: String) { - self.init(json: nil) - self.created = created - self.creator = creator - self.lastModified = lastModified - self.status = status - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["created"] { - presentKeys.insert("created") - if let val = exist as? String { - self.created = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "created")) - } - if let exist: AnyObject = js["creator"] { - presentKeys.insert("creator") - if let val = exist as? FHIRJSON { - self.creator = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "creator", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "creator")) - } - if let exist: AnyObject = js["definition"] { - presentKeys.insert("definition") - if let val = exist as? String { - self.definition = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "definition", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["description"] { - presentKeys.insert("description") - if let val = exist as? String { - self.description_fhir = val - } - else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["failureReason"] { - presentKeys.insert("failureReason") - if let val = exist as? FHIRJSON { - self.failureReason = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "failureReason", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["for"] { - presentKeys.insert("for") - if let val = exist as? FHIRJSON { - self.for_fhir = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "for", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["identifier"] { - presentKeys.insert("identifier") - if let val = exist as? FHIRJSON { - self.identifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["input"] { - presentKeys.insert("input") - if let val = exist as? [FHIRJSON] { - self.input = TaskInput.instantiate(fromArray: val, owner: self) as? [TaskInput] - } - else { - errors.append(FHIRJSONError(key: "input", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["lastModified"] { - presentKeys.insert("lastModified") - if let val = exist as? String { - self.lastModified = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "lastModified", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "lastModified")) - } - if let exist: AnyObject = js["output"] { - presentKeys.insert("output") - if let val = exist as? [FHIRJSON] { - self.output = TaskOutput.instantiate(fromArray: val, owner: self) as? [TaskOutput] - } - else { - errors.append(FHIRJSONError(key: "output", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["owner"] { - presentKeys.insert("owner") - if let val = exist as? FHIRJSON { - self.owner = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "owner", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["parent"] { - presentKeys.insert("parent") - if let val = exist as? FHIRJSON { - self.parent = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "parent", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["performerType"] { - presentKeys.insert("performerType") - if let val = exist as? [FHIRJSON] { - self.performerType = Coding.instantiate(fromArray: val, owner: self) as? [Coding] - } - else { - errors.append(FHIRJSONError(key: "performerType", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["priority"] { - presentKeys.insert("priority") - if let val = exist as? String { - self.priority = val - } - else { - errors.append(FHIRJSONError(key: "priority", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["status"] { - presentKeys.insert("status") - if let val = exist as? String { - self.status = val - } - else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "status")) - } - if let exist: AnyObject = js["subject"] { - presentKeys.insert("subject") - if let val = exist as? FHIRJSON { - self.subject = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? FHIRJSON { - self.type = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let created = self.created { - json["created"] = created.asJSON() - } - if let creator = self.creator { - json["creator"] = creator.asJSON() - } - if let definition = self.definition { - json["definition"] = definition.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let failureReason = self.failureReason { - json["failureReason"] = failureReason.asJSON() - } - if let for_fhir = self.for_fhir { - json["for"] = for_fhir.asJSON() - } - if let identifier = self.identifier { - json["identifier"] = identifier.asJSON() - } - if let input = self.input { - json["input"] = TaskInput.asJSONArray(input) - } - if let lastModified = self.lastModified { - json["lastModified"] = lastModified.asJSON() - } - if let output = self.output { - json["output"] = TaskOutput.asJSONArray(output) - } - if let owner = self.owner { - json["owner"] = owner.asJSON() - } - if let parent = self.parent { - json["parent"] = parent.asJSON() - } - if let performerType = self.performerType { - json["performerType"] = Coding.asJSONArray(performerType) - } - if let priority = self.priority { - json["priority"] = priority.asJSON() - } - if let status = self.status { - json["status"] = status.asJSON() - } - if let subject = self.subject { - json["subject"] = subject.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - - -/** - * Task Input. - * - * Inputs to the task. - */ -public class TaskInput: BackboneElement { - override public class var resourceName: String { - get { return "TaskInput" } - } - - /// Input Name. - public var name: String? - - /// Input Value. - public var valueAddress: Address? - - /// Input Value. - public var valueAnnotation: Annotation? - - /// Input Value. - public var valueAttachment: Attachment? - - /// Input Value. - public var valueBase64Binary: Base64Binary? - - /// Input Value. - public var valueBoolean: Bool? - - /// Input Value. - public var valueCode: String? - - /// Input Value. - public var valueCodeableConcept: CodeableConcept? - - /// Input Value. - public var valueCoding: Coding? - - /// Input Value. - public var valueContactPoint: ContactPoint? - - /// Input Value. - public var valueDate: FHIRDate? - - /// Input Value. - public var valueDateTime: DateTime? - - /// Input Value. - public var valueDecimal: NSDecimalNumber? - - /// Input Value. - public var valueHumanName: HumanName? - - /// Input Value. - public var valueId: String? - - /// Input Value. - public var valueIdentifier: Identifier? - - /// Input Value. - public var valueInstant: Instant? - - /// Input Value. - public var valueInteger: Int? - - /// Input Value. - public var valueMarkdown: String? - - /// Input Value. - public var valueMeta: Meta? - - /// Input Value. - public var valueOid: String? - - /// Input Value. - public var valuePeriod: Period? - - /// Input Value. - public var valuePositiveInt: UInt? - - /// Input Value. - public var valueQuantity: Quantity? - - /// Input Value. - public var valueRange: Range? - - /// Input Value. - public var valueRatio: Ratio? - - /// Input Value. - public var valueReference: Reference? - - /// Input Value. - public var valueSampledData: SampledData? - - /// Input Value. - public var valueSignature: Signature? - - /// Input Value. - public var valueString: String? - - /// Input Value. - public var valueTime: FHIRTime? - - /// Input Value. - public var valueTiming: Timing? - - /// Input Value. - public var valueUnsignedInt: UInt? - - /// Input Value. - public var valueUri: URL? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(name: String, valueAddress: Address, valueAnnotation: Annotation, valueAttachment: Attachment, valueBase64Binary: Base64Binary, valueBoolean: Bool, valueCode: String, valueCodeableConcept: CodeableConcept, valueCoding: Coding, valueContactPoint: ContactPoint, valueDate: FHIRDate, valueDateTime: DateTime, valueDecimal: NSDecimalNumber, valueHumanName: HumanName, valueId: String, valueIdentifier: Identifier, valueInstant: Instant, valueInteger: Int, valueMarkdown: String, valueMeta: Meta, valueOid: String, valuePeriod: Period, valuePositiveInt: UInt, valueQuantity: Quantity, valueRange: Range, valueRatio: Ratio, valueReference: Reference, valueSampledData: SampledData, valueSignature: Signature, valueString: String, valueTime: FHIRTime, valueTiming: Timing, valueUnsignedInt: UInt, valueUri: URL) { - self.init(json: nil) - self.name = name - self.valueAddress = valueAddress - self.valueAnnotation = valueAnnotation - self.valueAttachment = valueAttachment - self.valueBase64Binary = valueBase64Binary - self.valueBoolean = valueBoolean - self.valueCode = valueCode - self.valueCodeableConcept = valueCodeableConcept - self.valueCoding = valueCoding - self.valueContactPoint = valueContactPoint - self.valueDate = valueDate - self.valueDateTime = valueDateTime - self.valueDecimal = valueDecimal - self.valueHumanName = valueHumanName - self.valueId = valueId - self.valueIdentifier = valueIdentifier - self.valueInstant = valueInstant - self.valueInteger = valueInteger - self.valueMarkdown = valueMarkdown - self.valueMeta = valueMeta - self.valueOid = valueOid - self.valuePeriod = valuePeriod - self.valuePositiveInt = valuePositiveInt - self.valueQuantity = valueQuantity - self.valueRange = valueRange - self.valueRatio = valueRatio - self.valueReference = valueReference - self.valueSampledData = valueSampledData - self.valueSignature = valueSignature - self.valueString = valueString - self.valueTime = valueTime - self.valueTiming = valueTiming - self.valueUnsignedInt = valueUnsignedInt - self.valueUri = valueUri - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["valueAddress"] { - presentKeys.insert("valueAddress") - if let val = exist as? FHIRJSON { - self.valueAddress = Address(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueAddress", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueAnnotation"] { - presentKeys.insert("valueAnnotation") - if let val = exist as? FHIRJSON { - self.valueAnnotation = Annotation(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueAnnotation", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueAttachment"] { - presentKeys.insert("valueAttachment") - if let val = exist as? FHIRJSON { - self.valueAttachment = Attachment(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueBase64Binary"] { - presentKeys.insert("valueBase64Binary") - if let val = exist as? String { - self.valueBase64Binary = Base64Binary(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueBase64Binary", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueBoolean"] { - presentKeys.insert("valueBoolean") - if let val = exist as? Bool { - self.valueBoolean = val - } - else { - errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCode"] { - presentKeys.insert("valueCode") - if let val = exist as? String { - self.valueCode = val - } - else { - errors.append(FHIRJSONError(key: "valueCode", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCodeableConcept"] { - presentKeys.insert("valueCodeableConcept") - if let val = exist as? FHIRJSON { - self.valueCodeableConcept = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCoding"] { - presentKeys.insert("valueCoding") - if let val = exist as? FHIRJSON { - self.valueCoding = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueCoding", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueContactPoint"] { - presentKeys.insert("valueContactPoint") - if let val = exist as? FHIRJSON { - self.valueContactPoint = ContactPoint(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueContactPoint", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueDate"] { - presentKeys.insert("valueDate") - if let val = exist as? String { - self.valueDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueDateTime"] { - presentKeys.insert("valueDateTime") - if let val = exist as? String { - self.valueDateTime = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueDecimal"] { - presentKeys.insert("valueDecimal") - if let val = exist as? NSNumber { - self.valueDecimal = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "valueDecimal", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueHumanName"] { - presentKeys.insert("valueHumanName") - if let val = exist as? FHIRJSON { - self.valueHumanName = HumanName(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueHumanName", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueId"] { - presentKeys.insert("valueId") - if let val = exist as? String { - self.valueId = val - } - else { - errors.append(FHIRJSONError(key: "valueId", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueIdentifier"] { - presentKeys.insert("valueIdentifier") - if let val = exist as? FHIRJSON { - self.valueIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueInstant"] { - presentKeys.insert("valueInstant") - if let val = exist as? String { - self.valueInstant = Instant(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueInstant", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueInteger"] { - presentKeys.insert("valueInteger") - if let val = exist as? Int { - self.valueInteger = val - } - else { - errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueMarkdown"] { - presentKeys.insert("valueMarkdown") - if let val = exist as? String { - self.valueMarkdown = val - } - else { - errors.append(FHIRJSONError(key: "valueMarkdown", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueMeta"] { - presentKeys.insert("valueMeta") - if let val = exist as? FHIRJSON { - self.valueMeta = Meta(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueMeta", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueOid"] { - presentKeys.insert("valueOid") - if let val = exist as? String { - self.valueOid = val - } - else { - errors.append(FHIRJSONError(key: "valueOid", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valuePeriod"] { - presentKeys.insert("valuePeriod") - if let val = exist as? FHIRJSON { - self.valuePeriod = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valuePositiveInt"] { - presentKeys.insert("valuePositiveInt") - if let val = exist as? UInt { - self.valuePositiveInt = val - } - else { - errors.append(FHIRJSONError(key: "valuePositiveInt", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueQuantity"] { - presentKeys.insert("valueQuantity") - if let val = exist as? FHIRJSON { - self.valueQuantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueRange"] { - presentKeys.insert("valueRange") - if let val = exist as? FHIRJSON { - self.valueRange = Range(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueRatio"] { - presentKeys.insert("valueRatio") - if let val = exist as? FHIRJSON { - self.valueRatio = Ratio(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueRatio", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueReference"] { - presentKeys.insert("valueReference") - if let val = exist as? FHIRJSON { - self.valueReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueSampledData"] { - presentKeys.insert("valueSampledData") - if let val = exist as? FHIRJSON { - self.valueSampledData = SampledData(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueSignature"] { - presentKeys.insert("valueSignature") - if let val = exist as? FHIRJSON { - self.valueSignature = Signature(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueSignature", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueString"] { - presentKeys.insert("valueString") - if let val = exist as? String { - self.valueString = val - } - else { - errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueTime"] { - presentKeys.insert("valueTime") - if let val = exist as? String { - self.valueTime = FHIRTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueTiming"] { - presentKeys.insert("valueTiming") - if let val = exist as? FHIRJSON { - self.valueTiming = Timing(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueTiming", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueUnsignedInt"] { - presentKeys.insert("valueUnsignedInt") - if let val = exist as? UInt { - self.valueUnsignedInt = val - } - else { - errors.append(FHIRJSONError(key: "valueUnsignedInt", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueUri"] { - presentKeys.insert("valueUri") - if let val = exist as? String { - self.valueUri = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueUri", wants: String.self, has: exist.dynamicType)) - } - } - - // check if nonoptional expanded properties are present - if nil == self.valueBoolean && nil == self.valueInteger && nil == self.valueDecimal && nil == self.valueBase64Binary && nil == self.valueInstant && nil == self.valueString && nil == self.valueUri && nil == self.valueDate && nil == self.valueDateTime && nil == self.valueTime && nil == self.valueCode && nil == self.valueOid && nil == self.valueId && nil == self.valueUnsignedInt && nil == self.valuePositiveInt && nil == self.valueMarkdown && nil == self.valueAnnotation && nil == self.valueAttachment && nil == self.valueIdentifier && nil == self.valueCodeableConcept && nil == self.valueCoding && nil == self.valueQuantity && nil == self.valueRange && nil == self.valuePeriod && nil == self.valueRatio && nil == self.valueSampledData && nil == self.valueSignature && nil == self.valueHumanName && nil == self.valueAddress && nil == self.valueContactPoint && nil == self.valueTiming && nil == self.valueReference && nil == self.valueMeta { - errors.append(FHIRJSONError(key: "value*")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let valueAddress = self.valueAddress { - json["valueAddress"] = valueAddress.asJSON() - } - if let valueAnnotation = self.valueAnnotation { - json["valueAnnotation"] = valueAnnotation.asJSON() - } - if let valueAttachment = self.valueAttachment { - json["valueAttachment"] = valueAttachment.asJSON() - } - if let valueBase64Binary = self.valueBase64Binary { - json["valueBase64Binary"] = valueBase64Binary.asJSON() - } - if let valueBoolean = self.valueBoolean { - json["valueBoolean"] = valueBoolean.asJSON() - } - if let valueCode = self.valueCode { - json["valueCode"] = valueCode.asJSON() - } - if let valueCodeableConcept = self.valueCodeableConcept { - json["valueCodeableConcept"] = valueCodeableConcept.asJSON() - } - if let valueCoding = self.valueCoding { - json["valueCoding"] = valueCoding.asJSON() - } - if let valueContactPoint = self.valueContactPoint { - json["valueContactPoint"] = valueContactPoint.asJSON() - } - if let valueDate = self.valueDate { - json["valueDate"] = valueDate.asJSON() - } - if let valueDateTime = self.valueDateTime { - json["valueDateTime"] = valueDateTime.asJSON() - } - if let valueDecimal = self.valueDecimal { - json["valueDecimal"] = valueDecimal.asJSON() - } - if let valueHumanName = self.valueHumanName { - json["valueHumanName"] = valueHumanName.asJSON() - } - if let valueId = self.valueId { - json["valueId"] = valueId.asJSON() - } - if let valueIdentifier = self.valueIdentifier { - json["valueIdentifier"] = valueIdentifier.asJSON() - } - if let valueInstant = self.valueInstant { - json["valueInstant"] = valueInstant.asJSON() - } - if let valueInteger = self.valueInteger { - json["valueInteger"] = valueInteger.asJSON() - } - if let valueMarkdown = self.valueMarkdown { - json["valueMarkdown"] = valueMarkdown.asJSON() - } - if let valueMeta = self.valueMeta { - json["valueMeta"] = valueMeta.asJSON() - } - if let valueOid = self.valueOid { - json["valueOid"] = valueOid.asJSON() - } - if let valuePeriod = self.valuePeriod { - json["valuePeriod"] = valuePeriod.asJSON() - } - if let valuePositiveInt = self.valuePositiveInt { - json["valuePositiveInt"] = valuePositiveInt.asJSON() - } - if let valueQuantity = self.valueQuantity { - json["valueQuantity"] = valueQuantity.asJSON() - } - if let valueRange = self.valueRange { - json["valueRange"] = valueRange.asJSON() - } - if let valueRatio = self.valueRatio { - json["valueRatio"] = valueRatio.asJSON() - } - if let valueReference = self.valueReference { - json["valueReference"] = valueReference.asJSON() - } - if let valueSampledData = self.valueSampledData { - json["valueSampledData"] = valueSampledData.asJSON() - } - if let valueSignature = self.valueSignature { - json["valueSignature"] = valueSignature.asJSON() - } - if let valueString = self.valueString { - json["valueString"] = valueString.asJSON() - } - if let valueTime = self.valueTime { - json["valueTime"] = valueTime.asJSON() - } - if let valueTiming = self.valueTiming { - json["valueTiming"] = valueTiming.asJSON() - } - if let valueUnsignedInt = self.valueUnsignedInt { - json["valueUnsignedInt"] = valueUnsignedInt.asJSON() - } - if let valueUri = self.valueUri { - json["valueUri"] = valueUri.asJSON() - } - - return json - } -} - - -/** - * Task Output. - * - * Outputs produced by the Task. - */ -public class TaskOutput: BackboneElement { - override public class var resourceName: String { - get { return "TaskOutput" } - } - - /// Output Name. - public var name: String? - - /// Output Value. - public var valueAddress: Address? - - /// Output Value. - public var valueAnnotation: Annotation? - - /// Output Value. - public var valueAttachment: Attachment? - - /// Output Value. - public var valueBase64Binary: Base64Binary? - - /// Output Value. - public var valueBoolean: Bool? - - /// Output Value. - public var valueCode: String? - - /// Output Value. - public var valueCodeableConcept: CodeableConcept? - - /// Output Value. - public var valueCoding: Coding? - - /// Output Value. - public var valueContactPoint: ContactPoint? - - /// Output Value. - public var valueDate: FHIRDate? - - /// Output Value. - public var valueDateTime: DateTime? - - /// Output Value. - public var valueDecimal: NSDecimalNumber? - - /// Output Value. - public var valueHumanName: HumanName? - - /// Output Value. - public var valueId: String? - - /// Output Value. - public var valueIdentifier: Identifier? - - /// Output Value. - public var valueInstant: Instant? - - /// Output Value. - public var valueInteger: Int? - - /// Output Value. - public var valueMarkdown: String? - - /// Output Value. - public var valueMeta: Meta? - - /// Output Value. - public var valueOid: String? - - /// Output Value. - public var valuePeriod: Period? - - /// Output Value. - public var valuePositiveInt: UInt? - - /// Output Value. - public var valueQuantity: Quantity? - - /// Output Value. - public var valueRange: Range? - - /// Output Value. - public var valueRatio: Ratio? - - /// Output Value. - public var valueReference: Reference? - - /// Output Value. - public var valueSampledData: SampledData? - - /// Output Value. - public var valueSignature: Signature? - - /// Output Value. - public var valueString: String? - - /// Output Value. - public var valueTime: FHIRTime? - - /// Output Value. - public var valueTiming: Timing? - - /// Output Value. - public var valueUnsignedInt: UInt? - - /// Output Value. - public var valueUri: URL? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(name: String, valueAddress: Address, valueAnnotation: Annotation, valueAttachment: Attachment, valueBase64Binary: Base64Binary, valueBoolean: Bool, valueCode: String, valueCodeableConcept: CodeableConcept, valueCoding: Coding, valueContactPoint: ContactPoint, valueDate: FHIRDate, valueDateTime: DateTime, valueDecimal: NSDecimalNumber, valueHumanName: HumanName, valueId: String, valueIdentifier: Identifier, valueInstant: Instant, valueInteger: Int, valueMarkdown: String, valueMeta: Meta, valueOid: String, valuePeriod: Period, valuePositiveInt: UInt, valueQuantity: Quantity, valueRange: Range, valueRatio: Ratio, valueReference: Reference, valueSampledData: SampledData, valueSignature: Signature, valueString: String, valueTime: FHIRTime, valueTiming: Timing, valueUnsignedInt: UInt, valueUri: URL) { - self.init(json: nil) - self.name = name - self.valueAddress = valueAddress - self.valueAnnotation = valueAnnotation - self.valueAttachment = valueAttachment - self.valueBase64Binary = valueBase64Binary - self.valueBoolean = valueBoolean - self.valueCode = valueCode - self.valueCodeableConcept = valueCodeableConcept - self.valueCoding = valueCoding - self.valueContactPoint = valueContactPoint - self.valueDate = valueDate - self.valueDateTime = valueDateTime - self.valueDecimal = valueDecimal - self.valueHumanName = valueHumanName - self.valueId = valueId - self.valueIdentifier = valueIdentifier - self.valueInstant = valueInstant - self.valueInteger = valueInteger - self.valueMarkdown = valueMarkdown - self.valueMeta = valueMeta - self.valueOid = valueOid - self.valuePeriod = valuePeriod - self.valuePositiveInt = valuePositiveInt - self.valueQuantity = valueQuantity - self.valueRange = valueRange - self.valueRatio = valueRatio - self.valueReference = valueReference - self.valueSampledData = valueSampledData - self.valueSignature = valueSignature - self.valueString = valueString - self.valueTime = valueTime - self.valueTiming = valueTiming - self.valueUnsignedInt = valueUnsignedInt - self.valueUri = valueUri - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["valueAddress"] { - presentKeys.insert("valueAddress") - if let val = exist as? FHIRJSON { - self.valueAddress = Address(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueAddress", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueAnnotation"] { - presentKeys.insert("valueAnnotation") - if let val = exist as? FHIRJSON { - self.valueAnnotation = Annotation(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueAnnotation", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueAttachment"] { - presentKeys.insert("valueAttachment") - if let val = exist as? FHIRJSON { - self.valueAttachment = Attachment(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueBase64Binary"] { - presentKeys.insert("valueBase64Binary") - if let val = exist as? String { - self.valueBase64Binary = Base64Binary(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueBase64Binary", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueBoolean"] { - presentKeys.insert("valueBoolean") - if let val = exist as? Bool { - self.valueBoolean = val - } - else { - errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCode"] { - presentKeys.insert("valueCode") - if let val = exist as? String { - self.valueCode = val - } - else { - errors.append(FHIRJSONError(key: "valueCode", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCodeableConcept"] { - presentKeys.insert("valueCodeableConcept") - if let val = exist as? FHIRJSON { - self.valueCodeableConcept = CodeableConcept(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueCoding"] { - presentKeys.insert("valueCoding") - if let val = exist as? FHIRJSON { - self.valueCoding = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueCoding", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueContactPoint"] { - presentKeys.insert("valueContactPoint") - if let val = exist as? FHIRJSON { - self.valueContactPoint = ContactPoint(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueContactPoint", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueDate"] { - presentKeys.insert("valueDate") - if let val = exist as? String { - self.valueDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueDateTime"] { - presentKeys.insert("valueDateTime") - if let val = exist as? String { - self.valueDateTime = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueDecimal"] { - presentKeys.insert("valueDecimal") - if let val = exist as? NSNumber { - self.valueDecimal = NSDecimalNumber(json: val) - } - else { - errors.append(FHIRJSONError(key: "valueDecimal", wants: NSNumber.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueHumanName"] { - presentKeys.insert("valueHumanName") - if let val = exist as? FHIRJSON { - self.valueHumanName = HumanName(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueHumanName", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueId"] { - presentKeys.insert("valueId") - if let val = exist as? String { - self.valueId = val - } - else { - errors.append(FHIRJSONError(key: "valueId", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueIdentifier"] { - presentKeys.insert("valueIdentifier") - if let val = exist as? FHIRJSON { - self.valueIdentifier = Identifier(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueInstant"] { - presentKeys.insert("valueInstant") - if let val = exist as? String { - self.valueInstant = Instant(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueInstant", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueInteger"] { - presentKeys.insert("valueInteger") - if let val = exist as? Int { - self.valueInteger = val - } - else { - errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueMarkdown"] { - presentKeys.insert("valueMarkdown") - if let val = exist as? String { - self.valueMarkdown = val - } - else { - errors.append(FHIRJSONError(key: "valueMarkdown", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueMeta"] { - presentKeys.insert("valueMeta") - if let val = exist as? FHIRJSON { - self.valueMeta = Meta(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueMeta", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueOid"] { - presentKeys.insert("valueOid") - if let val = exist as? String { - self.valueOid = val - } - else { - errors.append(FHIRJSONError(key: "valueOid", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valuePeriod"] { - presentKeys.insert("valuePeriod") - if let val = exist as? FHIRJSON { - self.valuePeriod = Period(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valuePositiveInt"] { - presentKeys.insert("valuePositiveInt") - if let val = exist as? UInt { - self.valuePositiveInt = val - } - else { - errors.append(FHIRJSONError(key: "valuePositiveInt", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueQuantity"] { - presentKeys.insert("valueQuantity") - if let val = exist as? FHIRJSON { - self.valueQuantity = Quantity(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueRange"] { - presentKeys.insert("valueRange") - if let val = exist as? FHIRJSON { - self.valueRange = Range(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueRatio"] { - presentKeys.insert("valueRatio") - if let val = exist as? FHIRJSON { - self.valueRatio = Ratio(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueRatio", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueReference"] { - presentKeys.insert("valueReference") - if let val = exist as? FHIRJSON { - self.valueReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueSampledData"] { - presentKeys.insert("valueSampledData") - if let val = exist as? FHIRJSON { - self.valueSampledData = SampledData(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueSignature"] { - presentKeys.insert("valueSignature") - if let val = exist as? FHIRJSON { - self.valueSignature = Signature(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueSignature", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueString"] { - presentKeys.insert("valueString") - if let val = exist as? String { - self.valueString = val - } - else { - errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueTime"] { - presentKeys.insert("valueTime") - if let val = exist as? String { - self.valueTime = FHIRTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueTiming"] { - presentKeys.insert("valueTiming") - if let val = exist as? FHIRJSON { - self.valueTiming = Timing(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "valueTiming", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueUnsignedInt"] { - presentKeys.insert("valueUnsignedInt") - if let val = exist as? UInt { - self.valueUnsignedInt = val - } - else { - errors.append(FHIRJSONError(key: "valueUnsignedInt", wants: UInt.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["valueUri"] { - presentKeys.insert("valueUri") - if let val = exist as? String { - self.valueUri = URL(string: val) - } - else { - errors.append(FHIRJSONError(key: "valueUri", wants: String.self, has: exist.dynamicType)) - } - } - - // check if nonoptional expanded properties are present - if nil == self.valueBoolean && nil == self.valueInteger && nil == self.valueDecimal && nil == self.valueBase64Binary && nil == self.valueInstant && nil == self.valueString && nil == self.valueUri && nil == self.valueDate && nil == self.valueDateTime && nil == self.valueTime && nil == self.valueCode && nil == self.valueOid && nil == self.valueId && nil == self.valueUnsignedInt && nil == self.valuePositiveInt && nil == self.valueMarkdown && nil == self.valueAnnotation && nil == self.valueAttachment && nil == self.valueIdentifier && nil == self.valueCodeableConcept && nil == self.valueCoding && nil == self.valueQuantity && nil == self.valueRange && nil == self.valuePeriod && nil == self.valueRatio && nil == self.valueSampledData && nil == self.valueSignature && nil == self.valueHumanName && nil == self.valueAddress && nil == self.valueContactPoint && nil == self.valueTiming && nil == self.valueReference && nil == self.valueMeta { - errors.append(FHIRJSONError(key: "value*")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let valueAddress = self.valueAddress { - json["valueAddress"] = valueAddress.asJSON() - } - if let valueAnnotation = self.valueAnnotation { - json["valueAnnotation"] = valueAnnotation.asJSON() - } - if let valueAttachment = self.valueAttachment { - json["valueAttachment"] = valueAttachment.asJSON() - } - if let valueBase64Binary = self.valueBase64Binary { - json["valueBase64Binary"] = valueBase64Binary.asJSON() - } - if let valueBoolean = self.valueBoolean { - json["valueBoolean"] = valueBoolean.asJSON() - } - if let valueCode = self.valueCode { - json["valueCode"] = valueCode.asJSON() - } - if let valueCodeableConcept = self.valueCodeableConcept { - json["valueCodeableConcept"] = valueCodeableConcept.asJSON() - } - if let valueCoding = self.valueCoding { - json["valueCoding"] = valueCoding.asJSON() - } - if let valueContactPoint = self.valueContactPoint { - json["valueContactPoint"] = valueContactPoint.asJSON() - } - if let valueDate = self.valueDate { - json["valueDate"] = valueDate.asJSON() - } - if let valueDateTime = self.valueDateTime { - json["valueDateTime"] = valueDateTime.asJSON() - } - if let valueDecimal = self.valueDecimal { - json["valueDecimal"] = valueDecimal.asJSON() - } - if let valueHumanName = self.valueHumanName { - json["valueHumanName"] = valueHumanName.asJSON() - } - if let valueId = self.valueId { - json["valueId"] = valueId.asJSON() - } - if let valueIdentifier = self.valueIdentifier { - json["valueIdentifier"] = valueIdentifier.asJSON() - } - if let valueInstant = self.valueInstant { - json["valueInstant"] = valueInstant.asJSON() - } - if let valueInteger = self.valueInteger { - json["valueInteger"] = valueInteger.asJSON() - } - if let valueMarkdown = self.valueMarkdown { - json["valueMarkdown"] = valueMarkdown.asJSON() - } - if let valueMeta = self.valueMeta { - json["valueMeta"] = valueMeta.asJSON() - } - if let valueOid = self.valueOid { - json["valueOid"] = valueOid.asJSON() - } - if let valuePeriod = self.valuePeriod { - json["valuePeriod"] = valuePeriod.asJSON() - } - if let valuePositiveInt = self.valuePositiveInt { - json["valuePositiveInt"] = valuePositiveInt.asJSON() - } - if let valueQuantity = self.valueQuantity { - json["valueQuantity"] = valueQuantity.asJSON() - } - if let valueRange = self.valueRange { - json["valueRange"] = valueRange.asJSON() - } - if let valueRatio = self.valueRatio { - json["valueRatio"] = valueRatio.asJSON() - } - if let valueReference = self.valueReference { - json["valueReference"] = valueReference.asJSON() - } - if let valueSampledData = self.valueSampledData { - json["valueSampledData"] = valueSampledData.asJSON() - } - if let valueSignature = self.valueSignature { - json["valueSignature"] = valueSignature.asJSON() - } - if let valueString = self.valueString { - json["valueString"] = valueString.asJSON() - } - if let valueTime = self.valueTime { - json["valueTime"] = valueTime.asJSON() - } - if let valueTiming = self.valueTiming { - json["valueTiming"] = valueTiming.asJSON() - } - if let valueUnsignedInt = self.valueUnsignedInt { - json["valueUnsignedInt"] = valueUnsignedInt.asJSON() - } - if let valueUri = self.valueUri { - json["valueUri"] = valueUri.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/TestScript.swift b/Sources/Models/TestScript.swift index d6cc1041..11ca2708 100644 --- a/Sources/Models/TestScript.swift +++ b/Sources/Models/TestScript.swift @@ -2,7 +2,7 @@ // TestScript.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/TestScript) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/TestScript) on 2016-08-09. // 2016, SMART Health IT. // @@ -32,9 +32,6 @@ public class TestScript: DomainResource { /// Natural language description of the TestScript. public var description_fhir: String? - /// An abstract server representing a destination or receiver in a message exchange. - public var destination: [TestScriptDestination]? - /// If for testing purposes, not real usage. public var experimental: Bool? @@ -47,12 +44,12 @@ public class TestScript: DomainResource { /// Required capability that is assumed to function correctly on the FHIR server being tested. public var metadata: TestScriptMetadata? + /// Whether or not the tests apply to more than one FHIR server. + public var multiserver: Bool? + /// Informal name for this TestScript. public var name: String? - /// An abstract server representing a client or sender in a message exchange. - public var origin: [TestScriptOrigin]? - /// Reference of the validation profile. public var profile: [Reference]? @@ -62,12 +59,6 @@ public class TestScript: DomainResource { /// Scope and Usage this Test Script is for. public var requirements: String? - /// 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? @@ -145,15 +136,6 @@ public class TestScript: DomainResource { errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["destination"] { - presentKeys.insert("destination") - if let val = exist as? [FHIRJSON] { - self.destination = TestScriptDestination.instantiate(fromArray: val, owner: self) as? [TestScriptDestination] - } - else { - errors.append(FHIRJSONError(key: "destination", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["experimental"] { presentKeys.insert("experimental") if let val = exist as? Bool { @@ -190,6 +172,15 @@ public class TestScript: DomainResource { errors.append(FHIRJSONError(key: "metadata", wants: FHIRJSON.self, has: exist.dynamicType)) } } + if let exist: AnyObject = js["multiserver"] { + presentKeys.insert("multiserver") + if let val = exist as? Bool { + self.multiserver = val + } + else { + errors.append(FHIRJSONError(key: "multiserver", wants: Bool.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["name"] { presentKeys.insert("name") if let val = exist as? String { @@ -202,15 +193,6 @@ public class TestScript: DomainResource { else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["origin"] { - presentKeys.insert("origin") - if let val = exist as? [FHIRJSON] { - self.origin = TestScriptOrigin.instantiate(fromArray: val, owner: self) as? [TestScriptOrigin] - } - else { - errors.append(FHIRJSONError(key: "origin", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["profile"] { presentKeys.insert("profile") if let val = exist as? [FHIRJSON] { @@ -238,24 +220,6 @@ public class TestScript: DomainResource { errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["rule"] { - presentKeys.insert("rule") - if let val = exist as? [FHIRJSON] { - self.rule = TestScriptRule.instantiate(fromArray: val, owner: self) as? [TestScriptRule] - } - else { - errors.append(FHIRJSONError(key: "rule", wants: Array.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["ruleset"] { - presentKeys.insert("ruleset") - if let val = exist as? [FHIRJSON] { - self.ruleset = TestScriptRuleset.instantiate(fromArray: val, owner: self) as? [TestScriptRuleset] - } - else { - errors.append(FHIRJSONError(key: "ruleset", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["setup"] { presentKeys.insert("setup") if let val = exist as? FHIRJSON { @@ -353,9 +317,6 @@ public class TestScript: DomainResource { if let description_fhir = self.description_fhir { json["description"] = description_fhir.asJSON() } - if let destination = self.destination { - json["destination"] = TestScriptDestination.asJSONArray(destination) - } if let experimental = self.experimental { json["experimental"] = experimental.asJSON() } @@ -368,12 +329,12 @@ public class TestScript: DomainResource { if let metadata = self.metadata { json["metadata"] = metadata.asJSON() } + if let multiserver = self.multiserver { + json["multiserver"] = multiserver.asJSON() + } if let name = self.name { json["name"] = name.asJSON() } - if let origin = self.origin { - json["origin"] = TestScriptOrigin.asJSONArray(origin) - } if let profile = self.profile { json["profile"] = Reference.asJSONArray(profile) } @@ -383,12 +344,6 @@ public class TestScript: DomainResource { if let requirements = self.requirements { json["requirements"] = requirements.asJSON() } - if let rule = self.rule { - json["rule"] = TestScriptRule.asJSONArray(rule) - } - if let ruleset = self.ruleset { - json["ruleset"] = TestScriptRuleset.asJSONArray(ruleset) - } if let setup = self.setup { json["setup"] = setup.asJSON() } @@ -429,7 +384,7 @@ public class TestScriptContact: BackboneElement { get { return "TestScriptContact" } } - /// Name of an individual to contact. + /// Name of a individual to contact. public var name: String? /// Contact details for individual or publisher. @@ -481,81 +436,6 @@ public class TestScriptContact: BackboneElement { } -/** - * 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. - */ -public class TestScriptDestination: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptDestination" } - } - - /// The index of the abstract destination server starting at 1. - public var index: Int? - - /// FHIR-Server | FHIR-SDC-FormManager | FHIR-SDC-FormReceiver | FHIR-SDC-FormProcessor. - public var profile: Coding? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(index: Int, profile: Coding) { - self.init(json: nil) - self.index = index - self.profile = profile - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["index"] { - presentKeys.insert("index") - if let val = exist as? Int { - self.index = val - } - else { - errors.append(FHIRJSONError(key: "index", wants: Int.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "index")) - } - if let exist: AnyObject = js["profile"] { - presentKeys.insert("profile") - if let val = exist as? FHIRJSON { - self.profile = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "profile")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let index = self.index { - json["index"] = index.asJSON() - } - if let profile = self.profile { - json["profile"] = profile.asJSON() - } - - return json - } -} - - /** * Fixture in the test script - by reference (uri). * @@ -726,9 +606,6 @@ public class TestScriptMetadataCapability: BackboneElement { /// Links to the FHIR specification. public var link: [URL]? - /// Which origin server these requirements apply to. - public var origin: [Int]? - /// Are the capabilities required?. public var required: Bool? @@ -789,15 +666,6 @@ public class TestScriptMetadataCapability: BackboneElement { errors.append(FHIRJSONError(key: "link", wants: Array.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["origin"] { - presentKeys.insert("origin") - if let val = exist as? [Int] { - self.origin = val - } - else { - errors.append(FHIRJSONError(key: "origin", wants: Array.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["required"] { presentKeys.insert("required") if let val = exist as? Bool { @@ -839,13 +707,6 @@ public class TestScriptMetadataCapability: BackboneElement { } json["link"] = arr } - if let origin = self.origin { - var arr = [AnyObject]() - for val in origin { - arr.append(val.asJSON()) - } - json["origin"] = arr - } if let required = self.required { json["required"] = required.asJSON() } @@ -930,20 +791,18 @@ public class TestScriptMetadataLink: BackboneElement { /** - * 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. + * A series of required setup operations before tests are executed. */ -public class TestScriptOrigin: BackboneElement { +public class TestScriptSetup: BackboneElement { override public class var resourceName: String { - get { return "TestScriptOrigin" } + get { return "TestScriptSetup" } } - /// The index of the abstract origin server starting at 1. - public var index: Int? + /// A setup operation or assert to perform. + public var action: [TestScriptSetupAction]? - /// FHIR-Client | FHIR-SDC-FormFiller. - public var profile: Coding? + /// Capabilities that are assumed to function correctly on the FHIR server being tested. + public var metadata: TestScriptMetadata? /** Initialize with a JSON object. */ @@ -952,39 +811,35 @@ public class TestScriptOrigin: BackboneElement { } /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(index: Int, profile: Coding) { + public convenience init(action: [TestScriptSetupAction]) { self.init(json: nil) - self.index = index - self.profile = profile + self.action = action } public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["index"] { - presentKeys.insert("index") - if let val = exist as? Int { - self.index = val + if let exist: AnyObject = js["action"] { + presentKeys.insert("action") + if let val = exist as? [FHIRJSON] { + self.action = TestScriptSetupAction.instantiate(fromArray: val, owner: self) as? [TestScriptSetupAction] } else { - errors.append(FHIRJSONError(key: "index", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) } } else { - errors.append(FHIRJSONError(key: "index")) + errors.append(FHIRJSONError(key: "action")) } - if let exist: AnyObject = js["profile"] { - presentKeys.insert("profile") + if let exist: AnyObject = js["metadata"] { + presentKeys.insert("metadata") if let val = exist as? FHIRJSON { - self.profile = Coding(json: val, owner: self) + self.metadata = TestScriptMetadata(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "metadata", wants: FHIRJSON.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "profile")) - } } return errors.isEmpty ? nil : errors } @@ -992,11 +847,11 @@ public class TestScriptOrigin: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let index = self.index { - json["index"] = index.asJSON() + if let action = self.action { + json["action"] = TestScriptSetupAction.asJSONArray(action) } - if let profile = self.profile { - json["profile"] = profile.asJSON() + if let metadata = self.metadata { + json["metadata"] = metadata.asJSON() } return json @@ -1005,20 +860,20 @@ public class TestScriptOrigin: BackboneElement { /** - * Assert rule used within the test script. + * A setup operation or assert to perform. * - * Assert rule to be used in one or more asserts within the test script. + * Action would contain either an operation or an assertion. */ -public class TestScriptRule: BackboneElement { +public class TestScriptSetupAction: BackboneElement { override public class var resourceName: String { - get { return "TestScriptRule" } + get { return "TestScriptSetupAction" } } - /// Rule parameter template. - public var param: [TestScriptRuleParam]? + /// The assertion to perform. + public var assert: TestScriptSetupActionAssert? - /// Assert rule resource reference. - public var resource: Reference? + /// The setup operation to perform. + public var operation: TestScriptSetupActionOperation? /** Initialize with a JSON object. */ @@ -1026,36 +881,27 @@ public class TestScriptRule: BackboneElement { super.init(json: json, owner: owner) } - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(resource: Reference) { - self.init(json: nil) - self.resource = resource - } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["param"] { - presentKeys.insert("param") - if let val = exist as? [FHIRJSON] { - self.param = TestScriptRuleParam.instantiate(fromArray: val, owner: self) as? [TestScriptRuleParam] + if let exist: AnyObject = js["assert"] { + presentKeys.insert("assert") + if let val = exist as? FHIRJSON { + self.assert = TestScriptSetupActionAssert(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "param", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "assert", wants: FHIRJSON.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["resource"] { - presentKeys.insert("resource") + if let exist: AnyObject = js["operation"] { + presentKeys.insert("operation") if let val = exist as? FHIRJSON { - self.resource = Reference(json: val, owner: self) + self.operation = TestScriptSetupActionOperation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "operation", wants: FHIRJSON.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "resource")) - } } return errors.isEmpty ? nil : errors } @@ -1063,11 +909,11 @@ public class TestScriptRule: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let param = self.param { - json["param"] = TestScriptRuleParam.asJSONArray(param) + if let assert = self.assert { + json["assert"] = assert.asJSON() } - if let resource = self.resource { - json["resource"] = resource.asJSON() + if let operation = self.operation { + json["operation"] = operation.asJSON() } return json @@ -1076,505 +922,103 @@ public class TestScriptRule: BackboneElement { /** - * Rule parameter template. + * The assertion to perform. * - * Each rule template can take one or more parameters for rule evaluation. + * Evaluates the results of previous operations to determine if the server under test behaves appropriately. */ -public class TestScriptRuleParam: BackboneElement { +public class TestScriptSetupActionAssert: BackboneElement { override public class var resourceName: String { - get { return "TestScriptRuleParam" } + get { return "TestScriptSetupActionAssert" } } - /// Parameter name matching external assert rule parameter. - public var name: String? + /// Id of fixture used to compare the "sourceId/path" evaluations to. + public var compareToSourceId: String? + + /// XPath or JSONPath expression against fixture used to compare the "sourceId/path" evaluations to. + public var compareToSourcePath: String? + + /// xml | json. + public var contentType: String? + + /// Tracking/reporting assertion description. + public var description_fhir: String? + + /// response | request. + public var direction: String? + + /// HTTP header field name. + public var headerField: String? + + /// Tracking/logging assertion label. + public var label: String? + + /// Fixture Id of minimum content resource. + public var minimumId: String? + + /// Perform validation on navigation links?. + public var navigationLinks: Bool? + + /// equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains. + public var operator_fhir: String? + + /// XPath or JSONPath expression. + public var path: String? + + /// Resource type. + public var resource: String? + + /// okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable. + public var response: String? - /// Parameter value defined either explicitly or dynamically. + /// HTTP response code to test. + public var responseCode: String? + + /// Fixture Id of source expression or headerField. + public var sourceId: String? + + /// Profile Id of validation profile reference. + public var validateProfileId: String? + + /// The value to compare to. public var value: String? + /// Will this assert produce a warning only on error?. + public var warningOnly: Bool? + /** Initialize with a JSON object. */ public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { super.init(json: json, owner: owner) } - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(name: String) { - self.init(json: nil) - self.name = name - } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") + if let exist: AnyObject = js["compareToSourceId"] { + presentKeys.insert("compareToSourceId") if let val = exist as? String { - self.name = val + self.compareToSourceId = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "compareToSourceId", wants: String.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "name")) + if let exist: AnyObject = js["compareToSourcePath"] { + presentKeys.insert("compareToSourcePath") + if let val = exist as? String { + self.compareToSourcePath = val + } + else { + errors.append(FHIRJSONError(key: "compareToSourcePath", wants: String.self, has: exist.dynamicType)) + } } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") + if let exist: AnyObject = js["contentType"] { + presentKeys.insert("contentType") if let val = exist as? String { - self.value = val + self.contentType = val } else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * 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. - */ -public class TestScriptRuleset: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptRuleset" } - } - - /// Assert ruleset resource reference. - public var resource: Reference? - - /// Id of referenced rule within the ruleset. - public var rule: [TestScriptRulesetRule]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(resource: Reference, rule: [TestScriptRulesetRule]) { - self.init(json: nil) - self.resource = resource - self.rule = rule - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["resource"] { - presentKeys.insert("resource") - if let val = exist as? FHIRJSON { - self.resource = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "resource")) - } - if let exist: AnyObject = js["rule"] { - presentKeys.insert("rule") - if let val = exist as? [FHIRJSON] { - self.rule = TestScriptRulesetRule.instantiate(fromArray: val, owner: self) as? [TestScriptRulesetRule] - } - else { - errors.append(FHIRJSONError(key: "rule", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "rule")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let resource = self.resource { - json["resource"] = resource.asJSON() - } - if let rule = self.rule { - json["rule"] = TestScriptRulesetRule.asJSONArray(rule) - } - - return json - } -} - - -/** - * Id of referenced rule within the ruleset. - * - * Id of the referenced rule within the external ruleset template. - */ -public class TestScriptRulesetRule: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptRulesetRule" } - } - - /// Ruleset rule parameter template. - public var param: [TestScriptRulesetRuleParam]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["param"] { - presentKeys.insert("param") - if let val = exist as? [FHIRJSON] { - self.param = TestScriptRulesetRuleParam.instantiate(fromArray: val, owner: self) as? [TestScriptRulesetRuleParam] - } - else { - errors.append(FHIRJSONError(key: "param", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let param = self.param { - json["param"] = TestScriptRulesetRuleParam.asJSONArray(param) - } - - return json - } -} - - -/** - * Ruleset rule parameter template. - * - * Each rule template can take one or more parameters for rule evaluation. - */ -public class TestScriptRulesetRuleParam: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptRulesetRuleParam" } - } - - /// Parameter name matching external assert ruleset rule parameter. - public var name: String? - - /// Parameter value defined either explicitly or dynamically. - public var value: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(name: String) { - self.init(json: nil) - self.name = name - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") - if let val = exist as? String { - self.name = val - } - else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "name")) - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? String { - self.value = val - } - else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * A series of required setup operations before tests are executed. - */ -public class TestScriptSetup: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptSetup" } - } - - /// A setup operation or assert to perform. - public var action: [TestScriptSetupAction]? - - /// Capabilities that are assumed to function correctly on the FHIR server being tested. - public var metadata: TestScriptMetadata? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(action: [TestScriptSetupAction]) { - self.init(json: nil) - self.action = action - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["action"] { - presentKeys.insert("action") - if let val = exist as? [FHIRJSON] { - self.action = TestScriptSetupAction.instantiate(fromArray: val, owner: self) as? [TestScriptSetupAction] - } - else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "action")) - } - if let exist: AnyObject = js["metadata"] { - presentKeys.insert("metadata") - if let val = exist as? FHIRJSON { - self.metadata = TestScriptMetadata(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "metadata", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let action = self.action { - json["action"] = TestScriptSetupAction.asJSONArray(action) - } - if let metadata = self.metadata { - json["metadata"] = metadata.asJSON() - } - - return json - } -} - - -/** - * A setup operation or assert to perform. - * - * Action would contain either an operation or an assertion. - */ -public class TestScriptSetupAction: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptSetupAction" } - } - - /// The assertion to perform. - public var assert: TestScriptSetupActionAssert? - - /// The setup operation to perform. - public var operation: TestScriptSetupActionOperation? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["assert"] { - presentKeys.insert("assert") - if let val = exist as? FHIRJSON { - self.assert = TestScriptSetupActionAssert(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "assert", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["operation"] { - presentKeys.insert("operation") - if let val = exist as? FHIRJSON { - self.operation = TestScriptSetupActionOperation(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "operation", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let assert = self.assert { - json["assert"] = assert.asJSON() - } - if let operation = self.operation { - json["operation"] = operation.asJSON() - } - - return json - } -} - - -/** - * The assertion to perform. - * - * Evaluates the results of previous operations to determine if the server under test behaves appropriately. - */ -public class TestScriptSetupActionAssert: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptSetupActionAssert" } - } - - /// Id of fixture used to compare the "sourceId/path" evaluations to. - public var compareToSourceId: String? - - /// XPath or JSONPath expression against fixture used to compare the "sourceId/path" evaluations to. - public var compareToSourcePath: String? - - /// xml | json. - public var contentType: String? - - /// Tracking/reporting assertion description. - public var description_fhir: String? - - /// response | request. - public var direction: String? - - /// HTTP header field name. - public var headerField: String? - - /// Tracking/logging assertion label. - public var label: String? - - /// Fixture Id of minimum content resource. - public var minimumId: String? - - /// Perform validation on navigation links?. - public var navigationLinks: Bool? - - /// equals | notEquals | in | notIn | greaterThan | lessThan | empty | notEmpty | contains | notContains. - public var operator_fhir: String? - - /// XPath or JSONPath expression. - public var path: String? - - /// Resource type. - public var resource: String? - - /// okay | created | noContent | notModified | bad | forbidden | notFound | methodNotAllowed | conflict | gone | preconditionFailed | unprocessable. - public var response: String? - - /// HTTP response code to test. - public var responseCode: String? - - /// Id of the TestScript.rule. - public var rule: TestScriptSetupActionAssertRule? - - /// Id of the TestScript.ruleset. - public var ruleset: TestScriptSetupActionAssertRuleset? - - /// Fixture Id of source expression or headerField. - public var sourceId: String? - - /// Profile Id of validation profile reference. - public var validateProfileId: String? - - /// The value to compare to. - public var value: String? - - /// Will this assert produce a warning only on error?. - public var warningOnly: Bool? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["compareToSourceId"] { - presentKeys.insert("compareToSourceId") - if let val = exist as? String { - self.compareToSourceId = val - } - else { - errors.append(FHIRJSONError(key: "compareToSourceId", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["compareToSourcePath"] { - presentKeys.insert("compareToSourcePath") - if let val = exist as? String { - self.compareToSourcePath = val - } - else { - errors.append(FHIRJSONError(key: "compareToSourcePath", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["contentType"] { - presentKeys.insert("contentType") - if let val = exist as? String { - self.contentType = val - } - else { - errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["description"] { @@ -1614,463 +1058,85 @@ public class TestScriptSetupActionAssert: BackboneElement { } } if let exist: AnyObject = js["minimumId"] { - presentKeys.insert("minimumId") - if let val = exist as? String { - self.minimumId = val - } - else { - errors.append(FHIRJSONError(key: "minimumId", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["navigationLinks"] { - presentKeys.insert("navigationLinks") - if let val = exist as? Bool { - self.navigationLinks = val - } - else { - errors.append(FHIRJSONError(key: "navigationLinks", wants: Bool.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["operator"] { - presentKeys.insert("operator") - if let val = exist as? String { - self.operator_fhir = val - } - else { - errors.append(FHIRJSONError(key: "operator", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["path"] { - presentKeys.insert("path") - if let val = exist as? String { - self.path = val - } - else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["resource"] { - presentKeys.insert("resource") - if let val = exist as? String { - self.resource = val - } - else { - errors.append(FHIRJSONError(key: "resource", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["response"] { - presentKeys.insert("response") - if let val = exist as? String { - self.response = val - } - else { - errors.append(FHIRJSONError(key: "response", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["responseCode"] { - presentKeys.insert("responseCode") - if let val = exist as? String { - self.responseCode = val - } - else { - errors.append(FHIRJSONError(key: "responseCode", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["rule"] { - presentKeys.insert("rule") - if let val = exist as? FHIRJSON { - self.rule = TestScriptSetupActionAssertRule(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "rule", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["ruleset"] { - presentKeys.insert("ruleset") - if let val = exist as? FHIRJSON { - self.ruleset = TestScriptSetupActionAssertRuleset(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["sourceId"] { - presentKeys.insert("sourceId") - if let val = exist as? String { - self.sourceId = val - } - else { - errors.append(FHIRJSONError(key: "sourceId", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["validateProfileId"] { - presentKeys.insert("validateProfileId") - if let val = exist as? String { - self.validateProfileId = val - } - else { - errors.append(FHIRJSONError(key: "validateProfileId", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? String { - self.value = val - } - else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["warningOnly"] { - presentKeys.insert("warningOnly") - if let val = exist as? Bool { - self.warningOnly = val - } - else { - errors.append(FHIRJSONError(key: "warningOnly", wants: Bool.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let compareToSourceId = self.compareToSourceId { - json["compareToSourceId"] = compareToSourceId.asJSON() - } - if let compareToSourcePath = self.compareToSourcePath { - json["compareToSourcePath"] = compareToSourcePath.asJSON() - } - if let contentType = self.contentType { - json["contentType"] = contentType.asJSON() - } - if let description_fhir = self.description_fhir { - json["description"] = description_fhir.asJSON() - } - if let direction = self.direction { - json["direction"] = direction.asJSON() - } - if let headerField = self.headerField { - json["headerField"] = headerField.asJSON() - } - if let label = self.label { - json["label"] = label.asJSON() - } - if let minimumId = self.minimumId { - json["minimumId"] = minimumId.asJSON() - } - if let navigationLinks = self.navigationLinks { - json["navigationLinks"] = navigationLinks.asJSON() - } - if let operator_fhir = self.operator_fhir { - json["operator"] = operator_fhir.asJSON() - } - if let path = self.path { - json["path"] = path.asJSON() - } - if let resource = self.resource { - json["resource"] = resource.asJSON() - } - if let response = self.response { - json["response"] = response.asJSON() - } - if let responseCode = self.responseCode { - json["responseCode"] = responseCode.asJSON() - } - if let rule = self.rule { - json["rule"] = rule.asJSON() - } - if let ruleset = self.ruleset { - json["ruleset"] = ruleset.asJSON() - } - if let sourceId = self.sourceId { - json["sourceId"] = sourceId.asJSON() - } - if let validateProfileId = self.validateProfileId { - json["validateProfileId"] = validateProfileId.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - if let warningOnly = self.warningOnly { - json["warningOnly"] = warningOnly.asJSON() - } - - return json - } -} - - -/** - * Id of the TestScript.rule. - * - * The TestScript.rule id value this assert will evaluate. - */ -public class TestScriptSetupActionAssertRule: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptSetupActionAssertRule" } - } - - /// Rule parameter template. - public var param: [TestScriptSetupActionAssertRuleParam]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["param"] { - presentKeys.insert("param") - if let val = exist as? [FHIRJSON] { - self.param = TestScriptSetupActionAssertRuleParam.instantiate(fromArray: val, owner: self) as? [TestScriptSetupActionAssertRuleParam] - } - else { - errors.append(FHIRJSONError(key: "param", wants: Array.self, has: exist.dynamicType)) - } - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let param = self.param { - json["param"] = TestScriptSetupActionAssertRuleParam.asJSONArray(param) - } - - return json - } -} - - -/** - * Rule parameter template. - * - * Each rule template can take one or more parameters for rule evaluation. - */ -public class TestScriptSetupActionAssertRuleParam: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptSetupActionAssertRuleParam" } - } - - /// Parameter name matching external assert rule parameter. - public var name: String? - - /// Parameter value defined either explicitly or dynamically. - public var value: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(name: String, value: String) { - self.init(json: nil) - self.name = name - self.value = value - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") + presentKeys.insert("minimumId") if let val = exist as? String { - self.name = val + self.minimumId = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minimumId", wants: String.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "name")) + if let exist: AnyObject = js["navigationLinks"] { + presentKeys.insert("navigationLinks") + if let val = exist as? Bool { + self.navigationLinks = val + } + else { + errors.append(FHIRJSONError(key: "navigationLinks", wants: Bool.self, has: exist.dynamicType)) + } } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") + if let exist: AnyObject = js["operator"] { + presentKeys.insert("operator") if let val = exist as? String { - self.value = val + self.operator_fhir = val } else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "operator", wants: String.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "value")) + if let exist: AnyObject = js["path"] { + presentKeys.insert("path") + if let val = exist as? String { + self.path = val + } + else { + errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) + } } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let name = self.name { - json["name"] = name.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - -/** - * Id of the TestScript.ruleset. - * - * The TestScript.ruleset id value this assert will evaluate. - */ -public class TestScriptSetupActionAssertRuleset: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptSetupActionAssertRuleset" } - } - - /// Id of referenced rule within the ruleset. - public var rule: [TestScriptSetupActionAssertRulesetRule]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(rule: [TestScriptSetupActionAssertRulesetRule]) { - self.init(json: nil) - self.rule = rule - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["rule"] { - presentKeys.insert("rule") - if let val = exist as? [FHIRJSON] { - self.rule = TestScriptSetupActionAssertRulesetRule.instantiate(fromArray: val, owner: self) as? [TestScriptSetupActionAssertRulesetRule] + if let exist: AnyObject = js["resource"] { + presentKeys.insert("resource") + if let val = exist as? String { + self.resource = val } else { - errors.append(FHIRJSONError(key: "rule", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "resource", wants: String.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "rule")) + if let exist: AnyObject = js["response"] { + presentKeys.insert("response") + if let val = exist as? String { + self.response = val + } + else { + errors.append(FHIRJSONError(key: "response", wants: String.self, has: exist.dynamicType)) + } } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let rule = self.rule { - json["rule"] = TestScriptSetupActionAssertRulesetRule.asJSONArray(rule) - } - - return json - } -} - - -/** - * Id of referenced rule within the ruleset. - * - * Id of the referenced rule within the external ruleset template. - */ -public class TestScriptSetupActionAssertRulesetRule: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptSetupActionAssertRulesetRule" } - } - - /// Rule parameter template. - public var param: [TestScriptSetupActionAssertRulesetRuleParam]? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["param"] { - presentKeys.insert("param") - if let val = exist as? [FHIRJSON] { - self.param = TestScriptSetupActionAssertRulesetRuleParam.instantiate(fromArray: val, owner: self) as? [TestScriptSetupActionAssertRulesetRuleParam] + if let exist: AnyObject = js["responseCode"] { + presentKeys.insert("responseCode") + if let val = exist as? String { + self.responseCode = val } else { - errors.append(FHIRJSONError(key: "param", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "responseCode", wants: String.self, has: exist.dynamicType)) } } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let param = self.param { - json["param"] = TestScriptSetupActionAssertRulesetRuleParam.asJSONArray(param) - } - - return json - } -} - - -/** - * Rule parameter template. - * - * Each rule template can take one or more parameters for rule evaluation. - */ -public class TestScriptSetupActionAssertRulesetRuleParam: BackboneElement { - override public class var resourceName: String { - get { return "TestScriptSetupActionAssertRulesetRuleParam" } - } - - /// Parameter name matching external assert ruleset rule parameter. - public var name: String? - - /// Parameter value defined either explicitly or dynamically. - public var value: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(name: String, value: String) { - self.init(json: nil) - self.name = name - self.value = value - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["name"] { - presentKeys.insert("name") + if let exist: AnyObject = js["sourceId"] { + presentKeys.insert("sourceId") if let val = exist as? String { - self.name = val + self.sourceId = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sourceId", wants: String.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "name")) + if let exist: AnyObject = js["validateProfileId"] { + presentKeys.insert("validateProfileId") + if let val = exist as? String { + self.validateProfileId = val + } + else { + errors.append(FHIRJSONError(key: "validateProfileId", wants: String.self, has: exist.dynamicType)) + } } if let exist: AnyObject = js["value"] { presentKeys.insert("value") @@ -2081,8 +1147,14 @@ public class TestScriptSetupActionAssertRulesetRuleParam: BackboneElement { errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) } } - else { - errors.append(FHIRJSONError(key: "value")) + if let exist: AnyObject = js["warningOnly"] { + presentKeys.insert("warningOnly") + if let val = exist as? Bool { + self.warningOnly = val + } + else { + errors.append(FHIRJSONError(key: "warningOnly", wants: Bool.self, has: exist.dynamicType)) + } } } return errors.isEmpty ? nil : errors @@ -2091,12 +1163,60 @@ public class TestScriptSetupActionAssertRulesetRuleParam: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let name = self.name { - json["name"] = name.asJSON() + if let compareToSourceId = self.compareToSourceId { + json["compareToSourceId"] = compareToSourceId.asJSON() + } + if let compareToSourcePath = self.compareToSourcePath { + json["compareToSourcePath"] = compareToSourcePath.asJSON() + } + if let contentType = self.contentType { + json["contentType"] = contentType.asJSON() + } + if let description_fhir = self.description_fhir { + json["description"] = description_fhir.asJSON() + } + if let direction = self.direction { + json["direction"] = direction.asJSON() + } + if let headerField = self.headerField { + json["headerField"] = headerField.asJSON() + } + if let label = self.label { + json["label"] = label.asJSON() + } + if let minimumId = self.minimumId { + json["minimumId"] = minimumId.asJSON() + } + if let navigationLinks = self.navigationLinks { + json["navigationLinks"] = navigationLinks.asJSON() + } + if let operator_fhir = self.operator_fhir { + json["operator"] = operator_fhir.asJSON() + } + if let path = self.path { + json["path"] = path.asJSON() + } + if let resource = self.resource { + json["resource"] = resource.asJSON() + } + if let response = self.response { + json["response"] = response.asJSON() + } + if let responseCode = self.responseCode { + json["responseCode"] = responseCode.asJSON() + } + if let sourceId = self.sourceId { + json["sourceId"] = sourceId.asJSON() + } + if let validateProfileId = self.validateProfileId { + json["validateProfileId"] = validateProfileId.asJSON() } if let value = self.value { json["value"] = value.asJSON() } + if let warningOnly = self.warningOnly { + json["warningOnly"] = warningOnly.asJSON() + } return json } @@ -2122,7 +1242,7 @@ public class TestScriptSetupActionOperation: BackboneElement { /// Tracking/reporting operation description. public var description_fhir: String? - /// Server responding to the request. + /// Which server to perform the operation on. public var destination: Int? /// Whether or not to send the request url in encoded format. @@ -2131,9 +1251,6 @@ public class TestScriptSetupActionOperation: BackboneElement { /// Tracking/logging operation label. public var label: String? - /// Server initiating the request. - public var origin: Int? - /// Explicitly defined path parameters. public var params: String? @@ -2152,7 +1269,7 @@ public class TestScriptSetupActionOperation: BackboneElement { /// Id of fixture used for extracting the [id], [type], and [vid] for GET requests. public var targetId: String? - /// The operation code type that will be executed. + /// The setup operation type that will be executed. public var type: Coding? /// Request URL. @@ -2221,15 +1338,6 @@ public class TestScriptSetupActionOperation: BackboneElement { errors.append(FHIRJSONError(key: "label", wants: String.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["origin"] { - presentKeys.insert("origin") - if let val = exist as? Int { - self.origin = val - } - else { - errors.append(FHIRJSONError(key: "origin", wants: Int.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["params"] { presentKeys.insert("params") if let val = exist as? String { @@ -2327,9 +1435,6 @@ public class TestScriptSetupActionOperation: BackboneElement { if let label = self.label { json["label"] = label.asJSON() } - if let origin = self.origin { - json["origin"] = origin.asJSON() - } if let params = self.params { json["params"] = params.asJSON() } @@ -2709,9 +1814,6 @@ public class TestScriptVariable: BackboneElement { get { return "TestScriptVariable" } } - /// Default, hard-coded, or user-defined value for this variable. - public var defaultValue: String? - /// HTTP header field name for source. public var headerField: String? @@ -2739,15 +1841,6 @@ public class TestScriptVariable: BackboneElement { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["defaultValue"] { - presentKeys.insert("defaultValue") - if let val = exist as? String { - self.defaultValue = val - } - else { - errors.append(FHIRJSONError(key: "defaultValue", wants: String.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["headerField"] { presentKeys.insert("headerField") if let val = exist as? String { @@ -2794,9 +1887,6 @@ public class TestScriptVariable: BackboneElement { override public func asJSON() -> FHIRJSON { var json = super.asJSON() - if let defaultValue = self.defaultValue { - json["defaultValue"] = defaultValue.asJSON() - } if let headerField = self.headerField { json["headerField"] = headerField.asJSON() } diff --git a/Sources/Models/Timing.swift b/Sources/Models/Timing.swift index cb2d22e2..81c49f0d 100644 --- a/Sources/Models/Timing.swift +++ b/Sources/Models/Timing.swift @@ -2,7 +2,7 @@ // Timing.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/Timing) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Timing) on 2016-08-09. // 2016, SMART Health IT. // @@ -114,9 +114,6 @@ public class TimingRepeat: Element { /// Number of times to repeat. public var count: Int? - /// Maximum number of times to repeat. - public var countMax: Int? - /// How long when it happens. public var duration: NSDecimalNumber? @@ -124,7 +121,7 @@ public class TimingRepeat: Element { public var durationMax: NSDecimalNumber? /// s | min | h | d | wk | mo | a - unit of time (UCUM). - public var durationUnit: String? + public var durationUnits: String? /// Event occurs frequency times per period. public var frequency: Int? @@ -132,9 +129,6 @@ public class TimingRepeat: Element { /// Event occurs up to frequencyMax times per period. public var frequencyMax: Int? - /// Minutes from event (before or after). - public var offset: UInt? - /// Event occurs frequency times per period. public var period: NSDecimalNumber? @@ -142,7 +136,7 @@ public class TimingRepeat: Element { public var periodMax: NSDecimalNumber? /// s | min | h | d | wk | mo | a - unit of time (UCUM). - public var periodUnit: String? + public var periodUnits: String? /// Regular life events the event is tied to. public var when: String? @@ -192,15 +186,6 @@ public class TimingRepeat: Element { errors.append(FHIRJSONError(key: "count", wants: Int.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["countMax"] { - presentKeys.insert("countMax") - if let val = exist as? Int { - self.countMax = val - } - else { - errors.append(FHIRJSONError(key: "countMax", wants: Int.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["duration"] { presentKeys.insert("duration") if let val = exist as? NSNumber { @@ -219,13 +204,13 @@ public class TimingRepeat: Element { errors.append(FHIRJSONError(key: "durationMax", wants: NSNumber.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["durationUnit"] { - presentKeys.insert("durationUnit") + if let exist: AnyObject = js["durationUnits"] { + presentKeys.insert("durationUnits") if let val = exist as? String { - self.durationUnit = val + self.durationUnits = val } else { - errors.append(FHIRJSONError(key: "durationUnit", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "durationUnits", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["frequency"] { @@ -246,15 +231,6 @@ public class TimingRepeat: Element { errors.append(FHIRJSONError(key: "frequencyMax", wants: Int.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["offset"] { - presentKeys.insert("offset") - if let val = exist as? UInt { - self.offset = val - } - else { - errors.append(FHIRJSONError(key: "offset", wants: UInt.self, has: exist.dynamicType)) - } - } if let exist: AnyObject = js["period"] { presentKeys.insert("period") if let val = exist as? NSNumber { @@ -273,13 +249,13 @@ public class TimingRepeat: Element { errors.append(FHIRJSONError(key: "periodMax", wants: NSNumber.self, has: exist.dynamicType)) } } - if let exist: AnyObject = js["periodUnit"] { - presentKeys.insert("periodUnit") + if let exist: AnyObject = js["periodUnits"] { + presentKeys.insert("periodUnits") if let val = exist as? String { - self.periodUnit = val + self.periodUnits = val } else { - errors.append(FHIRJSONError(key: "periodUnit", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "periodUnits", wants: String.self, has: exist.dynamicType)) } } if let exist: AnyObject = js["when"] { @@ -310,17 +286,14 @@ public class TimingRepeat: Element { if let count = self.count { json["count"] = count.asJSON() } - if let countMax = self.countMax { - json["countMax"] = countMax.asJSON() - } if let duration = self.duration { json["duration"] = duration.asJSON() } if let durationMax = self.durationMax { json["durationMax"] = durationMax.asJSON() } - if let durationUnit = self.durationUnit { - json["durationUnit"] = durationUnit.asJSON() + if let durationUnits = self.durationUnits { + json["durationUnits"] = durationUnits.asJSON() } if let frequency = self.frequency { json["frequency"] = frequency.asJSON() @@ -328,17 +301,14 @@ public class TimingRepeat: Element { if let frequencyMax = self.frequencyMax { json["frequencyMax"] = frequencyMax.asJSON() } - if let offset = self.offset { - json["offset"] = offset.asJSON() - } if let period = self.period { json["period"] = period.asJSON() } if let periodMax = self.periodMax { json["periodMax"] = periodMax.asJSON() } - if let periodUnit = self.periodUnit { - json["periodUnit"] = periodUnit.asJSON() + if let periodUnits = self.periodUnits { + json["periodUnits"] = periodUnits.asJSON() } if let when = self.when { json["when"] = when.asJSON() diff --git a/Sources/Models/TriggerDefinition.swift b/Sources/Models/TriggerDefinition.swift deleted file mode 100644 index 51810445..00000000 --- a/Sources/Models/TriggerDefinition.swift +++ /dev/null @@ -1,156 +0,0 @@ -// -// TriggerDefinition.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/TriggerDefinition) on 2016-07-08. -// 2016, SMART Health IT. -// - -import Foundation - - -/** - * Defines an expected trigger for a module. - * - * A description of a triggering event. - */ -public class TriggerDefinition: Element { - override public class var resourceName: String { - get { return "TriggerDefinition" } - } - - /// Triggering data of the event. - public var eventData: DataRequirement? - - /// Name of the event. - public var eventName: String? - - /// Timing of the event. - public var eventTimingDate: FHIRDate? - - /// Timing of the event. - public var eventTimingDateTime: DateTime? - - /// Timing of the event. - public var eventTimingReference: Reference? - - /// Timing of the event. - public var eventTimingTiming: Timing? - - /// named-event | periodic | data-added | data-modified | data-removed | data-accessed | data-access-ended. - public var type: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(type: String) { - self.init(json: nil) - self.type = type - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["eventData"] { - presentKeys.insert("eventData") - if let val = exist as? FHIRJSON { - self.eventData = DataRequirement(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "eventData", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["eventName"] { - presentKeys.insert("eventName") - if let val = exist as? String { - self.eventName = val - } - else { - errors.append(FHIRJSONError(key: "eventName", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["eventTimingDate"] { - presentKeys.insert("eventTimingDate") - if let val = exist as? String { - self.eventTimingDate = FHIRDate(string: val) - } - else { - errors.append(FHIRJSONError(key: "eventTimingDate", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["eventTimingDateTime"] { - presentKeys.insert("eventTimingDateTime") - if let val = exist as? String { - self.eventTimingDateTime = DateTime(string: val) - } - else { - errors.append(FHIRJSONError(key: "eventTimingDateTime", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["eventTimingReference"] { - presentKeys.insert("eventTimingReference") - if let val = exist as? FHIRJSON { - self.eventTimingReference = Reference(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "eventTimingReference", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["eventTimingTiming"] { - presentKeys.insert("eventTimingTiming") - if let val = exist as? FHIRJSON { - self.eventTimingTiming = Timing(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "eventTimingTiming", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["type"] { - presentKeys.insert("type") - if let val = exist as? String { - self.type = val - } - else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "type")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let eventData = self.eventData { - json["eventData"] = eventData.asJSON() - } - if let eventName = self.eventName { - json["eventName"] = eventName.asJSON() - } - if let eventTimingDate = self.eventTimingDate { - json["eventTimingDate"] = eventTimingDate.asJSON() - } - if let eventTimingDateTime = self.eventTimingDateTime { - json["eventTimingDateTime"] = eventTimingDateTime.asJSON() - } - if let eventTimingReference = self.eventTimingReference { - json["eventTimingReference"] = eventTimingReference.asJSON() - } - if let eventTimingTiming = self.eventTimingTiming { - json["eventTimingTiming"] = eventTimingTiming.asJSON() - } - if let type = self.type { - json["type"] = type.asJSON() - } - - return json - } -} - diff --git a/Sources/Models/ValueSet.swift b/Sources/Models/ValueSet.swift index 9c6354cd..8b79ddf1 100644 --- a/Sources/Models/ValueSet.swift +++ b/Sources/Models/ValueSet.swift @@ -2,7 +2,7 @@ // ValueSet.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2016-07-08. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2016-08-09. // 2016, SMART Health IT. // @@ -19,6 +19,9 @@ public class ValueSet: DomainResource { get { return "ValueSet" } } + /// An inline code system, which is part of this value set. + public var codeSystem: ValueSetCodeSystem? + /// When value set includes codes from elsewhere. public var compose: ValueSetCompose? @@ -88,6 +91,15 @@ public class ValueSet: DomainResource { public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { + if let exist: AnyObject = js["codeSystem"] { + presentKeys.insert("codeSystem") + if let val = exist as? FHIRJSON { + self.codeSystem = ValueSetCodeSystem(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "codeSystem", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } if let exist: AnyObject = js["compose"] { presentKeys.insert("compose") if let val = exist as? FHIRJSON { @@ -260,6 +272,9 @@ public class ValueSet: DomainResource { override public func asJSON() -> FHIRJSON { var json = super.asJSON() + if let codeSystem = self.codeSystem { + json["codeSystem"] = codeSystem.asJSON() + } if let compose = self.compose { json["compose"] = compose.asJSON() } @@ -320,6 +335,331 @@ public class ValueSet: DomainResource { } +/** + * An inline code system, which is part of this value set. + * + * A definition of a code system, inlined into the value set (as a packaging convenience). Note that the inline code + * system may be used from other value sets by referring to its (codeSystem.system) directly. + */ +public class ValueSetCodeSystem: BackboneElement { + override public class var resourceName: String { + get { return "ValueSetCodeSystem" } + } + + /// If code comparison is case sensitive. + public var caseSensitive: Bool? + + /// Concepts in the code system. + public var concept: [ValueSetCodeSystemConcept]? + + /// URI to identify the code system (e.g. in Coding.system). + public var system: URL? + + /// Version (for use in Coding.version). + public var version: String? + + + /** Initialize with a JSON object. */ + public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { + super.init(json: json, owner: owner) + } + + /** Convenience initializer, taking all required properties as arguments. */ + public convenience init(concept: [ValueSetCodeSystemConcept], system: URL) { + self.init(json: nil) + self.concept = concept + self.system = system + } + + public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + if let js = json { + if let exist: AnyObject = js["caseSensitive"] { + presentKeys.insert("caseSensitive") + if let val = exist as? Bool { + self.caseSensitive = val + } + else { + errors.append(FHIRJSONError(key: "caseSensitive", wants: Bool.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["concept"] { + presentKeys.insert("concept") + if let val = exist as? [FHIRJSON] { + self.concept = ValueSetCodeSystemConcept.instantiate(fromArray: val, owner: self) as? [ValueSetCodeSystemConcept] + } + else { + errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "concept")) + } + if let exist: AnyObject = js["system"] { + presentKeys.insert("system") + if let val = exist as? String { + self.system = URL(string: val) + } + else { + errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "system")) + } + if let exist: AnyObject = js["version"] { + presentKeys.insert("version") + if let val = exist as? String { + self.version = val + } + else { + errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + } + } + } + return errors.isEmpty ? nil : errors + } + + override public func asJSON() -> FHIRJSON { + var json = super.asJSON() + + if let caseSensitive = self.caseSensitive { + json["caseSensitive"] = caseSensitive.asJSON() + } + if let concept = self.concept { + json["concept"] = ValueSetCodeSystemConcept.asJSONArray(concept) + } + if let system = self.system { + json["system"] = system.asJSON() + } + if let version = self.version { + json["version"] = version.asJSON() + } + + return json + } +} + + +/** + * 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. + */ +public class ValueSetCodeSystemConcept: BackboneElement { + override public class var resourceName: String { + get { return "ValueSetCodeSystemConcept" } + } + + /// If this code is not for use as a real concept. + public var abstract: Bool? + + /// Code that identifies concept. + public var code: String? + + /// Child Concepts (is-a/contains/categorizes). + public var concept: [ValueSetCodeSystemConcept]? + + /// Formal definition. + public var definition: String? + + /// Additional representations for the concept. + public var designation: [ValueSetCodeSystemConceptDesignation]? + + /// Text to display to the user. + public var display: String? + + + /** Initialize with a JSON object. */ + public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { + super.init(json: json, owner: owner) + } + + /** Convenience initializer, taking all required properties as arguments. */ + public convenience init(code: String) { + self.init(json: nil) + self.code = code + } + + public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + if let js = json { + if let exist: AnyObject = js["abstract"] { + presentKeys.insert("abstract") + if let val = exist as? Bool { + self.abstract = val + } + else { + errors.append(FHIRJSONError(key: "abstract", wants: Bool.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["code"] { + presentKeys.insert("code") + if let val = exist as? String { + self.code = val + } + else { + errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "code")) + } + if let exist: AnyObject = js["concept"] { + presentKeys.insert("concept") + if let val = exist as? [FHIRJSON] { + self.concept = ValueSetCodeSystemConcept.instantiate(fromArray: val, owner: self) as? [ValueSetCodeSystemConcept] + } + else { + errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["definition"] { + presentKeys.insert("definition") + if let val = exist as? String { + self.definition = val + } + else { + errors.append(FHIRJSONError(key: "definition", wants: String.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["designation"] { + presentKeys.insert("designation") + if let val = exist as? [FHIRJSON] { + self.designation = ValueSetCodeSystemConceptDesignation.instantiate(fromArray: val, owner: self) as? [ValueSetCodeSystemConceptDesignation] + } + else { + errors.append(FHIRJSONError(key: "designation", wants: Array.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["display"] { + presentKeys.insert("display") + if let val = exist as? String { + self.display = val + } + else { + errors.append(FHIRJSONError(key: "display", wants: String.self, has: exist.dynamicType)) + } + } + } + return errors.isEmpty ? nil : errors + } + + override public func asJSON() -> FHIRJSON { + var json = super.asJSON() + + if let abstract = self.abstract { + json["abstract"] = abstract.asJSON() + } + if let code = self.code { + json["code"] = code.asJSON() + } + if let concept = self.concept { + json["concept"] = ValueSetCodeSystemConcept.asJSONArray(concept) + } + if let definition = self.definition { + json["definition"] = definition.asJSON() + } + if let designation = self.designation { + json["designation"] = ValueSetCodeSystemConceptDesignation.asJSONArray(designation) + } + if let display = self.display { + json["display"] = display.asJSON() + } + + return json + } +} + + +/** + * Additional representations for the concept. + * + * Additional representations for the concept - other languages, aliases, specialized purposes, used for particular + * purposes, etc. + */ +public class ValueSetCodeSystemConceptDesignation: BackboneElement { + override public class var resourceName: String { + get { return "ValueSetCodeSystemConceptDesignation" } + } + + /// Human language of the designation. + public var language: String? + + /// Details how this designation would be used. + public var use: Coding? + + /// The text value for this designation. + public var value: String? + + + /** Initialize with a JSON object. */ + public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { + super.init(json: json, owner: owner) + } + + /** Convenience initializer, taking all required properties as arguments. */ + public convenience init(value: String) { + self.init(json: nil) + self.value = value + } + + public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + if let js = json { + if let exist: AnyObject = js["language"] { + presentKeys.insert("language") + if let val = exist as? String { + self.language = val + } + else { + errors.append(FHIRJSONError(key: "language", wants: String.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["use"] { + presentKeys.insert("use") + if let val = exist as? FHIRJSON { + self.use = Coding(json: val, owner: self) + } + else { + errors.append(FHIRJSONError(key: "use", wants: FHIRJSON.self, has: exist.dynamicType)) + } + } + if let exist: AnyObject = js["value"] { + presentKeys.insert("value") + if let val = exist as? String { + self.value = val + } + else { + errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + } + } + else { + errors.append(FHIRJSONError(key: "value")) + } + } + return errors.isEmpty ? nil : errors + } + + override public func asJSON() -> FHIRJSON { + var json = super.asJSON() + + if let language = self.language { + json["language"] = language.asJSON() + } + if let use = self.use { + json["use"] = use.asJSON() + } + if let value = self.value { + json["value"] = value.asJSON() + } + + return json + } +} + + /** * When value set includes codes from elsewhere. * @@ -515,7 +855,7 @@ public class ValueSetComposeIncludeConcept: BackboneElement { public var code: String? /// Additional representations for this valueset. - public var designation: [ValueSetComposeIncludeConceptDesignation]? + public var designation: [ValueSetCodeSystemConceptDesignation]? /// Test to display for this code for this value set. public var display: String? @@ -550,7 +890,7 @@ public class ValueSetComposeIncludeConcept: BackboneElement { if let exist: AnyObject = js["designation"] { presentKeys.insert("designation") if let val = exist as? [FHIRJSON] { - self.designation = ValueSetComposeIncludeConceptDesignation.instantiate(fromArray: val, owner: self) as? [ValueSetComposeIncludeConceptDesignation] + self.designation = ValueSetCodeSystemConceptDesignation.instantiate(fromArray: val, owner: self) as? [ValueSetCodeSystemConceptDesignation] } else { errors.append(FHIRJSONError(key: "designation", wants: Array.self, has: exist.dynamicType)) @@ -576,7 +916,7 @@ public class ValueSetComposeIncludeConcept: BackboneElement { json["code"] = code.asJSON() } if let designation = self.designation { - json["designation"] = ValueSetComposeIncludeConceptDesignation.asJSONArray(designation) + json["designation"] = ValueSetCodeSystemConceptDesignation.asJSONArray(designation) } if let display = self.display { json["display"] = display.asJSON() @@ -587,93 +927,6 @@ public class ValueSetComposeIncludeConcept: BackboneElement { } -/** - * Additional representations for this valueset. - * - * Additional representations for this concept when used in this value set - other languages, aliases, specialized - * purposes, used for particular purposes, etc. - */ -public class ValueSetComposeIncludeConceptDesignation: BackboneElement { - override public class var resourceName: String { - get { return "ValueSetComposeIncludeConceptDesignation" } - } - - /// Human language of the designation. - public var language: String? - - /// Details how this designation would be used. - public var use: Coding? - - /// The text value for this designation. - public var value: String? - - - /** Initialize with a JSON object. */ - public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { - super.init(json: json, owner: owner) - } - - /** Convenience initializer, taking all required properties as arguments. */ - public convenience init(value: String) { - self.init(json: nil) - self.value = value - } - - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() - if let js = json { - if let exist: AnyObject = js["language"] { - presentKeys.insert("language") - if let val = exist as? String { - self.language = val - } - else { - errors.append(FHIRJSONError(key: "language", wants: String.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["use"] { - presentKeys.insert("use") - if let val = exist as? FHIRJSON { - self.use = Coding(json: val, owner: self) - } - else { - errors.append(FHIRJSONError(key: "use", wants: FHIRJSON.self, has: exist.dynamicType)) - } - } - if let exist: AnyObject = js["value"] { - presentKeys.insert("value") - if let val = exist as? String { - self.value = val - } - else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) - } - } - else { - errors.append(FHIRJSONError(key: "value")) - } - } - return errors.isEmpty ? nil : errors - } - - override public func asJSON() -> FHIRJSON { - var json = super.asJSON() - - if let language = self.language { - json["language"] = language.asJSON() - } - if let use = self.use { - json["use"] = use.asJSON() - } - if let value = self.value { - json["value"] = value.asJSON() - } - - return json - } -} - - /** * Select codes/concepts by their properties (including relationships). * diff --git a/Sources/Models/VisionPrescription.swift b/Sources/Models/VisionPrescription.swift index 12da032e..37aa5565 100644 --- a/Sources/Models/VisionPrescription.swift +++ b/Sources/Models/VisionPrescription.swift @@ -2,7 +2,7 @@ // VisionPrescription.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 (http://hl7.org/fhir/StructureDefinition/VisionPrescription) on 2016-07-07. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/VisionPrescription) on 2016-08-09. // 2016, SMART Health IT. // diff --git a/SwiftFHIR.xcodeproj/project.pbxproj b/SwiftFHIR.xcodeproj/project.pbxproj index 9474ef99..e04e4bdb 100644 --- a/SwiftFHIR.xcodeproj/project.pbxproj +++ b/SwiftFHIR.xcodeproj/project.pbxproj @@ -439,89 +439,7 @@ EE39069F1CD3E4F6008FECEA /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE39069E1CD3E4F6008FECEA /* RequestTests.swift */; }; EE3906A01CD3E4F6008FECEA /* RequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE39069E1CD3E4F6008FECEA /* RequestTests.swift */; }; EE545F3B1A66805600E17B0C /* SwiftFHIR.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE684C1E19A789BA00B5A2C0 /* SwiftFHIR.framework */; }; - EE65DB481CB39FE100E25C72 /* CareTeamTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E11CB39D0900ADFF94 /* CareTeamTests.swift */; }; - EE65DB491CB39FE100E25C72 /* CodeSystemTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E21CB39D0900ADFF94 /* CodeSystemTests.swift */; }; - EE65DB4A1CB39FE100E25C72 /* DecisionSupportRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E31CB39D0900ADFF94 /* DecisionSupportRuleTests.swift */; }; - EE65DB4B1CB39FE100E25C72 /* DecisionSupportServiceModuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E41CB39D0900ADFF94 /* DecisionSupportServiceModuleTests.swift */; }; - EE65DB4C1CB39FE100E25C72 /* ExpansionProfileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E51CB39D0900ADFF94 /* ExpansionProfileTests.swift */; }; - EE65DB4D1CB39FE100E25C72 /* GuidanceResponseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E61CB39D0900ADFF94 /* GuidanceResponseTests.swift */; }; - EE65DB4E1CB39FE100E25C72 /* ImagingExcerptTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E71CB39D0900ADFF94 /* ImagingExcerptTests.swift */; }; - EE65DB4F1CB39FE100E25C72 /* LibraryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E81CB39D0900ADFF94 /* LibraryTests.swift */; }; - EE65DB501CB39FE100E25C72 /* LinkageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E91CB39D0900ADFF94 /* LinkageTests.swift */; }; - EE65DB511CB39FE100E25C72 /* MeasureReportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88EA1CB39D0900ADFF94 /* MeasureReportTests.swift */; }; - EE65DB521CB39FE100E25C72 /* ModuleDefinitionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88EB1CB39D0900ADFF94 /* ModuleDefinitionTests.swift */; }; - EE65DB531CB39FE100E25C72 /* OrderSetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88EC1CB39D0900ADFF94 /* OrderSetTests.swift */; }; - EE65DB541CB39FE100E25C72 /* PractitionerRoleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88ED1CB39D0900ADFF94 /* PractitionerRoleTests.swift */; }; - EE65DB561CB39FE100E25C72 /* SequenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88EF1CB39D0900ADFF94 /* SequenceTests.swift */; }; - EE65DB571CB39FE100E25C72 /* StructureMapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88F01CB39D0900ADFF94 /* StructureMapTests.swift */; }; - EE65DB581CB39FE100E25C72 /* TaskTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88F11CB39D0900ADFF94 /* TaskTests.swift */; }; - EE65DB591CB39FE200E25C72 /* CareTeamTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E11CB39D0900ADFF94 /* CareTeamTests.swift */; }; - EE65DB5A1CB39FE200E25C72 /* CodeSystemTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E21CB39D0900ADFF94 /* CodeSystemTests.swift */; }; - EE65DB5B1CB39FE200E25C72 /* DecisionSupportRuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E31CB39D0900ADFF94 /* DecisionSupportRuleTests.swift */; }; - EE65DB5C1CB39FE200E25C72 /* DecisionSupportServiceModuleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E41CB39D0900ADFF94 /* DecisionSupportServiceModuleTests.swift */; }; - EE65DB5D1CB39FE200E25C72 /* ExpansionProfileTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E51CB39D0900ADFF94 /* ExpansionProfileTests.swift */; }; - EE65DB5E1CB39FE200E25C72 /* GuidanceResponseTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E61CB39D0900ADFF94 /* GuidanceResponseTests.swift */; }; - EE65DB5F1CB39FE200E25C72 /* ImagingExcerptTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E71CB39D0900ADFF94 /* ImagingExcerptTests.swift */; }; - EE65DB601CB39FE200E25C72 /* LibraryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E81CB39D0900ADFF94 /* LibraryTests.swift */; }; - EE65DB611CB39FE200E25C72 /* LinkageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88E91CB39D0900ADFF94 /* LinkageTests.swift */; }; - EE65DB621CB39FE200E25C72 /* MeasureReportTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88EA1CB39D0900ADFF94 /* MeasureReportTests.swift */; }; - EE65DB631CB39FE200E25C72 /* ModuleDefinitionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88EB1CB39D0900ADFF94 /* ModuleDefinitionTests.swift */; }; - EE65DB641CB39FE200E25C72 /* OrderSetTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88EC1CB39D0900ADFF94 /* OrderSetTests.swift */; }; - EE65DB651CB39FE200E25C72 /* PractitionerRoleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88ED1CB39D0900ADFF94 /* PractitionerRoleTests.swift */; }; - EE65DB671CB39FE200E25C72 /* SequenceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88EF1CB39D0900ADFF94 /* SequenceTests.swift */; }; - EE65DB681CB39FE200E25C72 /* StructureMapTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88F01CB39D0900ADFF94 /* StructureMapTests.swift */; }; - EE65DB691CB39FE200E25C72 /* TaskTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88F11CB39D0900ADFF94 /* TaskTests.swift */; }; - EE65DB6A1CB39FFD00E25C72 /* ActionDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B11CB39A6A00ADFF94 /* ActionDefinition.swift */; }; - EE65DB6B1CB39FFD00E25C72 /* CareTeam.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B21CB39A6A00ADFF94 /* CareTeam.swift */; }; - EE65DB6C1CB39FFD00E25C72 /* CodeSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B31CB39A6A00ADFF94 /* CodeSystem.swift */; }; - EE65DB6D1CB39FFD00E25C72 /* CompartmentDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B41CB39A6A00ADFF94 /* CompartmentDefinition.swift */; }; - EE65DB6E1CB39FFD00E25C72 /* DataRequirement.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B51CB39A6A00ADFF94 /* DataRequirement.swift */; }; - EE65DB6F1CB39FFD00E25C72 /* DecisionSupportRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B61CB39A6A00ADFF94 /* DecisionSupportRule.swift */; }; - EE65DB701CB39FFD00E25C72 /* DecisionSupportServiceModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B71CB39A6A00ADFF94 /* DecisionSupportServiceModule.swift */; }; - EE65DB711CB39FFD00E25C72 /* ExpansionProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B81CB39A6A00ADFF94 /* ExpansionProfile.swift */; }; - EE65DB721CB39FFD00E25C72 /* GuidanceResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B91CB39A6A00ADFF94 /* GuidanceResponse.swift */; }; - EE65DB731CB39FFD00E25C72 /* ImagingExcerpt.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BA1CB39A6A00ADFF94 /* ImagingExcerpt.swift */; }; - EE65DB741CB39FFD00E25C72 /* Library.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BB1CB39A6A00ADFF94 /* Library.swift */; }; - EE65DB751CB39FFD00E25C72 /* Linkage.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BC1CB39A6A00ADFF94 /* Linkage.swift */; }; - EE65DB761CB39FFD00E25C72 /* Measure.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BD1CB39A6A00ADFF94 /* Measure.swift */; }; - EE65DB771CB39FFD00E25C72 /* MeasureReport.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BE1CB39A6A00ADFF94 /* MeasureReport.swift */; }; - EE65DB781CB39FFD00E25C72 /* ModuleDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BF1CB39A6A00ADFF94 /* ModuleDefinition.swift */; }; - EE65DB791CB39FFD00E25C72 /* ModuleMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C01CB39A6A00ADFF94 /* ModuleMetadata.swift */; }; - EE65DB7A1CB39FFD00E25C72 /* OrderSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C11CB39A6A00ADFF94 /* OrderSet.swift */; }; - EE65DB7B1CB39FFD00E25C72 /* ParameterDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C21CB39A6A00ADFF94 /* ParameterDefinition.swift */; }; - EE65DB7C1CB39FFD00E25C72 /* PractitionerRole.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C31CB39A6A00ADFF94 /* PractitionerRole.swift */; }; - EE65DB7D1CB39FFD00E25C72 /* ProtocolFHIR.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C41CB39A6A00ADFF94 /* ProtocolFHIR.swift */; }; - EE65DB7E1CB39FFD00E25C72 /* Sequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C51CB39A6A00ADFF94 /* Sequence.swift */; }; - EE65DB7F1CB39FFD00E25C72 /* StructureMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C61CB39A6A00ADFF94 /* StructureMap.swift */; }; - EE65DB801CB39FFD00E25C72 /* Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C71CB39A6A00ADFF94 /* Task.swift */; }; - EE65DB811CB39FFD00E25C72 /* TriggerDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C81CB39A6A00ADFF94 /* TriggerDefinition.swift */; }; EE684CCF19A7CEF000B5A2C0 /* ExtensionsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE684CCE19A7CEF000B5A2C0 /* ExtensionsTest.swift */; }; - EE6940291D2EAA4B00D6DCA1 /* ProtocolFHIRTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88EE1CB39D0900ADFF94 /* ProtocolFHIRTests.swift */; }; - EE69402A1D2EAA4C00D6DCA1 /* ProtocolFHIRTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88EE1CB39D0900ADFF94 /* ProtocolFHIRTests.swift */; }; - EE6C88C91CB39A6A00ADFF94 /* ActionDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B11CB39A6A00ADFF94 /* ActionDefinition.swift */; }; - EE6C88CA1CB39A6A00ADFF94 /* CareTeam.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B21CB39A6A00ADFF94 /* CareTeam.swift */; }; - EE6C88CB1CB39A6A00ADFF94 /* CodeSystem.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B31CB39A6A00ADFF94 /* CodeSystem.swift */; }; - EE6C88CC1CB39A6A00ADFF94 /* CompartmentDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B41CB39A6A00ADFF94 /* CompartmentDefinition.swift */; }; - EE6C88CD1CB39A6A00ADFF94 /* DataRequirement.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B51CB39A6A00ADFF94 /* DataRequirement.swift */; }; - EE6C88CE1CB39A6A00ADFF94 /* DecisionSupportRule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B61CB39A6A00ADFF94 /* DecisionSupportRule.swift */; }; - EE6C88CF1CB39A6A00ADFF94 /* DecisionSupportServiceModule.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B71CB39A6A00ADFF94 /* DecisionSupportServiceModule.swift */; }; - EE6C88D01CB39A6A00ADFF94 /* ExpansionProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B81CB39A6A00ADFF94 /* ExpansionProfile.swift */; }; - EE6C88D11CB39A6A00ADFF94 /* GuidanceResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88B91CB39A6A00ADFF94 /* GuidanceResponse.swift */; }; - EE6C88D21CB39A6A00ADFF94 /* ImagingExcerpt.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BA1CB39A6A00ADFF94 /* ImagingExcerpt.swift */; }; - EE6C88D31CB39A6A00ADFF94 /* Library.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BB1CB39A6A00ADFF94 /* Library.swift */; }; - EE6C88D41CB39A6A00ADFF94 /* Linkage.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BC1CB39A6A00ADFF94 /* Linkage.swift */; }; - EE6C88D51CB39A6A00ADFF94 /* Measure.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BD1CB39A6A00ADFF94 /* Measure.swift */; }; - EE6C88D61CB39A6A00ADFF94 /* MeasureReport.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BE1CB39A6A00ADFF94 /* MeasureReport.swift */; }; - EE6C88D71CB39A6A00ADFF94 /* ModuleDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88BF1CB39A6A00ADFF94 /* ModuleDefinition.swift */; }; - EE6C88D81CB39A6A00ADFF94 /* ModuleMetadata.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C01CB39A6A00ADFF94 /* ModuleMetadata.swift */; }; - EE6C88D91CB39A6A00ADFF94 /* OrderSet.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C11CB39A6A00ADFF94 /* OrderSet.swift */; }; - EE6C88DA1CB39A6A00ADFF94 /* ParameterDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C21CB39A6A00ADFF94 /* ParameterDefinition.swift */; }; - EE6C88DB1CB39A6A00ADFF94 /* PractitionerRole.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C31CB39A6A00ADFF94 /* PractitionerRole.swift */; }; - EE6C88DC1CB39A6A00ADFF94 /* ProtocolFHIR.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C41CB39A6A00ADFF94 /* ProtocolFHIR.swift */; }; - EE6C88DD1CB39A6A00ADFF94 /* Sequence.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C51CB39A6A00ADFF94 /* Sequence.swift */; }; - EE6C88DE1CB39A6A00ADFF94 /* StructureMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C61CB39A6A00ADFF94 /* StructureMap.swift */; }; - EE6C88DF1CB39A6A00ADFF94 /* Task.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C71CB39A6A00ADFF94 /* Task.swift */; }; - EE6C88E01CB39A6A00ADFF94 /* TriggerDefinition.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE6C88C81CB39A6A00ADFF94 /* TriggerDefinition.swift */; }; EE6DA8631A5D4B3A00E00708 /* SwiftFHIR.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE6DA8571A5D4B1000E00708 /* SwiftFHIR.framework */; }; EE8901231B7E07D700F1EDBF /* Element+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8901221B7E07D700F1EDBF /* Element+Extensions.swift */; }; EE8901241B7E07D700F1EDBF /* Element+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8901221B7E07D700F1EDBF /* Element+Extensions.swift */; }; @@ -815,47 +733,6 @@ EE684C2919A789BA00B5A2C0 /* SwiftFHIRTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftFHIRTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; EE684C2C19A789BA00B5A2C0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; EE684CCE19A7CEF000B5A2C0 /* ExtensionsTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtensionsTest.swift; sourceTree = ""; }; - EE6C88B11CB39A6A00ADFF94 /* ActionDefinition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionDefinition.swift; sourceTree = ""; }; - EE6C88B21CB39A6A00ADFF94 /* CareTeam.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CareTeam.swift; sourceTree = ""; }; - EE6C88B31CB39A6A00ADFF94 /* CodeSystem.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeSystem.swift; sourceTree = ""; }; - EE6C88B41CB39A6A00ADFF94 /* CompartmentDefinition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompartmentDefinition.swift; sourceTree = ""; }; - EE6C88B51CB39A6A00ADFF94 /* DataRequirement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataRequirement.swift; sourceTree = ""; }; - EE6C88B61CB39A6A00ADFF94 /* DecisionSupportRule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecisionSupportRule.swift; sourceTree = ""; }; - EE6C88B71CB39A6A00ADFF94 /* DecisionSupportServiceModule.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecisionSupportServiceModule.swift; sourceTree = ""; }; - EE6C88B81CB39A6A00ADFF94 /* ExpansionProfile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExpansionProfile.swift; sourceTree = ""; }; - EE6C88B91CB39A6A00ADFF94 /* GuidanceResponse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GuidanceResponse.swift; sourceTree = ""; }; - EE6C88BA1CB39A6A00ADFF94 /* ImagingExcerpt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImagingExcerpt.swift; sourceTree = ""; }; - EE6C88BB1CB39A6A00ADFF94 /* Library.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Library.swift; sourceTree = ""; }; - EE6C88BC1CB39A6A00ADFF94 /* Linkage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Linkage.swift; sourceTree = ""; }; - EE6C88BD1CB39A6A00ADFF94 /* Measure.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Measure.swift; sourceTree = ""; }; - EE6C88BE1CB39A6A00ADFF94 /* MeasureReport.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeasureReport.swift; sourceTree = ""; }; - EE6C88BF1CB39A6A00ADFF94 /* ModuleDefinition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModuleDefinition.swift; sourceTree = ""; }; - EE6C88C01CB39A6A00ADFF94 /* ModuleMetadata.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModuleMetadata.swift; sourceTree = ""; }; - EE6C88C11CB39A6A00ADFF94 /* OrderSet.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderSet.swift; sourceTree = ""; }; - EE6C88C21CB39A6A00ADFF94 /* ParameterDefinition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ParameterDefinition.swift; sourceTree = ""; }; - EE6C88C31CB39A6A00ADFF94 /* PractitionerRole.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PractitionerRole.swift; sourceTree = ""; }; - EE6C88C41CB39A6A00ADFF94 /* ProtocolFHIR.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProtocolFHIR.swift; sourceTree = ""; }; - EE6C88C51CB39A6A00ADFF94 /* Sequence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Sequence.swift; sourceTree = ""; }; - EE6C88C61CB39A6A00ADFF94 /* StructureMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StructureMap.swift; sourceTree = ""; }; - EE6C88C71CB39A6A00ADFF94 /* Task.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Task.swift; sourceTree = ""; }; - EE6C88C81CB39A6A00ADFF94 /* TriggerDefinition.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TriggerDefinition.swift; sourceTree = ""; }; - EE6C88E11CB39D0900ADFF94 /* CareTeamTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CareTeamTests.swift; sourceTree = ""; }; - EE6C88E21CB39D0900ADFF94 /* CodeSystemTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CodeSystemTests.swift; sourceTree = ""; }; - EE6C88E31CB39D0900ADFF94 /* DecisionSupportRuleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecisionSupportRuleTests.swift; sourceTree = ""; }; - EE6C88E41CB39D0900ADFF94 /* DecisionSupportServiceModuleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DecisionSupportServiceModuleTests.swift; sourceTree = ""; }; - EE6C88E51CB39D0900ADFF94 /* ExpansionProfileTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExpansionProfileTests.swift; sourceTree = ""; }; - EE6C88E61CB39D0900ADFF94 /* GuidanceResponseTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GuidanceResponseTests.swift; sourceTree = ""; }; - EE6C88E71CB39D0900ADFF94 /* ImagingExcerptTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ImagingExcerptTests.swift; sourceTree = ""; }; - EE6C88E81CB39D0900ADFF94 /* LibraryTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LibraryTests.swift; sourceTree = ""; }; - EE6C88E91CB39D0900ADFF94 /* LinkageTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LinkageTests.swift; sourceTree = ""; }; - EE6C88EA1CB39D0900ADFF94 /* MeasureReportTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MeasureReportTests.swift; sourceTree = ""; }; - EE6C88EB1CB39D0900ADFF94 /* ModuleDefinitionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ModuleDefinitionTests.swift; sourceTree = ""; }; - EE6C88EC1CB39D0900ADFF94 /* OrderSetTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OrderSetTests.swift; sourceTree = ""; }; - EE6C88ED1CB39D0900ADFF94 /* PractitionerRoleTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PractitionerRoleTests.swift; sourceTree = ""; }; - EE6C88EE1CB39D0900ADFF94 /* ProtocolFHIRTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProtocolFHIRTests.swift; sourceTree = ""; }; - EE6C88EF1CB39D0900ADFF94 /* SequenceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SequenceTests.swift; sourceTree = ""; }; - EE6C88F01CB39D0900ADFF94 /* StructureMapTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StructureMapTests.swift; sourceTree = ""; }; - EE6C88F11CB39D0900ADFF94 /* TaskTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TaskTests.swift; sourceTree = ""; }; EE6DA8571A5D4B1000E00708 /* SwiftFHIR.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftFHIR.framework; sourceTree = BUILT_PRODUCTS_DIR; }; EE6DA85D1A5D4B3A00E00708 /* SwiftFHIRiOSTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SwiftFHIRiOSTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; EE8901221B7E07D700F1EDBF /* Element+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Element+Extensions.swift"; sourceTree = ""; }; @@ -978,7 +855,6 @@ isa = PBXGroup; children = ( EEEE30E01BB1FD94008866E2 /* Account.swift */, - EE6C88B11CB39A6A00ADFF94 /* ActionDefinition.swift */, EE02F5911ACF252000179969 /* Address.swift */, EE02F5921ACF252000179969 /* Age.swift */, EE02F5931ACF252000179969 /* AllergyIntolerance.swift */, @@ -993,16 +869,13 @@ EE02F59A1ACF252000179969 /* BodySite.swift */, EE02F59B1ACF252000179969 /* Bundle.swift */, EE02F59C1ACF252000179969 /* CarePlan.swift */, - EE6C88B21CB39A6A00ADFF94 /* CareTeam.swift */, EE02F59D1ACF252000179969 /* Claim.swift */, EE02F59E1ACF252000179969 /* ClaimResponse.swift */, EE02F59F1ACF252000179969 /* ClinicalImpression.swift */, EE02F5A01ACF252000179969 /* CodeableConcept.swift */, - EE6C88B31CB39A6A00ADFF94 /* CodeSystem.swift */, EE02F5A11ACF252000179969 /* Coding.swift */, EE02F5A21ACF252000179969 /* Communication.swift */, EE02F5A31ACF252000179969 /* CommunicationRequest.swift */, - EE6C88B41CB39A6A00ADFF94 /* CompartmentDefinition.swift */, EE02F5A41ACF252000179969 /* Composition.swift */, EE02F5A51ACF252000179969 /* ConceptMap.swift */, EE02F5A61ACF252000179969 /* Condition.swift */, @@ -1012,10 +885,7 @@ EE02F5AB1ACF252000179969 /* Count.swift */, EE02F5AC1ACF252000179969 /* Coverage.swift */, EE02F5AD1ACF252000179969 /* DataElement.swift */, - EE6C88B51CB39A6A00ADFF94 /* DataRequirement.swift */, EE1310B01C1B435300D9DAE7 /* DateAndTime.swift */, - EE6C88B61CB39A6A00ADFF94 /* DecisionSupportRule.swift */, - EE6C88B71CB39A6A00ADFF94 /* DecisionSupportServiceModule.swift */, EEEE30E21BB1FD94008866E2 /* DetectedIssue.swift */, EE02F5AE1ACF252000179969 /* Device.swift */, EE02F5AF1ACF252000179969 /* DeviceComponent.swift */, @@ -1037,7 +907,6 @@ EE02F5BE1ACF252000179969 /* EnrollmentRequest.swift */, EE02F5BF1ACF252000179969 /* EnrollmentResponse.swift */, EE02F5C01ACF252000179969 /* EpisodeOfCare.swift */, - EE6C88B81CB39A6A00ADFF94 /* ExpansionProfile.swift */, EE02F5C11ACF252000179969 /* ExplanationOfBenefit.swift */, EE02F5C21ACF252000179969 /* Extension.swift */, EE02F5C31ACF252000179969 /* FamilyMemberHistory.swift */, @@ -1051,23 +920,17 @@ EE02F5C41ACF252000179969 /* Flag.swift */, EE02F5C51ACF252000179969 /* Goal.swift */, EE02F5C61ACF252000179969 /* Group.swift */, - EE6C88B91CB39A6A00ADFF94 /* GuidanceResponse.swift */, EE02F5C71ACF252000179969 /* HealthcareService.swift */, EE02F5C81ACF252000179969 /* HumanName.swift */, EE02F5C91ACF252000179969 /* Identifier.swift */, - EE6C88BA1CB39A6A00ADFF94 /* ImagingExcerpt.swift */, EE02F5CA1ACF252000179969 /* ImagingObjectSelection.swift */, EE02F5CB1ACF252000179969 /* ImagingStudy.swift */, EE02F5CC1ACF252000179969 /* Immunization.swift */, EE02F5CD1ACF252000179969 /* ImmunizationRecommendation.swift */, EEEE30E31BB1FD94008866E2 /* ImplementationGuide.swift */, EE1310B61C1B435300D9DAE7 /* JSON-extensions.swift */, - EE6C88BB1CB39A6A00ADFF94 /* Library.swift */, - EE6C88BC1CB39A6A00ADFF94 /* Linkage.swift */, EE02F5CE1ACF252000179969 /* List.swift */, EE02F5CF1ACF252000179969 /* Location.swift */, - EE6C88BD1CB39A6A00ADFF94 /* Measure.swift */, - EE6C88BE1CB39A6A00ADFF94 /* MeasureReport.swift */, EE02F5D01ACF252000179969 /* Media.swift */, EE02F5D11ACF252000179969 /* Medication.swift */, EE02F5D21ACF252000179969 /* MedicationAdministration.swift */, @@ -1076,8 +939,6 @@ EE02F5D51ACF252000179969 /* MedicationStatement.swift */, EE02F5D61ACF252000179969 /* MessageHeader.swift */, EE02F5D71ACF252000179969 /* Meta.swift */, - EE6C88BF1CB39A6A00ADFF94 /* ModuleDefinition.swift */, - EE6C88C01CB39A6A00ADFF94 /* ModuleMetadata.swift */, EE02F5D81ACF252000179969 /* Money.swift */, EE02F5D91ACF252000179969 /* NamingSystem.swift */, EE02F5DA1ACF252000179969 /* Narrative.swift */, @@ -1087,9 +948,7 @@ EE02F5DE1ACF252000179969 /* OperationOutcome.swift */, EE02F5DF1ACF252000179969 /* Order.swift */, EE02F5E01ACF252000179969 /* OrderResponse.swift */, - EE6C88C11CB39A6A00ADFF94 /* OrderSet.swift */, EE02F5E11ACF252000179969 /* Organization.swift */, - EE6C88C21CB39A6A00ADFF94 /* ParameterDefinition.swift */, EE02F5E21ACF252000179969 /* Parameters.swift */, EE02F5E31ACF252000179969 /* Patient.swift */, EE02F5E41ACF252000179969 /* PaymentNotice.swift */, @@ -1097,12 +956,10 @@ EE02F5E61ACF252000179969 /* Period.swift */, EE02F5E71ACF252000179969 /* Person.swift */, EE02F5E81ACF252000179969 /* Practitioner.swift */, - EE6C88C31CB39A6A00ADFF94 /* PractitionerRole.swift */, EE02F5E91ACF252000179969 /* Procedure.swift */, EE02F5EA1ACF252000179969 /* ProcedureRequest.swift */, EE02F5EB1ACF252000179969 /* ProcessRequest.swift */, EE02F5EC1ACF252000179969 /* ProcessResponse.swift */, - EE6C88C41CB39A6A00ADFF94 /* ProtocolFHIR.swift */, EE02F5ED1ACF252000179969 /* Provenance.swift */, EE02F5EE1ACF252000179969 /* Quantity.swift */, EE02F5EF1ACF252000179969 /* Questionnaire.swift */, @@ -1117,20 +974,16 @@ EE02F5F81ACF252000179969 /* SampledData.swift */, EE02F5F91ACF252000179969 /* Schedule.swift */, EE02F5FA1ACF252000179969 /* SearchParameter.swift */, - EE6C88C51CB39A6A00ADFF94 /* Sequence.swift */, EE02F5FB1ACF252000179969 /* Signature.swift */, EE02F5FC1ACF252000179969 /* Slot.swift */, EE02F5FD1ACF252000179969 /* Specimen.swift */, EE02F5FE1ACF252000179969 /* StructureDefinition.swift */, - EE6C88C61CB39A6A00ADFF94 /* StructureMap.swift */, EE02F5FF1ACF252000179969 /* Subscription.swift */, EE02F6001ACF252000179969 /* Substance.swift */, EEEE30E71BB1FD94008866E2 /* SupplyDelivery.swift */, EEEE30E81BB1FD94008866E2 /* SupplyRequest.swift */, - EE6C88C71CB39A6A00ADFF94 /* Task.swift */, EEEE30E91BB1FD94008866E2 /* TestScript.swift */, EE02F6021ACF252000179969 /* Timing.swift */, - EE6C88C81CB39A6A00ADFF94 /* TriggerDefinition.swift */, EE02F6031ACF252000179969 /* ValueSet.swift */, EE02F6041ACF252000179969 /* VisionPrescription.swift */, ); @@ -1170,11 +1023,9 @@ EE02F6F61ACF259B00179969 /* BodySiteTests.swift */, EE02F6F71ACF259B00179969 /* BundleTests.swift */, EE02F6F81ACF259B00179969 /* CarePlanTests.swift */, - EE6C88E11CB39D0900ADFF94 /* CareTeamTests.swift */, EE02F6F91ACF259B00179969 /* ClaimResponseTests.swift */, EE02F6FA1ACF259B00179969 /* ClaimTests.swift */, EE02F6FB1ACF259B00179969 /* ClinicalImpressionTests.swift */, - EE6C88E21CB39D0900ADFF94 /* CodeSystemTests.swift */, EE02F6FC1ACF259B00179969 /* CommunicationRequestTests.swift */, EE02F6FD1ACF259B00179969 /* CommunicationTests.swift */, EE02F6FE1ACF259B00179969 /* CompositionTests.swift */, @@ -1185,8 +1036,6 @@ EE02F7041ACF259B00179969 /* CoverageTests.swift */, EE02F7051ACF259B00179969 /* DataElementTests.swift */, EE02F7061ACF259B00179969 /* DateAndTimeTests.swift */, - EE6C88E31CB39D0900ADFF94 /* DecisionSupportRuleTests.swift */, - EE6C88E41CB39D0900ADFF94 /* DecisionSupportServiceModuleTests.swift */, EEEE30F51BB1FDB7008866E2 /* DetectedIssueTests.swift */, EE02F7071ACF259B00179969 /* DeviceComponentTests.swift */, EE02F7081ACF259B00179969 /* DeviceMetricTests.swift */, @@ -1202,37 +1051,29 @@ EE02F7131ACF259B00179969 /* EnrollmentRequestTests.swift */, EE02F7141ACF259B00179969 /* EnrollmentResponseTests.swift */, EE02F7151ACF259B00179969 /* EpisodeOfCareTests.swift */, - EE6C88E51CB39D0900ADFF94 /* ExpansionProfileTests.swift */, EE02F7161ACF259B00179969 /* ExplanationOfBenefitTests.swift */, EE02F7171ACF259B00179969 /* FamilyMemberHistoryTests.swift */, EE02F7191ACF259B00179969 /* FlagTests.swift */, EE02F71A1ACF259B00179969 /* GoalTests.swift */, EE02F71B1ACF259B00179969 /* GroupTests.swift */, - EE6C88E61CB39D0900ADFF94 /* GuidanceResponseTests.swift */, EE02F71C1ACF259B00179969 /* HealthcareServiceTests.swift */, - EE6C88E71CB39D0900ADFF94 /* ImagingExcerptTests.swift */, EE02F71D1ACF259B00179969 /* ImagingObjectSelectionTests.swift */, EE02F71E1ACF259B00179969 /* ImagingStudyTests.swift */, EE02F71F1ACF259B00179969 /* ImmunizationRecommendationTests.swift */, EE02F7201ACF259B00179969 /* ImmunizationTests.swift */, EEEE30F61BB1FDB7008866E2 /* ImplementationGuideTests.swift */, - EE6C88E81CB39D0900ADFF94 /* LibraryTests.swift */, - EE6C88E91CB39D0900ADFF94 /* LinkageTests.swift */, EE02F7211ACF259B00179969 /* ListTests.swift */, EE02F7221ACF259B00179969 /* LocationTests.swift */, - EE6C88EA1CB39D0900ADFF94 /* MeasureReportTests.swift */, EE02F7231ACF259B00179969 /* MediaTests.swift */, EEEE30F71BB1FDB7008866E2 /* MedicationOrderTests.swift */, EE02F7271ACF259B00179969 /* MedicationTests.swift */, EE02F7281ACF259B00179969 /* MessageHeaderTests.swift */, - EE6C88EB1CB39D0900ADFF94 /* ModuleDefinitionTests.swift */, EE02F7291ACF259B00179969 /* NamingSystemTests.swift */, EE02F72A1ACF259B00179969 /* NutritionOrderTests.swift */, EE02F72B1ACF259B00179969 /* ObservationTests.swift */, EEEE30F81BB1FDB7008866E2 /* OperationDefinitionTests.swift */, EE02F72C1ACF259B00179969 /* OperationOutcomeTests.swift */, EE02F72D1ACF259B00179969 /* OrderResponseTests.swift */, - EE6C88EC1CB39D0900ADFF94 /* OrderSetTests.swift */, EE02F72E1ACF259B00179969 /* OrderTests.swift */, EE02F72F1ACF259B00179969 /* OrganizationTests.swift */, EE02F7301ACF259B00179969 /* ParametersTests.swift */, @@ -1240,13 +1081,11 @@ EE02F7321ACF259B00179969 /* PaymentNoticeTests.swift */, EE02F7331ACF259B00179969 /* PaymentReconciliationTests.swift */, EE02F7341ACF259B00179969 /* PersonTests.swift */, - EE6C88ED1CB39D0900ADFF94 /* PractitionerRoleTests.swift */, EE02F7351ACF259B00179969 /* PractitionerTests.swift */, EE02F7361ACF259B00179969 /* ProcedureRequestTests.swift */, EE02F7371ACF259B00179969 /* ProcedureTests.swift */, EE02F7381ACF259B00179969 /* ProcessRequestTests.swift */, EE02F7391ACF259B00179969 /* ProcessResponseTests.swift */, - EE6C88EE1CB39D0900ADFF94 /* ProtocolFHIRTests.swift */, EE02F73A1ACF259B00179969 /* ProvenanceTests.swift */, EEEE30F91BB1FDB7008866E2 /* QuestionnaireResponseTests.swift */, EE02F73C1ACF259B00179969 /* QuestionnaireTests.swift */, @@ -1255,16 +1094,13 @@ EE02F73F1ACF259B00179969 /* RiskAssessmentTests.swift */, EE02F7401ACF259B00179969 /* ScheduleTests.swift */, EE02F7411ACF259B00179969 /* SearchParameterTests.swift */, - EE6C88EF1CB39D0900ADFF94 /* SequenceTests.swift */, EE02F7421ACF259B00179969 /* SlotTests.swift */, EE02F7431ACF259B00179969 /* SpecimenTests.swift */, EE02F7441ACF259B00179969 /* StructureDefinitionTests.swift */, - EE6C88F01CB39D0900ADFF94 /* StructureMapTests.swift */, EE02F7451ACF259B00179969 /* SubscriptionTests.swift */, EE02F7461ACF259B00179969 /* SubstanceTests.swift */, EEEE30FA1BB1FDB7008866E2 /* SupplyDeliveryTests.swift */, EEEE30FB1BB1FDB7008866E2 /* SupplyRequestTests.swift */, - EE6C88F11CB39D0900ADFF94 /* TaskTests.swift */, EEEE30FC1BB1FDB7008866E2 /* TestScriptTests.swift */, EE02F7481ACF259B00179969 /* ValueSetTests.swift */, EE02F7491ACF259B00179969 /* VisionPrescriptionTests.swift */, @@ -1481,17 +1317,13 @@ EE02F6211ACF252000179969 /* ClinicalImpression.swift in Sources */, EE02F61B1ACF252000179969 /* CarePlan.swift in Sources */, EE02F6E31ACF252000179969 /* Substance.swift in Sources */, - EE6C88D21CB39A6A00ADFF94 /* ImagingExcerpt.swift in Sources */, EE02F6691ACF252000179969 /* FamilyMemberHistory.swift in Sources */, - EE6C88CE1CB39A6A00ADFF94 /* DecisionSupportRule.swift in Sources */, EE02F64D1ACF252000179969 /* Distance.swift in Sources */, EE02F6731ACF252000179969 /* HumanName.swift in Sources */, EE02F6E71ACF252000179969 /* Timing.swift in Sources */, EE02F6191ACF252000179969 /* Bundle.swift in Sources */, EE02F6411ACF252000179969 /* DeviceComponent.swift in Sources */, EE02F60F1ACF252000179969 /* Attachment.swift in Sources */, - EE6C88CA1CB39A6A00ADFF94 /* CareTeam.swift in Sources */, - EE6C88C91CB39A6A00ADFF94 /* ActionDefinition.swift in Sources */, EE02F68F1ACF252000179969 /* MessageHeader.swift in Sources */, EE02F6231ACF252000179969 /* CodeableConcept.swift in Sources */, EE02F69F1ACF252000179969 /* OperationOutcome.swift in Sources */, @@ -1505,12 +1337,10 @@ EE02F6151ACF252000179969 /* Binary.swift in Sources */, EE02F6CB1ACF252000179969 /* ReferralRequest.swift in Sources */, EE02F6391ACF252000179969 /* Count.swift in Sources */, - EE6C88D11CB39A6A00ADFF94 /* GuidanceResponse.swift in Sources */, EE9B32001ACADE8000980AA9 /* Reference+Resolving.swift in Sources */, EEEE30EF1BB1FD94008866E2 /* QuestionnaireResponse.swift in Sources */, EE02F62F1ACF252000179969 /* Condition.swift in Sources */, EE02F6891ACF252000179969 /* MedicationDispense.swift in Sources */, - EE6C88D01CB39A6A00ADFF94 /* ExpansionProfile.swift in Sources */, EE02F6531ACF252000179969 /* DomainResource.swift in Sources */, EE02F6C11ACF252000179969 /* Questionnaire.swift in Sources */, EE02F66B1ACF252000179969 /* Flag.swift in Sources */, @@ -1521,7 +1351,6 @@ EE02F6A51ACF252000179969 /* Organization.swift in Sources */, EE02F6571ACF252000179969 /* ElementDefinition.swift in Sources */, EE1310B81C1B435300D9DAE7 /* DateAndTime.swift in Sources */, - EE6C88D41CB39A6A00ADFF94 /* Linkage.swift in Sources */, EE02F6131ACF252000179969 /* Basic.swift in Sources */, EE02F6AD1ACF252000179969 /* PaymentReconciliation.swift in Sources */, EE02F6071ACF252000179969 /* Age.swift in Sources */, @@ -1535,10 +1364,8 @@ EE02F6791ACF252000179969 /* ImagingStudy.swift in Sources */, EE02F6E11ACF252000179969 /* Subscription.swift in Sources */, EE02F6D11ACF252000179969 /* RiskAssessment.swift in Sources */, - EE6C88DE1CB39A6A00ADFF94 /* StructureMap.swift in Sources */, EE02F6B11ACF252000179969 /* Person.swift in Sources */, EE02F6631ACF252000179969 /* EpisodeOfCare.swift in Sources */, - EE6C88E01CB39A6A00ADFF94 /* TriggerDefinition.swift in Sources */, EE02F6A31ACF252000179969 /* OrderResponse.swift in Sources */, EE02F6111ACF252000179969 /* AuditEvent.swift in Sources */, EE1F49D21C0D11060095BF0F /* FHIRBaseServer.swift in Sources */, @@ -1547,31 +1374,23 @@ EE1310CC1C1B5ACC00D9DAE7 /* FHIRServer.swift in Sources */, EE02F6771ACF252000179969 /* ImagingObjectSelection.swift in Sources */, EEEE30EA1BB1FD94008866E2 /* Account.swift in Sources */, - EE6C88D91CB39A6A00ADFF94 /* OrderSet.swift in Sources */, EE02F6511ACF252000179969 /* DocumentReference.swift in Sources */, EE02F6851ACF252000179969 /* Medication.swift in Sources */, EE01F9701C58F6AB003AEA7E /* DomainResource+Containment.swift in Sources */, EEEE30EE1BB1FD94008866E2 /* MedicationOrder.swift in Sources */, EE02F6711ACF252000179969 /* HealthcareService.swift in Sources */, - EE6C88DA1CB39A6A00ADFF94 /* ParameterDefinition.swift in Sources */, - EE6C88D81CB39A6A00ADFF94 /* ModuleMetadata.swift in Sources */, EE02F6591ACF252000179969 /* EligibilityRequest.swift in Sources */, EE02F6671ACF252000179969 /* Extension.swift in Sources */, - EE6C88DB1CB39A6A00ADFF94 /* PractitionerRole.swift in Sources */, - EE6C88D61CB39A6A00ADFF94 /* MeasureReport.swift in Sources */, EE02F65B1ACF252000179969 /* EligibilityResponse.swift in Sources */, EE02F6EE1ACF257000179969 /* FHIRSearch.swift in Sources */, EE02F63B1ACF252000179969 /* Coverage.swift in Sources */, - EE6C88CC1CB39A6A00ADFF94 /* CompartmentDefinition.swift in Sources */, EE02F60B1ACF252000179969 /* Appointment.swift in Sources */, - EE6C88D71CB39A6A00ADFF94 /* ModuleDefinition.swift in Sources */, EE02F66F1ACF252000179969 /* Group.swift in Sources */, EE1310BA1C1B435300D9DAE7 /* FHIRAbstractBase.swift in Sources */, EE02F6351ACF252000179969 /* Contract.swift in Sources */, EE8901231B7E07D700F1EDBF /* Element+Extensions.swift in Sources */, EEEE30F21BB1FD94008866E2 /* SupplyRequest.swift in Sources */, EE02F6751ACF252000179969 /* Identifier.swift in Sources */, - EE6C88CB1CB39A6A00ADFF94 /* CodeSystem.swift in Sources */, EE02F6D51ACF252000179969 /* Schedule.swift in Sources */, EE1310B91C1B435300D9DAE7 /* Element.swift in Sources */, EE1310DA1C1B681500D9DAE7 /* FHIRServerDataResponse.swift in Sources */, @@ -1582,18 +1401,14 @@ EE02F66D1ACF252000179969 /* Goal.swift in Sources */, EE02F62D1ACF252000179969 /* ConceptMap.swift in Sources */, EE02F6651ACF252000179969 /* ExplanationOfBenefit.swift in Sources */, - EE6C88D51CB39A6A00ADFF94 /* Measure.swift in Sources */, EE1310CF1C1B5EE500D9DAE7 /* Resource+Instantiation.swift in Sources */, EE02F6991ACF252000179969 /* NutritionOrder.swift in Sources */, - EE6C88DC1CB39A6A00ADFF94 /* ProtocolFHIR.swift in Sources */, EE02F6B31ACF252000179969 /* Practitioner.swift in Sources */, EE02F6B51ACF252000179969 /* Procedure.swift in Sources */, EE02F6E91ACF252000179969 /* ValueSet.swift in Sources */, - EE6C88DF1CB39A6A00ADFF94 /* Task.swift in Sources */, EE02F6C51ACF252000179969 /* Range.swift in Sources */, EE1310BE1C1B435300D9DAE7 /* JSON-extensions.swift in Sources */, EE02F6EB1ACF252000179969 /* VisionPrescription.swift in Sources */, - EE6C88DD1CB39A6A00ADFF94 /* Sequence.swift in Sources */, EEEE30ED1BB1FD94008866E2 /* ImplementationGuide.swift in Sources */, EE02F64B1ACF252000179969 /* DiagnosticReport.swift in Sources */, EE02F6551ACF252000179969 /* Duration.swift in Sources */, @@ -1609,7 +1424,6 @@ EE02F6DF1ACF252000179969 /* StructureDefinition.swift in Sources */, EE02F6491ACF252000179969 /* DiagnosticOrder.swift in Sources */, EE02F63D1ACF252000179969 /* DataElement.swift in Sources */, - EE6C88CF1CB39A6A00ADFF94 /* DecisionSupportServiceModule.swift in Sources */, EE02F6451ACF252000179969 /* DeviceUseRequest.swift in Sources */, EE02F6251ACF252000179969 /* Coding.swift in Sources */, EEEE30F31BB1FD94008866E2 /* TestScript.swift in Sources */, @@ -1618,7 +1432,6 @@ EE02F6B91ACF252000179969 /* ProcessRequest.swift in Sources */, EE02F63F1ACF252000179969 /* Device.swift in Sources */, EE02F61F1ACF252000179969 /* ClaimResponse.swift in Sources */, - EE6C88D31CB39A6A00ADFF94 /* Library.swift in Sources */, EE02F6291ACF252000179969 /* CommunicationRequest.swift in Sources */, EE02F6931ACF252000179969 /* Money.swift in Sources */, EE02F67F1ACF252000179969 /* List.swift in Sources */, @@ -1630,7 +1443,6 @@ EE1310D71C1B608E00D9DAE7 /* FHIRServerRequestHandler.swift in Sources */, EE02F6A71ACF252000179969 /* Parameters.swift in Sources */, EE02F6091ACF252000179969 /* AllergyIntolerance.swift in Sources */, - EE6C88CD1CB39A6A00ADFF94 /* DataRequirement.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1642,12 +1454,9 @@ EE02F7761ACF259B00179969 /* DateAndTimeTests.swift in Sources */, EEEE31021BB1FDB7008866E2 /* QuestionnaireResponseTests.swift in Sources */, EE02F7881ACF259B00179969 /* DocumentReferenceTests.swift in Sources */, - EE65DB4E1CB39FE100E25C72 /* ImagingExcerptTests.swift in Sources */, - EE65DB4C1CB39FE100E25C72 /* ExpansionProfileTests.swift in Sources */, EE02F7921ACF259B00179969 /* EnrollmentResponseTests.swift in Sources */, EE02F7D01ACF259B00179969 /* PaymentReconciliationTests.swift in Sources */, EE02F7F21ACF259B00179969 /* StructureDefinitionTests.swift in Sources */, - EE65DB531CB39FE100E25C72 /* OrderSetTests.swift in Sources */, EE02F77A1ACF259B00179969 /* DeviceMetricTests.swift in Sources */, EE02F7D81ACF259B00179969 /* ProcedureTests.swift in Sources */, EE02F7A41ACF259B00179969 /* ImagingObjectSelectionTests.swift in Sources */, @@ -1655,15 +1464,12 @@ EE02F7DC1ACF259B00179969 /* ProcessResponseTests.swift in Sources */, EE02F7841ACF259B00179969 /* DiagnosticReportTests.swift in Sources */, EE02F7E21ACF259B00179969 /* QuestionnaireTests.swift in Sources */, - EE65DB541CB39FE100E25C72 /* PractitionerRoleTests.swift in Sources */, EE02F7521ACF259B00179969 /* BasicTests.swift in Sources */, EE02F7BC1ACF259B00179969 /* NamingSystemTests.swift in Sources */, EE02F76C1ACF259B00179969 /* ConformanceTests.swift in Sources */, EE02F75C1ACF259B00179969 /* ClaimResponseTests.swift in Sources */, EEE5DF371A5D862B002AFF53 /* FHIRSearchTests.swift in Sources */, - EE65DB4F1CB39FE100E25C72 /* LibraryTests.swift in Sources */, EE39069F1CD3E4F6008FECEA /* RequestTests.swift in Sources */, - EE65DB511CB39FE100E25C72 /* MeasureReportTests.swift in Sources */, EE02F7561ACF259B00179969 /* BodySiteTests.swift in Sources */, EE02F7F61ACF259B00179969 /* SubstanceTests.swift in Sources */, EE02F7EE1ACF259B00179969 /* SlotTests.swift in Sources */, @@ -1675,7 +1481,6 @@ EE02F7E81ACF259B00179969 /* RiskAssessmentTests.swift in Sources */, EE02F7D41ACF259B00179969 /* PractitionerTests.swift in Sources */, EE02F7EA1ACF259B00179969 /* ScheduleTests.swift in Sources */, - EE65DB501CB39FE100E25C72 /* LinkageTests.swift in Sources */, EE01F9731C58FC51003AEA7E /* ResourceTests.swift in Sources */, EE02F7981ACF259B00179969 /* FamilyMemberHistoryTests.swift in Sources */, EE02F7AA1ACF259B00179969 /* ImmunizationTests.swift in Sources */, @@ -1688,11 +1493,9 @@ EE02F7661ACF259B00179969 /* CompositionTests.swift in Sources */, EE02F7DA1ACF259B00179969 /* ProcessRequestTests.swift in Sources */, EE684CCF19A7CEF000B5A2C0 /* ExtensionsTest.swift in Sources */, - EE6940291D2EAA4B00D6DCA1 /* ProtocolFHIRTests.swift in Sources */, EE02F7E61ACF259B00179969 /* RelatedPersonTests.swift in Sources */, EEEE31041BB1FDB7008866E2 /* SupplyRequestTests.swift in Sources */, EE02F7D61ACF259B00179969 /* ProcedureRequestTests.swift in Sources */, - EE65DB571CB39FE100E25C72 /* StructureMapTests.swift in Sources */, EE02F7641ACF259B00179969 /* CommunicationTests.swift in Sources */, EE02F77E1ACF259B00179969 /* DeviceUseRequestTests.swift in Sources */, EE02F7941ACF259B00179969 /* EpisodeOfCareTests.swift in Sources */, @@ -1703,7 +1506,6 @@ EE02F7FC1ACF259B00179969 /* VisionPrescriptionTests.swift in Sources */, EE02F7601ACF259B00179969 /* ClinicalImpressionTests.swift in Sources */, EE02F7F41ACF259B00179969 /* SubscriptionTests.swift in Sources */, - EE65DB4D1CB39FE100E25C72 /* GuidanceResponseTests.swift in Sources */, EE02F7A01ACF259B00179969 /* GroupTests.swift in Sources */, EE02F7781ACF259B00179969 /* DeviceComponentTests.swift in Sources */, EE02F7C81ACF259B00179969 /* OrganizationTests.swift in Sources */, @@ -1720,13 +1522,9 @@ EE02F76A1ACF259B00179969 /* ConditionTests.swift in Sources */, EE02F7AC1ACF259B00179969 /* ListTests.swift in Sources */, EE02F7501ACF259B00179969 /* AuditEventTests.swift in Sources */, - EE65DB4B1CB39FE100E25C72 /* DecisionSupportServiceModuleTests.swift in Sources */, EE02F7FA1ACF259B00179969 /* ValueSetTests.swift in Sources */, EE02F7621ACF259B00179969 /* CommunicationRequestTests.swift in Sources */, EE02F79E1ACF259B00179969 /* GoalTests.swift in Sources */, - EE65DB521CB39FE100E25C72 /* ModuleDefinitionTests.swift in Sources */, - EE65DB581CB39FE100E25C72 /* TaskTests.swift in Sources */, - EE65DB481CB39FE100E25C72 /* CareTeamTests.swift in Sources */, EE02F7A61ACF259B00179969 /* ImagingStudyTests.swift in Sources */, EE02F7A81ACF259B00179969 /* ImmunizationRecommendationTests.swift in Sources */, EE02F7681ACF259B00179969 /* ConceptMapTests.swift in Sources */, @@ -1735,9 +1533,7 @@ EE02F7741ACF259B00179969 /* DataElementTests.swift in Sources */, EE02F7B01ACF259B00179969 /* MediaTests.swift in Sources */, EE02F74C1ACF259B00179969 /* AppointmentResponseTests.swift in Sources */, - EE65DB4A1CB39FE100E25C72 /* DecisionSupportRuleTests.swift in Sources */, EEEE31001BB1FDB7008866E2 /* MedicationOrderTests.swift in Sources */, - EE65DB561CB39FE100E25C72 /* SequenceTests.swift in Sources */, EE02F75E1ACF259B00179969 /* ClaimTests.swift in Sources */, EE02F7CA1ACF259B00179969 /* ParametersTests.swift in Sources */, EE02F7DE1ACF259B00179969 /* ProvenanceTests.swift in Sources */, @@ -1747,7 +1543,6 @@ EE02F78A1ACF259B00179969 /* EligibilityRequestTests.swift in Sources */, EE02F7801ACF259B00179969 /* DeviceUseStatementTests.swift in Sources */, EE02F75A1ACF259B00179969 /* CarePlanTests.swift in Sources */, - EE65DB491CB39FE100E25C72 /* CodeSystemTests.swift in Sources */, EE02F7EC1ACF259B00179969 /* SearchParameterTests.swift in Sources */, EE02F7C01ACF259B00179969 /* ObservationTests.swift in Sources */, EE02F7AE1ACF259B00179969 /* LocationTests.swift in Sources */, @@ -1776,17 +1571,13 @@ EE02F6221ACF252000179969 /* ClinicalImpression.swift in Sources */, EE02F61C1ACF252000179969 /* CarePlan.swift in Sources */, EE02F6E41ACF252000179969 /* Substance.swift in Sources */, - EE65DB731CB39FFD00E25C72 /* ImagingExcerpt.swift in Sources */, EE02F66A1ACF252000179969 /* FamilyMemberHistory.swift in Sources */, - EE65DB6F1CB39FFD00E25C72 /* DecisionSupportRule.swift in Sources */, EE02F64E1ACF252000179969 /* Distance.swift in Sources */, EE02F6741ACF252000179969 /* HumanName.swift in Sources */, EE02F6E81ACF252000179969 /* Timing.swift in Sources */, EE02F61A1ACF252000179969 /* Bundle.swift in Sources */, EE02F6421ACF252000179969 /* DeviceComponent.swift in Sources */, EE02F6101ACF252000179969 /* Attachment.swift in Sources */, - EE65DB6B1CB39FFD00E25C72 /* CareTeam.swift in Sources */, - EE65DB6A1CB39FFD00E25C72 /* ActionDefinition.swift in Sources */, EE02F6901ACF252000179969 /* MessageHeader.swift in Sources */, EE02F6241ACF252000179969 /* CodeableConcept.swift in Sources */, EE02F6A01ACF252000179969 /* OperationOutcome.swift in Sources */, @@ -1800,12 +1591,10 @@ EE02F6DA1ACF252000179969 /* Signature.swift in Sources */, EE02F6161ACF252000179969 /* Binary.swift in Sources */, EE02F6CC1ACF252000179969 /* ReferralRequest.swift in Sources */, - EE65DB721CB39FFD00E25C72 /* GuidanceResponse.swift in Sources */, EE02F63A1ACF252000179969 /* Count.swift in Sources */, EE9B32011ACADE8000980AA9 /* Reference+Resolving.swift in Sources */, EEEE310B1BB1FE26008866E2 /* QuestionnaireResponse.swift in Sources */, EE02F6301ACF252000179969 /* Condition.swift in Sources */, - EE65DB711CB39FFD00E25C72 /* ExpansionProfile.swift in Sources */, EE02F68A1ACF252000179969 /* MedicationDispense.swift in Sources */, EE02F6541ACF252000179969 /* DomainResource.swift in Sources */, EE02F6C21ACF252000179969 /* Questionnaire.swift in Sources */, @@ -1816,7 +1605,6 @@ EE02F6A61ACF252000179969 /* Organization.swift in Sources */, EE02F6581ACF252000179969 /* ElementDefinition.swift in Sources */, EE02F6141ACF252000179969 /* Basic.swift in Sources */, - EE65DB751CB39FFD00E25C72 /* Linkage.swift in Sources */, EE02F6AE1ACF252000179969 /* PaymentReconciliation.swift in Sources */, EE02F6081ACF252000179969 /* Age.swift in Sources */, EE02F6DC1ACF252000179969 /* Slot.swift in Sources */, @@ -1830,10 +1618,8 @@ EE02F6E21ACF252000179969 /* Subscription.swift in Sources */, EE02F6D21ACF252000179969 /* RiskAssessment.swift in Sources */, EE02F6B21ACF252000179969 /* Person.swift in Sources */, - EE65DB7F1CB39FFD00E25C72 /* StructureMap.swift in Sources */, EE1310D31C1B605400D9DAE7 /* FHIRError.swift in Sources */, EE1310C01C1B542100D9DAE7 /* DateAndTime.swift in Sources */, - EE65DB811CB39FFD00E25C72 /* TriggerDefinition.swift in Sources */, EE02F6641ACF252000179969 /* EpisodeOfCare.swift in Sources */, EE02F6A41ACF252000179969 /* OrderResponse.swift in Sources */, EE02F6121ACF252000179969 /* AuditEvent.swift in Sources */, @@ -1842,31 +1628,23 @@ EE02F6341ACF252000179969 /* ContactPoint.swift in Sources */, EE02F6781ACF252000179969 /* ImagingObjectSelection.swift in Sources */, EEEE31061BB1FE26008866E2 /* Account.swift in Sources */, - EE65DB7A1CB39FFD00E25C72 /* OrderSet.swift in Sources */, EE02F6521ACF252000179969 /* DocumentReference.swift in Sources */, EE1310C11C1B542100D9DAE7 /* Element.swift in Sources */, EE01F9711C58F6AB003AEA7E /* DomainResource+Containment.swift in Sources */, EE02F6861ACF252000179969 /* Medication.swift in Sources */, EEEE310A1BB1FE26008866E2 /* MedicationOrder.swift in Sources */, - EE65DB7B1CB39FFD00E25C72 /* ParameterDefinition.swift in Sources */, - EE65DB791CB39FFD00E25C72 /* ModuleMetadata.swift in Sources */, EE1310D21C1B604600D9DAE7 /* FHIRServer.swift in Sources */, EE02F6721ACF252000179969 /* HealthcareService.swift in Sources */, - EE65DB7C1CB39FFD00E25C72 /* PractitionerRole.swift in Sources */, - EE65DB771CB39FFD00E25C72 /* MeasureReport.swift in Sources */, EE02F65A1ACF252000179969 /* EligibilityRequest.swift in Sources */, EE02F6681ACF252000179969 /* Extension.swift in Sources */, EE02F65C1ACF252000179969 /* EligibilityResponse.swift in Sources */, - EE65DB6D1CB39FFD00E25C72 /* CompartmentDefinition.swift in Sources */, EE1310D51C1B605D00D9DAE7 /* Resource+Instantiation.swift in Sources */, - EE65DB781CB39FFD00E25C72 /* ModuleDefinition.swift in Sources */, EE02F6EF1ACF257000179969 /* FHIRSearch.swift in Sources */, EE02F63C1ACF252000179969 /* Coverage.swift in Sources */, EE02F60C1ACF252000179969 /* Appointment.swift in Sources */, EE02F6701ACF252000179969 /* Group.swift in Sources */, EE02F6361ACF252000179969 /* Contract.swift in Sources */, EE8901241B7E07D700F1EDBF /* Element+Extensions.swift in Sources */, - EE65DB6C1CB39FFD00E25C72 /* CodeSystem.swift in Sources */, EEEE310E1BB1FE26008866E2 /* SupplyRequest.swift in Sources */, EE02F6761ACF252000179969 /* Identifier.swift in Sources */, EE1310DB1C1B767100D9DAE7 /* FHIRServerDataResponse.swift in Sources */, @@ -1877,18 +1655,14 @@ EE02F6C81ACF252000179969 /* Ratio.swift in Sources */, EE02F6881ACF252000179969 /* MedicationAdministration.swift in Sources */, EE02F66E1ACF252000179969 /* Goal.swift in Sources */, - EE65DB761CB39FFD00E25C72 /* Measure.swift in Sources */, EE02F62E1ACF252000179969 /* ConceptMap.swift in Sources */, EE02F6661ACF252000179969 /* ExplanationOfBenefit.swift in Sources */, - EE65DB7D1CB39FFD00E25C72 /* ProtocolFHIR.swift in Sources */, EE1310C51C1B542100D9DAE7 /* FHIRTypes.swift in Sources */, EE1310C21C1B542100D9DAE7 /* FHIRAbstractBase.swift in Sources */, EE02F69A1ACF252000179969 /* NutritionOrder.swift in Sources */, - EE65DB801CB39FFD00E25C72 /* Task.swift in Sources */, EE02F6B41ACF252000179969 /* Practitioner.swift in Sources */, EE02F6B61ACF252000179969 /* Procedure.swift in Sources */, EE02F6EA1ACF252000179969 /* ValueSet.swift in Sources */, - EE65DB7E1CB39FFD00E25C72 /* Sequence.swift in Sources */, EE02F6C61ACF252000179969 /* Range.swift in Sources */, EE02F6EC1ACF252000179969 /* VisionPrescription.swift in Sources */, EEEE31091BB1FE26008866E2 /* ImplementationGuide.swift in Sources */, @@ -1904,7 +1678,6 @@ EE02F6181ACF252000179969 /* BodySite.swift in Sources */, EE02F6AA1ACF252000179969 /* Patient.swift in Sources */, EE02F6E01ACF252000179969 /* StructureDefinition.swift in Sources */, - EE65DB701CB39FFD00E25C72 /* DecisionSupportServiceModule.swift in Sources */, EE02F64A1ACF252000179969 /* DiagnosticOrder.swift in Sources */, EE02F63E1ACF252000179969 /* DataElement.swift in Sources */, EE02F6461ACF252000179969 /* DeviceUseRequest.swift in Sources */, @@ -1913,7 +1686,6 @@ EE02F62C1ACF252000179969 /* Composition.swift in Sources */, EE02F6BA1ACF252000179969 /* ProcessRequest.swift in Sources */, EE02F6401ACF252000179969 /* Device.swift in Sources */, - EE65DB741CB39FFD00E25C72 /* Library.swift in Sources */, EE02F6201ACF252000179969 /* ClaimResponse.swift in Sources */, EE02F62A1ACF252000179969 /* CommunicationRequest.swift in Sources */, EE02F6941ACF252000179969 /* Money.swift in Sources */, @@ -1925,7 +1697,6 @@ EE1310D81C1B613F00D9DAE7 /* FHIRServerRequestHandler.swift in Sources */, EE02F6A81ACF252000179969 /* Parameters.swift in Sources */, EE02F60A1ACF252000179969 /* AllergyIntolerance.swift in Sources */, - EE65DB6E1CB39FFD00E25C72 /* DataRequirement.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1949,28 +1720,20 @@ EE02F7E31ACF259B00179969 /* QuestionnaireTests.swift in Sources */, EE02F7531ACF259B00179969 /* BasicTests.swift in Sources */, EE02F7BD1ACF259B00179969 /* NamingSystemTests.swift in Sources */, - EE65DB631CB39FE200E25C72 /* ModuleDefinitionTests.swift in Sources */, EE02F76D1ACF259B00179969 /* ConformanceTests.swift in Sources */, EE02F75D1ACF259B00179969 /* ClaimResponseTests.swift in Sources */, EEE5DF381A5D862B002AFF53 /* FHIRSearchTests.swift in Sources */, EE02F7571ACF259B00179969 /* BodySiteTests.swift in Sources */, EE02F7F71ACF259B00179969 /* SubstanceTests.swift in Sources */, - EE65DB641CB39FE200E25C72 /* OrderSetTests.swift in Sources */, EE02F7EF1ACF259B00179969 /* SlotTests.swift in Sources */, EE02F7A31ACF259B00179969 /* HealthcareServiceTests.swift in Sources */, - EE65DB621CB39FE200E25C72 /* MeasureReportTests.swift in Sources */, EEEE31181BB1FE32008866E2 /* TestScriptTests.swift in Sources */, - EE65DB601CB39FE200E25C72 /* LibraryTests.swift in Sources */, EE02F7911ACF259B00179969 /* EnrollmentRequestTests.swift in Sources */, EE02F78F1ACF259B00179969 /* EncounterTests.swift in Sources */, - EE65DB611CB39FE200E25C72 /* LinkageTests.swift in Sources */, EEEE31161BB1FE32008866E2 /* SupplyDeliveryTests.swift in Sources */, EE02F7E91ACF259B00179969 /* RiskAssessmentTests.swift in Sources */, - EE65DB5C1CB39FE200E25C72 /* DecisionSupportServiceModuleTests.swift in Sources */, EE02F7D51ACF259B00179969 /* PractitionerTests.swift in Sources */, - EE65DB5E1CB39FE200E25C72 /* GuidanceResponseTests.swift in Sources */, EE02F7EB1ACF259B00179969 /* ScheduleTests.swift in Sources */, - EE65DB5F1CB39FE200E25C72 /* ImagingExcerptTests.swift in Sources */, EE02F7991ACF259B00179969 /* FamilyMemberHistoryTests.swift in Sources */, EE02F7AB1ACF259B00179969 /* ImmunizationTests.swift in Sources */, EE02F76F1ACF259B00179969 /* ContractTests.swift in Sources */, @@ -1987,19 +1750,15 @@ EE02F7651ACF259B00179969 /* CommunicationTests.swift in Sources */, EE02F77F1ACF259B00179969 /* DeviceUseRequestTests.swift in Sources */, EE02F7951ACF259B00179969 /* EpisodeOfCareTests.swift in Sources */, - EE65DB681CB39FE200E25C72 /* StructureMapTests.swift in Sources */, EEF20DAE1A5D4ECD009A6EDA /* ExtensionsTest.swift in Sources */, - EE65DB651CB39FE200E25C72 /* PractitionerRoleTests.swift in Sources */, EE3906A01CD3E4F6008FECEA /* RequestTests.swift in Sources */, EE02F7591ACF259B00179969 /* BundleTests.swift in Sources */, - EE69402A1D2EAA4C00D6DCA1 /* ProtocolFHIRTests.swift in Sources */, EE02F7731ACF259B00179969 /* CoverageTests.swift in Sources */, EE1F49D61C0D14F60095BF0F /* ReferenceTests.swift in Sources */, EE02F7BB1ACF259B00179969 /* MessageHeaderTests.swift in Sources */, EE02F7FD1ACF259B00179969 /* VisionPrescriptionTests.swift in Sources */, EE02F7611ACF259B00179969 /* ClinicalImpressionTests.swift in Sources */, EE02F7F51ACF259B00179969 /* SubscriptionTests.swift in Sources */, - EE65DB691CB39FE200E25C72 /* TaskTests.swift in Sources */, EE02F7A11ACF259B00179969 /* GroupTests.swift in Sources */, EE02F7791ACF259B00179969 /* DeviceComponentTests.swift in Sources */, EE02F7C91ACF259B00179969 /* OrganizationTests.swift in Sources */, @@ -2007,16 +1766,12 @@ EE02F78D1ACF259B00179969 /* EligibilityResponseTests.swift in Sources */, EE02F7BF1ACF259B00179969 /* NutritionOrderTests.swift in Sources */, EE02F7CD1ACF259B00179969 /* PatientTests.swift in Sources */, - EE65DB5B1CB39FE200E25C72 /* DecisionSupportRuleTests.swift in Sources */, EEEE31121BB1FE32008866E2 /* ImplementationGuideTests.swift in Sources */, EE02F77D1ACF259B00179969 /* DeviceTests.swift in Sources */, - EE65DB5A1CB39FE200E25C72 /* CodeSystemTests.swift in Sources */, EE02F79D1ACF259B00179969 /* FlagTests.swift in Sources */, EE02F7E51ACF259B00179969 /* ReferralRequestTests.swift in Sources */, EEEE31141BB1FE32008866E2 /* OperationDefinitionTests.swift in Sources */, EE02F76B1ACF259B00179969 /* ConditionTests.swift in Sources */, - EE65DB671CB39FE200E25C72 /* SequenceTests.swift in Sources */, - EE65DB591CB39FE200E25C72 /* CareTeamTests.swift in Sources */, EE02F7AD1ACF259B00179969 /* ListTests.swift in Sources */, EE02F7511ACF259B00179969 /* AuditEventTests.swift in Sources */, EE02F7FB1ACF259B00179969 /* ValueSetTests.swift in Sources */, @@ -2045,7 +1800,6 @@ EE02F7C11ACF259B00179969 /* ObservationTests.swift in Sources */, EE02F7AF1ACF259B00179969 /* LocationTests.swift in Sources */, EE02F7D31ACF259B00179969 /* PersonTests.swift in Sources */, - EE65DB5D1CB39FE200E25C72 /* ExpansionProfileTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Tests/ModelTests/AccountTests.swift b/Tests/ModelTests/AccountTests.swift index 9cb6d2cc..0450ab92 100644 --- a/Tests/ModelTests/AccountTests.swift +++ b/Tests/ModelTests/AccountTests.swift @@ -2,7 +2,7 @@ // AccountTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/AllergyIntoleranceTests.swift b/Tests/ModelTests/AllergyIntoleranceTests.swift index 4896646f..ec009208 100644 --- a/Tests/ModelTests/AllergyIntoleranceTests.swift +++ b/Tests/ModelTests/AllergyIntoleranceTests.swift @@ -2,7 +2,7 @@ // AllergyIntoleranceTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -37,19 +37,13 @@ class AllergyIntoleranceTests: XCTestCase { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "allergyintolerance-example.json") XCTAssertEqual(inst.category, "food") - XCTAssertEqual(inst.criticality, "high") + XCTAssertEqual(inst.criticality, "CRITH") XCTAssertEqual(inst.id, "example") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://acme.com/ids/patients/risks") XCTAssertEqual(inst.identifier?[0].value, "49476534") XCTAssertEqual(inst.lastOccurence?.description, "2012-06") - XCTAssertEqual(inst.note?[0].text, "The criticality is high becasue of the observed anaphylactic reaction when challenged with cashew extract.") - XCTAssertEqual(inst.onset?.description, "2004") XCTAssertEqual(inst.patient?.reference, "Patient/example") - XCTAssertEqual(inst.reaction?[0].certainty, "confirmed") - XCTAssertEqual(inst.reaction?[0].description_fhir, "Challenge Protocol. Severe reaction to subcutaneous cashew extract. Epinephrine administered") - XCTAssertEqual(inst.reaction?[0].exposureRoute?.coding?[0].code, "34206005") - XCTAssertEqual(inst.reaction?[0].exposureRoute?.coding?[0].display, "Subcutaneous route") - XCTAssertEqual(inst.reaction?[0].exposureRoute?.coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.reaction?[0].description_fhir, "Challenge Protocol. Severe Reaction to 1/8 cashew. Epinephrine administered") XCTAssertEqual(inst.reaction?[0].manifestation?[0].coding?[0].code, "39579001") XCTAssertEqual(inst.reaction?[0].manifestation?[0].coding?[0].display, "Anaphylactic reaction") XCTAssertEqual(inst.reaction?[0].manifestation?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") @@ -62,12 +56,10 @@ class AllergyIntoleranceTests: XCTestCase { XCTAssertEqual(inst.reaction?[1].manifestation?[0].coding?[0].code, "64305001") XCTAssertEqual(inst.reaction?[1].manifestation?[0].coding?[0].display, "Urticaria") XCTAssertEqual(inst.reaction?[1].manifestation?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.reaction?[1].note?[0].text, "The patient reports that the onset of urticaria was within 15 minutes of eating cashews.") XCTAssertEqual(inst.reaction?[1].onset?.description, "2004") XCTAssertEqual(inst.reaction?[1].severity, "moderate") XCTAssertEqual(inst.recordedDate?.description, "2014-10-09T14:58:00+11:00") XCTAssertEqual(inst.recorder?.reference, "Practitioner/example") - XCTAssertEqual(inst.reporter?.reference, "Patient/example") XCTAssertEqual(inst.status, "confirmed") XCTAssertEqual(inst.substance?.coding?[0].code, "227493005") XCTAssertEqual(inst.substance?.coding?[0].display, "Cashew nuts") diff --git a/Tests/ModelTests/AppointmentResponseTests.swift b/Tests/ModelTests/AppointmentResponseTests.swift index 20d169dc..8732a483 100644 --- a/Tests/ModelTests/AppointmentResponseTests.swift +++ b/Tests/ModelTests/AppointmentResponseTests.swift @@ -2,7 +2,7 @@ // AppointmentResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -46,8 +46,7 @@ class AppointmentResponseTests: XCTestCase { XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://example.org/sampleappointmentresponse-identifier") XCTAssertEqual(inst.identifier?[0].value, "response123") XCTAssertEqual(inst.participantStatus, "tentative") - XCTAssertEqual(inst.participantType?[0].coding?[0].code, "ATND") - XCTAssertEqual(inst.participantType?[0].coding?[0].system?.absoluteString, "http://hl7.org/fhir/v3/ParticipationType") + XCTAssertEqual(inst.participantType?[0].coding?[0].code, "attending") XCTAssertEqual(inst.start?.description, "2013-12-25T13:15:00Z") XCTAssertEqual(inst.text?.div, "
Accept Brian MRI results discussion
") XCTAssertEqual(inst.text?.status, "generated") diff --git a/Tests/ModelTests/AppointmentTests.swift b/Tests/ModelTests/AppointmentTests.swift index 15c1297b..c98b085f 100644 --- a/Tests/ModelTests/AppointmentTests.swift +++ b/Tests/ModelTests/AppointmentTests.swift @@ -2,7 +2,7 @@ // AppointmentTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -36,11 +36,7 @@ class AppointmentTests: XCTestCase { func runAppointment1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Appointment { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "appointment-example-request.json") - XCTAssertEqual(inst.appointmentType?.coding?[0].code, "wi") - XCTAssertEqual(inst.appointmentType?.coding?[0].display, "Walk in") - XCTAssertEqual(inst.appointmentType?.coding?[0].system?.absoluteString, "http://example.org/appointment-type") XCTAssertEqual(inst.comment, "Further expand on the results of the MRI and determine the next actions that may be appropriate.") - XCTAssertEqual(inst.created?.description, "2015-12-02") XCTAssertEqual(inst.description_fhir, "Discussion on the results of your recent MRI") XCTAssertEqual(inst.id, "examplereq") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://example.org/sampleappointment-identifier") @@ -52,26 +48,19 @@ class AppointmentTests: XCTestCase { XCTAssertEqual(inst.participant?[0].status, "needs-action") XCTAssertEqual(inst.participant?[1].required, "required") XCTAssertEqual(inst.participant?[1].status, "needs-action") - XCTAssertEqual(inst.participant?[1].type?[0].coding?[0].code, "ATND") - XCTAssertEqual(inst.participant?[1].type?[0].coding?[0].system?.absoluteString, "http://hl7.org/fhir/v3/ParticipationType") + XCTAssertEqual(inst.participant?[1].type?[0].coding?[0].code, "attending") XCTAssertEqual(inst.participant?[2].actor?.display, "South Wing, second floor") XCTAssertEqual(inst.participant?[2].actor?.reference, "Location/1") XCTAssertEqual(inst.participant?[2].required, "required") XCTAssertEqual(inst.participant?[2].status, "accepted") XCTAssertEqual(inst.priority, UInt(5)) - XCTAssertEqual(inst.reason?.coding?[0].code, "413095006") - XCTAssertEqual(inst.reason?.coding?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.reason?.text, "Clinical Review") - XCTAssertEqual(inst.serviceCategory?.coding?[0].code, "gp") - XCTAssertEqual(inst.serviceCategory?.coding?[0].display, "General Practice") - XCTAssertEqual(inst.serviceCategory?.coding?[0].system?.absoluteString, "http://example.org/service-category") XCTAssertEqual(inst.slot?[0].reference, "Slot/example") - XCTAssertEqual(inst.specialty?[0].coding?[0].code, "gp") - XCTAssertEqual(inst.specialty?[0].coding?[0].display, "General Practice") - XCTAssertEqual(inst.specialty?[0].coding?[0].system?.absoluteString, "http://example.org/specialty") XCTAssertEqual(inst.status, "proposed") XCTAssertEqual(inst.text?.div, "
Brian MRI results discussion
") XCTAssertEqual(inst.text?.status, "generated") + XCTAssertEqual(inst.type?.coding?[0].code, "52") + XCTAssertEqual(inst.type?.coding?[0].display, "General Discussion") return inst } @@ -90,11 +79,7 @@ class AppointmentTests: XCTestCase { func runAppointment2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Appointment { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "appointment-example.json") - XCTAssertEqual(inst.appointmentType?.coding?[0].code, "follow") - XCTAssertEqual(inst.appointmentType?.coding?[0].display, "Followup") - XCTAssertEqual(inst.appointmentType?.coding?[0].system?.absoluteString, "http://example.org/appointment-type") XCTAssertEqual(inst.comment, "Further expand on the results of the MRI and determine the next actions that may be appropriate.") - XCTAssertEqual(inst.created?.description, "2013-10-10") XCTAssertEqual(inst.description_fhir, "Discussion on the results of your recent MRI") XCTAssertEqual(inst.end?.description, "2013-12-10T11:00:00Z") XCTAssertEqual(inst.id, "example") @@ -106,25 +91,18 @@ class AppointmentTests: XCTestCase { XCTAssertEqual(inst.participant?[1].actor?.reference, "Practitioner/example") XCTAssertEqual(inst.participant?[1].required, "required") XCTAssertEqual(inst.participant?[1].status, "accepted") - XCTAssertEqual(inst.participant?[1].type?[0].coding?[0].code, "ATND") - XCTAssertEqual(inst.participant?[1].type?[0].coding?[0].system?.absoluteString, "http://hl7.org/fhir/v3/ParticipationType") + XCTAssertEqual(inst.participant?[1].type?[0].coding?[0].code, "attending") XCTAssertEqual(inst.participant?[2].actor?.display, "South Wing, second floor") XCTAssertEqual(inst.participant?[2].actor?.reference, "Location/1") XCTAssertEqual(inst.participant?[2].required, "required") XCTAssertEqual(inst.participant?[2].status, "accepted") XCTAssertEqual(inst.priority, UInt(5)) - XCTAssertEqual(inst.serviceCategory?.coding?[0].code, "gp") - XCTAssertEqual(inst.serviceCategory?.coding?[0].display, "General Practice") - XCTAssertEqual(inst.serviceCategory?.coding?[0].system?.absoluteString, "http://example.org/service-category") - XCTAssertEqual(inst.serviceType?[0].coding?[0].code, "52") - XCTAssertEqual(inst.serviceType?[0].coding?[0].display, "General Discussion") - XCTAssertEqual(inst.specialty?[0].coding?[0].code, "gp") - XCTAssertEqual(inst.specialty?[0].coding?[0].display, "General Practice") - XCTAssertEqual(inst.specialty?[0].coding?[0].system?.absoluteString, "http://example.org/specialty") XCTAssertEqual(inst.start?.description, "2013-12-10T09:00:00Z") XCTAssertEqual(inst.status, "booked") XCTAssertEqual(inst.text?.div, "
Brian MRI results discussion
") XCTAssertEqual(inst.text?.status, "generated") + XCTAssertEqual(inst.type?.coding?[0].code, "52") + XCTAssertEqual(inst.type?.coding?[0].display, "General Discussion") return inst } @@ -143,9 +121,6 @@ class AppointmentTests: XCTestCase { func runAppointment3(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Appointment { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "appointment-example2doctors.json") - XCTAssertEqual(inst.appointmentType?.coding?[0].code, "wi") - XCTAssertEqual(inst.appointmentType?.coding?[0].display, "Walk in") - XCTAssertEqual(inst.appointmentType?.coding?[0].system?.absoluteString, "http://example.org/appointment-type") XCTAssertEqual(inst.comment, "Clarify the results of the MRI to ensure context of test was correct") XCTAssertEqual(inst.description_fhir, "Discussion about Peter Chalmers MRI results") XCTAssertEqual(inst.end?.description, "2013-12-09T11:00:00Z") @@ -166,18 +141,12 @@ class AppointmentTests: XCTestCase { XCTAssertEqual(inst.participant?[3].required, "information-only") XCTAssertEqual(inst.participant?[3].status, "accepted") XCTAssertEqual(inst.priority, UInt(5)) - XCTAssertEqual(inst.serviceCategory?.coding?[0].code, "gp") - XCTAssertEqual(inst.serviceCategory?.coding?[0].display, "General Practice") - XCTAssertEqual(inst.serviceCategory?.coding?[0].system?.absoluteString, "http://example.org/service-category") - XCTAssertEqual(inst.serviceType?[0].coding?[0].code, "52") - XCTAssertEqual(inst.serviceType?[0].coding?[0].display, "General Discussion") - XCTAssertEqual(inst.specialty?[0].coding?[0].code, "gp") - XCTAssertEqual(inst.specialty?[0].coding?[0].display, "General Practice") - XCTAssertEqual(inst.specialty?[0].coding?[0].system?.absoluteString, "http://example.org/specialty") XCTAssertEqual(inst.start?.description, "2013-12-09T09:00:00Z") XCTAssertEqual(inst.status, "booked") XCTAssertEqual(inst.text?.div, "
Brian MRI results discussion
") XCTAssertEqual(inst.text?.status, "generated") + XCTAssertEqual(inst.type?.coding?[0].code, "52") + XCTAssertEqual(inst.type?.coding?[0].display, "General Discussion") return inst } diff --git a/Tests/ModelTests/AuditEventTests.swift b/Tests/ModelTests/AuditEventTests.swift index 2c14a50c..185e9c61 100644 --- a/Tests/ModelTests/AuditEventTests.swift +++ b/Tests/ModelTests/AuditEventTests.swift @@ -2,7 +2,7 @@ // AuditEventTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -36,28 +36,28 @@ class AuditEventTests: XCTestCase { func runAuditEvent1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.AuditEvent { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "audit-event-example-login.json") - XCTAssertEqual(inst.action, "E") - XCTAssertEqual(inst.agent?[0].altId, "601847123") - XCTAssertEqual(inst.agent?[0].name, "Grahame Grieve") - XCTAssertEqual(inst.agent?[0].network?.address, "127.0.0.1") - XCTAssertEqual(inst.agent?[0].network?.type, "2") - XCTAssertTrue(inst.agent?[0].requestor ?? false) - XCTAssertEqual(inst.agent?[0].userId?.value, "95") + XCTAssertEqual(inst.event?.action, "E") + XCTAssertEqual(inst.event?.dateTime?.description, "2013-06-20T23:41:23Z") + XCTAssertEqual(inst.event?.outcome, "0") + XCTAssertEqual(inst.event?.subtype?[0].code, "110122") + XCTAssertEqual(inst.event?.subtype?[0].display, "Login") + XCTAssertEqual(inst.event?.subtype?[0].system?.absoluteString, "http://nema.org/dicom/dicm") + XCTAssertEqual(inst.event?.type?.code, "110114") + XCTAssertEqual(inst.event?.type?.display, "User Authentication") + XCTAssertEqual(inst.event?.type?.system?.absoluteString, "http://nema.org/dicom/dicm") XCTAssertEqual(inst.id, "example-login") - XCTAssertEqual(inst.outcome, "0") - XCTAssertEqual(inst.recorded?.description, "2013-06-20T23:41:23Z") + XCTAssertEqual(inst.participant?[0].altId, "601847123") + XCTAssertEqual(inst.participant?[0].name, "Grahame Grieve") + XCTAssertEqual(inst.participant?[0].network?.address, "127.0.0.1") + XCTAssertEqual(inst.participant?[0].network?.type, "2") + XCTAssertTrue(inst.participant?[0].requestor ?? false) + XCTAssertEqual(inst.participant?[0].userId?.value, "95") XCTAssertEqual(inst.source?.identifier?.value, "hl7connect.healthintersections.com.au") XCTAssertEqual(inst.source?.site, "Cloud") XCTAssertEqual(inst.source?.type?[0].code, "3") XCTAssertEqual(inst.source?.type?[0].display, "Web Server") XCTAssertEqual(inst.source?.type?[0].system?.absoluteString, "http://hl7.org/fhir/security-source-type") - XCTAssertEqual(inst.subtype?[0].code, "110122") - XCTAssertEqual(inst.subtype?[0].display, "Login") - XCTAssertEqual(inst.subtype?[0].system?.absoluteString, "http://nema.org/dicom/dicm") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type?.code, "110114") - XCTAssertEqual(inst.type?.display, "User Authentication") - XCTAssertEqual(inst.type?.system?.absoluteString, "http://nema.org/dicom/dicm") return inst } @@ -76,28 +76,28 @@ class AuditEventTests: XCTestCase { func runAuditEvent2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.AuditEvent { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "audit-event-example-logout.json") - XCTAssertEqual(inst.action, "E") - XCTAssertEqual(inst.agent?[0].altId, "601847123") - XCTAssertEqual(inst.agent?[0].name, "Grahame Grieve") - XCTAssertEqual(inst.agent?[0].network?.address, "127.0.0.1") - XCTAssertEqual(inst.agent?[0].network?.type, "2") - XCTAssertTrue(inst.agent?[0].requestor ?? false) - XCTAssertEqual(inst.agent?[0].userId?.value, "95") + XCTAssertEqual(inst.event?.action, "E") + XCTAssertEqual(inst.event?.dateTime?.description, "2013-06-20T23:46:41Z") + XCTAssertEqual(inst.event?.outcome, "0") + XCTAssertEqual(inst.event?.subtype?[0].code, "110123") + XCTAssertEqual(inst.event?.subtype?[0].display, "Logout") + XCTAssertEqual(inst.event?.subtype?[0].system?.absoluteString, "http://nema.org/dicom/dicm") + XCTAssertEqual(inst.event?.type?.code, "110114") + XCTAssertEqual(inst.event?.type?.display, "User Authentication") + XCTAssertEqual(inst.event?.type?.system?.absoluteString, "http://nema.org/dicom/dicm") XCTAssertEqual(inst.id, "example-logout") - XCTAssertEqual(inst.outcome, "0") - XCTAssertEqual(inst.recorded?.description, "2013-06-20T23:46:41Z") + XCTAssertEqual(inst.participant?[0].altId, "601847123") + XCTAssertEqual(inst.participant?[0].name, "Grahame Grieve") + XCTAssertEqual(inst.participant?[0].network?.address, "127.0.0.1") + XCTAssertEqual(inst.participant?[0].network?.type, "2") + XCTAssertTrue(inst.participant?[0].requestor ?? false) + XCTAssertEqual(inst.participant?[0].userId?.value, "95") XCTAssertEqual(inst.source?.identifier?.value, "hl7connect.healthintersections.com.au") XCTAssertEqual(inst.source?.site, "Cloud") XCTAssertEqual(inst.source?.type?[0].code, "3") XCTAssertEqual(inst.source?.type?[0].display, "Web Server") XCTAssertEqual(inst.source?.type?[0].system?.absoluteString, "http://hl7.org/fhir/security-source-type") - XCTAssertEqual(inst.subtype?[0].code, "110123") - XCTAssertEqual(inst.subtype?[0].display, "Logout") - XCTAssertEqual(inst.subtype?[0].system?.absoluteString, "http://nema.org/dicom/dicm") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type?.code, "110114") - XCTAssertEqual(inst.type?.display, "User Authentication") - XCTAssertEqual(inst.type?.system?.absoluteString, "http://nema.org/dicom/dicm") return inst } @@ -116,53 +116,53 @@ class AuditEventTests: XCTestCase { func runAuditEvent3(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.AuditEvent { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "audit-event-example-media.json") - XCTAssertEqual(inst.action, "R") - XCTAssertFalse(inst.agent?[0].requestor ?? true) - XCTAssertEqual(inst.agent?[0].role?[0].coding?[0].code, "110153") - XCTAssertEqual(inst.agent?[0].role?[0].coding?[0].display, "Source Role ID") - XCTAssertEqual(inst.agent?[0].role?[0].coding?[0].system?.absoluteString, "http://nema.org/dicom/dicm") - XCTAssertEqual(inst.agent?[0].userId?.value, "ExportToMedia.app") - XCTAssertEqual(inst.agent?[1].altId, "601847123") - XCTAssertEqual(inst.agent?[1].name, "Grahame Grieve") - XCTAssertTrue(inst.agent?[1].requestor ?? false) - XCTAssertEqual(inst.agent?[1].userId?.value, "95") - XCTAssertEqual(inst.agent?[2].media?.code, "110033") - XCTAssertEqual(inst.agent?[2].media?.display, "DVD") - XCTAssertEqual(inst.agent?[2].media?.system?.absoluteString, "http://nema.org/dicom/dicm") - XCTAssertEqual(inst.agent?[2].name, "Media title: Hello World") - XCTAssertFalse(inst.agent?[2].requestor ?? true) - XCTAssertEqual(inst.entity?[0].identifier?.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") - XCTAssertEqual(inst.entity?[0].role?.code, "1") - XCTAssertEqual(inst.entity?[0].role?.display, "Patient") - XCTAssertEqual(inst.entity?[0].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") - XCTAssertEqual(inst.entity?[0].type?.code, "1") - XCTAssertEqual(inst.entity?[0].type?.display, "Person") - XCTAssertEqual(inst.entity?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") - XCTAssertEqual(inst.entity?[1].identifier?.type?.coding?[0].code, "IHE XDS Metadata") - XCTAssertEqual(inst.entity?[1].identifier?.type?.coding?[0].display, "submission set classificationNode") - XCTAssertEqual(inst.entity?[1].identifier?.type?.coding?[0].system?.absoluteString, "urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd") - XCTAssertEqual(inst.entity?[1].identifier?.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") - XCTAssertEqual(inst.entity?[1].role?.code, "20") - XCTAssertEqual(inst.entity?[1].role?.display, "Job") - XCTAssertEqual(inst.entity?[1].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") - XCTAssertEqual(inst.entity?[1].type?.code, "2") - XCTAssertEqual(inst.entity?[1].type?.display, "System Object") - XCTAssertEqual(inst.entity?[1].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") - XCTAssertEqual(inst.entity?[2].reference?.reference, "DocumentManifest/example") - XCTAssertEqual(inst.entity?[2].type?.code, "2") - XCTAssertEqual(inst.entity?[2].type?.display, "System Object") - XCTAssertEqual(inst.entity?[2].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.event?.action, "R") + XCTAssertEqual(inst.event?.dateTime?.description, "2015-08-27T23:42:24Z") + XCTAssertEqual(inst.event?.outcome, "0") + XCTAssertEqual(inst.event?.subtype?[0].code, "ITI-32") + XCTAssertEqual(inst.event?.subtype?[0].display, "Distribute Document Set on Media") + XCTAssertEqual(inst.event?.subtype?[0].system?.absoluteString, "urn:oid:1.3.6.1.4.1.19376.1.2") + XCTAssertEqual(inst.event?.type?.code, "110106") + XCTAssertEqual(inst.event?.type?.display, "Export") + XCTAssertEqual(inst.event?.type?.system?.absoluteString, "http://nema.org/dicom/dicm") XCTAssertEqual(inst.id, "example-media") - XCTAssertEqual(inst.outcome, "0") - XCTAssertEqual(inst.recorded?.description, "2015-08-27T23:42:24Z") + XCTAssertEqual(inst.object?[0].identifier?.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") + XCTAssertEqual(inst.object?[0].role?.code, "1") + XCTAssertEqual(inst.object?[0].role?.display, "Patient") + XCTAssertEqual(inst.object?[0].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") + XCTAssertEqual(inst.object?[0].type?.code, "1") + XCTAssertEqual(inst.object?[0].type?.display, "Person") + XCTAssertEqual(inst.object?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.object?[1].identifier?.type?.coding?[0].code, "IHE XDS Metadata") + XCTAssertEqual(inst.object?[1].identifier?.type?.coding?[0].display, "submission set classificationNode") + XCTAssertEqual(inst.object?[1].identifier?.type?.coding?[0].system?.absoluteString, "urn:uuid:a54d6aa5-d40d-43f9-88c5-b4633d873bdd") + XCTAssertEqual(inst.object?[1].identifier?.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") + XCTAssertEqual(inst.object?[1].role?.code, "20") + XCTAssertEqual(inst.object?[1].role?.display, "Job") + XCTAssertEqual(inst.object?[1].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") + XCTAssertEqual(inst.object?[1].type?.code, "2") + XCTAssertEqual(inst.object?[1].type?.display, "System Object") + XCTAssertEqual(inst.object?[1].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.object?[2].reference?.reference, "DocumentManifest/example") + XCTAssertEqual(inst.object?[2].type?.code, "2") + XCTAssertEqual(inst.object?[2].type?.display, "System Object") + XCTAssertEqual(inst.object?[2].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertFalse(inst.participant?[0].requestor ?? true) + XCTAssertEqual(inst.participant?[0].role?[0].coding?[0].code, "110153") + XCTAssertEqual(inst.participant?[0].role?[0].coding?[0].display, "Source Role ID") + XCTAssertEqual(inst.participant?[0].role?[0].coding?[0].system?.absoluteString, "http://nema.org/dicom/dicm") + XCTAssertEqual(inst.participant?[0].userId?.value, "ExportToMedia.app") + XCTAssertEqual(inst.participant?[1].altId, "601847123") + XCTAssertEqual(inst.participant?[1].name, "Grahame Grieve") + XCTAssertTrue(inst.participant?[1].requestor ?? false) + XCTAssertEqual(inst.participant?[1].userId?.value, "95") + XCTAssertEqual(inst.participant?[2].media?.code, "110033") + XCTAssertEqual(inst.participant?[2].media?.display, "DVD") + XCTAssertEqual(inst.participant?[2].media?.system?.absoluteString, "http://nema.org/dicom/dicm") + XCTAssertEqual(inst.participant?[2].name, "Media title: Hello World") + XCTAssertFalse(inst.participant?[2].requestor ?? true) XCTAssertEqual(inst.source?.identifier?.value, "hl7connect.healthintersections.com.au") - XCTAssertEqual(inst.subtype?[0].code, "ITI-32") - XCTAssertEqual(inst.subtype?[0].display, "Distribute Document Set on Media") - XCTAssertEqual(inst.subtype?[0].system?.absoluteString, "urn:oid:1.3.6.1.4.1.19376.1.2") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type?.code, "110106") - XCTAssertEqual(inst.type?.display, "Export") - XCTAssertEqual(inst.type?.system?.absoluteString, "http://nema.org/dicom/dicm") return inst } @@ -181,45 +181,45 @@ class AuditEventTests: XCTestCase { func runAuditEvent4(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.AuditEvent { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "audit-event-example-pixQuery.json") - XCTAssertEqual(inst.action, "E") - XCTAssertEqual(inst.agent?[0].altId, "6580") - XCTAssertEqual(inst.agent?[0].network?.address, "Workstation1.ehr.familyclinic.com") - XCTAssertEqual(inst.agent?[0].network?.type, "1") - XCTAssertFalse(inst.agent?[0].requestor ?? true) - XCTAssertEqual(inst.agent?[0].role?[0].coding?[0].code, "110153") - XCTAssertEqual(inst.agent?[0].role?[0].coding?[0].display, "Source Role ID") - XCTAssertEqual(inst.agent?[0].role?[0].coding?[0].system?.absoluteString, "http://nema.org/dicom/dicm") - XCTAssertEqual(inst.agent?[0].userId?.value, "2.16.840.1.113883.4.2|2.16.840.1.113883.4.2") - XCTAssertEqual(inst.agent?[1].altId, "601847123") - XCTAssertEqual(inst.agent?[1].name, "Grahame Grieve") - XCTAssertTrue(inst.agent?[1].requestor ?? false) - XCTAssertEqual(inst.agent?[1].userId?.value, "95") - XCTAssertEqual(inst.entity?[0].identifier?.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") - XCTAssertEqual(inst.entity?[0].role?.code, "1") - XCTAssertEqual(inst.entity?[0].role?.display, "Patient") - XCTAssertEqual(inst.entity?[0].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") - XCTAssertEqual(inst.entity?[0].type?.code, "1") - XCTAssertEqual(inst.entity?[0].type?.display, "Person") - XCTAssertEqual(inst.entity?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") - XCTAssertEqual(inst.entity?[1].detail?[0].type, "MSH-10") - XCTAssertEqual(inst.entity?[1].detail?[0].value, Base64Binary(value: "MS4yLjg0MC4xMTQzNTAuMS4xMy4wLjEuNy4xLjE=")) - XCTAssertEqual(inst.entity?[1].role?.code, "24") - XCTAssertEqual(inst.entity?[1].role?.display, "Query") - XCTAssertEqual(inst.entity?[1].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") - XCTAssertEqual(inst.entity?[1].type?.code, "2") - XCTAssertEqual(inst.entity?[1].type?.display, "System Object") - XCTAssertEqual(inst.entity?[1].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.event?.action, "E") + XCTAssertEqual(inst.event?.dateTime?.description, "2015-08-26T23:42:24Z") + XCTAssertEqual(inst.event?.outcome, "0") + XCTAssertEqual(inst.event?.subtype?[0].code, "ITI-9") + XCTAssertEqual(inst.event?.subtype?[0].display, "PIX Query") + XCTAssertEqual(inst.event?.subtype?[0].system?.absoluteString, "urn:oid:1.3.6.1.4.1.19376.1.2") + XCTAssertEqual(inst.event?.type?.code, "110112") + XCTAssertEqual(inst.event?.type?.display, "Query") + XCTAssertEqual(inst.event?.type?.system?.absoluteString, "http://nema.org/dicom/dicm") XCTAssertEqual(inst.id, "example-pixQuery") - XCTAssertEqual(inst.outcome, "0") - XCTAssertEqual(inst.recorded?.description, "2015-08-26T23:42:24Z") + XCTAssertEqual(inst.object?[0].identifier?.value, "e3cdfc81a0d24bd^^^&2.16.840.1.113883.4.2&ISO") + XCTAssertEqual(inst.object?[0].role?.code, "1") + XCTAssertEqual(inst.object?[0].role?.display, "Patient") + XCTAssertEqual(inst.object?[0].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") + XCTAssertEqual(inst.object?[0].type?.code, "1") + XCTAssertEqual(inst.object?[0].type?.display, "Person") + XCTAssertEqual(inst.object?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.object?[1].detail?[0].type, "MSH-10") + XCTAssertEqual(inst.object?[1].detail?[0].value, Base64Binary(value: "MS4yLjg0MC4xMTQzNTAuMS4xMy4wLjEuNy4xLjE=")) + XCTAssertEqual(inst.object?[1].role?.code, "24") + XCTAssertEqual(inst.object?[1].role?.display, "Query") + XCTAssertEqual(inst.object?[1].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") + XCTAssertEqual(inst.object?[1].type?.code, "2") + XCTAssertEqual(inst.object?[1].type?.display, "System Object") + XCTAssertEqual(inst.object?[1].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.participant?[0].altId, "6580") + XCTAssertEqual(inst.participant?[0].network?.address, "Workstation1.ehr.familyclinic.com") + XCTAssertEqual(inst.participant?[0].network?.type, "1") + XCTAssertFalse(inst.participant?[0].requestor ?? true) + XCTAssertEqual(inst.participant?[0].role?[0].coding?[0].code, "110153") + XCTAssertEqual(inst.participant?[0].role?[0].coding?[0].display, "Source Role ID") + XCTAssertEqual(inst.participant?[0].role?[0].coding?[0].system?.absoluteString, "http://nema.org/dicom/dicm") + XCTAssertEqual(inst.participant?[0].userId?.value, "2.16.840.1.113883.4.2|2.16.840.1.113883.4.2") + XCTAssertEqual(inst.participant?[1].altId, "601847123") + XCTAssertEqual(inst.participant?[1].name, "Grahame Grieve") + XCTAssertTrue(inst.participant?[1].requestor ?? false) + XCTAssertEqual(inst.participant?[1].userId?.value, "95") XCTAssertEqual(inst.source?.identifier?.value, "hl7connect.healthintersections.com.au") - XCTAssertEqual(inst.subtype?[0].code, "ITI-9") - XCTAssertEqual(inst.subtype?[0].display, "PIX Query") - XCTAssertEqual(inst.subtype?[0].system?.absoluteString, "urn:oid:1.3.6.1.4.1.19376.1.2") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type?.code, "110112") - XCTAssertEqual(inst.type?.display, "Query") - XCTAssertEqual(inst.type?.system?.absoluteString, "http://nema.org/dicom/dicm") return inst } @@ -238,33 +238,33 @@ class AuditEventTests: XCTestCase { func runAuditEvent5(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.AuditEvent { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "audit-event-example-search.json") - XCTAssertEqual(inst.action, "E") - XCTAssertEqual(inst.agent?[0].altId, "601847123") - XCTAssertEqual(inst.agent?[0].name, "Grahame Grieve") - XCTAssertTrue(inst.agent?[0].requestor ?? false) - XCTAssertEqual(inst.agent?[0].userId?.value, "95") - XCTAssertEqual(inst.entity?[0].query, Base64Binary(value: "aHR0cDovL2ZoaXItZGV2LmhlYWx0aGludGVyc2VjdGlvbnMuY29tLmF1L29wZW4vRW5jb3VudGVyP3BhcnRpY2lwYW50PTEz")) - XCTAssertEqual(inst.entity?[0].role?.code, "24") - XCTAssertEqual(inst.entity?[0].role?.display, "Query") - XCTAssertEqual(inst.entity?[0].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") - XCTAssertEqual(inst.entity?[0].type?.code, "2") - XCTAssertEqual(inst.entity?[0].type?.display, "System Object") - XCTAssertEqual(inst.entity?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.event?.action, "E") + XCTAssertEqual(inst.event?.dateTime?.description, "2015-08-22T23:42:24Z") + XCTAssertEqual(inst.event?.outcome, "0") + XCTAssertEqual(inst.event?.subtype?[0].code, "search") + XCTAssertEqual(inst.event?.subtype?[0].display, "search") + XCTAssertEqual(inst.event?.subtype?[0].system?.absoluteString, "http://hl7.org/fhir/restful-interaction") + XCTAssertEqual(inst.event?.type?.code, "rest") + XCTAssertEqual(inst.event?.type?.display, "Restful Operation") + XCTAssertEqual(inst.event?.type?.system?.absoluteString, "http://hl7.org/fhir/audit-event-type") XCTAssertEqual(inst.id, "example-search") - XCTAssertEqual(inst.outcome, "0") - XCTAssertEqual(inst.recorded?.description, "2015-08-22T23:42:24Z") + XCTAssertEqual(inst.object?[0].query, Base64Binary(value: "aHR0cDovL2ZoaXItZGV2LmhlYWx0aGludGVyc2VjdGlvbnMuY29tLmF1L29wZW4vRW5jb3VudGVyP3BhcnRpY2lwYW50PTEz")) + XCTAssertEqual(inst.object?[0].role?.code, "24") + XCTAssertEqual(inst.object?[0].role?.display, "Query") + XCTAssertEqual(inst.object?[0].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") + XCTAssertEqual(inst.object?[0].type?.code, "2") + XCTAssertEqual(inst.object?[0].type?.display, "System Object") + XCTAssertEqual(inst.object?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.participant?[0].altId, "601847123") + XCTAssertEqual(inst.participant?[0].name, "Grahame Grieve") + XCTAssertTrue(inst.participant?[0].requestor ?? false) + XCTAssertEqual(inst.participant?[0].userId?.value, "95") XCTAssertEqual(inst.source?.identifier?.value, "hl7connect.healthintersections.com.au") XCTAssertEqual(inst.source?.site, "Cloud") XCTAssertEqual(inst.source?.type?[0].code, "3") XCTAssertEqual(inst.source?.type?[0].display, "Web Server") XCTAssertEqual(inst.source?.type?[0].system?.absoluteString, "http://hl7.org/fhir/security-source-type") - XCTAssertEqual(inst.subtype?[0].code, "search") - XCTAssertEqual(inst.subtype?[0].display, "search") - XCTAssertEqual(inst.subtype?[0].system?.absoluteString, "http://hl7.org/fhir/restful-interaction") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type?.code, "rest") - XCTAssertEqual(inst.type?.display, "Restful Operation") - XCTAssertEqual(inst.type?.system?.absoluteString, "http://hl7.org/fhir/audit-event-type") return inst } @@ -283,33 +283,33 @@ class AuditEventTests: XCTestCase { func runAuditEvent6(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.AuditEvent { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "audit-event-example-vread.json") - XCTAssertEqual(inst.action, "R") - XCTAssertEqual(inst.agent?[0].altId, "601847123") - XCTAssertEqual(inst.agent?[0].name, "Grahame Grieve") - XCTAssertTrue(inst.agent?[0].requestor ?? false) - XCTAssertEqual(inst.agent?[0].userId?.value, "95") - XCTAssertEqual(inst.entity?[0].lifecycle?.code, "6") - XCTAssertEqual(inst.entity?[0].lifecycle?.display, "Access / Use") - XCTAssertEqual(inst.entity?[0].lifecycle?.system?.absoluteString, "http://hl7.org/fhir/object-lifecycle") - XCTAssertEqual(inst.entity?[0].reference?.reference, "Patient/example/_history/1") - XCTAssertEqual(inst.entity?[0].type?.code, "2") - XCTAssertEqual(inst.entity?[0].type?.display, "System Object") - XCTAssertEqual(inst.entity?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.event?.action, "R") + XCTAssertEqual(inst.event?.dateTime?.description, "2013-06-20T23:42:24Z") + XCTAssertEqual(inst.event?.outcome, "0") + XCTAssertEqual(inst.event?.subtype?[0].code, "vread") + XCTAssertEqual(inst.event?.subtype?[0].display, "vread") + XCTAssertEqual(inst.event?.subtype?[0].system?.absoluteString, "http://hl7.org/fhir/restful-interaction") + XCTAssertEqual(inst.event?.type?.code, "rest") + XCTAssertEqual(inst.event?.type?.display, "Restful Operation") + XCTAssertEqual(inst.event?.type?.system?.absoluteString, "http://hl7.org/fhir/audit-event-type") XCTAssertEqual(inst.id, "example-rest") - XCTAssertEqual(inst.outcome, "0") - XCTAssertEqual(inst.recorded?.description, "2013-06-20T23:42:24Z") + XCTAssertEqual(inst.object?[0].lifecycle?.code, "6") + XCTAssertEqual(inst.object?[0].lifecycle?.display, "Access / Use") + XCTAssertEqual(inst.object?[0].lifecycle?.system?.absoluteString, "http://hl7.org/fhir/object-lifecycle") + XCTAssertEqual(inst.object?[0].reference?.reference, "Patient/example/_history/1") + XCTAssertEqual(inst.object?[0].type?.code, "2") + XCTAssertEqual(inst.object?[0].type?.display, "System Object") + XCTAssertEqual(inst.object?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.participant?[0].altId, "601847123") + XCTAssertEqual(inst.participant?[0].name, "Grahame Grieve") + XCTAssertTrue(inst.participant?[0].requestor ?? false) + XCTAssertEqual(inst.participant?[0].userId?.value, "95") XCTAssertEqual(inst.source?.identifier?.value, "hl7connect.healthintersections.com.au") XCTAssertEqual(inst.source?.site, "Cloud") XCTAssertEqual(inst.source?.type?[0].code, "3") XCTAssertEqual(inst.source?.type?[0].display, "Web Server") XCTAssertEqual(inst.source?.type?[0].system?.absoluteString, "http://hl7.org/fhir/security-source-type") - XCTAssertEqual(inst.subtype?[0].code, "vread") - XCTAssertEqual(inst.subtype?[0].display, "vread") - XCTAssertEqual(inst.subtype?[0].system?.absoluteString, "http://hl7.org/fhir/restful-interaction") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type?.code, "rest") - XCTAssertEqual(inst.type?.display, "Restful Operation") - XCTAssertEqual(inst.type?.system?.absoluteString, "http://hl7.org/fhir/audit-event-type") return inst } @@ -328,77 +328,77 @@ class AuditEventTests: XCTestCase { func runAuditEvent7(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.AuditEvent { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "auditevent-example-disclosure.json") - XCTAssertEqual(inst.action, "R") - XCTAssertEqual(inst.agent?[0].altId, "notMe") - XCTAssertEqual(inst.agent?[0].location?.reference, "Location/1") - XCTAssertEqual(inst.agent?[0].name, "That guy everyone wishes would be caught") - XCTAssertEqual(inst.agent?[0].network?.address, "custodian.net") - XCTAssertEqual(inst.agent?[0].network?.type, "1") - XCTAssertEqual(inst.agent?[0].policy?[0].absoluteString, "http://consent.com/yes") - XCTAssertTrue(inst.agent?[0].requestor ?? false) - XCTAssertEqual(inst.agent?[0].role?[0].coding?[0].code, "110153") - XCTAssertEqual(inst.agent?[0].role?[0].coding?[0].display, "Source Role ID") - XCTAssertEqual(inst.agent?[0].role?[0].coding?[0].system?.absoluteString, "http://nema.org/dicom/dicm") - XCTAssertEqual(inst.agent?[0].userId?.value, "SomeIdiot@nowhere.com") - XCTAssertEqual(inst.agent?[1].network?.address, "marketing.land") - XCTAssertEqual(inst.agent?[1].network?.type, "1") - XCTAssertEqual(inst.agent?[1].purposeOfUse?[0].code, "HMARKT") - XCTAssertEqual(inst.agent?[1].purposeOfUse?[0].display, "healthcare marketing") - XCTAssertEqual(inst.agent?[1].purposeOfUse?[0].system?.absoluteString, "http://hl7.org/fhir/v3/ActReason") - XCTAssertEqual(inst.agent?[1].reference?.reference, "Practitioner/example") - XCTAssertFalse(inst.agent?[1].requestor ?? true) - XCTAssertEqual(inst.agent?[1].role?[0].coding?[0].code, "110152") - XCTAssertEqual(inst.agent?[1].role?[0].coding?[0].display, "Destination Role ID") - XCTAssertEqual(inst.agent?[1].role?[0].coding?[0].system?.absoluteString, "http://nema.org/dicom/dicm") - XCTAssertEqual(inst.agent?[1].userId?.value, "Where") - XCTAssertEqual(inst.entity?[0].reference?.reference, "Patient/example") - XCTAssertEqual(inst.entity?[0].role?.code, "1") - XCTAssertEqual(inst.entity?[0].role?.display, "Patient") - XCTAssertEqual(inst.entity?[0].role?.system?.absoluteString, "http://hl7.org/fhir/valueset-object-role") - XCTAssertEqual(inst.entity?[0].type?.code, "1") - XCTAssertEqual(inst.entity?[0].type?.display, "Person") - XCTAssertEqual(inst.entity?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") - XCTAssertEqual(inst.entity?[1].description_fhir, "data about Everthing important") - XCTAssertEqual(inst.entity?[1].identifier?.value, "What.id") - XCTAssertEqual(inst.entity?[1].lifecycle?.code, "11") - XCTAssertEqual(inst.entity?[1].lifecycle?.display, "Disclosure") - XCTAssertEqual(inst.entity?[1].lifecycle?.system?.absoluteString, "http://hl7.org/fhir/object-lifecycle") - XCTAssertEqual(inst.entity?[1].name, "Namne of What") - XCTAssertEqual(inst.entity?[1].reference?.reference, "Patient/example/_history/1") - XCTAssertEqual(inst.entity?[1].role?.code, "4") - XCTAssertEqual(inst.entity?[1].role?.display, "DomainResource") - XCTAssertEqual(inst.entity?[1].role?.system?.absoluteString, "http://hl7.org/fhir/valueset-object-role") - XCTAssertEqual(inst.entity?[1].securityLabel?[0].code, "V") - XCTAssertEqual(inst.entity?[1].securityLabel?[0].display, "very restricted") - XCTAssertEqual(inst.entity?[1].securityLabel?[0].system?.absoluteString, "http://hl7.org/fhir/v3/Confidentiality") - XCTAssertEqual(inst.entity?[1].securityLabel?[1].code, "STD") - XCTAssertEqual(inst.entity?[1].securityLabel?[1].display, "sexually transmitted disease information sensitivity") - XCTAssertEqual(inst.entity?[1].securityLabel?[1].system?.absoluteString, "http://hl7.org/fhir/v3/ActCode") - XCTAssertEqual(inst.entity?[1].securityLabel?[2].code, "DELAU") - XCTAssertEqual(inst.entity?[1].securityLabel?[2].display, "delete after use") - XCTAssertEqual(inst.entity?[1].securityLabel?[2].system?.absoluteString, "http://hl7.org/fhir/v3/ActCode") - XCTAssertEqual(inst.entity?[1].type?.code, "2") - XCTAssertEqual(inst.entity?[1].type?.display, "System Object") - XCTAssertEqual(inst.entity?[1].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.event?.action, "R") + XCTAssertEqual(inst.event?.dateTime?.description, "2013-09-22T00:08:00Z") + XCTAssertEqual(inst.event?.outcome, "0") + XCTAssertEqual(inst.event?.outcomeDesc, "Successful Disclosure") + XCTAssertEqual(inst.event?.purposeOfEvent?[0].code, "HMARKT") + XCTAssertEqual(inst.event?.purposeOfEvent?[0].display, "healthcare marketing") + XCTAssertEqual(inst.event?.purposeOfEvent?[0].system?.absoluteString, "http://hl7.org/fhir/v3/ActReason") + XCTAssertEqual(inst.event?.subtype?[0].code, "Disclosure") + XCTAssertEqual(inst.event?.subtype?[0].display, "HIPAA disclosure") + XCTAssertEqual(inst.event?.type?.code, "110106") + XCTAssertEqual(inst.event?.type?.display, "Export") + XCTAssertEqual(inst.event?.type?.system?.absoluteString, "http://nema.org/dicom/dicm") XCTAssertEqual(inst.id, "example-disclosure") - XCTAssertEqual(inst.outcome, "0") - XCTAssertEqual(inst.outcomeDesc, "Successful Disclosure") - XCTAssertEqual(inst.purposeOfEvent?[0].code, "HMARKT") - XCTAssertEqual(inst.purposeOfEvent?[0].display, "healthcare marketing") - XCTAssertEqual(inst.purposeOfEvent?[0].system?.absoluteString, "http://hl7.org/fhir/v3/ActReason") - XCTAssertEqual(inst.recorded?.description, "2013-09-22T00:08:00Z") + XCTAssertEqual(inst.object?[0].reference?.reference, "Patient/example") + XCTAssertEqual(inst.object?[0].role?.code, "1") + XCTAssertEqual(inst.object?[0].role?.display, "Patient") + XCTAssertEqual(inst.object?[0].role?.system?.absoluteString, "http://hl7.org/fhir/valueset-object-role") + XCTAssertEqual(inst.object?[0].type?.code, "1") + XCTAssertEqual(inst.object?[0].type?.display, "Person") + XCTAssertEqual(inst.object?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.object?[1].description_fhir, "data about Everthing important") + XCTAssertEqual(inst.object?[1].identifier?.value, "What.id") + XCTAssertEqual(inst.object?[1].lifecycle?.code, "11") + XCTAssertEqual(inst.object?[1].lifecycle?.display, "Disclosure") + XCTAssertEqual(inst.object?[1].lifecycle?.system?.absoluteString, "http://hl7.org/fhir/object-lifecycle") + XCTAssertEqual(inst.object?[1].name, "Namne of What") + XCTAssertEqual(inst.object?[1].reference?.reference, "Patient/example/_history/1") + XCTAssertEqual(inst.object?[1].role?.code, "4") + XCTAssertEqual(inst.object?[1].role?.display, "DomainResource") + XCTAssertEqual(inst.object?[1].role?.system?.absoluteString, "http://hl7.org/fhir/valueset-object-role") + XCTAssertEqual(inst.object?[1].securityLabel?[0].code, "V") + XCTAssertEqual(inst.object?[1].securityLabel?[0].display, "very restricted") + XCTAssertEqual(inst.object?[1].securityLabel?[0].system?.absoluteString, "http://hl7.org/fhir/v3/Confidentiality") + XCTAssertEqual(inst.object?[1].securityLabel?[1].code, "STD") + XCTAssertEqual(inst.object?[1].securityLabel?[1].display, "sexually transmitted disease information sensitivity") + XCTAssertEqual(inst.object?[1].securityLabel?[1].system?.absoluteString, "http://hl7.org/fhir/v3/ActCode") + XCTAssertEqual(inst.object?[1].securityLabel?[2].code, "DELAU") + XCTAssertEqual(inst.object?[1].securityLabel?[2].display, "delete after use") + XCTAssertEqual(inst.object?[1].securityLabel?[2].system?.absoluteString, "http://hl7.org/fhir/v3/ActCode") + XCTAssertEqual(inst.object?[1].type?.code, "2") + XCTAssertEqual(inst.object?[1].type?.display, "System Object") + XCTAssertEqual(inst.object?[1].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.participant?[0].altId, "notMe") + XCTAssertEqual(inst.participant?[0].location?.reference, "Location/1") + XCTAssertEqual(inst.participant?[0].name, "That guy everyone wishes would be caught") + XCTAssertEqual(inst.participant?[0].network?.address, "custodian.net") + XCTAssertEqual(inst.participant?[0].network?.type, "1") + XCTAssertEqual(inst.participant?[0].policy?[0].absoluteString, "http://consent.com/yes") + XCTAssertTrue(inst.participant?[0].requestor ?? false) + XCTAssertEqual(inst.participant?[0].role?[0].coding?[0].code, "110153") + XCTAssertEqual(inst.participant?[0].role?[0].coding?[0].display, "Source Role ID") + XCTAssertEqual(inst.participant?[0].role?[0].coding?[0].system?.absoluteString, "http://nema.org/dicom/dicm") + XCTAssertEqual(inst.participant?[0].userId?.value, "SomeIdiot@nowhere.com") + XCTAssertEqual(inst.participant?[1].network?.address, "marketing.land") + XCTAssertEqual(inst.participant?[1].network?.type, "1") + XCTAssertEqual(inst.participant?[1].purposeOfUse?[0].code, "HMARKT") + XCTAssertEqual(inst.participant?[1].purposeOfUse?[0].display, "healthcare marketing") + XCTAssertEqual(inst.participant?[1].purposeOfUse?[0].system?.absoluteString, "http://hl7.org/fhir/v3/ActReason") + XCTAssertEqual(inst.participant?[1].reference?.reference, "Practitioner/example") + XCTAssertFalse(inst.participant?[1].requestor ?? true) + XCTAssertEqual(inst.participant?[1].role?[0].coding?[0].code, "110152") + XCTAssertEqual(inst.participant?[1].role?[0].coding?[0].display, "Destination Role ID") + XCTAssertEqual(inst.participant?[1].role?[0].coding?[0].system?.absoluteString, "http://nema.org/dicom/dicm") + XCTAssertEqual(inst.participant?[1].userId?.value, "Where") XCTAssertEqual(inst.source?.identifier?.value, "Watchers Accounting of Disclosures Application") XCTAssertEqual(inst.source?.site, "Watcher") XCTAssertEqual(inst.source?.type?[0].code, "4") XCTAssertEqual(inst.source?.type?[0].display, "Application Server") XCTAssertEqual(inst.source?.type?[0].system?.absoluteString, "http://hl7.org/fhir/security-source-type") - XCTAssertEqual(inst.subtype?[0].code, "Disclosure") - XCTAssertEqual(inst.subtype?[0].display, "HIPAA disclosure") XCTAssertEqual(inst.text?.div, "
Disclosure by some idiot, for marketing reasons, to places unknown, of a Poor Sap, data about Everthing important.
") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type?.code, "110106") - XCTAssertEqual(inst.type?.display, "Export") - XCTAssertEqual(inst.type?.system?.absoluteString, "http://nema.org/dicom/dicm") return inst } @@ -417,41 +417,41 @@ class AuditEventTests: XCTestCase { func runAuditEvent8(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.AuditEvent { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "auditevent-example.json") - XCTAssertEqual(inst.action, "E") - XCTAssertEqual(inst.agent?[0].network?.address, "127.0.0.1") - XCTAssertEqual(inst.agent?[0].network?.type, "2") - XCTAssertFalse(inst.agent?[0].requestor ?? true) - XCTAssertEqual(inst.agent?[0].role?[0].text, "Service User (Logon)") - XCTAssertEqual(inst.agent?[0].userId?.value, "Grahame") - XCTAssertEqual(inst.entity?[0].identifier?.type?.coding?[0].code, "SNO") - XCTAssertEqual(inst.entity?[0].identifier?.type?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/identifier-type") - XCTAssertEqual(inst.entity?[0].identifier?.type?.text, "Dell Serial Number") - XCTAssertEqual(inst.entity?[0].identifier?.value, "ABCDEF") - XCTAssertEqual(inst.entity?[0].lifecycle?.code, "6") - XCTAssertEqual(inst.entity?[0].lifecycle?.display, "Access / Use") - XCTAssertEqual(inst.entity?[0].lifecycle?.system?.absoluteString, "http://hl7.org/fhir/object-lifecycle") - XCTAssertEqual(inst.entity?[0].name, "Grahame's Laptop") - XCTAssertEqual(inst.entity?[0].role?.code, "4") - XCTAssertEqual(inst.entity?[0].role?.display, "Domain Resource") - XCTAssertEqual(inst.entity?[0].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") - XCTAssertEqual(inst.entity?[0].type?.code, "4") - XCTAssertEqual(inst.entity?[0].type?.display, "Other") - XCTAssertEqual(inst.entity?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.event?.action, "E") + XCTAssertEqual(inst.event?.dateTime?.description, "2012-10-25T22:04:27+11:00") + XCTAssertEqual(inst.event?.outcome, "0") + XCTAssertEqual(inst.event?.subtype?[0].code, "110120") + XCTAssertEqual(inst.event?.subtype?[0].display, "Application Start") + XCTAssertEqual(inst.event?.subtype?[0].system?.absoluteString, "http://nema.org/dicom/dicm") + XCTAssertEqual(inst.event?.type?.code, "110100") + XCTAssertEqual(inst.event?.type?.display, "Application Activity") + XCTAssertEqual(inst.event?.type?.system?.absoluteString, "http://nema.org/dicom/dicm") XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.outcome, "0") - XCTAssertEqual(inst.recorded?.description, "2012-10-25T22:04:27+11:00") + XCTAssertEqual(inst.object?[0].identifier?.type?.coding?[0].code, "SNO") + XCTAssertEqual(inst.object?[0].identifier?.type?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/identifier-type") + XCTAssertEqual(inst.object?[0].identifier?.type?.text, "Dell Serial Number") + XCTAssertEqual(inst.object?[0].identifier?.value, "ABCDEF") + XCTAssertEqual(inst.object?[0].lifecycle?.code, "6") + XCTAssertEqual(inst.object?[0].lifecycle?.display, "Access / Use") + XCTAssertEqual(inst.object?[0].lifecycle?.system?.absoluteString, "http://hl7.org/fhir/object-lifecycle") + XCTAssertEqual(inst.object?[0].name, "Grahame's Laptop") + XCTAssertEqual(inst.object?[0].role?.code, "4") + XCTAssertEqual(inst.object?[0].role?.display, "DomainResource") + XCTAssertEqual(inst.object?[0].role?.system?.absoluteString, "http://hl7.org/fhir/object-role") + XCTAssertEqual(inst.object?[0].type?.code, "4") + XCTAssertEqual(inst.object?[0].type?.display, "Other") + XCTAssertEqual(inst.object?[0].type?.system?.absoluteString, "http://hl7.org/fhir/object-type") + XCTAssertEqual(inst.participant?[0].network?.address, "127.0.0.1") + XCTAssertEqual(inst.participant?[0].network?.type, "2") + XCTAssertFalse(inst.participant?[0].requestor ?? true) + XCTAssertEqual(inst.participant?[0].role?[0].text, "Service User (Logon)") + XCTAssertEqual(inst.participant?[0].userId?.value, "Grahame") XCTAssertEqual(inst.source?.identifier?.value, "Grahame's Laptop") XCTAssertEqual(inst.source?.site, "Development") XCTAssertEqual(inst.source?.type?[0].code, "1") XCTAssertEqual(inst.source?.type?[0].system?.absoluteString, "http://hl7.org/fhir/audit-event-sub-type") - XCTAssertEqual(inst.subtype?[0].code, "110120") - XCTAssertEqual(inst.subtype?[0].display, "Application Start") - XCTAssertEqual(inst.subtype?[0].system?.absoluteString, "http://nema.org/dicom/dicm") XCTAssertEqual(inst.text?.div, "
Application Start for under service login "Grahame" (id: Grahame's Test HL7Connect)
") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type?.code, "110100") - XCTAssertEqual(inst.type?.display, "Application Activity") - XCTAssertEqual(inst.type?.system?.absoluteString, "http://nema.org/dicom/dicm") return inst } diff --git a/Tests/ModelTests/BasicTests.swift b/Tests/ModelTests/BasicTests.swift index 80f18bba..02a08841 100644 --- a/Tests/ModelTests/BasicTests.swift +++ b/Tests/ModelTests/BasicTests.swift @@ -2,7 +2,7 @@ // BasicTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/BinaryTests.swift b/Tests/ModelTests/BinaryTests.swift index 83008247..3a055ed2 100644 --- a/Tests/ModelTests/BinaryTests.swift +++ b/Tests/ModelTests/BinaryTests.swift @@ -2,7 +2,7 @@ // BinaryTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/BodySiteTests.swift b/Tests/ModelTests/BodySiteTests.swift index 33d85617..98a67d1c 100644 --- a/Tests/ModelTests/BodySiteTests.swift +++ b/Tests/ModelTests/BodySiteTests.swift @@ -2,7 +2,7 @@ // BodySiteTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/BundleTests.swift b/Tests/ModelTests/BundleTests.swift index ecf54427..73054cc5 100644 --- a/Tests/ModelTests/BundleTests.swift +++ b/Tests/ModelTests/BundleTests.swift @@ -2,7 +2,7 @@ // BundleTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -193,7 +193,7 @@ class BundleTests: XCTestCase { XCTAssertEqual(inst.meta?.lastUpdated?.description, "2013-05-28T22:12:21Z") XCTAssertEqual(inst.signature?.contentType, "image/jpg") XCTAssertEqual(inst.signature?.type?[0].code, "1.2.840.10065.1.12.1.1") - XCTAssertEqual(inst.signature?.type?[0].display, "Author's Signature") + XCTAssertEqual(inst.signature?.type?[0].display, "AuthorID") XCTAssertEqual(inst.signature?.type?[0].system?.absoluteString, "http://hl7.org/fhir/valueset-signature-type") XCTAssertEqual(inst.signature?.when?.description, "2015-08-31T07:42:33+10:00") XCTAssertEqual(inst.signature?.whoReference?.reference, "Device/software") diff --git a/Tests/ModelTests/CarePlanTests.swift b/Tests/ModelTests/CarePlanTests.swift index e4b1773a..dfe243a4 100644 --- a/Tests/ModelTests/CarePlanTests.swift +++ b/Tests/ModelTests/CarePlanTests.swift @@ -2,7 +2,7 @@ // CarePlanTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -633,7 +633,7 @@ class CarePlanTests: XCTestCase { XCTAssertFalse(inst.activity?[0].detail?.prohibited ?? true) XCTAssertEqual(inst.activity?[0].detail?.scheduledTiming?.repeat_fhir?.frequency, 1) XCTAssertEqual(inst.activity?[0].detail?.scheduledTiming?.repeat_fhir?.period, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.activity?[0].detail?.scheduledTiming?.repeat_fhir?.periodUnit, "d") + XCTAssertEqual(inst.activity?[0].detail?.scheduledTiming?.repeat_fhir?.periodUnits, "d") XCTAssertEqual(inst.addresses?[0].display, "obesity") XCTAssertEqual(inst.addresses?[0].reference, "#p1") XCTAssertEqual(inst.contained?[0].id, "p1") diff --git a/Tests/ModelTests/CareTeamTests.swift b/Tests/ModelTests/CareTeamTests.swift deleted file mode 100644 index 49b87fe1..00000000 --- a/Tests/ModelTests/CareTeamTests.swift +++ /dev/null @@ -1,55 +0,0 @@ -// -// CareTeamTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class CareTeamTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.CareTeam { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.CareTeam { - let instance = SwiftFHIR.CareTeam(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testCareTeam1() { - do { - let instance = try runCareTeam1() - try runCareTeam1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test CareTeam successfully, but threw") - } - } - - @discardableResult - func runCareTeam1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.CareTeam { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "careteam-example.json") - - XCTAssertEqual(inst.contained?[0].id, "pr1") - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.participant?[0].member?.display, "Peter James Chalmers") - XCTAssertEqual(inst.participant?[0].member?.reference, "Patient/example") - XCTAssertEqual(inst.participant?[0].role?.text, "responsiblePerson") - XCTAssertEqual(inst.participant?[1].member?.display, "Dorothy Dietition") - XCTAssertEqual(inst.participant?[1].member?.reference, "#pr1") - XCTAssertEqual(inst.participant?[1].role?.text, "adviser") - XCTAssertEqual(inst.period?.end?.description, "2013-01-01") - XCTAssertEqual(inst.subject?.display, "Peter James Chalmers") - XCTAssertEqual(inst.subject?.reference, "Patient/example") - XCTAssertEqual(inst.text?.div, "
Care Team
") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } -} diff --git a/Tests/ModelTests/ClaimResponseTests.swift b/Tests/ModelTests/ClaimResponseTests.swift index c833a5f7..1e9661a3 100644 --- a/Tests/ModelTests/ClaimResponseTests.swift +++ b/Tests/ModelTests/ClaimResponseTests.swift @@ -2,7 +2,7 @@ // ClaimResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -44,20 +44,19 @@ class ClaimResponseTests: XCTestCase { XCTAssertEqual(inst.item?[0].adjudication?[0].amount?.code, "USD") XCTAssertEqual(inst.item?[0].adjudication?[0].amount?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].adjudication?[0].amount?.value, NSDecimalNumber(string: "135.57")) - XCTAssertEqual(inst.item?[0].adjudication?[0].category?.code, "eligible") + XCTAssertEqual(inst.item?[0].adjudication?[0].code?.code, "eligible") XCTAssertEqual(inst.item?[0].adjudication?[1].amount?.code, "USD") XCTAssertEqual(inst.item?[0].adjudication?[1].amount?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].adjudication?[1].amount?.value, NSDecimalNumber(string: "10.0")) - XCTAssertEqual(inst.item?[0].adjudication?[1].category?.code, "copay") - XCTAssertEqual(inst.item?[0].adjudication?[2].category?.code, "eligpercent") + XCTAssertEqual(inst.item?[0].adjudication?[1].code?.code, "copay") + XCTAssertEqual(inst.item?[0].adjudication?[2].code?.code, "eligpercent") XCTAssertEqual(inst.item?[0].adjudication?[2].value, NSDecimalNumber(string: "80.0")) XCTAssertEqual(inst.item?[0].adjudication?[3].amount?.code, "USD") XCTAssertEqual(inst.item?[0].adjudication?[3].amount?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].adjudication?[3].amount?.value, NSDecimalNumber(string: "100.47")) - XCTAssertEqual(inst.item?[0].adjudication?[3].category?.code, "benefit") + XCTAssertEqual(inst.item?[0].adjudication?[3].code?.code, "benefit") XCTAssertEqual(inst.item?[0].sequenceLinkId, UInt(1)) - XCTAssertEqual(inst.organizationIdentifier?.system?.absoluteString, "http://www.jurisdiction.org/insurers") - XCTAssertEqual(inst.organizationIdentifier?.value, "555123") + XCTAssertEqual(inst.organization?.reference, "Organization/2") XCTAssertEqual(inst.outcome, "complete") XCTAssertEqual(inst.payeeType?.code, "provider") XCTAssertEqual(inst.payeeType?.system?.absoluteString, "http://hl7.org/fhir/payeetype") @@ -67,7 +66,8 @@ class ClaimResponseTests: XCTestCase { XCTAssertEqual(inst.paymentDate?.description, "2014-08-31") XCTAssertEqual(inst.paymentRef?.system?.absoluteString, "http://www.BenefitsInc.com/fhir/paymentRef") XCTAssertEqual(inst.paymentRef?.value, "201408-2-1569478") - XCTAssertEqual(inst.requestReference?.reference, "http://www.BenefitsInc.com/fhir/oralhealthclaim/15476332402") + XCTAssertEqual(inst.request?.reference, "http://www.BenefitsInc.com/fhir/oralhealthclaim/15476332402") + XCTAssertEqual(inst.requestOrganization?.reference, "Organization/1") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the ClaimResponse
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.totalBenefit?.code, "USD") diff --git a/Tests/ModelTests/ClaimTests.swift b/Tests/ModelTests/ClaimTests.swift index 56b39fe2..385ac1ff 100644 --- a/Tests/ModelTests/ClaimTests.swift +++ b/Tests/ModelTests/ClaimTests.swift @@ -2,7 +2,7 @@ // ClaimTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -36,41 +36,35 @@ class ClaimTests: XCTestCase { func runClaim1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "claim-example-institutional.json") - XCTAssertEqual(inst.coverage?[0].coverageReference?.reference, "Coverage/9876B1") + XCTAssertEqual(inst.coverage?[0].coverage?.reference, "Coverage/9876B1") XCTAssertTrue(inst.coverage?[0].focal ?? false) + XCTAssertEqual(inst.coverage?[0].relationship?.code, "self") XCTAssertEqual(inst.coverage?[0].sequence, UInt(1)) XCTAssertEqual(inst.created?.description, "2014-08-16") XCTAssertEqual(inst.diagnosis?[0].diagnosis?.code, "654456") XCTAssertEqual(inst.diagnosis?[0].sequence, UInt(1)) - XCTAssertEqual(inst.entererIdentifier?.system?.absoluteString, "http://jurisdiction.org/facilities/HOSP1234/users") - XCTAssertEqual(inst.entererIdentifier?.value, "UC1234") - XCTAssertEqual(inst.facilityIdentifier?.system?.absoluteString, "http://jurisdiction.org/facilities") - XCTAssertEqual(inst.facilityIdentifier?.value, "HOSP1234") XCTAssertEqual(inst.id, "960150") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyhospital.com/claim") XCTAssertEqual(inst.identifier?[0].value, "9612345") XCTAssertEqual(inst.item?[0].net?.code, "USD") XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "125.0")) - XCTAssertEqual(inst.item?[0].providerReference?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[0].provider?.reference, "Practitioner/example") XCTAssertEqual(inst.item?[0].sequence, UInt(1)) XCTAssertEqual(inst.item?[0].service?.code, "exam") XCTAssertEqual(inst.item?[0].service?.system?.absoluteString, "http://hl7.org/fhir/ex-serviceproduct") - XCTAssertEqual(inst.item?[0].servicedDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[0].serviceDate?.description, "2014-08-16") XCTAssertEqual(inst.item?[0].type?.code, "service") XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") XCTAssertEqual(inst.item?[0].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].unitPrice?.value, NSDecimalNumber(string: "125.0")) - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") - XCTAssertEqual(inst.patientReference?.reference, "Patient/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") + XCTAssertEqual(inst.patient?.reference, "Patient/1") XCTAssertEqual(inst.payee?.type?.code, "provider") XCTAssertEqual(inst.priority?.code, "normal") - XCTAssertEqual(inst.targetReference?.reference, "Organization/2") + XCTAssertEqual(inst.target?.reference, "Organization/2") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Claim
") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.total?.code, "USD") - XCTAssertEqual(inst.total?.system?.absoluteString, "urn:iso:std:iso:4217") - XCTAssertEqual(inst.total?.value, NSDecimalNumber(string: "125.0")) XCTAssertEqual(inst.type, "institutional") XCTAssertEqual(inst.use, "complete") @@ -91,8 +85,9 @@ class ClaimTests: XCTestCase { func runClaim2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "claim-example-oral-average.json") - XCTAssertEqual(inst.coverage?[0].coverageReference?.reference, "Coverage/9876B1") + XCTAssertEqual(inst.coverage?[0].coverage?.reference, "Coverage/9876B1") XCTAssertTrue(inst.coverage?[0].focal ?? false) + XCTAssertEqual(inst.coverage?[0].relationship?.code, "self") XCTAssertEqual(inst.coverage?[0].sequence, UInt(1)) XCTAssertEqual(inst.created?.description, "2014-08-16") XCTAssertEqual(inst.diagnosis?[0].diagnosis?.code, "123456") @@ -103,11 +98,11 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.item?[0].net?.code, "USD") XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "135.57")) - XCTAssertEqual(inst.item?[0].providerReference?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[0].provider?.reference, "Practitioner/example") XCTAssertEqual(inst.item?[0].sequence, UInt(1)) XCTAssertEqual(inst.item?[0].service?.code, "1200") XCTAssertEqual(inst.item?[0].service?.system?.absoluteString, "http://hl7.org/fhir/oralservicecodes") - XCTAssertEqual(inst.item?[0].servicedDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[0].serviceDate?.description, "2014-08-16") XCTAssertEqual(inst.item?[0].type?.code, "service") XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") XCTAssertEqual(inst.item?[0].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") @@ -117,11 +112,11 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.item?[1].net?.code, "USD") XCTAssertEqual(inst.item?[1].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[1].net?.value, NSDecimalNumber(string: "105.0")) - XCTAssertEqual(inst.item?[1].providerReference?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[1].provider?.reference, "Practitioner/example") XCTAssertEqual(inst.item?[1].sequence, UInt(2)) XCTAssertEqual(inst.item?[1].service?.code, "21211") XCTAssertEqual(inst.item?[1].service?.system?.absoluteString, "http://hl7.org/fhir/oralservicecodes") - XCTAssertEqual(inst.item?[1].servicedDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[1].serviceDate?.description, "2014-08-16") XCTAssertEqual(inst.item?[1].subSite?[0].code, "L") XCTAssertEqual(inst.item?[1].subSite?[0].system?.absoluteString, "http://fdi.org/fhir/oralsurfacecodes") XCTAssertEqual(inst.item?[1].type?.code, "service") @@ -153,20 +148,20 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.item?[2].net?.code, "USD") XCTAssertEqual(inst.item?[2].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[2].net?.value, NSDecimalNumber(string: "1100.0")) - XCTAssertEqual(inst.item?[2].providerReference?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[2].provider?.reference, "Practitioner/example") XCTAssertEqual(inst.item?[2].sequence, UInt(3)) XCTAssertEqual(inst.item?[2].service?.code, "27211") XCTAssertEqual(inst.item?[2].service?.system?.absoluteString, "http://hl7.org/fhir/oralservicecodes") - XCTAssertEqual(inst.item?[2].servicedDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[2].serviceDate?.description, "2014-08-16") XCTAssertEqual(inst.item?[2].type?.code, "group") XCTAssertEqual(inst.item?[2].unitPrice?.code, "USD") XCTAssertEqual(inst.item?[2].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[2].unitPrice?.value, NSDecimalNumber(string: "1100.0")) - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") - XCTAssertEqual(inst.patientReference?.reference, "Patient/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") + XCTAssertEqual(inst.patient?.reference, "Patient/1") XCTAssertEqual(inst.payee?.type?.code, "provider") XCTAssertEqual(inst.priority?.code, "normal") - XCTAssertEqual(inst.targetReference?.reference, "Organization/2") + XCTAssertEqual(inst.target?.reference, "Organization/2") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Oral Health Claim
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.type, "oral") @@ -187,58 +182,6 @@ class ClaimTests: XCTestCase { @discardableResult func runClaim3(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "claim-example-oral-contained-identifier.json") - - XCTAssertEqual(inst.contained?[0].id, "patient-1") - XCTAssertEqual(inst.coverage?[0].coverageIdentifier?.system?.absoluteString, "http://www.jurisdiction.com/nationalplan") - XCTAssertEqual(inst.coverage?[0].coverageIdentifier?.value, "123AB345") - XCTAssertTrue(inst.coverage?[0].focal ?? false) - XCTAssertEqual(inst.coverage?[0].sequence, UInt(1)) - XCTAssertEqual(inst.created?.description, "2014-08-16") - XCTAssertEqual(inst.diagnosis?[0].diagnosis?.code, "123456") - XCTAssertEqual(inst.diagnosis?[0].sequence, UInt(1)) - XCTAssertEqual(inst.id, "100155") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/claim") - XCTAssertEqual(inst.identifier?[0].value, "12347") - XCTAssertEqual(inst.item?[0].net?.code, "USD") - XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") - XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "135.57")) - XCTAssertEqual(inst.item?[0].providerIdentifier?.system?.absoluteString, "http://www.jurisdiction.com/providerId") - XCTAssertEqual(inst.item?[0].providerIdentifier?.value, "MD98765") - XCTAssertEqual(inst.item?[0].sequence, UInt(1)) - XCTAssertEqual(inst.item?[0].service?.code, "1200") - XCTAssertEqual(inst.item?[0].servicedDate?.description, "2014-08-16") - XCTAssertEqual(inst.item?[0].type?.code, "service") - XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") - XCTAssertEqual(inst.item?[0].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") - XCTAssertEqual(inst.item?[0].unitPrice?.value, NSDecimalNumber(string: "135.57")) - XCTAssertEqual(inst.organizationIdentifier?.system?.absoluteString, "http://www.jurisdiction.com/careorganizations") - XCTAssertEqual(inst.organizationIdentifier?.value, "HOSP12345") - XCTAssertEqual(inst.patientReference?.reference, "#patient-1") - XCTAssertEqual(inst.payee?.type?.code, "provider") - XCTAssertEqual(inst.priority?.code, "normal") - XCTAssertEqual(inst.targetIdentifier?.system?.absoluteString, "http://www.jurisdiction.com/insurers") - XCTAssertEqual(inst.targetIdentifier?.value, "123456") - XCTAssertEqual(inst.text?.div, "
This example assumes a national health care scheme where patients, providers and organizations have known business identifiers.
") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type, "oral") - XCTAssertEqual(inst.use, "complete") - - return inst - } - - func testClaim4() { - do { - let instance = try runClaim4() - try runClaim4(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test Claim successfully, but threw") - } - } - - @discardableResult - func runClaim4(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "claim-example-oral-contained.json") XCTAssertEqual(inst.contained?[0].id, "organization-1") @@ -246,8 +189,9 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.contained?[2].id, "practitioner-1") XCTAssertEqual(inst.contained?[3].id, "patient-1") XCTAssertEqual(inst.contained?[4].id, "coverage-1") - XCTAssertEqual(inst.coverage?[0].coverageReference?.reference, "#coverage-1") + XCTAssertEqual(inst.coverage?[0].coverage?.reference, "#coverage-1") XCTAssertTrue(inst.coverage?[0].focal ?? false) + XCTAssertEqual(inst.coverage?[0].relationship?.code, "self") XCTAssertEqual(inst.coverage?[0].sequence, UInt(1)) XCTAssertEqual(inst.created?.description, "2014-08-16") XCTAssertEqual(inst.diagnosis?[0].diagnosis?.code, "123456") @@ -258,19 +202,19 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.item?[0].net?.code, "USD") XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "135.57")) - XCTAssertEqual(inst.item?[0].providerReference?.reference, "#practitioner-1") + XCTAssertEqual(inst.item?[0].provider?.reference, "#practitioner-1") XCTAssertEqual(inst.item?[0].sequence, UInt(1)) XCTAssertEqual(inst.item?[0].service?.code, "1200") - XCTAssertEqual(inst.item?[0].servicedDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[0].serviceDate?.description, "2014-08-16") XCTAssertEqual(inst.item?[0].type?.code, "service") XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") XCTAssertEqual(inst.item?[0].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].unitPrice?.value, NSDecimalNumber(string: "135.57")) - XCTAssertEqual(inst.organizationReference?.reference, "#organization-1") - XCTAssertEqual(inst.patientReference?.reference, "#patient-1") + XCTAssertEqual(inst.organization?.reference, "#organization-1") + XCTAssertEqual(inst.patient?.reference, "#patient-1") XCTAssertEqual(inst.payee?.type?.code, "provider") XCTAssertEqual(inst.priority?.code, "normal") - XCTAssertEqual(inst.targetReference?.reference, "#organization-2") + XCTAssertEqual(inst.target?.reference, "#organization-2") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Oral Health Claim
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.type, "oral") @@ -279,62 +223,10 @@ class ClaimTests: XCTestCase { return inst } - func testClaim5() { - do { - let instance = try runClaim5() - try runClaim5(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test Claim successfully, but threw") - } - } - - @discardableResult - func runClaim5(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "claim-example-oral-identifier.json") - - XCTAssertEqual(inst.coverage?[0].coverageIdentifier?.system?.absoluteString, "http://www.jurisdiction.com/nationalplan") - XCTAssertEqual(inst.coverage?[0].coverageIdentifier?.value, "123AB345") - XCTAssertTrue(inst.coverage?[0].focal ?? false) - XCTAssertEqual(inst.coverage?[0].sequence, UInt(1)) - XCTAssertEqual(inst.created?.description, "2014-08-16") - XCTAssertEqual(inst.diagnosis?[0].diagnosis?.code, "123456") - XCTAssertEqual(inst.diagnosis?[0].sequence, UInt(1)) - XCTAssertEqual(inst.id, "100154") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/claim") - XCTAssertEqual(inst.identifier?[0].value, "12347") - XCTAssertEqual(inst.item?[0].net?.code, "USD") - XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") - XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "135.57")) - XCTAssertEqual(inst.item?[0].providerIdentifier?.system?.absoluteString, "http://www.jurisdiction.com/providerId") - XCTAssertEqual(inst.item?[0].providerIdentifier?.value, "MD98765") - XCTAssertEqual(inst.item?[0].sequence, UInt(1)) - XCTAssertEqual(inst.item?[0].service?.code, "1200") - XCTAssertEqual(inst.item?[0].servicedDate?.description, "2014-08-16") - XCTAssertEqual(inst.item?[0].type?.code, "service") - XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") - XCTAssertEqual(inst.item?[0].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") - XCTAssertEqual(inst.item?[0].unitPrice?.value, NSDecimalNumber(string: "135.57")) - XCTAssertEqual(inst.organizationIdentifier?.system?.absoluteString, "http://www.jurisdiction.com/careorganizations") - XCTAssertEqual(inst.organizationIdentifier?.value, "HOSP12345") - XCTAssertEqual(inst.patientIdentifier?.system?.absoluteString, "http://www.jurisdiction.com/nationalId") - XCTAssertEqual(inst.patientIdentifier?.value, "123AB345") - XCTAssertEqual(inst.payee?.type?.code, "provider") - XCTAssertEqual(inst.priority?.code, "normal") - XCTAssertEqual(inst.targetIdentifier?.system?.absoluteString, "http://www.jurisdiction.com/insurers") - XCTAssertEqual(inst.targetIdentifier?.value, "123456") - XCTAssertEqual(inst.text?.div, "
This example assumes a national health care scheme where patients, providers and organizations have known business identifiers.
") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type, "oral") - XCTAssertEqual(inst.use, "complete") - - return inst - } - - func testClaim6() { + func testClaim4() { do { - let instance = try runClaim6() - try runClaim6(instance.asJSON()) + let instance = try runClaim4() + try runClaim4(instance.asJSON()) } catch { XCTAssertTrue(false, "Must instantiate and test Claim successfully, but threw") @@ -342,17 +234,17 @@ class ClaimTests: XCTestCase { } @discardableResult - func runClaim6(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { + func runClaim4(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "claim-example-oral-orthoplan.json") - XCTAssertEqual(inst.coverage?[0].coverageReference?.reference, "Coverage/9876B1") + XCTAssertEqual(inst.coverage?[0].coverage?.reference, "Coverage/9876B1") XCTAssertTrue(inst.coverage?[0].focal ?? false) + XCTAssertEqual(inst.coverage?[0].relationship?.code, "self") XCTAssertEqual(inst.coverage?[0].sequence, UInt(1)) XCTAssertEqual(inst.created?.description, "2015-03-16") XCTAssertEqual(inst.diagnosis?[0].diagnosis?.code, "123457") XCTAssertEqual(inst.diagnosis?[0].diagnosis?.system?.absoluteString, "http://hl7.org/fhir/sid/icd-10") XCTAssertEqual(inst.diagnosis?[0].sequence, UInt(1)) - XCTAssertEqual(inst.fundsReserve?.code, "provider") XCTAssertEqual(inst.id, "100153") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/claim") XCTAssertEqual(inst.identifier?[0].value, "12355") @@ -411,11 +303,11 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.item?[0].net?.code, "USD") XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "9000.0")) - XCTAssertEqual(inst.item?[0].providerReference?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[0].provider?.reference, "Practitioner/example") XCTAssertEqual(inst.item?[0].sequence, UInt(1)) XCTAssertEqual(inst.item?[0].service?.code, "ORTHPLAN") XCTAssertEqual(inst.item?[0].service?.system?.absoluteString, "http://hl7.org/fhir/oralservicecodes") - XCTAssertEqual(inst.item?[0].servicedDate?.description, "2015-05-16") + XCTAssertEqual(inst.item?[0].serviceDate?.description, "2015-05-16") XCTAssertEqual(inst.item?[0].type?.code, "FRAMEING") XCTAssertEqual(inst.item?[0].type?.system?.absoluteString, "http://hl7.org/fhir/v3/ActCode") XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") @@ -426,11 +318,11 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.item?[1].net?.code, "USD") XCTAssertEqual(inst.item?[1].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[1].net?.value, NSDecimalNumber(string: "105.0")) - XCTAssertEqual(inst.item?[1].providerReference?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[1].provider?.reference, "Practitioner/example") XCTAssertEqual(inst.item?[1].sequence, UInt(2)) XCTAssertEqual(inst.item?[1].service?.code, "21211") XCTAssertEqual(inst.item?[1].service?.system?.absoluteString, "http://hl7.org/fhir/oralservicecodes") - XCTAssertEqual(inst.item?[1].servicedDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[1].serviceDate?.description, "2014-08-16") XCTAssertEqual(inst.item?[1].subSite?[0].code, "L") XCTAssertEqual(inst.item?[1].subSite?[0].system?.absoluteString, "http://fdi.org/fhir/oralsurfacecodes") XCTAssertEqual(inst.item?[1].type?.code, "service") @@ -462,20 +354,20 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.item?[2].net?.code, "USD") XCTAssertEqual(inst.item?[2].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[2].net?.value, NSDecimalNumber(string: "1100.0")) - XCTAssertEqual(inst.item?[2].providerReference?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[2].provider?.reference, "Practitioner/example") XCTAssertEqual(inst.item?[2].sequence, UInt(3)) XCTAssertEqual(inst.item?[2].service?.code, "27211") XCTAssertEqual(inst.item?[2].service?.system?.absoluteString, "http://hl7.org/fhir/oralservicecodes") - XCTAssertEqual(inst.item?[2].servicedDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[2].serviceDate?.description, "2014-08-16") XCTAssertEqual(inst.item?[2].type?.code, "group") XCTAssertEqual(inst.item?[2].unitPrice?.code, "USD") XCTAssertEqual(inst.item?[2].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[2].unitPrice?.value, NSDecimalNumber(string: "1100.0")) - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") - XCTAssertEqual(inst.patientReference?.reference, "Patient/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") + XCTAssertEqual(inst.patient?.reference, "Patient/1") XCTAssertEqual(inst.payee?.type?.code, "provider") XCTAssertEqual(inst.priority?.code, "normal") - XCTAssertEqual(inst.targetReference?.reference, "Organization/2") + XCTAssertEqual(inst.target?.reference, "Organization/2") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Oral Health Claim
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.type, "oral") @@ -484,10 +376,10 @@ class ClaimTests: XCTestCase { return inst } - func testClaim7() { + func testClaim5() { do { - let instance = try runClaim7() - try runClaim7(instance.asJSON()) + let instance = try runClaim5() + try runClaim5(instance.asJSON()) } catch { XCTAssertTrue(false, "Must instantiate and test Claim successfully, but threw") @@ -495,11 +387,12 @@ class ClaimTests: XCTestCase { } @discardableResult - func runClaim7(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { + func runClaim5(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "claim-example-pharmacy.json") - XCTAssertEqual(inst.coverage?[0].coverageReference?.reference, "Coverage/9876B1") + XCTAssertEqual(inst.coverage?[0].coverage?.reference, "Coverage/9876B1") XCTAssertTrue(inst.coverage?[0].focal ?? false) + XCTAssertEqual(inst.coverage?[0].relationship?.code, "self") XCTAssertEqual(inst.coverage?[0].sequence, UInt(1)) XCTAssertEqual(inst.created?.description, "2014-08-16") XCTAssertEqual(inst.diagnosis?[0].diagnosis?.code, "654456") @@ -510,20 +403,20 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.item?[0].net?.code, "USD") XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "60.0")) - XCTAssertEqual(inst.item?[0].providerReference?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[0].provider?.reference, "Practitioner/example") XCTAssertEqual(inst.item?[0].sequence, UInt(1)) XCTAssertEqual(inst.item?[0].service?.code, "smokecess") XCTAssertEqual(inst.item?[0].service?.system?.absoluteString, "http://hl7.org/fhir/ex-pharmaservice") - XCTAssertEqual(inst.item?[0].servicedDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[0].serviceDate?.description, "2014-08-16") XCTAssertEqual(inst.item?[0].type?.code, "service") XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") XCTAssertEqual(inst.item?[0].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].unitPrice?.value, NSDecimalNumber(string: "60.0")) - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") - XCTAssertEqual(inst.patientReference?.reference, "Patient/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") + XCTAssertEqual(inst.patient?.reference, "Patient/1") XCTAssertEqual(inst.payee?.type?.code, "provider") XCTAssertEqual(inst.priority?.code, "stat") - XCTAssertEqual(inst.targetReference?.reference, "Organization/2") + XCTAssertEqual(inst.target?.reference, "Organization/2") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Pharmacy Claim
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.type, "pharmacy") @@ -532,10 +425,10 @@ class ClaimTests: XCTestCase { return inst } - func testClaim8() { + func testClaim6() { do { - let instance = try runClaim8() - try runClaim8(instance.asJSON()) + let instance = try runClaim6() + try runClaim6(instance.asJSON()) } catch { XCTAssertTrue(false, "Must instantiate and test Claim successfully, but threw") @@ -543,11 +436,12 @@ class ClaimTests: XCTestCase { } @discardableResult - func runClaim8(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { + func runClaim6(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "claim-example-professional.json") - XCTAssertEqual(inst.coverage?[0].coverageReference?.reference, "Coverage/9876B1") + XCTAssertEqual(inst.coverage?[0].coverage?.reference, "Coverage/9876B1") XCTAssertTrue(inst.coverage?[0].focal ?? false) + XCTAssertEqual(inst.coverage?[0].relationship?.code, "self") XCTAssertEqual(inst.coverage?[0].sequence, UInt(1)) XCTAssertEqual(inst.created?.description, "2014-08-16") XCTAssertEqual(inst.diagnosis?[0].diagnosis?.code, "654456") @@ -558,20 +452,20 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.item?[0].net?.code, "USD") XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "75.0")) - XCTAssertEqual(inst.item?[0].providerReference?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[0].provider?.reference, "Practitioner/example") XCTAssertEqual(inst.item?[0].sequence, UInt(1)) XCTAssertEqual(inst.item?[0].service?.code, "exam") XCTAssertEqual(inst.item?[0].service?.system?.absoluteString, "http://hl7.org/fhir/ex-serviceproduct") - XCTAssertEqual(inst.item?[0].servicedDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[0].serviceDate?.description, "2014-08-16") XCTAssertEqual(inst.item?[0].type?.code, "service") XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") XCTAssertEqual(inst.item?[0].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].unitPrice?.value, NSDecimalNumber(string: "75.0")) - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") - XCTAssertEqual(inst.patientReference?.reference, "Patient/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") + XCTAssertEqual(inst.patient?.reference, "Patient/1") XCTAssertEqual(inst.payee?.type?.code, "provider") XCTAssertEqual(inst.priority?.code, "normal") - XCTAssertEqual(inst.targetReference?.reference, "Organization/2") + XCTAssertEqual(inst.target?.reference, "Organization/2") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Claim
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.type, "professional") @@ -580,10 +474,10 @@ class ClaimTests: XCTestCase { return inst } - func testClaim9() { + func testClaim7() { do { - let instance = try runClaim9() - try runClaim9(instance.asJSON()) + let instance = try runClaim7() + try runClaim7(instance.asJSON()) } catch { XCTAssertTrue(false, "Must instantiate and test Claim successfully, but threw") @@ -591,11 +485,12 @@ class ClaimTests: XCTestCase { } @discardableResult - func runClaim9(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { + func runClaim7(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "claim-example-vision-glasses.json") - XCTAssertEqual(inst.coverage?[0].coverageReference?.reference, "Coverage/9876B1") + XCTAssertEqual(inst.coverage?[0].coverage?.reference, "Coverage/9876B1") XCTAssertTrue(inst.coverage?[0].focal ?? false) + XCTAssertEqual(inst.coverage?[0].relationship?.code, "self") XCTAssertEqual(inst.coverage?[0].sequence, UInt(1)) XCTAssertEqual(inst.created?.description, "2014-08-16") XCTAssertEqual(inst.diagnosis?[0].diagnosis?.code, "654321") @@ -638,21 +533,21 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.item?[0].net?.code, "USD") XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "214.0")) - XCTAssertEqual(inst.item?[0].providerReference?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[0].provider?.reference, "Practitioner/example") XCTAssertEqual(inst.item?[0].sequence, UInt(1)) XCTAssertEqual(inst.item?[0].service?.code, "glasses") XCTAssertEqual(inst.item?[0].service?.system?.absoluteString, "http://hl7.org/fhir/ex-visionservice") - XCTAssertEqual(inst.item?[0].servicedDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[0].serviceDate?.description, "2014-08-16") XCTAssertEqual(inst.item?[0].type?.code, "group") XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") XCTAssertEqual(inst.item?[0].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].unitPrice?.value, NSDecimalNumber(string: "214.0")) - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") - XCTAssertEqual(inst.patientReference?.reference, "Patient/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") + XCTAssertEqual(inst.patient?.reference, "Patient/1") XCTAssertEqual(inst.payee?.type?.code, "provider") - XCTAssertEqual(inst.prescriptionReference?.reference, "http://www.optdocs.com/prescription/12345") + XCTAssertEqual(inst.prescription?.reference, "http://www.optdocs.com/prescription/12345") XCTAssertEqual(inst.priority?.code, "normal") - XCTAssertEqual(inst.targetReference?.reference, "Organization/2") + XCTAssertEqual(inst.target?.reference, "Organization/2") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Vision Claim for Glasses
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.type, "vision") @@ -661,10 +556,10 @@ class ClaimTests: XCTestCase { return inst } - func testClaim10() { + func testClaim8() { do { - let instance = try runClaim10() - try runClaim10(instance.asJSON()) + let instance = try runClaim8() + try runClaim8(instance.asJSON()) } catch { XCTAssertTrue(false, "Must instantiate and test Claim successfully, but threw") @@ -672,11 +567,12 @@ class ClaimTests: XCTestCase { } @discardableResult - func runClaim10(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { + func runClaim8(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "claim-example-vision.json") - XCTAssertEqual(inst.coverage?[0].coverageReference?.reference, "Coverage/9876B1") + XCTAssertEqual(inst.coverage?[0].coverage?.reference, "Coverage/9876B1") XCTAssertTrue(inst.coverage?[0].focal ?? false) + XCTAssertEqual(inst.coverage?[0].relationship?.code, "self") XCTAssertEqual(inst.coverage?[0].sequence, UInt(1)) XCTAssertEqual(inst.created?.description, "2014-08-16") XCTAssertEqual(inst.diagnosis?[0].diagnosis?.code, "654321") @@ -687,20 +583,20 @@ class ClaimTests: XCTestCase { XCTAssertEqual(inst.item?[0].net?.code, "USD") XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "80.0")) - XCTAssertEqual(inst.item?[0].providerReference?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[0].provider?.reference, "Practitioner/example") XCTAssertEqual(inst.item?[0].sequence, UInt(1)) XCTAssertEqual(inst.item?[0].service?.code, "exam") XCTAssertEqual(inst.item?[0].service?.system?.absoluteString, "http://hl7.org/fhir/ex-visionservice") - XCTAssertEqual(inst.item?[0].servicedDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[0].serviceDate?.description, "2014-08-16") XCTAssertEqual(inst.item?[0].type?.code, "service") XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") XCTAssertEqual(inst.item?[0].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.item?[0].unitPrice?.value, NSDecimalNumber(string: "80.0")) - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") - XCTAssertEqual(inst.patientReference?.reference, "Patient/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") + XCTAssertEqual(inst.patient?.reference, "Patient/1") XCTAssertEqual(inst.payee?.type?.code, "provider") XCTAssertEqual(inst.priority?.code, "normal") - XCTAssertEqual(inst.targetReference?.reference, "Organization/2") + XCTAssertEqual(inst.target?.reference, "Organization/2") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Vision Claim
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.type, "vision") @@ -708,4 +604,52 @@ class ClaimTests: XCTestCase { return inst } + + func testClaim9() { + do { + let instance = try runClaim9() + try runClaim9(instance.asJSON()) + } + catch { + XCTAssertTrue(false, "Must instantiate and test Claim successfully, but threw") + } + } + + @discardableResult + func runClaim9(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Claim { + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "claim-example.json") + + XCTAssertEqual(inst.coverage?[0].coverage?.reference, "Coverage/9876B1") + XCTAssertTrue(inst.coverage?[0].focal ?? false) + XCTAssertEqual(inst.coverage?[0].relationship?.code, "self") + XCTAssertEqual(inst.coverage?[0].sequence, UInt(1)) + XCTAssertEqual(inst.created?.description, "2014-08-16") + XCTAssertEqual(inst.diagnosis?[0].diagnosis?.code, "123456") + XCTAssertEqual(inst.diagnosis?[0].sequence, UInt(1)) + XCTAssertEqual(inst.id, "100150") + XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/claim") + XCTAssertEqual(inst.identifier?[0].value, "12345") + XCTAssertEqual(inst.item?[0].net?.code, "USD") + XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") + XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "135.57")) + XCTAssertEqual(inst.item?[0].provider?.reference, "Practitioner/example") + XCTAssertEqual(inst.item?[0].sequence, UInt(1)) + XCTAssertEqual(inst.item?[0].service?.code, "1200") + XCTAssertEqual(inst.item?[0].serviceDate?.description, "2014-08-16") + XCTAssertEqual(inst.item?[0].type?.code, "service") + XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") + XCTAssertEqual(inst.item?[0].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") + XCTAssertEqual(inst.item?[0].unitPrice?.value, NSDecimalNumber(string: "135.57")) + XCTAssertEqual(inst.organization?.reference, "Organization/1") + XCTAssertEqual(inst.patient?.reference, "Patient/1") + XCTAssertEqual(inst.payee?.type?.code, "provider") + XCTAssertEqual(inst.priority?.code, "normal") + XCTAssertEqual(inst.target?.reference, "Organization/2") + XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Oral Health Claim
") + XCTAssertEqual(inst.text?.status, "generated") + XCTAssertEqual(inst.type, "oral") + XCTAssertEqual(inst.use, "complete") + + return inst + } } diff --git a/Tests/ModelTests/ClinicalImpressionTests.swift b/Tests/ModelTests/ClinicalImpressionTests.swift index 778e3d4b..0f2ebd39 100644 --- a/Tests/ModelTests/ClinicalImpressionTests.swift +++ b/Tests/ModelTests/ClinicalImpressionTests.swift @@ -2,7 +2,7 @@ // ClinicalImpressionTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/CodeSystemTests.swift b/Tests/ModelTests/CodeSystemTests.swift deleted file mode 100644 index f8699cee..00000000 --- a/Tests/ModelTests/CodeSystemTests.swift +++ /dev/null @@ -1,141 +0,0 @@ -// -// CodeSystemTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class CodeSystemTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.CodeSystem { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.CodeSystem { - let instance = SwiftFHIR.CodeSystem(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testCodeSystem1() { - do { - let instance = try runCodeSystem1() - try runCodeSystem1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test CodeSystem successfully, but threw") - } - } - - @discardableResult - func runCodeSystem1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.CodeSystem { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "codesystem-example.json") - - XCTAssertTrue(inst.caseSensitive ?? false) - XCTAssertEqual(inst.concept?[0].code, "chol-mmol") - XCTAssertEqual(inst.concept?[0].definition, "Serum Cholesterol, in mmol/L") - XCTAssertEqual(inst.concept?[0].designation?[0].use?.code, "internal-label") - XCTAssertEqual(inst.concept?[0].designation?[0].use?.system?.absoluteString, "http://acme.com/config/fhir/codesystems/internal") - XCTAssertEqual(inst.concept?[0].designation?[0].value, "From ACME POC Testing") - XCTAssertEqual(inst.concept?[0].display, "SChol (mmol/L)") - XCTAssertEqual(inst.concept?[1].code, "chol-mass") - XCTAssertEqual(inst.concept?[1].definition, "Serum Cholesterol, in mg/L") - XCTAssertEqual(inst.concept?[1].designation?[0].use?.code, "internal-label") - XCTAssertEqual(inst.concept?[1].designation?[0].use?.system?.absoluteString, "http://acme.com/config/fhir/codesystems/internal") - XCTAssertEqual(inst.concept?[1].designation?[0].value, "From Paragon Labs") - XCTAssertEqual(inst.concept?[1].display, "SChol (mg/L)") - XCTAssertEqual(inst.concept?[2].code, "chol") - XCTAssertEqual(inst.concept?[2].definition, "Serum Cholesterol") - XCTAssertEqual(inst.concept?[2].designation?[0].use?.code, "internal-label") - XCTAssertEqual(inst.concept?[2].designation?[0].use?.system?.absoluteString, "http://acme.com/config/fhir/codesystems/internal") - XCTAssertEqual(inst.concept?[2].designation?[0].value, "Obdurate Labs uses this with both kinds of units...") - XCTAssertEqual(inst.concept?[2].display, "SChol") - XCTAssertEqual(inst.contact?[0].name, "FHIR project team") - XCTAssertEqual(inst.contact?[0].telecom?[0].system, "other") - XCTAssertEqual(inst.contact?[0].telecom?[0].value, "http://hl7.org/fhir") - XCTAssertEqual(inst.content, "complete") - XCTAssertEqual(inst.date?.description, "2016-01-28") - XCTAssertEqual(inst.description_fhir, "This is an example code system that includes all the ACME codes for serum/plasma cholesterol from v2.36.") - XCTAssertTrue(inst.experimental ?? false) - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.identifier?.system?.absoluteString, "http://acme.com/identifiers/codesystems") - XCTAssertEqual(inst.identifier?.value, "internal-cholesterol-inl") - XCTAssertEqual(inst.meta?.profile?[0].absoluteString, "http://hl7.org/fhir/StructureDefinition/codesystem-shareable-definition") - XCTAssertEqual(inst.name, "ACME Codes for Cholesterol in Serum/Plasma") - XCTAssertEqual(inst.publisher, "HL7 International") - XCTAssertEqual(inst.status, "draft") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.url?.absoluteString, "http://hl7.org/fhir/CodeSystem/example") - XCTAssertEqual(inst.version, "20160128") - - return inst - } - - func testCodeSystem2() { - do { - let instance = try runCodeSystem2() - try runCodeSystem2(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test CodeSystem successfully, but threw") - } - } - - @discardableResult - func runCodeSystem2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.CodeSystem { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "codesystem-list-example-codes.json") - - XCTAssertTrue(inst.caseSensitive ?? false) - XCTAssertEqual(inst.concept?[0].code, "alerts") - XCTAssertEqual(inst.concept?[0].definition, "A list of alerts for the patient.") - XCTAssertEqual(inst.concept?[0].display, "Alerts") - XCTAssertEqual(inst.concept?[1].code, "adverserxns") - XCTAssertEqual(inst.concept?[1].definition, "A list of part adverse reactions.") - XCTAssertEqual(inst.concept?[1].display, "Adverse Reactions") - XCTAssertEqual(inst.concept?[2].code, "allergies") - XCTAssertEqual(inst.concept?[2].definition, "A list of Allergies for the patient.") - XCTAssertEqual(inst.concept?[2].display, "Allergies") - XCTAssertEqual(inst.concept?[3].code, "medications") - XCTAssertEqual(inst.concept?[3].definition, "A list of medication statements for the patient.") - XCTAssertEqual(inst.concept?[3].display, "Medication List") - XCTAssertEqual(inst.concept?[4].code, "problems") - XCTAssertEqual(inst.concept?[4].definition, "A list of problems that the patient is known of have (or have had in the past).") - XCTAssertEqual(inst.concept?[4].display, "Problem List") - XCTAssertEqual(inst.concept?[5].code, "worklist") - XCTAssertEqual(inst.concept?[5].definition, "A list of items that constitute a set of work to be performed (typically this code would be specialized for more specific uses, such as a ward round list).") - XCTAssertEqual(inst.concept?[5].display, "Worklist") - XCTAssertEqual(inst.concept?[6].code, "waiting") - XCTAssertEqual(inst.concept?[6].definition, "A list of items waiting for an event (perhaps a surgical patient waiting list).") - XCTAssertEqual(inst.concept?[6].display, "Waiting List") - XCTAssertEqual(inst.concept?[7].code, "protocols") - XCTAssertEqual(inst.concept?[7].definition, "A set of protocols to be followed.") - XCTAssertEqual(inst.concept?[7].display, "Protocols") - XCTAssertEqual(inst.concept?[8].code, "plans") - XCTAssertEqual(inst.concept?[8].definition, "A set of care plans that apply in a particular context of care.") - XCTAssertEqual(inst.concept?[8].display, "Care Plans") - XCTAssertEqual(inst.contact?[0].telecom?[0].system, "other") - XCTAssertEqual(inst.contact?[0].telecom?[0].value, "http://hl7.org/fhir") - XCTAssertEqual(inst.content, "complete") - XCTAssertEqual(inst.description_fhir, "Example use codes for the List resource - typical kinds of use.") - XCTAssertTrue(inst.experimental ?? false) - XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/valueset-oid") - XCTAssertEqual(inst.extension_fhir?[0].valueUri?.absoluteString, "urn:oid:2.16.840.1.113883.4.642.1.173") - XCTAssertEqual(inst.id, "list-example-codes") - XCTAssertEqual(inst.meta?.lastUpdated?.description, "2016-03-31T08:01:25.570+11:00") - XCTAssertEqual(inst.meta?.profile?[0].absoluteString, "http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition") - XCTAssertEqual(inst.name, "Example Use Codes for List") - XCTAssertEqual(inst.publisher, "FHIR Project") - XCTAssertEqual(inst.status, "draft") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.url?.absoluteString, "http://hl7.org/fhir/list-example-use-codes") - XCTAssertEqual(inst.valueSet?.absoluteString, "http://hl7.org/fhir/ValueSet/list-example-codes") - XCTAssertEqual(inst.version, "1.4.0") - - return inst - } -} diff --git a/Tests/ModelTests/CommunicationRequestTests.swift b/Tests/ModelTests/CommunicationRequestTests.swift index ce8929a9..315b4345 100644 --- a/Tests/ModelTests/CommunicationRequestTests.swift +++ b/Tests/ModelTests/CommunicationRequestTests.swift @@ -2,7 +2,7 @@ // CommunicationRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/CommunicationTests.swift b/Tests/ModelTests/CommunicationTests.swift index 38f54f6d..6f61286f 100644 --- a/Tests/ModelTests/CommunicationTests.swift +++ b/Tests/ModelTests/CommunicationTests.swift @@ -2,7 +2,7 @@ // CommunicationTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/CompositionTests.swift b/Tests/ModelTests/CompositionTests.swift index b34cbf5b..21bbb368 100644 --- a/Tests/ModelTests/CompositionTests.swift +++ b/Tests/ModelTests/CompositionTests.swift @@ -2,7 +2,7 @@ // CompositionTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ConceptMapTests.swift b/Tests/ModelTests/ConceptMapTests.swift index 76c8e0ca..c47ffbac 100644 --- a/Tests/ModelTests/ConceptMapTests.swift +++ b/Tests/ModelTests/ConceptMapTests.swift @@ -2,7 +2,7 @@ // ConceptMapTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -42,70 +42,70 @@ class ConceptMapTests: XCTestCase { XCTAssertEqual(inst.contact?[1].telecom?[0].value, "http://www.phconnect.org/group/laboratorymessagingcommunityofpractice/forum/attachment/download?id=3649725%3AUploadedFile%3A145786") XCTAssertEqual(inst.date?.description, "2013-07-25") XCTAssertEqual(inst.element?[0].code, "ACNE") - XCTAssertEqual(inst.element?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[0].codeSystem?.absoluteString, "http://hl7.org/fhir/v2/0487") XCTAssertEqual(inst.element?[0].target?[0].code, "309068002") + XCTAssertEqual(inst.element?[0].target?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[0].target?[0].equivalence, "equivalent") - XCTAssertEqual(inst.element?[0].target?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[1].code, "ACNFLD") - XCTAssertEqual(inst.element?[1].system?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[1].codeSystem?.absoluteString, "http://hl7.org/fhir/v2/0487") XCTAssertEqual(inst.element?[1].target?[0].code, "119323008") + XCTAssertEqual(inst.element?[1].target?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[1].target?[0].comments, "HL7 term is a historical term. mapped to Pus") XCTAssertEqual(inst.element?[1].target?[0].equivalence, "equivalent") XCTAssertEqual(inst.element?[1].target?[0].product?[0].code, "47002008") + XCTAssertEqual(inst.element?[1].target?[0].product?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[1].target?[0].product?[0].element?.absoluteString, "http://hl7.org/fhir/v2/element/SPM-5") - XCTAssertEqual(inst.element?[1].target?[0].product?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.element?[1].target?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[2].code, "AIRS") - XCTAssertEqual(inst.element?[2].system?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[2].codeSystem?.absoluteString, "http://hl7.org/fhir/v2/0487") XCTAssertEqual(inst.element?[2].target?[0].code, "446302006") + XCTAssertEqual(inst.element?[2].target?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[2].target?[0].equivalence, "equivalent") - XCTAssertEqual(inst.element?[2].target?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[3].code, "ALL") - XCTAssertEqual(inst.element?[3].system?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[3].codeSystem?.absoluteString, "http://hl7.org/fhir/v2/0487") XCTAssertEqual(inst.element?[3].target?[0].code, "119376003") + XCTAssertEqual(inst.element?[3].target?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[3].target?[0].equivalence, "equivalent") XCTAssertEqual(inst.element?[3].target?[0].product?[0].code, "7970006") + XCTAssertEqual(inst.element?[3].target?[0].product?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[3].target?[0].product?[0].element?.absoluteString, "http://hl7.org/fhir/v2/element/SPM-5") - XCTAssertEqual(inst.element?[3].target?[0].product?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.element?[3].target?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[4].code, "AMP") - XCTAssertEqual(inst.element?[4].system?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[4].codeSystem?.absoluteString, "http://hl7.org/fhir/v2/0487") XCTAssertEqual(inst.element?[4].target?[0].code, "408654003") + XCTAssertEqual(inst.element?[4].target?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[4].target?[0].equivalence, "equivalent") XCTAssertEqual(inst.element?[4].target?[0].product?[0].code, "81723002") + XCTAssertEqual(inst.element?[4].target?[0].product?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[4].target?[0].product?[0].element?.absoluteString, "http://hl7.org/fhir/v2/element/SPM-7") - XCTAssertEqual(inst.element?[4].target?[0].product?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.element?[4].target?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[5].code, "ANGI") - XCTAssertEqual(inst.element?[5].system?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[5].codeSystem?.absoluteString, "http://hl7.org/fhir/v2/0487") XCTAssertEqual(inst.element?[5].target?[0].code, "119312009") + XCTAssertEqual(inst.element?[5].target?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[5].target?[0].comments, "TBD in detail") XCTAssertEqual(inst.element?[5].target?[0].equivalence, "equivalent") - XCTAssertEqual(inst.element?[5].target?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[6].code, "ARTC") - XCTAssertEqual(inst.element?[6].system?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[6].codeSystem?.absoluteString, "http://hl7.org/fhir/v2/0487") XCTAssertEqual(inst.element?[6].target?[0].code, "119312009") + XCTAssertEqual(inst.element?[6].target?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[6].target?[0].comments, "TBD in detail") XCTAssertEqual(inst.element?[6].target?[0].equivalence, "equivalent") - XCTAssertEqual(inst.element?[6].target?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[7].code, "ASERU") - XCTAssertEqual(inst.element?[7].system?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[7].codeSystem?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[7].target?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[7].target?[0].comments, "pending") XCTAssertEqual(inst.element?[7].target?[0].equivalence, "unmatched") - XCTAssertEqual(inst.element?[7].target?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[8].code, "ASP") - XCTAssertEqual(inst.element?[8].system?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[8].codeSystem?.absoluteString, "http://hl7.org/fhir/v2/0487") XCTAssertEqual(inst.element?[8].target?[0].code, "119295008") + XCTAssertEqual(inst.element?[8].target?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[8].target?[0].equivalence, "equivalent") XCTAssertEqual(inst.element?[8].target?[0].product?[0].code, "14766002") + XCTAssertEqual(inst.element?[8].target?[0].product?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[8].target?[0].product?[0].element?.absoluteString, "http://hl7.org/fhir/v2/element/SPM-7") - XCTAssertEqual(inst.element?[8].target?[0].product?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.element?[8].target?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[9].code, "ATTE") - XCTAssertEqual(inst.element?[9].system?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[9].codeSystem?.absoluteString, "http://hl7.org/fhir/v2/0487") + XCTAssertEqual(inst.element?[9].target?[0].codeSystem?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.element?[9].target?[0].comments, "TBD") XCTAssertEqual(inst.element?[9].target?[0].equivalence, "unmatched") - XCTAssertEqual(inst.element?[9].target?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertFalse(inst.experimental ?? true) XCTAssertEqual(inst.id, "102") XCTAssertEqual(inst.name, "Specimen mapping from v2 table 0487 to SNOMED CT") @@ -141,31 +141,31 @@ class ConceptMapTests: XCTestCase { XCTAssertEqual(inst.date?.description, "2012-06-13") XCTAssertEqual(inst.description_fhir, "A mapping between the FHIR and HL7 v3 AddressUse Code systems") XCTAssertEqual(inst.element?[0].code, "home") - XCTAssertEqual(inst.element?[0].system?.absoluteString, "http://hl7.org/fhir/address-use") + XCTAssertEqual(inst.element?[0].codeSystem?.absoluteString, "http://hl7.org/fhir/address-use") XCTAssertEqual(inst.element?[0].target?[0].code, "H") + XCTAssertEqual(inst.element?[0].target?[0].codeSystem?.absoluteString, "http://hl7.org/fhir/v3/AddressUse") XCTAssertEqual(inst.element?[0].target?[0].equivalence, "equivalent") - XCTAssertEqual(inst.element?[0].target?[0].system?.absoluteString, "http://hl7.org/fhir/v3/AddressUse") XCTAssertEqual(inst.element?[1].code, "home") - XCTAssertEqual(inst.element?[1].system?.absoluteString, "http://hl7.org/fhir/address-use") + XCTAssertEqual(inst.element?[1].codeSystem?.absoluteString, "http://hl7.org/fhir/address-use") XCTAssertEqual(inst.element?[1].target?[0].code, "H") + XCTAssertEqual(inst.element?[1].target?[0].codeSystem?.absoluteString, "http://hl7.org/fhir/v3/AddressUse") XCTAssertEqual(inst.element?[1].target?[0].equivalence, "equivalent") - XCTAssertEqual(inst.element?[1].target?[0].system?.absoluteString, "http://hl7.org/fhir/v3/AddressUse") XCTAssertEqual(inst.element?[2].code, "work") - XCTAssertEqual(inst.element?[2].system?.absoluteString, "http://hl7.org/fhir/address-use") + XCTAssertEqual(inst.element?[2].codeSystem?.absoluteString, "http://hl7.org/fhir/address-use") XCTAssertEqual(inst.element?[2].target?[0].code, "WP") + XCTAssertEqual(inst.element?[2].target?[0].codeSystem?.absoluteString, "http://hl7.org/fhir/v3/AddressUse") XCTAssertEqual(inst.element?[2].target?[0].equivalence, "equivalent") - XCTAssertEqual(inst.element?[2].target?[0].system?.absoluteString, "http://hl7.org/fhir/v3/AddressUse") XCTAssertEqual(inst.element?[3].code, "temp") - XCTAssertEqual(inst.element?[3].system?.absoluteString, "http://hl7.org/fhir/address-use") + XCTAssertEqual(inst.element?[3].codeSystem?.absoluteString, "http://hl7.org/fhir/address-use") XCTAssertEqual(inst.element?[3].target?[0].code, "TMP") + XCTAssertEqual(inst.element?[3].target?[0].codeSystem?.absoluteString, "http://hl7.org/fhir/v3/AddressUse") XCTAssertEqual(inst.element?[3].target?[0].equivalence, "equivalent") - XCTAssertEqual(inst.element?[3].target?[0].system?.absoluteString, "http://hl7.org/fhir/v3/AddressUse") XCTAssertEqual(inst.element?[4].code, "old") - XCTAssertEqual(inst.element?[4].system?.absoluteString, "http://hl7.org/fhir/address-use") + XCTAssertEqual(inst.element?[4].codeSystem?.absoluteString, "http://hl7.org/fhir/address-use") XCTAssertEqual(inst.element?[4].target?[0].code, "BAD") + XCTAssertEqual(inst.element?[4].target?[0].codeSystem?.absoluteString, "http://hl7.org/fhir/v3/AddressUse") XCTAssertEqual(inst.element?[4].target?[0].comments, "In the HL7 v3 AD, old is handled by the usablePeriod element, but you have to provide a time, there's no simple equivalent of flagging an address as old") XCTAssertEqual(inst.element?[4].target?[0].equivalence, "disjoint") - XCTAssertEqual(inst.element?[4].target?[0].system?.absoluteString, "http://hl7.org/fhir/v3/AddressUse") XCTAssertTrue(inst.experimental ?? false) XCTAssertEqual(inst.id, "101") XCTAssertEqual(inst.identifier?.system?.absoluteString, "urn:ietf:rfc:3986") @@ -173,9 +173,9 @@ class ConceptMapTests: XCTestCase { XCTAssertEqual(inst.name, "FHIR/v3 Address Use Mapping") XCTAssertEqual(inst.publisher, "HL7, Inc") XCTAssertEqual(inst.requirements, "To help implementers map from HL7 v3/CDA to FHIR") - XCTAssertEqual(inst.sourceReference?.reference, "http://hl7.org/fhir/ValueSet/address-use") + XCTAssertEqual(inst.sourceReference?.reference, "http://hl7.org/fhir/address-use") XCTAssertEqual(inst.status, "draft") - XCTAssertEqual(inst.targetReference?.reference, "http://hl7.org/fhir/ValueSet/v3-AddressUse") + XCTAssertEqual(inst.targetReference?.reference, "http://hl7.org/fhir/v3/AddressUse") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.url?.absoluteString, "http://hl7.org/fhir/ConceptMap/101") XCTAssertEqual(inst.useContext?[0].text, "for CDA Usage") diff --git a/Tests/ModelTests/ConditionTests.swift b/Tests/ModelTests/ConditionTests.swift index c098690f..ab6f44b9 100644 --- a/Tests/ModelTests/ConditionTests.swift +++ b/Tests/ModelTests/ConditionTests.swift @@ -2,7 +2,7 @@ // ConditionTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ConformanceTests.swift b/Tests/ModelTests/ConformanceTests.swift index 363ec9ea..3398e8aa 100644 --- a/Tests/ModelTests/ConformanceTests.swift +++ b/Tests/ModelTests/ConformanceTests.swift @@ -2,7 +2,7 @@ // ConformanceTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -176,7 +176,6 @@ class ConformanceTests: XCTestCase { XCTAssertEqual(inst.rest?[0].resource?[3].type, "DiagnosticReport") XCTAssertEqual(inst.rest?[0].security?.service?[0].text, "OAuth") XCTAssertEqual(inst.software?.name, "ACME PHR Server") - XCTAssertEqual(inst.status, "draft") XCTAssertEqual(inst.text?.status, "generated") return inst diff --git a/Tests/ModelTests/ContractTests.swift b/Tests/ModelTests/ContractTests.swift index f564610f..f82f9052 100644 --- a/Tests/ModelTests/ContractTests.swift +++ b/Tests/ModelTests/ContractTests.swift @@ -2,7 +2,7 @@ // ContractTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/CoverageTests.swift b/Tests/ModelTests/CoverageTests.swift index dbe9b1fb..c9d473ec 100644 --- a/Tests/ModelTests/CoverageTests.swift +++ b/Tests/ModelTests/CoverageTests.swift @@ -2,7 +2,7 @@ // CoverageTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -36,18 +36,16 @@ class CoverageTests: XCTestCase { func runCoverage1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Coverage { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "coverage-example-2.json") - XCTAssertEqual(inst.beneficiaryReference?.reference, "Patient/5") XCTAssertEqual(inst.dependent, UInt(1)) XCTAssertEqual(inst.id, "7546D") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://xyz.com/codes/identifier") XCTAssertEqual(inst.identifier?[0].value, "AB9876") - XCTAssertEqual(inst.issuerReference?.reference, "Organization/2") + XCTAssertEqual(inst.issuer?.reference, "Organization/2") XCTAssertEqual(inst.period?.end?.description, "2012-03-17") XCTAssertEqual(inst.period?.start?.description, "2011-03-17") XCTAssertEqual(inst.plan, "11024") - XCTAssertEqual(inst.planholderReference?.reference, "Patient/5") - XCTAssertEqual(inst.relationship?.code, "self") XCTAssertEqual(inst.subPlan, "D15C9") + XCTAssertEqual(inst.subscriber?.reference, "Patient/5") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the coverage
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.type?.code, "EHCPOL") @@ -71,19 +69,17 @@ class CoverageTests: XCTestCase { func runCoverage2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Coverage { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "coverage-example.json") - XCTAssertEqual(inst.beneficiaryReference?.reference, "Patient/4") XCTAssertEqual(inst.dependent, UInt(1)) XCTAssertEqual(inst.id, "9876B1") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://benefitsinc.com/certificate") XCTAssertEqual(inst.identifier?[0].value, "12345") - XCTAssertEqual(inst.issuerReference?.reference, "Organization/2") + XCTAssertEqual(inst.issuer?.reference, "Organization/2") XCTAssertEqual(inst.period?.end?.description, "2012-05-23") XCTAssertEqual(inst.period?.start?.description, "2011-05-23") XCTAssertEqual(inst.plan, "CBI35") - XCTAssertEqual(inst.planholderReference?.reference, "Patient/4") - XCTAssertEqual(inst.relationship?.code, "self") XCTAssertEqual(inst.sequence, UInt(1)) XCTAssertEqual(inst.subPlan, "123") + XCTAssertEqual(inst.subscriber?.reference, "Patient/4") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the coverage
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.type?.code, "EHCPOL") diff --git a/Tests/ModelTests/DataElementTests.swift b/Tests/ModelTests/DataElementTests.swift index 4bb54f86..b48682df 100644 --- a/Tests/ModelTests/DataElementTests.swift +++ b/Tests/ModelTests/DataElementTests.swift @@ -2,7 +2,7 @@ // DataElementTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -37,9 +37,8 @@ class DataElementTests: XCTestCase { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "dataelement-example.json") XCTAssertEqual(inst.contained?[0].id, "2179414") - XCTAssertEqual(inst.contained?[1].id, "2179414-permitted-cs") - XCTAssertEqual(inst.contained?[2].id, "2179414-permitted") - XCTAssertEqual(inst.contained?[3].id, "2179414-cm") + XCTAssertEqual(inst.contained?[1].id, "2179414-permitted") + XCTAssertEqual(inst.contained?[2].id, "2179414-cm") XCTAssertEqual(inst.element?[0].binding?.strength, "required") XCTAssertEqual(inst.element?[0].binding?.valueSetReference?.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/11179-permitted-value-valueset") XCTAssertEqual(inst.element?[0].binding?.valueSetReference?.extension_fhir?[0].valueReference?.reference, "#2179414-permitted") @@ -121,7 +120,7 @@ class DataElementTests: XCTestCase { XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.CenturyHospital/Laboratory/DirectoryofServices") XCTAssertEqual(inst.identifier?[0].type?.text, "Prothrombin Time, PT") XCTAssertEqual(inst.identifier?[0].value, "11") - XCTAssertEqual(inst.mapping?[0].comment, "Version 2.48 or later") + XCTAssertEqual(inst.mapping?[0].comments, "Version 2.48 or later") XCTAssertEqual(inst.mapping?[0].identity, "loinc") XCTAssertEqual(inst.mapping?[0].name, "LOINC") XCTAssertEqual(inst.mapping?[0].uri?.absoluteString, "http://loinc.org/") diff --git a/Tests/ModelTests/DecisionSupportRuleTests.swift b/Tests/ModelTests/DecisionSupportRuleTests.swift deleted file mode 100644 index bcce5411..00000000 --- a/Tests/ModelTests/DecisionSupportRuleTests.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// DecisionSupportRuleTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class DecisionSupportRuleTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.DecisionSupportRule { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.DecisionSupportRule { - let instance = SwiftFHIR.DecisionSupportRule(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testDecisionSupportRule1() { - do { - let instance = try runDecisionSupportRule1() - try runDecisionSupportRule1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test DecisionSupportRule successfully, but threw") - } - } - - @discardableResult - func runDecisionSupportRule1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.DecisionSupportRule { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "decisionsupportrule-example.json") - - XCTAssertEqual(inst.action?[0].customization?[0].expression, "ChlamydiaScreeningRequest") - XCTAssertEqual(inst.action?[0].customization?[0].path, "~") - XCTAssertEqual(inst.action?[0].title, "Patient has not had chlamydia screening within the recommended timeframe...") - XCTAssertEqual(inst.condition, "NoScreening") - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.library?[0].reference, "Library/ChlamydiaScreening_CDS_UsingCommon") - XCTAssertEqual(inst.moduleMetadata?.description_fhir, "Chlamydia Screening CDS Example Using Common") - XCTAssertEqual(inst.moduleMetadata?.identifier?[0].use, "official") - XCTAssertEqual(inst.moduleMetadata?.identifier?[0].value, "ChlamydiaScreening_CDS_UsingCommon") - XCTAssertEqual(inst.moduleMetadata?.publicationDate?.description, "2015-07-22") - XCTAssertEqual(inst.moduleMetadata?.status, "draft") - XCTAssertEqual(inst.moduleMetadata?.title, "Chalmydia Screening CDS Example Using Common") - XCTAssertEqual(inst.moduleMetadata?.topic?[0].text, "Chlamydia Screeening") - XCTAssertEqual(inst.moduleMetadata?.type, "module") - XCTAssertEqual(inst.moduleMetadata?.version, "2.0.0") - XCTAssertEqual(inst.text?.div, "
Chalmydia Screening CDS Example Using Common
") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } -} diff --git a/Tests/ModelTests/DecisionSupportServiceModuleTests.swift b/Tests/ModelTests/DecisionSupportServiceModuleTests.swift deleted file mode 100644 index 977cee3f..00000000 --- a/Tests/ModelTests/DecisionSupportServiceModuleTests.swift +++ /dev/null @@ -1,71 +0,0 @@ -// -// DecisionSupportServiceModuleTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class DecisionSupportServiceModuleTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.DecisionSupportServiceModule { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.DecisionSupportServiceModule { - let instance = SwiftFHIR.DecisionSupportServiceModule(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testDecisionSupportServiceModule1() { - do { - let instance = try runDecisionSupportServiceModule1() - try runDecisionSupportServiceModule1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test DecisionSupportServiceModule successfully, but threw") - } - } - - @discardableResult - func runDecisionSupportServiceModule1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.DecisionSupportServiceModule { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "decisionsupportservicemodule-example.json") - - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.moduleMetadata?.description_fhir, "Guideline appropriate ordering is used to assess appropriateness of an order given a patient, a proposed order, and a set of clinical indications.") - XCTAssertEqual(inst.moduleMetadata?.identifier?[0].use, "official") - XCTAssertEqual(inst.moduleMetadata?.identifier?[0].value, "guildeline-appropriate-ordering") - XCTAssertEqual(inst.moduleMetadata?.publicationDate?.description, "2015-07-22") - XCTAssertEqual(inst.moduleMetadata?.status, "draft") - XCTAssertEqual(inst.moduleMetadata?.title, "Guideline Appropriate Ordering Module") - XCTAssertEqual(inst.moduleMetadata?.topic?[0].text, "Guideline Appropriate Ordering") - XCTAssertEqual(inst.moduleMetadata?.topic?[1].text, "Appropriate Use Criteria") - XCTAssertEqual(inst.moduleMetadata?.type, "module") - XCTAssertEqual(inst.moduleMetadata?.version, "1.0.0") - XCTAssertEqual(inst.parameter?[0].name, "patient") - XCTAssertEqual(inst.parameter?[0].profile?.reference, "http://hl7.org/fhir/StructureDefinition/gao-patient") - XCTAssertEqual(inst.parameter?[0].type, "Patient") - XCTAssertEqual(inst.parameter?[0].use, "in") - XCTAssertEqual(inst.parameter?[1].name, "order") - XCTAssertEqual(inst.parameter?[1].profile?.reference, "http://hl7.org/fhir/StructureDefinition/gao-order") - XCTAssertEqual(inst.parameter?[1].type, "Order") - XCTAssertEqual(inst.parameter?[1].use, "in") - XCTAssertEqual(inst.parameter?[2].name, "order") - XCTAssertEqual(inst.parameter?[2].profile?.reference, "http://hl7.org/fhir/StructureDefinition/gao-order") - XCTAssertEqual(inst.parameter?[2].type, "Order") - XCTAssertEqual(inst.parameter?[2].use, "out") - XCTAssertEqual(inst.parameter?[3].name, "result") - XCTAssertEqual(inst.parameter?[3].profile?.reference, "http://hl7.org/fhir/StructureDefinition/gao-result") - XCTAssertEqual(inst.parameter?[3].type, "Basic") - XCTAssertEqual(inst.parameter?[3].use, "out") - XCTAssertEqual(inst.text?.div, "
Guideline Appropriate Ordering Module
") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } -} diff --git a/Tests/ModelTests/DetectedIssueTests.swift b/Tests/ModelTests/DetectedIssueTests.swift index 96e39f5c..45134a45 100644 --- a/Tests/ModelTests/DetectedIssueTests.swift +++ b/Tests/ModelTests/DetectedIssueTests.swift @@ -2,7 +2,7 @@ // DetectedIssueTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DeviceComponentTests.swift b/Tests/ModelTests/DeviceComponentTests.swift index 20221fa2..5a809f54 100644 --- a/Tests/ModelTests/DeviceComponentTests.swift +++ b/Tests/ModelTests/DeviceComponentTests.swift @@ -2,7 +2,7 @@ // DeviceComponentTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DeviceMetricTests.swift b/Tests/ModelTests/DeviceMetricTests.swift index d0882da9..49661c30 100644 --- a/Tests/ModelTests/DeviceMetricTests.swift +++ b/Tests/ModelTests/DeviceMetricTests.swift @@ -2,7 +2,7 @@ // DeviceMetricTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DeviceTests.swift b/Tests/ModelTests/DeviceTests.swift index b22dc5d0..4bfa1ada 100644 --- a/Tests/ModelTests/DeviceTests.swift +++ b/Tests/ModelTests/DeviceTests.swift @@ -2,7 +2,7 @@ // DeviceTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -36,7 +36,7 @@ class DeviceTests: XCTestCase { func runDevice1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Device { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "device-example-f001-feedingtube.json") - XCTAssertEqual(inst.expirationDate?.description, "2020-08-08") + XCTAssertEqual(inst.expiry?.description, "2020-08-08") XCTAssertEqual(inst.id, "f001") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http:/goodhealthhospital/identifier/devices") XCTAssertEqual(inst.identifier?[0].value, "12345") @@ -48,8 +48,7 @@ class DeviceTests: XCTestCase { XCTAssertEqual(inst.type?.coding?[0].code, "25062003") XCTAssertEqual(inst.type?.coding?[0].display, "Feeding tube, device") XCTAssertEqual(inst.type?.coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.udiCarrier?.system?.absoluteString, "urn:oid:2.16.840.1.113883.3.3719") - XCTAssertEqual(inst.udiCarrier?.value, "(01)00000123000017(10)ABC123(17)120415") + XCTAssertEqual(inst.udi, "(01)00000123000017(10)ABC123(17)120415") return inst } @@ -153,46 +152,6 @@ class DeviceTests: XCTestCase { @discardableResult func runDevice5(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Device { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "device-example-udi1.json") - - XCTAssertEqual(inst.expirationDate?.description, "2014-11-20") - XCTAssertEqual(inst.id, "example-udi1") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://acme.com/devices/pacemakers/octane/serial") - XCTAssertEqual(inst.identifier?[0].value, "1234-5678-90AB-CDEF") - XCTAssertEqual(inst.identifier?[1].type?.coding?[0].code, "SNO") - XCTAssertEqual(inst.identifier?[1].type?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/identifier-type") - XCTAssertEqual(inst.identifier?[1].value, "10987654d321") - XCTAssertEqual(inst.lotNumber, "7654321D") - XCTAssertEqual(inst.manufacturer, "Acme Devices, Inc") - XCTAssertEqual(inst.model, "PM/Octane 2014") - XCTAssertEqual(inst.patient?.reference, "Patient/example") - XCTAssertEqual(inst.status, "not-available") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type?.coding?[0].code, "09504000059118") - XCTAssertEqual(inst.type?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/NamingSystem/gs1-di") - XCTAssertEqual(inst.type?.coding?[1].code, "468063009") - XCTAssertEqual(inst.type?.coding?[1].display, "Coated femoral stem prosthesis, modular") - XCTAssertEqual(inst.type?.coding?[1].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.udiCarrier?.system?.absoluteString, "http://hl7.org/fhir/NamingSystem/fda-udi") - XCTAssertEqual(inst.udiCarrier?.type?.coding?[0].code, "UDI") - XCTAssertEqual(inst.udiCarrier?.type?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/identifier-type") - XCTAssertEqual(inst.udiCarrier?.value, "{01}09504000059118{17}141120{10}7654321D{21}10987654d321") - - return inst - } - - func testDevice6() { - do { - let instance = try runDevice6() - try runDevice6(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test Device successfully, but threw") - } - } - - @discardableResult - func runDevice6(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Device { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "device-example.json") XCTAssertEqual(inst.contact?[0].system, "phone") diff --git a/Tests/ModelTests/DeviceUseRequestTests.swift b/Tests/ModelTests/DeviceUseRequestTests.swift index 46cb02dc..cb82712d 100644 --- a/Tests/ModelTests/DeviceUseRequestTests.swift +++ b/Tests/ModelTests/DeviceUseRequestTests.swift @@ -2,7 +2,7 @@ // DeviceUseRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DeviceUseStatementTests.swift b/Tests/ModelTests/DeviceUseStatementTests.swift index 1e444d9f..75ad71bb 100644 --- a/Tests/ModelTests/DeviceUseStatementTests.swift +++ b/Tests/ModelTests/DeviceUseStatementTests.swift @@ -2,7 +2,7 @@ // DeviceUseStatementTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DiagnosticOrderTests.swift b/Tests/ModelTests/DiagnosticOrderTests.swift index dbd562af..4d515231 100644 --- a/Tests/ModelTests/DiagnosticOrderTests.swift +++ b/Tests/ModelTests/DiagnosticOrderTests.swift @@ -2,7 +2,7 @@ // DiagnosticOrderTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -127,69 +127,4 @@ class DiagnosticOrderTests: XCTestCase { return inst } - - func testDiagnosticOrder4() { - do { - let instance = try runDiagnosticOrder4() - try runDiagnosticOrder4(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test DiagnosticOrder successfully, but threw") - } - } - - @discardableResult - func runDiagnosticOrder4(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.DiagnosticOrder { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "diagnosticorder-genetics-example-1.json") - - XCTAssertEqual(inst.encounter?.reference, "Encounter/example") - XCTAssertEqual(inst.event?[0].actor?.reference, "Practitioner/example") - XCTAssertEqual(inst.event?[0].dateTime?.description, "2014-05-12T16:16:00-07:00") - XCTAssertEqual(inst.event?[0].status, "requested") - XCTAssertEqual(inst.id, "og-example1") - XCTAssertEqual(inst.item?[0].code?.coding?[0].code, "49874-1") - XCTAssertEqual(inst.item?[0].code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.item?[0].code?.text, "ABCB4 gene mutation analysis") - XCTAssertEqual(inst.item?[0].specimen?[0].reference, "Specimen/example") - XCTAssertEqual(inst.orderer?.reference, "Practitioner/example") - XCTAssertEqual(inst.status, "received") - XCTAssertEqual(inst.subject?.reference, "Patient/example") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } - - func testDiagnosticOrder5() { - do { - let instance = try runDiagnosticOrder5() - try runDiagnosticOrder5(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test DiagnosticOrder successfully, but threw") - } - } - - @discardableResult - func runDiagnosticOrder5(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.DiagnosticOrder { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "diagnosticorder-genetics-example-2.json") - - XCTAssertEqual(inst.encounter?.reference, "Encounter/example") - XCTAssertEqual(inst.event?[0].actor?.reference, "Practitioner/456") - XCTAssertEqual(inst.event?[0].dateTime?.description, "2014-05-12T16:16:00-07:00") - XCTAssertEqual(inst.event?[0].status, "requested") - XCTAssertEqual(inst.extension_fhir?[0].extension_fhir?[0].url?.absoluteString, "code") - XCTAssertEqual(inst.extension_fhir?[0].extension_fhir?[0].valueCodeableConcept?.coding?[0].code, "49874-1") - XCTAssertEqual(inst.extension_fhir?[0].extension_fhir?[0].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.extension_fhir?[0].extension_fhir?[0].valueCodeableConcept?.text, "ABCB4 gene mutation analysis") - XCTAssertEqual(inst.extension_fhir?[0].extension_fhir?[1].url?.absoluteString, "sequence") - XCTAssertEqual(inst.extension_fhir?[0].extension_fhir?[1].valueReference?.reference, "Sequence/example") - XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/diagnosticorder-geneticsItem") - XCTAssertEqual(inst.id, "og-example2") - XCTAssertEqual(inst.orderer?.reference, "Practitioner/example") - XCTAssertEqual(inst.status, "received") - XCTAssertEqual(inst.subject?.reference, "Patient/example") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } } diff --git a/Tests/ModelTests/DiagnosticReportTests.swift b/Tests/ModelTests/DiagnosticReportTests.swift index 57024aa3..4e02921a 100644 --- a/Tests/ModelTests/DiagnosticReportTests.swift +++ b/Tests/ModelTests/DiagnosticReportTests.swift @@ -2,7 +2,7 @@ // DiagnosticReportTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -379,87 +379,4 @@ class DiagnosticReportTests: XCTestCase { return inst } - - func testDiagnosticReport9() { - do { - let instance = try runDiagnosticReport9() - try runDiagnosticReport9(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test DiagnosticReport successfully, but threw") - } - } - - @discardableResult - func runDiagnosticReport9(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.DiagnosticReport { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "diagnosticreport-genetics-example-2 with familyhistory.json") - - XCTAssertEqual(inst.category?.coding?[0].code, "15220000") - XCTAssertEqual(inst.category?.coding?[0].display, "Laboratory test") - XCTAssertEqual(inst.category?.coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.category?.coding?[1].code, "LAB") - XCTAssertEqual(inst.category?.coding?[1].system?.absoluteString, "http://hl7.org/fhir/v2/0074") - XCTAssertEqual(inst.code?.coding?[0].code, "55233-1") - XCTAssertEqual(inst.code?.coding?[0].display, "Genetic analysis master panel") - XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.contained?[0].id, "f1-genetics") - XCTAssertEqual(inst.effectiveDateTime?.description, "2015-05-26T15:30:10+01:00") - XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/DiagnosticReport-geneticsFamilyMemberHistory") - XCTAssertEqual(inst.extension_fhir?[0].valueReference?.reference, "#dg1") - XCTAssertEqual(inst.id, "dg2") - XCTAssertEqual(inst.issued?.description, "2014-05-16T10:28:00+01:00") - XCTAssertEqual(inst.performer?.display, "Molecular Diagnostic Laboratory") - XCTAssertEqual(inst.performer?.reference, "Practitioner/genetics-example2") - XCTAssertEqual(inst.result?[0].display, "Genetic analysis for BRAC -1") - XCTAssertEqual(inst.result?[0].reference, "Observation/ob-genetics-3-1") - XCTAssertEqual(inst.result?[1].display, "Genetic analysis for BRAC -2") - XCTAssertEqual(inst.result?[1].reference, "Observation/ob-genetics-3-2") - XCTAssertEqual(inst.specimen?[0].display, "Molecular Specimen ID: MLD45-Z4-1234") - XCTAssertEqual(inst.specimen?[0].reference, "Specimen/genetics-example2") - XCTAssertEqual(inst.status, "final") - XCTAssertEqual(inst.subject?.display, "Peter James Chalmers(MRN: 12345)") - XCTAssertEqual(inst.subject?.reference, "Patient/example") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } - - func testDiagnosticReport10() { - do { - let instance = try runDiagnosticReport10() - try runDiagnosticReport10(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test DiagnosticReport successfully, but threw") - } - } - - @discardableResult - func runDiagnosticReport10(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.DiagnosticReport { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "diagnosticreport-hla-genetics-results-example.json") - - XCTAssertEqual(inst.code?.text, "HLA genotyping results") - XCTAssertEqual(inst.effectiveDateTime?.description, "2015-05-26T15:30:10+01:00") - XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/hla-genotyping-resultsAlleleAsignmentDate") - XCTAssertEqual(inst.extension_fhir?[0].valueDate?.description, "2014-10-22") - XCTAssertEqual(inst.extension_fhir?[1].extension_fhir?[0].url?.absoluteString, "text") - XCTAssertEqual(inst.extension_fhir?[1].extension_fhir?[0].valueString, "HLA-A*01:01:01+HLA-A*24:02:01") - XCTAssertEqual(inst.extension_fhir?[1].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/hla-genotyping-resultsGlstring") - XCTAssertEqual(inst.extension_fhir?[2].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/hla-genotyping-resultsConsensusSequenceBlock") - XCTAssertEqual(inst.extension_fhir?[2].valueReference?.reference, "Observation/consensus-sequence-block-example-1") - XCTAssertEqual(inst.extension_fhir?[3].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/hla-genotyping-resultsConsensusSequenceBlock") - XCTAssertEqual(inst.extension_fhir?[3].valueReference?.reference, "Observation/consensus-sequence-block-example-2") - XCTAssertEqual(inst.id, "hla-1") - XCTAssertEqual(inst.issued?.description, "2015-05-26T15:30:10+01:00") - XCTAssertEqual(inst.performer?.display, "Molecular Diagnostic Laboratory") - XCTAssertEqual(inst.performer?.reference, "Practitioner/genetics-example2") - XCTAssertEqual(inst.specimen?[0].display, "Molecular Specimen ID: MLD45-Z4-1234") - XCTAssertEqual(inst.specimen?[0].reference, "Specimen/genetics-example2") - XCTAssertEqual(inst.status, "final") - XCTAssertEqual(inst.subject?.display, "Molecular Lab Patient ID: HOSP-23456") - XCTAssertEqual(inst.subject?.reference, "Patient/genetics-example2") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } } diff --git a/Tests/ModelTests/DocumentManifestTests.swift b/Tests/ModelTests/DocumentManifestTests.swift new file mode 100644 index 00000000..37eb8658 --- /dev/null +++ b/Tests/ModelTests/DocumentManifestTests.swift @@ -0,0 +1,62 @@ +// +// DocumentManifestTests.swift +// SwiftFHIR +// +// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// 2016, SMART Health IT. +// + +import XCTest +import SwiftFHIR + + +class DocumentManifestTests: XCTestCase { + + func instantiateFrom(filename: String) throws -> SwiftFHIR.DocumentManifest { + return instantiateFrom(json: try readJSONFile(filename)) + } + + func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.DocumentManifest { + let instance = SwiftFHIR.DocumentManifest(json: json) + XCTAssertNotNil(instance, "Must have instantiated a test instance") + return instance + } + + func testDocumentManifest1() { + do { + let instance = try runDocumentManifest1() + try runDocumentManifest1(instance.asJSON()) + } + catch { + XCTAssertTrue(false, "Must instantiate and test DocumentManifest successfully, but threw") + } + } + + @discardableResult + func runDocumentManifest1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.DocumentManifest { + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "documentmanifest-example.json") + + XCTAssertEqual(inst.author?[0].reference, "#a1") + XCTAssertEqual(inst.contained?[0].id, "a1") + XCTAssertEqual(inst.content?[0].pReference?.reference, "DocumentReference/example") + XCTAssertEqual(inst.created?.description, "2004-12-25T23:50:50-05:00") + XCTAssertEqual(inst.description_fhir, "Physical") + XCTAssertEqual(inst.id, "example") + XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://example.org/documents") + XCTAssertEqual(inst.identifier?[0].value, "23425234234-2347") + XCTAssertEqual(inst.masterIdentifier?.system?.absoluteString, "http://example.org/documents") + XCTAssertEqual(inst.masterIdentifier?.value, "23425234234-2346") + XCTAssertEqual(inst.recipient?[0].reference, "Practitioner/xcda1") + XCTAssertEqual(inst.related?[0].identifier?.system?.absoluteString, "http://example.org/documents") + XCTAssertEqual(inst.related?[0].identifier?.value, "23425234234-9999") + XCTAssertEqual(inst.related?[0].ref?.reference, "DocumentReference/example") + XCTAssertEqual(inst.source?.absoluteString, "urn:oid:1.3.6.1.4.1.21367.2009.1.2.1") + XCTAssertEqual(inst.status, "current") + XCTAssertEqual(inst.subject?.reference, "Patient/xcda") + XCTAssertEqual(inst.text?.div, "
Text
") + XCTAssertEqual(inst.text?.status, "generated") + XCTAssertEqual(inst.type?.text, "History and Physical") + + return inst + } +} diff --git a/Tests/ModelTests/DocumentReferenceTests.swift b/Tests/ModelTests/DocumentReferenceTests.swift index 58badce4..f4540848 100644 --- a/Tests/ModelTests/DocumentReferenceTests.swift +++ b/Tests/ModelTests/DocumentReferenceTests.swift @@ -2,7 +2,7 @@ // DocumentReferenceTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/EligibilityRequestTests.swift b/Tests/ModelTests/EligibilityRequestTests.swift index 09aca0bd..17b94a50 100644 --- a/Tests/ModelTests/EligibilityRequestTests.swift +++ b/Tests/ModelTests/EligibilityRequestTests.swift @@ -2,7 +2,7 @@ // EligibilityRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -36,15 +36,11 @@ class EligibilityRequestTests: XCTestCase { func runEligibilityRequest1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.EligibilityRequest { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "eligibilityrequest-example.json") - XCTAssertEqual(inst.coverageReference?.reference, "Coverage/9876B1") XCTAssertEqual(inst.created?.description, "2014-08-16") XCTAssertEqual(inst.id, "52345") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/elegibilityrequest") XCTAssertEqual(inst.identifier?[0].value, "52345") - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") - XCTAssertEqual(inst.patientReference?.reference, "Patient/pat1") - XCTAssertEqual(inst.priority?.code, "normal") - XCTAssertEqual(inst.targetReference?.reference, "Organization/2") + XCTAssertEqual(inst.organization?.reference, "Organization/2") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the EligibilityRequest
") XCTAssertEqual(inst.text?.status, "generated") diff --git a/Tests/ModelTests/EligibilityResponseTests.swift b/Tests/ModelTests/EligibilityResponseTests.swift index 312bfaa2..a101808c 100644 --- a/Tests/ModelTests/EligibilityResponseTests.swift +++ b/Tests/ModelTests/EligibilityResponseTests.swift @@ -2,7 +2,7 @@ // EligibilityResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -41,10 +41,10 @@ class EligibilityResponseTests: XCTestCase { XCTAssertEqual(inst.id, "E2500") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.BenefitsInc.com/fhir/eligibilityresponse") XCTAssertEqual(inst.identifier?[0].value, "881234") - XCTAssertTrue(inst.inforce ?? false) - XCTAssertEqual(inst.organizationReference?.reference, "Organization/2") + XCTAssertEqual(inst.organization?.reference, "Organization/2") XCTAssertEqual(inst.outcome, "complete") - XCTAssertEqual(inst.requestReference?.reference, "http://www.BenefitsInc.com/fhir/eligibility/225476332402") + XCTAssertEqual(inst.request?.reference, "http://www.BenefitsInc.com/fhir/eligibility/225476332402") + XCTAssertEqual(inst.requestOrganization?.reference, "Organization/1") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the EligibilityResponse.
") XCTAssertEqual(inst.text?.status, "generated") diff --git a/Tests/ModelTests/EncounterTests.swift b/Tests/ModelTests/EncounterTests.swift index bcce72ea..3890878f 100644 --- a/Tests/ModelTests/EncounterTests.swift +++ b/Tests/ModelTests/EncounterTests.swift @@ -2,7 +2,7 @@ // EncounterTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -171,7 +171,7 @@ class EncounterTests: XCTestCase { XCTAssertEqual(inst.reason?[0].coding?[0].display, "Retropharyngeal abscess") XCTAssertEqual(inst.reason?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.reason?[0].extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/encounter-primaryDiagnosis") - XCTAssertEqual(inst.reason?[0].extension_fhir?[0].valuePositiveInt, UInt(1)) + XCTAssertEqual(inst.reason?[0].extension_fhir?[0].valueInteger, 1) XCTAssertEqual(inst.serviceProvider?.reference, "Organization/f001") XCTAssertEqual(inst.status, "finished") XCTAssertEqual(inst.text?.status, "generated") @@ -237,7 +237,7 @@ class EncounterTests: XCTestCase { XCTAssertEqual(inst.identifier?[0].value, "Encounter_Roel_20130128") XCTAssertEqual(inst.indication?[0].display, "Roel's TPF chemotherapy on January 28th, 2013") XCTAssertEqual(inst.indication?[0].extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/encounter-primaryDiagnosis") - XCTAssertEqual(inst.indication?[0].extension_fhir?[0].valuePositiveInt, UInt(1)) + XCTAssertEqual(inst.indication?[0].extension_fhir?[0].valueInteger, 1) XCTAssertEqual(inst.indication?[0].reference, "Procedure/f201") XCTAssertEqual(inst.length?.code, "258701004") XCTAssertEqual(inst.length?.system?.absoluteString, "http://snomed.info/sct") @@ -250,7 +250,7 @@ class EncounterTests: XCTestCase { XCTAssertEqual(inst.priority?.coding?[0].display, "Urgent") XCTAssertEqual(inst.priority?.coding?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.reason?[0].extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/encounter-primaryDiagnosis") - XCTAssertEqual(inst.reason?[0].extension_fhir?[0].valuePositiveInt, UInt(2)) + XCTAssertEqual(inst.reason?[0].extension_fhir?[0].valueInteger, 2) XCTAssertEqual(inst.reason?[0].text, "The patient is treated for a tumor.") XCTAssertEqual(inst.serviceProvider?.reference, "Organization/f201") XCTAssertEqual(inst.status, "finished") diff --git a/Tests/ModelTests/EnrollmentRequestTests.swift b/Tests/ModelTests/EnrollmentRequestTests.swift index 7e3debc5..ecb2db60 100644 --- a/Tests/ModelTests/EnrollmentRequestTests.swift +++ b/Tests/ModelTests/EnrollmentRequestTests.swift @@ -2,7 +2,7 @@ // EnrollmentRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/EnrollmentResponseTests.swift b/Tests/ModelTests/EnrollmentResponseTests.swift index 8703389f..1fdbc49d 100644 --- a/Tests/ModelTests/EnrollmentResponseTests.swift +++ b/Tests/ModelTests/EnrollmentResponseTests.swift @@ -2,7 +2,7 @@ // EnrollmentResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/EpisodeOfCareTests.swift b/Tests/ModelTests/EpisodeOfCareTests.swift index ae081ea5..3679f95a 100644 --- a/Tests/ModelTests/EpisodeOfCareTests.swift +++ b/Tests/ModelTests/EpisodeOfCareTests.swift @@ -2,7 +2,7 @@ // EpisodeOfCareTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -38,6 +38,13 @@ class EpisodeOfCareTests: XCTestCase { XCTAssertEqual(inst.careManager?.display, "Amanda Assigned") XCTAssertEqual(inst.careManager?.reference, "Practitioner/14") + XCTAssertEqual(inst.careTeam?[0].member?.display, "Henry Seven") + XCTAssertEqual(inst.careTeam?[0].member?.reference, "Practitioner/13") + XCTAssertEqual(inst.careTeam?[0].period?.end?.description, "2014-09-16") + XCTAssertEqual(inst.careTeam?[0].period?.start?.description, "2014-09-01") + XCTAssertEqual(inst.careTeam?[0].role?[0].coding?[0].code, "AO") + XCTAssertEqual(inst.careTeam?[0].role?[0].coding?[0].display, "Assessment Worker") + XCTAssertEqual(inst.careTeam?[0].role?[0].coding?[0].system?.absoluteString, "http://example.org/EpisodeOfCare/Role") XCTAssertEqual(inst.condition?[0].display, "Severe burn of left ear") XCTAssertEqual(inst.condition?[0].reference, "Condition/example") XCTAssertEqual(inst.id, "example") diff --git a/Tests/ModelTests/ExpansionProfileTests.swift b/Tests/ModelTests/ExpansionProfileTests.swift deleted file mode 100644 index f65390d6..00000000 --- a/Tests/ModelTests/ExpansionProfileTests.swift +++ /dev/null @@ -1,48 +0,0 @@ -// -// ExpansionProfileTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class ExpansionProfileTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.ExpansionProfile { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.ExpansionProfile { - let instance = SwiftFHIR.ExpansionProfile(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testExpansionProfile1() { - do { - let instance = try runExpansionProfile1() - try runExpansionProfile1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test ExpansionProfile successfully, but threw") - } - } - - @discardableResult - func runExpansionProfile1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ExpansionProfile { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "expansionprofile-example.json") - - XCTAssertTrue(inst.excludeNested ?? false) - XCTAssertTrue(inst.experimental ?? false) - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.status, "draft") - XCTAssertEqual(inst.text?.div, "
[ Provide Rendering ]
") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } -} diff --git a/Tests/ModelTests/ExplanationOfBenefitTests.swift b/Tests/ModelTests/ExplanationOfBenefitTests.swift index 328d7ab6..a513821e 100644 --- a/Tests/ModelTests/ExplanationOfBenefitTests.swift +++ b/Tests/ModelTests/ExplanationOfBenefitTests.swift @@ -2,7 +2,7 @@ // ExplanationOfBenefitTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -36,45 +36,17 @@ class ExplanationOfBenefitTests: XCTestCase { func runExplanationOfBenefit1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ExplanationOfBenefit { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "explanationofbenefit-example.json") - XCTAssertEqual(inst.claimReference?.reference, "Claim/100150") - XCTAssertEqual(inst.coverage?.coverageReference?.reference, "Coverage/9876B1") XCTAssertEqual(inst.created?.description, "2014-08-16") XCTAssertEqual(inst.disposition, "Claim settled as per contract.") - XCTAssertEqual(inst.id, "EB3500") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.BenefitsInc.com/fhir/explanationofbenefit") + XCTAssertEqual(inst.id, "R3500") + XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.BenefitsInc.com/fhir/eob") XCTAssertEqual(inst.identifier?[0].value, "987654321") - XCTAssertEqual(inst.item?[0].adjudication?[0].amount?.code, "USD") - XCTAssertEqual(inst.item?[0].adjudication?[0].amount?.system?.absoluteString, "urn:iso:std:iso:4217") - XCTAssertEqual(inst.item?[0].adjudication?[0].amount?.value, NSDecimalNumber(string: "120.0")) - XCTAssertEqual(inst.item?[0].adjudication?[0].category?.code, "eligible") - XCTAssertEqual(inst.item?[0].adjudication?[1].category?.code, "eligpercent") - XCTAssertEqual(inst.item?[0].adjudication?[1].value, NSDecimalNumber(string: "0.8")) - XCTAssertEqual(inst.item?[0].adjudication?[2].amount?.code, "USD") - XCTAssertEqual(inst.item?[0].adjudication?[2].amount?.system?.absoluteString, "urn:iso:std:iso:4217") - XCTAssertEqual(inst.item?[0].adjudication?[2].amount?.value, NSDecimalNumber(string: "96.0")) - XCTAssertEqual(inst.item?[0].adjudication?[2].category?.code, "benefit") - XCTAssertEqual(inst.item?[0].net?.code, "USD") - XCTAssertEqual(inst.item?[0].net?.system?.absoluteString, "urn:iso:std:iso:4217") - XCTAssertEqual(inst.item?[0].net?.value, NSDecimalNumber(string: "135.57")) - XCTAssertEqual(inst.item?[0].providerReference?.reference, "Practitioner/example") - XCTAssertEqual(inst.item?[0].sequence, UInt(1)) - XCTAssertEqual(inst.item?[0].service?.code, "1200") - XCTAssertEqual(inst.item?[0].service?.system?.absoluteString, "http://hl7.org/fhir/service-uscls") - XCTAssertEqual(inst.item?[0].servicedDate?.description, "2014-08-16") - XCTAssertEqual(inst.item?[0].type?.code, "service") - XCTAssertEqual(inst.item?[0].unitPrice?.code, "USD") - XCTAssertEqual(inst.item?[0].unitPrice?.system?.absoluteString, "urn:iso:std:iso:4217") - XCTAssertEqual(inst.item?[0].unitPrice?.value, NSDecimalNumber(string: "135.57")) - XCTAssertEqual(inst.organizationReference?.reference, "Organization/2") - XCTAssertEqual(inst.patientReference?.reference, "Patient/pat1") + XCTAssertEqual(inst.organization?.reference, "Organization/2") + XCTAssertEqual(inst.outcome, "complete") + XCTAssertEqual(inst.request?.reference, "http://www.BenefitsInc.com/fhir/oralhealthclaim/15476332402") + XCTAssertEqual(inst.requestOrganization?.reference, "Organization/1") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the ExplanationOfBenefit
") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.totalBenefit?.code, "USD") - XCTAssertEqual(inst.totalBenefit?.system?.absoluteString, "urn:iso:std:iso:4217") - XCTAssertEqual(inst.totalBenefit?.value, NSDecimalNumber(string: "96.0")) - XCTAssertEqual(inst.totalCost?.code, "USD") - XCTAssertEqual(inst.totalCost?.system?.absoluteString, "urn:iso:std:iso:4217") - XCTAssertEqual(inst.totalCost?.value, NSDecimalNumber(string: "135.57")) return inst } diff --git a/Tests/ModelTests/FamilyMemberHistoryTests.swift b/Tests/ModelTests/FamilyMemberHistoryTests.swift index c5d3b3cf..33c5f615 100644 --- a/Tests/ModelTests/FamilyMemberHistoryTests.swift +++ b/Tests/ModelTests/FamilyMemberHistoryTests.swift @@ -2,7 +2,7 @@ // FamilyMemberHistoryTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/FlagTests.swift b/Tests/ModelTests/FlagTests.swift index dcd6fc79..4a51b8bd 100644 --- a/Tests/ModelTests/FlagTests.swift +++ b/Tests/ModelTests/FlagTests.swift @@ -2,7 +2,7 @@ // FlagTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/GoalTests.swift b/Tests/ModelTests/GoalTests.swift index aa7396c9..c65068dd 100644 --- a/Tests/ModelTests/GoalTests.swift +++ b/Tests/ModelTests/GoalTests.swift @@ -2,7 +2,7 @@ // GoalTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/GroupTests.swift b/Tests/ModelTests/GroupTests.swift index ec37016c..0ac1fb7b 100644 --- a/Tests/ModelTests/GroupTests.swift +++ b/Tests/ModelTests/GroupTests.swift @@ -2,7 +2,7 @@ // GroupTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/GuidanceResponseTests.swift b/Tests/ModelTests/GuidanceResponseTests.swift deleted file mode 100644 index 7922bd56..00000000 --- a/Tests/ModelTests/GuidanceResponseTests.swift +++ /dev/null @@ -1,47 +0,0 @@ -// -// GuidanceResponseTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class GuidanceResponseTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.GuidanceResponse { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.GuidanceResponse { - let instance = SwiftFHIR.GuidanceResponse(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testGuidanceResponse1() { - do { - let instance = try runGuidanceResponse1() - try runGuidanceResponse1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test GuidanceResponse successfully, but threw") - } - } - - @discardableResult - func runGuidanceResponse1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.GuidanceResponse { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "guidanceresponse-example.json") - - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.module?.reference, "DecisionSupportServiceModule/example") - XCTAssertEqual(inst.status, "success") - XCTAssertEqual(inst.text?.div, "
[Put rendering here]
") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } -} diff --git a/Tests/ModelTests/HealthcareServiceTests.swift b/Tests/ModelTests/HealthcareServiceTests.swift index 5d42620e..463ebef8 100644 --- a/Tests/ModelTests/HealthcareServiceTests.swift +++ b/Tests/ModelTests/HealthcareServiceTests.swift @@ -2,7 +2,7 @@ // HealthcareServiceTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -57,7 +57,7 @@ class HealthcareServiceTests: XCTestCase { XCTAssertEqual(inst.eligibility?.coding?[0].display, "DVA Required") XCTAssertEqual(inst.eligibilityNote, "Evidence of application for DVA status may be sufficient for commencing assessment") XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.location?[0].reference, "Location/1") + XCTAssertEqual(inst.location?.reference, "Location/1") XCTAssertEqual(inst.notAvailable?[0].description_fhir, "Christmas/Boxing Day") XCTAssertEqual(inst.notAvailable?[0].during?.end?.description, "2015-12-26") XCTAssertEqual(inst.notAvailable?[0].during?.start?.description, "2015-12-25") @@ -75,15 +75,15 @@ class HealthcareServiceTests: XCTestCase { XCTAssertEqual(inst.referralMethod?[3].coding?[0].code, "semail") XCTAssertEqual(inst.referralMethod?[3].coding?[0].display, "Secure Email") XCTAssertEqual(inst.serviceName, "Consulting psychologists and/or psychology services") - XCTAssertEqual(inst.serviceType?[0].coding?[0].code, "394913002") - XCTAssertEqual(inst.serviceType?[0].coding?[0].display, "Psychotherapy") - XCTAssertEqual(inst.serviceType?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.serviceType?[1].coding?[0].code, "394587001") - XCTAssertEqual(inst.serviceType?[1].coding?[0].display, "Psychiatry") - XCTAssertEqual(inst.serviceType?[1].coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.specialty?[0].coding?[0].code, "47505003") - XCTAssertEqual(inst.specialty?[0].coding?[0].display, "Posttraumatic stress disorder") - XCTAssertEqual(inst.specialty?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.serviceType?[0].type?.coding?[0].code, "394913002") + XCTAssertEqual(inst.serviceType?[0].type?.coding?[0].display, "Psychotherapy") + XCTAssertEqual(inst.serviceType?[0].type?.coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.serviceType?[1].specialty?[0].coding?[0].code, "47505003") + XCTAssertEqual(inst.serviceType?[1].specialty?[0].coding?[0].display, "Posttraumatic stress disorder") + XCTAssertEqual(inst.serviceType?[1].specialty?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.serviceType?[1].type?.coding?[0].code, "394587001") + XCTAssertEqual(inst.serviceType?[1].type?.coding?[0].display, "Psychiatry") + XCTAssertEqual(inst.serviceType?[1].type?.coding?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.telecom?[0].system, "phone") XCTAssertEqual(inst.telecom?[0].use, "work") XCTAssertEqual(inst.telecom?[0].value, "(555) silent") diff --git a/Tests/ModelTests/ImagingExcerptTests.swift b/Tests/ModelTests/ImagingExcerptTests.swift deleted file mode 100644 index 69c9c0e7..00000000 --- a/Tests/ModelTests/ImagingExcerptTests.swift +++ /dev/null @@ -1,78 +0,0 @@ -// -// ImagingExcerptTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class ImagingExcerptTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.ImagingExcerpt { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.ImagingExcerpt { - let instance = SwiftFHIR.ImagingExcerpt(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testImagingExcerpt1() { - do { - let instance = try runImagingExcerpt1() - try runImagingExcerpt1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test ImagingExcerpt successfully, but threw") - } - } - - @discardableResult - func runImagingExcerpt1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ImagingExcerpt { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "imagingexcerpt-example.json") - - XCTAssertEqual(inst.authoringTime?.description, "2014-11-20T11:01:20-08:00") - XCTAssertEqual(inst.description_fhir, "1 SC image (screen snapshot) and 2 CT images to share a chest CT exam") - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.patient?.reference, "Patient/dicom") - XCTAssertEqual(inst.study?[0].dicom?[0].type, "WADO-RS") - XCTAssertEqual(inst.study?[0].dicom?[0].url?.absoluteString, "http://localhost/wado/SCP/2.16.124.113543.6003.189642796.63084.16749.2599092904") - XCTAssertEqual(inst.study?[0].series?[0].instance?[0].sopClass, "urn:oid:1.2.840.10008.5.1.4.1.1.7") - XCTAssertEqual(inst.study?[0].series?[0].instance?[0].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16748.2599092902") - XCTAssertEqual(inst.study?[0].series?[0].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16750.2599092901") - XCTAssertEqual(inst.study?[0].series?[1].instance?[0].sopClass, "urn:oid:1.2.840.10008.5.1.4.1.1.2") - XCTAssertEqual(inst.study?[0].series?[1].instance?[0].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16748.2599092903") - XCTAssertEqual(inst.study?[0].series?[1].instance?[1].sopClass, "urn:oid:1.2.840.10008.5.1.4.1.1.2") - XCTAssertEqual(inst.study?[0].series?[1].instance?[1].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16748.2599092904") - XCTAssertEqual(inst.study?[0].series?[1].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16750.2599092902") - XCTAssertEqual(inst.study?[0].uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16749.2599092904") - XCTAssertEqual(inst.study?[0].viewable?[0].contentType, "image/jpeg") - XCTAssertEqual(inst.study?[0].viewable?[0].height, UInt(100)) - XCTAssertEqual(inst.study?[0].viewable?[0].title, "thumbnail image") - XCTAssertEqual(inst.study?[0].viewable?[0].width, UInt(100)) - XCTAssertEqual(inst.study?[0].viewable?[1].contentType, "video/mp4") - XCTAssertEqual(inst.study?[0].viewable?[1].duration, UInt(2)) - XCTAssertEqual(inst.study?[0].viewable?[1].frames, UInt(10)) - XCTAssertEqual(inst.study?[0].viewable?[1].height, UInt(500)) - XCTAssertEqual(inst.study?[0].viewable?[1].title, "Cine loop") - XCTAssertEqual(inst.study?[0].viewable?[1].url?.absoluteString, "http://localhost/wado/SCP/2.16.124.113543.6003.189642796.63084.16749.2599092904.mp4") - XCTAssertEqual(inst.study?[0].viewable?[1].width, UInt(500)) - XCTAssertEqual(inst.study?[0].viewable?[2].contentType, "*/*") - XCTAssertEqual(inst.study?[0].viewable?[2].title, "web viewer") - XCTAssertEqual(inst.study?[0].viewable?[2].url?.absoluteString, "http://localhost/wado/SCP/2.16.124.113543.6003.189642796.63084.16749.2599092904.html") - XCTAssertEqual(inst.text?.div, "
A set of images accompanying to an exam document, including one SC image and two CT images, to publish the exam sharing
") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.title?.coding?[0].code, "113030") - XCTAssertEqual(inst.title?.coding?[0].display, "Manifest") - XCTAssertEqual(inst.title?.coding?[0].system?.absoluteString, "http://nema.org/dicom/dicm") - XCTAssertEqual(inst.title?.text, "A set of objects that have been exported for sharing") - XCTAssertEqual(inst.uid, "urn:oid:2.16.124.113543.6003.189642796.63084.16748.2599092901") - - return inst - } -} diff --git a/Tests/ModelTests/ImagingObjectSelectionTests.swift b/Tests/ModelTests/ImagingObjectSelectionTests.swift index df067ca4..8faba99d 100644 --- a/Tests/ModelTests/ImagingObjectSelectionTests.swift +++ b/Tests/ModelTests/ImagingObjectSelectionTests.swift @@ -2,7 +2,7 @@ // ImagingObjectSelectionTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ImagingStudyTests.swift b/Tests/ModelTests/ImagingStudyTests.swift index ca5b871f..a5d020fa 100644 --- a/Tests/ModelTests/ImagingStudyTests.swift +++ b/Tests/ModelTests/ImagingStudyTests.swift @@ -2,7 +2,7 @@ // ImagingStudyTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ImmunizationRecommendationTests.swift b/Tests/ModelTests/ImmunizationRecommendationTests.swift index 3004ff2b..4c68a7a9 100644 --- a/Tests/ModelTests/ImmunizationRecommendationTests.swift +++ b/Tests/ModelTests/ImmunizationRecommendationTests.swift @@ -2,7 +2,7 @@ // ImmunizationRecommendationTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -54,7 +54,9 @@ class ImmunizationRecommendationTests: XCTestCase { XCTAssertEqual(inst.recommendation?[0].dateCriterion?[2].code?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/immunization-recommendation-date-criterion") XCTAssertEqual(inst.recommendation?[0].dateCriterion?[2].value?.description, "2016-12-28T00:00:00-05:00") XCTAssertEqual(inst.recommendation?[0].doseNumber, UInt(1)) - XCTAssertEqual(inst.recommendation?[0].forecastStatus?.text, "Not Complete") + XCTAssertEqual(inst.recommendation?[0].forecastStatus?.coding?[0].code, "Not Complete") + XCTAssertEqual(inst.recommendation?[0].forecastStatus?.coding?[0].display, "Not Complete") + XCTAssertEqual(inst.recommendation?[0].forecastStatus?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/immunization-recommendation-status") XCTAssertEqual(inst.recommendation?[0].protocol_fhir?.authority?.reference, "Organization/hl7") XCTAssertEqual(inst.recommendation?[0].protocol_fhir?.description_fhir, "First sequence in protocol") XCTAssertEqual(inst.recommendation?[0].protocol_fhir?.doseSequence, 1) diff --git a/Tests/ModelTests/ImmunizationTests.swift b/Tests/ModelTests/ImmunizationTests.swift index 2978b8a4..2d796bca 100644 --- a/Tests/ModelTests/ImmunizationTests.swift +++ b/Tests/ModelTests/ImmunizationTests.swift @@ -2,7 +2,7 @@ // ImmunizationTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ImplementationGuideTests.swift b/Tests/ModelTests/ImplementationGuideTests.swift index 01fa796f..a7acd1fd 100644 --- a/Tests/ModelTests/ImplementationGuideTests.swift +++ b/Tests/ModelTests/ImplementationGuideTests.swift @@ -2,7 +2,7 @@ // ImplementationGuideTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -57,9 +57,9 @@ class ImplementationGuideTests: XCTestCase { XCTAssertEqual(inst.package?[0].name, "test") XCTAssertEqual(inst.package?[0].resource?[0].acronym, "daf-tst") XCTAssertEqual(inst.package?[0].resource?[0].description_fhir, "A test example to show how a package works") - XCTAssertTrue(inst.package?[0].resource?[0].example ?? false) XCTAssertEqual(inst.package?[0].resource?[0].exampleFor?.reference, "StructureDefinition/daf-patient") XCTAssertEqual(inst.package?[0].resource?[0].name, "Test Example") + XCTAssertEqual(inst.package?[0].resource?[0].purpose, "example") XCTAssertEqual(inst.package?[0].resource?[0].sourceUri?.absoluteString, "test.html") XCTAssertEqual(inst.page?.kind, "page") XCTAssertEqual(inst.page?.name, "Example Patient Page") diff --git a/Tests/ModelTests/LibraryTests.swift b/Tests/ModelTests/LibraryTests.swift deleted file mode 100644 index e30594ac..00000000 --- a/Tests/ModelTests/LibraryTests.swift +++ /dev/null @@ -1,137 +0,0 @@ -// -// LibraryTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class LibraryTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.Library { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.Library { - let instance = SwiftFHIR.Library(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testLibrary1() { - do { - let instance = try runLibrary1() - try runLibrary1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test Library successfully, but threw") - } - } - - @discardableResult - func runLibrary1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Library { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "library-cms146-example.json") - - XCTAssertEqual(inst.dataRequirement?[0].codeFilter?[0].path, "code") - XCTAssertEqual(inst.dataRequirement?[0].codeFilter?[0].valueSetString, "Other Female Reproductive Conditions") - XCTAssertEqual(inst.dataRequirement?[0].type, "Condition") - XCTAssertEqual(inst.dataRequirement?[1].type, "Patient") - XCTAssertEqual(inst.dataRequirement?[2].codeFilter?[0].path, "category") - XCTAssertEqual(inst.dataRequirement?[2].codeFilter?[0].valueCode?[0], "diagnosis") - XCTAssertEqual(inst.dataRequirement?[2].codeFilter?[1].path, "clinicalStatus") - XCTAssertEqual(inst.dataRequirement?[2].codeFilter?[1].valueCode?[0], "confirmed") - XCTAssertEqual(inst.dataRequirement?[2].codeFilter?[2].path, "code") - XCTAssertEqual(inst.dataRequirement?[2].codeFilter?[2].valueSetString, "2.16.840.1.113883.3.464.1003.102.12.1011") - XCTAssertEqual(inst.dataRequirement?[2].type, "Condition") - XCTAssertEqual(inst.dataRequirement?[3].codeFilter?[0].path, "category") - XCTAssertEqual(inst.dataRequirement?[3].codeFilter?[0].valueCode?[0], "diagnosis") - XCTAssertEqual(inst.dataRequirement?[3].codeFilter?[1].path, "clinicalStatus") - XCTAssertEqual(inst.dataRequirement?[3].codeFilter?[1].valueCode?[0], "confirmed") - XCTAssertEqual(inst.dataRequirement?[3].codeFilter?[2].path, "code") - XCTAssertEqual(inst.dataRequirement?[3].codeFilter?[2].valueSetString, "2.16.840.1.113883.3.464.1003.102.12.1012") - XCTAssertEqual(inst.dataRequirement?[3].type, "Condition") - XCTAssertEqual(inst.dataRequirement?[4].codeFilter?[0].path, "status") - XCTAssertEqual(inst.dataRequirement?[4].codeFilter?[0].valueCode?[0], "finished") - XCTAssertEqual(inst.dataRequirement?[4].codeFilter?[1].path, "class") - XCTAssertEqual(inst.dataRequirement?[4].codeFilter?[1].valueCode?[0], "ambulatory") - XCTAssertEqual(inst.dataRequirement?[4].codeFilter?[2].path, "type") - XCTAssertEqual(inst.dataRequirement?[4].codeFilter?[2].valueSetString, "2.16.840.1.113883.3.464.1003.101.12.1061") - XCTAssertEqual(inst.dataRequirement?[4].type, "Encounter") - XCTAssertEqual(inst.dataRequirement?[5].codeFilter?[0].path, "diagnosis") - XCTAssertEqual(inst.dataRequirement?[5].codeFilter?[0].valueSetString, "2.16.840.1.113883.3.464.1003.198.12.1012") - XCTAssertEqual(inst.dataRequirement?[5].type, "DiagnosticReport") - XCTAssertEqual(inst.dataRequirement?[6].codeFilter?[0].path, "code") - XCTAssertEqual(inst.dataRequirement?[6].codeFilter?[0].valueSetString, "2.16.840.1.113883.3.464.1003.196.12.1001") - XCTAssertEqual(inst.dataRequirement?[6].type, "Medication") - XCTAssertEqual(inst.dataRequirement?[7].codeFilter?[0].path, "status") - XCTAssertEqual(inst.dataRequirement?[7].codeFilter?[0].valueCode?[0], "active") - XCTAssertEqual(inst.dataRequirement?[7].codeFilter?[1].path, "medication.code") - XCTAssertEqual(inst.dataRequirement?[7].codeFilter?[1].valueSetString, "2.16.840.1.113883.3.464.1003.196.12.1001") - XCTAssertEqual(inst.dataRequirement?[7].type, "MedicationOrder") - XCTAssertEqual(inst.dataRequirement?[8].codeFilter?[0].path, "status") - XCTAssertEqual(inst.dataRequirement?[8].codeFilter?[0].valueCode?[0], "completed") - XCTAssertEqual(inst.dataRequirement?[8].codeFilter?[1].path, "medication.code") - XCTAssertEqual(inst.dataRequirement?[8].codeFilter?[1].valueSetString, "2.16.840.1.113883.3.464.1003.196.12.1001") - XCTAssertEqual(inst.dataRequirement?[8].type, "MedicationStatement") - XCTAssertEqual(inst.document?.contentType, "application/cql+text") - XCTAssertEqual(inst.document?.url?.absoluteString, "http://cqlrepository.org/CMS146.cql") - XCTAssertEqual(inst.id, "library-cms146-example") - XCTAssertEqual(inst.model?[0].identifier, "QUICK") - XCTAssertEqual(inst.moduleMetadata?.description_fhir, "Logic for CMS 146: Appropriate Testing for Children with Pharyngitis") - XCTAssertEqual(inst.moduleMetadata?.identifier?[0].use, "official") - XCTAssertEqual(inst.moduleMetadata?.identifier?[0].value, "CMS146") - XCTAssertEqual(inst.moduleMetadata?.publicationDate?.description, "2015-07-22") - XCTAssertEqual(inst.moduleMetadata?.status, "draft") - XCTAssertEqual(inst.moduleMetadata?.title, "Appropriate Testing for Children with Pharyngitis") - XCTAssertEqual(inst.moduleMetadata?.type, "library") - XCTAssertEqual(inst.moduleMetadata?.version, "2.0.0") - XCTAssertEqual(inst.text?.div, "
CMS 146 Logic
") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.valueSet?[0].identifier, "2.16.840.1.113883.3.560.100.2") - XCTAssertEqual(inst.valueSet?[0].name, "Female Administrative Sex") - - return inst - } - - func testLibrary2() { - do { - let instance = try runLibrary2() - try runLibrary2(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test Library successfully, but threw") - } - } - - @discardableResult - func runLibrary2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Library { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "library-example.json") - - XCTAssertEqual(inst.dataRequirement?[0].codeFilter?[0].path, "code") - XCTAssertEqual(inst.dataRequirement?[0].codeFilter?[0].valueSetString, "Other Female Reproductive Conditions") - XCTAssertEqual(inst.dataRequirement?[0].type, "Condition") - XCTAssertEqual(inst.document?.contentType, "application/cql+text") - XCTAssertEqual(inst.document?.url?.absoluteString, "http://cqlrepository.org/ChlamydiaScreening_Common.cql") - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.model?[0].identifier, "QUICK") - XCTAssertEqual(inst.moduleMetadata?.description_fhir, "Common Logic for adherence to Chlamydia Screening guidelines") - XCTAssertEqual(inst.moduleMetadata?.identifier?[0].use, "official") - XCTAssertEqual(inst.moduleMetadata?.identifier?[0].value, "ChalmydiaScreening_Common") - XCTAssertEqual(inst.moduleMetadata?.publicationDate?.description, "2015-07-22") - XCTAssertEqual(inst.moduleMetadata?.status, "draft") - XCTAssertEqual(inst.moduleMetadata?.title, "Chlamydia Screening Common Library") - XCTAssertEqual(inst.moduleMetadata?.topic?[0].text, "Chlamydia Screening") - XCTAssertEqual(inst.moduleMetadata?.type, "library") - XCTAssertEqual(inst.moduleMetadata?.version, "2.0.0") - XCTAssertEqual(inst.text?.div, "
Chlamydia Screening Common Library
") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.valueSet?[0].identifier, "2.16.840.1.113883.3.560.100.2") - XCTAssertEqual(inst.valueSet?[0].name, "Female Administrative Sex") - - return inst - } -} diff --git a/Tests/ModelTests/LinkageTests.swift b/Tests/ModelTests/LinkageTests.swift deleted file mode 100644 index c41d5ce1..00000000 --- a/Tests/ModelTests/LinkageTests.swift +++ /dev/null @@ -1,50 +0,0 @@ -// -// LinkageTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class LinkageTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.Linkage { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.Linkage { - let instance = SwiftFHIR.Linkage(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testLinkage1() { - do { - let instance = try runLinkage1() - try runLinkage1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test Linkage successfully, but threw") - } - } - - @discardableResult - func runLinkage1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Linkage { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "linkage-example.json") - - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.item?[0].resource?.display, "Severe burn of left ear (Date: 24-May 2012)") - XCTAssertEqual(inst.item?[0].resource?.reference, "Condition/example") - XCTAssertEqual(inst.item?[0].type, "source") - XCTAssertEqual(inst.item?[1].resource?.display, "Severe burn of left ear (Date: 24-May 2012)") - XCTAssertEqual(inst.item?[1].resource?.reference, "Condition/condition-example") - XCTAssertEqual(inst.item?[1].type, "alternate") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } -} diff --git a/Tests/ModelTests/ListTests.swift b/Tests/ModelTests/ListTests.swift index d015a95e..4aa94b6e 100644 --- a/Tests/ModelTests/ListTests.swift +++ b/Tests/ModelTests/ListTests.swift @@ -2,7 +2,7 @@ // ListTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -110,7 +110,7 @@ class ListTests: XCTestCase { XCTAssertEqual(inst.entry?[1].item?.reference, "#fmh-2") XCTAssertEqual(inst.id, "f201") XCTAssertEqual(inst.mode, "snapshot") - XCTAssertEqual(inst.note?[0].text, "Both parents, both brothers and both children (twin) are still alive.") + XCTAssertEqual(inst.note, "Both parents, both brothers and both children (twin) are still alive.") XCTAssertEqual(inst.status, "current") XCTAssertEqual(inst.subject?.display, "Roel") XCTAssertEqual(inst.subject?.reference, "Patient/f201") diff --git a/Tests/ModelTests/LocationTests.swift b/Tests/ModelTests/LocationTests.swift index fd0a0806..2d3e38e0 100644 --- a/Tests/ModelTests/LocationTests.swift +++ b/Tests/ModelTests/LocationTests.swift @@ -2,7 +2,7 @@ // LocationTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/MeasureReportTests.swift b/Tests/ModelTests/MeasureReportTests.swift deleted file mode 100644 index c6093a77..00000000 --- a/Tests/ModelTests/MeasureReportTests.swift +++ /dev/null @@ -1,443 +0,0 @@ -// -// MeasureReportTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class MeasureReportTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.MeasureReport { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.MeasureReport { - let instance = SwiftFHIR.MeasureReport(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testMeasureReport1() { - do { - let instance = try runMeasureReport1() - try runMeasureReport1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test MeasureReport successfully, but threw") - } - } - - @discardableResult - func runMeasureReport1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.MeasureReport { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "measurereport-cms146-cat1-example.json") - - XCTAssertEqual(inst.contained?[0].id, "reporter") - XCTAssertEqual(inst.evaluatedResources?.reference, "Bundle/456") - XCTAssertEqual(inst.group?[0].identifier?.value, "CMS146-group-1") - XCTAssertEqual(inst.group?[0].population?[0].count, 1) - XCTAssertEqual(inst.group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].population?[1].count, 1) - XCTAssertEqual(inst.group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].population?[2].count, 1) - XCTAssertEqual(inst.group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[0].count, 1) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[1].count, 1) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[2].count, 1) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].value, "true") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[0].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[1].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[2].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].value, "false") - XCTAssertEqual(inst.group?[0].stratifier?[0].identifier?.value, "stratifier-ages-up-to-9") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[0].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[1].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[2].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].value, "true") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[0].count, 1) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[1].count, 1) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[2].count, 1) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].value, "false") - XCTAssertEqual(inst.group?[0].stratifier?[1].identifier?.value, "stratifier-ages-10-plus") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[0].count, 1) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[1].count, 1) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[2].count, 1) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].value, "male") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[0].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[1].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[2].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].value, "female") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[0].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[1].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[2].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].value, "other") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[0].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[1].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[2].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].value, "unknown") - XCTAssertEqual(inst.group?[0].stratifier?[2].identifier?.value, "stratifier-gender") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[0].count, 1) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[0].value, "male") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[1].count, 0) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[1].value, "female") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[2].count, 0) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[2].value, "other") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[3].count, 0) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[3].value, "unknown") - XCTAssertEqual(inst.group?[0].supplementalData?[0].identifier?.value, "supplemental-data-gender") - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[0].count, 0) - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[0].value, "true") - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[1].count, 1) - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[1].value, "false") - XCTAssertEqual(inst.group?[0].supplementalData?[1].identifier?.value, "supplemental-data-deceased") - XCTAssertEqual(inst.id, "measurereport-cms146-cat1-example") - XCTAssertEqual(inst.measure?.reference, "Measure/CMS146") - XCTAssertEqual(inst.patient?.reference, "Patient/123") - XCTAssertEqual(inst.period?.end?.description, "2014-03-31") - XCTAssertEqual(inst.period?.start?.description, "2014-01-01") - XCTAssertEqual(inst.reportingOrganization?.reference, "#reporter") - XCTAssertEqual(inst.status, "complete") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type, "individual") - - return inst - } - - func testMeasureReport2() { - do { - let instance = try runMeasureReport2() - try runMeasureReport2(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test MeasureReport successfully, but threw") - } - } - - @discardableResult - func runMeasureReport2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.MeasureReport { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "measurereport-cms146-cat2-example.json") - - XCTAssertEqual(inst.contained?[0].id, "reporter") - XCTAssertEqual(inst.group?[0].identifier?.value, "CMS146-group-1") - XCTAssertEqual(inst.group?[0].population?[0].count, 500) - XCTAssertEqual(inst.group?[0].population?[0].patients?.reference, "List/CMS146-initial-population") - XCTAssertEqual(inst.group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].population?[1].count, 200) - XCTAssertEqual(inst.group?[0].population?[1].patients?.reference, "List/CMS146-numerator") - XCTAssertEqual(inst.group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].population?[2].count, 500) - XCTAssertEqual(inst.group?[0].population?[2].patients?.reference, "List/CMS146-denominator") - XCTAssertEqual(inst.group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].population?[3].count, 100) - XCTAssertEqual(inst.group?[0].population?[3].patients?.reference, "List/CMS146-denominator-exclusions") - XCTAssertEqual(inst.group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[0].patients?.reference, "List/CMS146-stratifier-ages-up-to-9-true-initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[1].patients?.reference, "List/CMS146-stratifier-ages-up-to-9-true-numerator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[2].patients?.reference, "List/CMS146-stratifier-ages-up-to-9-true-denominator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[3].patients?.reference, "List/CMS146-stratifier-ages-up-to-9-true-denominator-exclusions") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].value, "true") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[0].patients?.reference, "List/CMS146-stratifier-ages-up-to-9-false-initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[1].patients?.reference, "List/CMS146-stratifier-ages-up-to-9-false-numerator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[2].patients?.reference, "List/CMS146-stratifier-ages-up-to-9-false-denominator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[3].patients?.reference, "List/CMS146-stratifier-ages-up-to-9-false-denominator-exclusions") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].value, "false") - XCTAssertEqual(inst.group?[0].stratifier?[0].identifier?.value, "stratifier-ages-up-to-9") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[0].patients?.reference, "List/CMS146-stratifier-ages-10-plus-true-initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[1].patients?.reference, "List/CMS146-stratifier-ages-10-plus-true-numerator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[2].patients?.reference, "List/CMS146-stratifier-ages-10-plus-true-denominator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[3].patients?.reference, "List/CMS146-stratifier-ages-10-plus-true-denominator-exclusions") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].value, "true") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[0].patients?.reference, "List/CMS146-stratifier-ages-10-plus-false-initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[1].patients?.reference, "List/CMS146-stratifier-ages-10-plus-false-numerator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[2].patients?.reference, "List/CMS146-stratifier-ages-10-plus-false-denominator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[3].patients?.reference, "List/CMS146-stratifier-ages-10-plus-false-denominator-exclusions") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].value, "false") - XCTAssertEqual(inst.group?[0].stratifier?[1].identifier?.value, "stratifier-ages-10-plus") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[0].patients?.reference, "List/CMS146-stratifier-gender-male-initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[1].patients?.reference, "List/CMS146-stratifier-gender-male-numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[2].patients?.reference, "List/CMS146-stratifier-gender-male-denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[3].patients?.reference, "List/CMS146-stratifier-gender-male-denominator-exclusions") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].value, "male") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[0].patients?.reference, "List/CMS146-stratifier-gender-female-initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[1].patients?.reference, "List/CMS146-stratifier-gender-female-numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[2].patients?.reference, "List/CMS146-stratifier-gender-female-denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[3].patients?.reference, "List/CMS146-stratifier-gender-female-denominator-exclusions") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].value, "female") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[0].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[0].patients?.reference, "List/CMS146-stratifier-gender-other-initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[1].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[1].patients?.reference, "List/CMS146-stratifier-gender-other-numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[2].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[2].patients?.reference, "List/CMS146-stratifier-gender-other-denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[3].patients?.reference, "List/CMS146-stratifier-gender-other-denominator-exclusions") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].value, "other") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[0].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[0].patients?.reference, "List/CMS146-stratifier-gender-unknown-initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[1].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[1].patients?.reference, "List/CMS146-stratifier-gender-unknown-numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[2].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[2].patients?.reference, "List/CMS146-stratifier-gender-unknown-denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[3].patients?.reference, "List/CMS146-stratifier-gender-unknown-denominator-exclusions") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].value, "unknown") - XCTAssertEqual(inst.group?[0].stratifier?[2].identifier?.value, "stratifier-gender") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[0].count, 250) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[0].patients?.reference, "List/CMS146-supplemental-data-gender-male") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[0].value, "male") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[1].count, 250) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[1].patients?.reference, "List/CMS146-supplemental-data-gender-female") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[1].value, "female") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[2].count, 0) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[2].patients?.reference, "List/CMS146-supplemental-data-gender-other") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[2].value, "other") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[3].count, 0) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[3].patients?.reference, "List/CMS146-supplemental-data-gender-unknown") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[3].value, "unknown") - XCTAssertEqual(inst.group?[0].supplementalData?[0].identifier?.value, "supplemental-data-gender") - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[0].count, 0) - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[0].patients?.reference, "List/CMS146-supplemental-data-deceased-true") - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[0].value, "true") - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[1].count, 500) - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[1].patients?.reference, "List/CMS146-supplemental-data-deceased-false") - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[1].value, "false") - XCTAssertEqual(inst.group?[0].supplementalData?[1].identifier?.value, "supplemental-data-deceased") - XCTAssertEqual(inst.id, "measurereport-cms146-cat2-example") - XCTAssertEqual(inst.measure?.reference, "Measure/CMS146") - XCTAssertEqual(inst.period?.end?.description, "2014-03-31") - XCTAssertEqual(inst.period?.start?.description, "2014-01-01") - XCTAssertEqual(inst.reportingOrganization?.reference, "#reporter") - XCTAssertEqual(inst.status, "complete") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type, "patient-list") - - return inst - } - - func testMeasureReport3() { - do { - let instance = try runMeasureReport3() - try runMeasureReport3(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test MeasureReport successfully, but threw") - } - } - - @discardableResult - func runMeasureReport3(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.MeasureReport { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "measurereport-cms146-cat3-example.json") - - XCTAssertEqual(inst.contained?[0].id, "reporter") - XCTAssertEqual(inst.group?[0].identifier?.value, "CMS146-group-1") - XCTAssertEqual(inst.group?[0].population?[0].count, 500) - XCTAssertEqual(inst.group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].population?[1].count, 200) - XCTAssertEqual(inst.group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].population?[2].count, 500) - XCTAssertEqual(inst.group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].population?[3].count, 100) - XCTAssertEqual(inst.group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[0].value, "true") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[0].group?[1].value, "false") - XCTAssertEqual(inst.group?[0].stratifier?[0].identifier?.value, "stratifier-ages-up-to-9") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[0].value, "true") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[1].group?[1].value, "false") - XCTAssertEqual(inst.group?[0].stratifier?[1].identifier?.value, "stratifier-ages-10-plus") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[0].value, "male") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[0].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[1].count, 100) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[2].count, 250) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[3].count, 50) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[1].value, "female") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[0].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[1].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[2].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[2].value, "other") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[0].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[0].type, "initial-population") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[1].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[1].type, "numerator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[2].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[2].type, "denominator") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[3].count, 0) - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].population?[3].type, "denominator-exclusion") - XCTAssertEqual(inst.group?[0].stratifier?[2].group?[3].value, "unknown") - XCTAssertEqual(inst.group?[0].stratifier?[2].identifier?.value, "stratifier-gender") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[0].count, 250) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[0].value, "male") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[1].count, 250) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[1].value, "female") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[2].count, 0) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[2].value, "other") - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[3].count, 0) - XCTAssertEqual(inst.group?[0].supplementalData?[0].group?[3].value, "unknown") - XCTAssertEqual(inst.group?[0].supplementalData?[0].identifier?.value, "supplemental-data-gender") - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[0].count, 0) - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[0].value, "true") - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[1].count, 500) - XCTAssertEqual(inst.group?[0].supplementalData?[1].group?[1].value, "false") - XCTAssertEqual(inst.group?[0].supplementalData?[1].identifier?.value, "supplemental-data-deceased") - XCTAssertEqual(inst.id, "measurereport-cms146-cat3-example") - XCTAssertEqual(inst.measure?.reference, "Measure/CMS146") - XCTAssertEqual(inst.period?.end?.description, "2014-03-31") - XCTAssertEqual(inst.period?.start?.description, "2014-01-01") - XCTAssertEqual(inst.reportingOrganization?.reference, "#reporter") - XCTAssertEqual(inst.status, "complete") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type, "summary") - - return inst - } -} diff --git a/Tests/ModelTests/MediaTests.swift b/Tests/ModelTests/MediaTests.swift index ca1a3e21..01792643 100644 --- a/Tests/ModelTests/MediaTests.swift +++ b/Tests/ModelTests/MediaTests.swift @@ -2,7 +2,7 @@ // MediaTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/MedicationOrderTests.swift b/Tests/ModelTests/MedicationOrderTests.swift index 06e4761b..002806bd 100644 --- a/Tests/ModelTests/MedicationOrderTests.swift +++ b/Tests/ModelTests/MedicationOrderTests.swift @@ -2,7 +2,7 @@ // MedicationOrderTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -64,7 +64,7 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.boundsPeriod?.start?.description, "2013-08-04") XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.frequency, 3) XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.period, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnit, "d") + XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnits, "d") XCTAssertEqual(inst.encounter?.display, "visit who leads to this priscription") XCTAssertEqual(inst.encounter?.reference, "Encounter/f001") XCTAssertEqual(inst.id, "f001") @@ -77,9 +77,9 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.patient?.reference, "Patient/f001") XCTAssertEqual(inst.prescriber?.display, "R.A. van den Berk") XCTAssertEqual(inst.prescriber?.reference, "Practitioner/f006") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].code, "13645005") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].display, "Chronic obstructive pulmonary disease") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].code, "13645005") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].display, "Chronic obstructive pulmonary disease") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.status, "active") XCTAssertEqual(inst.text?.status, "generated") @@ -118,7 +118,7 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.boundsPeriod?.start?.description, "2013-08-04") XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.frequency, 1) XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.period, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnit, "d") + XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnits, "d") XCTAssertEqual(inst.encounter?.display, "encounter who leads to this priscription") XCTAssertEqual(inst.encounter?.reference, "Encounter/f001") XCTAssertEqual(inst.id, "f002") @@ -131,9 +131,9 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.patient?.reference, "Patient/f001") XCTAssertEqual(inst.prescriber?.display, "R.A. van den Berk") XCTAssertEqual(inst.prescriber?.reference, "Practitioner/f006") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].code, "28036006") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].display, "High density lipoprotein cholesterol level") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].code, "28036006") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].display, "High density lipoprotein cholesterol level") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.status, "active") XCTAssertEqual(inst.text?.status, "generated") @@ -172,7 +172,7 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.boundsPeriod?.start?.description, "2011-05-01") XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.frequency, 3) XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.period, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnit, "d") + XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnits, "d") XCTAssertEqual(inst.encounter?.display, "encounter who leads to this priscription") XCTAssertEqual(inst.encounter?.reference, "Encounter/f002") XCTAssertEqual(inst.id, "f003") @@ -185,9 +185,9 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.patient?.reference, "Patient/f001") XCTAssertEqual(inst.prescriber?.display, "S.M. Heps") XCTAssertEqual(inst.prescriber?.reference, "Practitioner/f007") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].code, "444780001") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].display, "High glucose level in blood") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].code, "444780001") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].display, "High glucose level in blood") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.status, "active") XCTAssertEqual(inst.text?.status, "generated") @@ -226,7 +226,7 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.boundsPeriod?.start?.description, "2011-05-01") XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.frequency, 1) XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.period, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnit, "d") + XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnits, "d") XCTAssertEqual(inst.encounter?.display, "encounter who leads to this priscription") XCTAssertEqual(inst.encounter?.reference, "Encounter/f001") XCTAssertEqual(inst.id, "f004") @@ -239,9 +239,9 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.patient?.reference, "Patient/f001") XCTAssertEqual(inst.prescriber?.display, "S.M. Heps") XCTAssertEqual(inst.prescriber?.reference, "Practitioner/f007") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].code, "38341003") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].display, "High blood pressure") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].code, "38341003") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].display, "High blood pressure") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.status, "active") XCTAssertEqual(inst.text?.status, "generated") @@ -280,7 +280,7 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.boundsPeriod?.start?.description, "2011-05-01") XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.frequency, 1) XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.period, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnit, "d") + XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnits, "d") XCTAssertEqual(inst.encounter?.display, "encounter who leads to this priscription") XCTAssertEqual(inst.encounter?.reference, "Encounter/f001") XCTAssertEqual(inst.id, "f005") @@ -293,9 +293,9 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.patient?.reference, "Patient/f001") XCTAssertEqual(inst.prescriber?.display, "S.M. Heps") XCTAssertEqual(inst.prescriber?.reference, "Practitioner/f007") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].code, "38341003") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].display, "High blood pressure") - XCTAssertEqual(inst.reasonCode?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].code, "38341003") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].display, "High blood pressure") + XCTAssertEqual(inst.reasonCodeableConcept?.coding?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.status, "active") XCTAssertEqual(inst.text?.status, "generated") @@ -342,7 +342,7 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.boundsPeriod?.start?.description, "2013-03-11") XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.frequency, 2) XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.period, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnit, "d") + XCTAssertEqual(inst.dosageInstruction?[0].timing?.repeat_fhir?.periodUnits, "d") XCTAssertEqual(inst.id, "f201") XCTAssertEqual(inst.medicationReference?.display, "25ug Salmeterol + 250ug Fluticasone") XCTAssertEqual(inst.medicationReference?.reference, "Medication/f201") @@ -350,8 +350,8 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.patient?.reference, "Patient/f201") XCTAssertEqual(inst.prescriber?.display, "Dokter Bonsig") XCTAssertEqual(inst.prescriber?.reference, "Practitioner/f201") - XCTAssertEqual(inst.reasonReference?[0].display, "fever") - XCTAssertEqual(inst.reasonReference?[0].reference, "Condition/f201") + XCTAssertEqual(inst.reasonReference?.display, "fever") + XCTAssertEqual(inst.reasonReference?.reference, "Condition/f201") XCTAssertEqual(inst.status, "active") XCTAssertEqual(inst.text?.status, "generated") @@ -398,8 +398,8 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.patient?.display, "Roel") XCTAssertEqual(inst.patient?.reference, "Patient/f201") XCTAssertEqual(inst.prescriber?.reference, "Practitioner/f201") - XCTAssertEqual(inst.reasonReference?[0].display, "sepsis") - XCTAssertEqual(inst.reasonReference?[0].reference, "Condition/f203") + XCTAssertEqual(inst.reasonReference?.display, "sepsis") + XCTAssertEqual(inst.reasonReference?.reference, "Condition/f203") XCTAssertEqual(inst.status, "completed") XCTAssertEqual(inst.text?.status, "generated") @@ -441,8 +441,8 @@ class MedicationOrderTests: XCTestCase { XCTAssertEqual(inst.patient?.display, "Roel") XCTAssertEqual(inst.patient?.reference, "Patient/f201") XCTAssertEqual(inst.prescriber?.reference, "Practitioner/f201") - XCTAssertEqual(inst.reasonReference?[0].display, "fever") - XCTAssertEqual(inst.reasonReference?[0].reference, "Condition/f201") + XCTAssertEqual(inst.reasonReference?.display, "fever") + XCTAssertEqual(inst.reasonReference?.reference, "Condition/f201") XCTAssertEqual(inst.status, "active") XCTAssertEqual(inst.text?.status, "generated") diff --git a/Tests/ModelTests/MedicationTests.swift b/Tests/ModelTests/MedicationTests.swift index 73f35618..1eb9ccea 100644 --- a/Tests/ModelTests/MedicationTests.swift +++ b/Tests/ModelTests/MedicationTests.swift @@ -2,7 +2,7 @@ // MedicationTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -49,8 +49,8 @@ class MedicationTests: XCTestCase { XCTAssertEqual(inst.product?.ingredient?[0].amount?.numerator?.system?.absoluteString, "http://unitsofmeasure.org") XCTAssertEqual(inst.product?.ingredient?[0].amount?.numerator?.unit, "ml") XCTAssertEqual(inst.product?.ingredient?[0].amount?.numerator?.value, NSDecimalNumber(string: "100")) - XCTAssertEqual(inst.product?.ingredient?[0].itemReference?.display, "Combivent") - XCTAssertEqual(inst.product?.ingredient?[0].itemReference?.reference, "Medication/f001") + XCTAssertEqual(inst.product?.ingredient?[0].item?.display, "Combivent") + XCTAssertEqual(inst.product?.ingredient?[0].item?.reference, "Medication/f001") XCTAssertEqual(inst.text?.status, "generated") return inst @@ -192,14 +192,14 @@ class MedicationTests: XCTestCase { XCTAssertEqual(inst.product?.ingredient?[0].amount?.numerator?.code, "ug") XCTAssertEqual(inst.product?.ingredient?[0].amount?.numerator?.system?.absoluteString, "http://unitsofmeasure.org") XCTAssertEqual(inst.product?.ingredient?[0].amount?.numerator?.value, NSDecimalNumber(string: "25")) - XCTAssertEqual(inst.product?.ingredient?[0].itemCodeableConcept?.text, "flutacisone") + XCTAssertEqual(inst.product?.ingredient?[0].item?.display, "flutacisone") XCTAssertEqual(inst.product?.ingredient?[1].amount?.denominator?.code, "PUFF") XCTAssertEqual(inst.product?.ingredient?[1].amount?.denominator?.system?.absoluteString, "http://hl7.org/fhir/v3/orderableDrugForm") XCTAssertEqual(inst.product?.ingredient?[1].amount?.denominator?.value, NSDecimalNumber(string: "1")) XCTAssertEqual(inst.product?.ingredient?[1].amount?.numerator?.code, "ug") XCTAssertEqual(inst.product?.ingredient?[1].amount?.numerator?.system?.absoluteString, "http://unitsofmeasure.org") XCTAssertEqual(inst.product?.ingredient?[1].amount?.numerator?.value, NSDecimalNumber(string: "250")) - XCTAssertEqual(inst.product?.ingredient?[1].itemCodeableConcept?.text, "salmeterol") + XCTAssertEqual(inst.product?.ingredient?[1].item?.display, "salmeterol") XCTAssertEqual(inst.text?.status, "generated") return inst diff --git a/Tests/ModelTests/MessageHeaderTests.swift b/Tests/ModelTests/MessageHeaderTests.swift index e0417127..bff7b555 100644 --- a/Tests/ModelTests/MessageHeaderTests.swift +++ b/Tests/ModelTests/MessageHeaderTests.swift @@ -2,7 +2,7 @@ // MessageHeaderTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ModuleDefinitionTests.swift b/Tests/ModelTests/ModuleDefinitionTests.swift deleted file mode 100644 index 2cba5feb..00000000 --- a/Tests/ModelTests/ModuleDefinitionTests.swift +++ /dev/null @@ -1,54 +0,0 @@ -// -// ModuleDefinitionTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class ModuleDefinitionTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.ModuleDefinition { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.ModuleDefinition { - let instance = SwiftFHIR.ModuleDefinition(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testModuleDefinition1() { - do { - let instance = try runModuleDefinition1() - try runModuleDefinition1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test ModuleDefinition successfully, but threw") - } - } - - @discardableResult - func runModuleDefinition1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ModuleDefinition { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "moduledefinition-example.json") - - XCTAssertEqual(inst.data?[0].codeFilter?[0].path, "code") - XCTAssertEqual(inst.data?[0].codeFilter?[0].valueSetString, "Other Female Reproductive Conditions") - XCTAssertEqual(inst.data?[0].type, "Condition") - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.identifier?[0].use, "official") - XCTAssertEqual(inst.identifier?[0].value, "ChalmydiaScreening_Common") - XCTAssertEqual(inst.model?[0].identifier, "QUICK") - XCTAssertEqual(inst.text?.div, "
[Put rendering here]
") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.valueSet?[0].identifier, "2.16.840.1.113883.3.560.100.2") - XCTAssertEqual(inst.valueSet?[0].name, "Female Administrative Sex") - XCTAssertEqual(inst.version, "2.0.0") - - return inst - } -} diff --git a/Tests/ModelTests/NamingSystemTests.swift b/Tests/ModelTests/NamingSystemTests.swift index afc0014e..4546fedd 100644 --- a/Tests/ModelTests/NamingSystemTests.swift +++ b/Tests/ModelTests/NamingSystemTests.swift @@ -2,7 +2,7 @@ // NamingSystemTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/NutritionOrderTests.swift b/Tests/ModelTests/NutritionOrderTests.swift index a4360976..68beac06 100644 --- a/Tests/ModelTests/NutritionOrderTests.swift +++ b/Tests/ModelTests/NutritionOrderTests.swift @@ -2,7 +2,7 @@ // NutritionOrderTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -127,7 +127,7 @@ class NutritionOrderTests: XCTestCase { XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.boundsPeriod?.start?.description, "2015-02-10") XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.frequency, 3) XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.period, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.periodUnit, "d") + XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.periodUnits, "d") XCTAssertEqual(inst.oralDiet?.type?[0].coding?[0].code, "160670007") XCTAssertEqual(inst.oralDiet?.type?[0].coding?[0].display, "Diabetic diet") XCTAssertEqual(inst.oralDiet?.type?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") @@ -184,9 +184,9 @@ class NutritionOrderTests: XCTestCase { XCTAssertEqual(inst.supplement?[0].schedule?[0].repeat_fhir?.boundsPeriod?.start?.description, "2015-02-10T15:00:00Z") XCTAssertEqual(inst.supplement?[0].schedule?[0].repeat_fhir?.frequency, 1) XCTAssertEqual(inst.supplement?[0].schedule?[0].repeat_fhir?.period, NSDecimalNumber(string: "24")) - XCTAssertEqual(inst.supplement?[0].schedule?[0].repeat_fhir?.periodUnit, "h") + XCTAssertEqual(inst.supplement?[0].schedule?[0].repeat_fhir?.periodUnits, "h") XCTAssertEqual(inst.supplement?[0].schedule?[1].repeat_fhir?.duration, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.supplement?[0].schedule?[1].repeat_fhir?.durationUnit, "h") + XCTAssertEqual(inst.supplement?[0].schedule?[1].repeat_fhir?.durationUnits, "h") XCTAssertEqual(inst.supplement?[0].schedule?[1].repeat_fhir?.when, "HS") XCTAssertEqual(inst.supplement?[0].type?.coding?[0].code, "443051000124104") XCTAssertEqual(inst.supplement?[0].type?.coding?[0].display, "Adult diabetes specialty formula") @@ -239,7 +239,7 @@ class NutritionOrderTests: XCTestCase { XCTAssertEqual(inst.supplement?[0].schedule?[0].repeat_fhir?.boundsPeriod?.start?.description, "2015-02-10") XCTAssertEqual(inst.supplement?[0].schedule?[0].repeat_fhir?.frequency, 3) XCTAssertEqual(inst.supplement?[0].schedule?[0].repeat_fhir?.period, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.supplement?[0].schedule?[0].repeat_fhir?.periodUnit, "d") + XCTAssertEqual(inst.supplement?[0].schedule?[0].repeat_fhir?.periodUnits, "d") XCTAssertEqual(inst.supplement?[0].type?.coding?[0].code, "442971000124100") XCTAssertEqual(inst.supplement?[0].type?.coding?[0].display, "Adult high energy formula") XCTAssertEqual(inst.supplement?[0].type?.coding?[0].system?.absoluteString, "http://snomed.info/sct") @@ -282,7 +282,7 @@ class NutritionOrderTests: XCTestCase { XCTAssertEqual(inst.enteralFormula?.administration?[0].schedule?.repeat_fhir?.boundsPeriod?.start?.description, "2014-09-17T16:00:00Z") XCTAssertEqual(inst.enteralFormula?.administration?[0].schedule?.repeat_fhir?.frequency, 1) XCTAssertEqual(inst.enteralFormula?.administration?[0].schedule?.repeat_fhir?.period, NSDecimalNumber(string: "4")) - XCTAssertEqual(inst.enteralFormula?.administration?[0].schedule?.repeat_fhir?.periodUnit, "h") + XCTAssertEqual(inst.enteralFormula?.administration?[0].schedule?.repeat_fhir?.periodUnits, "h") XCTAssertEqual(inst.enteralFormula?.administrationInstruction, "240 mls every 4hrs ") XCTAssertEqual(inst.enteralFormula?.baseFormulaProductName, "Acme High Protein Formula") XCTAssertEqual(inst.enteralFormula?.baseFormulaType?.coding?[0].code, "659311000124118") @@ -417,7 +417,7 @@ class NutritionOrderTests: XCTestCase { XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.boundsPeriod?.start?.description, "2015-02-10") XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.frequency, 3) XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.period, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.periodUnit, "d") + XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.periodUnits, "d") XCTAssertEqual(inst.oralDiet?.type?[0].coding?[0].code, "15108003") XCTAssertEqual(inst.oralDiet?.type?[0].coding?[0].display, "Restricted fiber diet") XCTAssertEqual(inst.oralDiet?.type?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") @@ -470,7 +470,7 @@ class NutritionOrderTests: XCTestCase { XCTAssertEqual(inst.enteralFormula?.administration?[0].schedule?.repeat_fhir?.boundsPeriod?.start?.description, "2014-09-17") XCTAssertEqual(inst.enteralFormula?.administration?[0].schedule?.repeat_fhir?.frequency, 1) XCTAssertEqual(inst.enteralFormula?.administration?[0].schedule?.repeat_fhir?.period, NSDecimalNumber(string: "3")) - XCTAssertEqual(inst.enteralFormula?.administration?[0].schedule?.repeat_fhir?.periodUnit, "h") + XCTAssertEqual(inst.enteralFormula?.administration?[0].schedule?.repeat_fhir?.periodUnits, "h") XCTAssertEqual(inst.enteralFormula?.administrationInstruction, "Add high calorie high carbohydrate additive to increase cal/oz from 24 cal/oz to 27 cal/oz.") XCTAssertEqual(inst.enteralFormula?.baseFormulaProductName, "Acme Infant Formula + Iron") XCTAssertEqual(inst.enteralFormula?.baseFormulaType?.coding?[0].code, "412414007") @@ -571,7 +571,7 @@ class NutritionOrderTests: XCTestCase { XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.boundsPeriod?.start?.description, "2015-02-10") XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.frequency, 3) XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.period, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.periodUnit, "d") + XCTAssertEqual(inst.oralDiet?.schedule?[0].repeat_fhir?.periodUnits, "d") XCTAssertEqual(inst.oralDiet?.texture?[0].modifier?.coding?[0].code, "228055009") XCTAssertEqual(inst.oralDiet?.texture?[0].modifier?.coding?[0].display, "Liquidized food") XCTAssertEqual(inst.oralDiet?.texture?[0].modifier?.coding?[0].system?.absoluteString, "http://snomed.info/sct") diff --git a/Tests/ModelTests/ObservationTests.swift b/Tests/ModelTests/ObservationTests.swift index 1ea54284..504ebcf8 100644 --- a/Tests/ModelTests/ObservationTests.swift +++ b/Tests/ModelTests/ObservationTests.swift @@ -2,7 +2,7 @@ // ObservationTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -34,45 +34,49 @@ class ObservationTests: XCTestCase { @discardableResult func runObservation1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Observation { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-bloodpressure-cancel.json") + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "obs-genetics-example1-somatic.json") - XCTAssertEqual(inst.bodySite?.coding?[0].code, "368209003") - XCTAssertEqual(inst.bodySite?.coding?[0].display, "Right arm") - XCTAssertEqual(inst.bodySite?.coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.code?.coding?[0].code, "55284-4") - XCTAssertEqual(inst.code?.coding?[0].display, "Blood pressure systolic & diastolic") + XCTAssertEqual(inst.code?.coding?[0].code, "55233-1") XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.comment, "In this example, the blood pressure measurements are not available due to cancellation of the order. Data absent reason is present for each component") - XCTAssertEqual(inst.component?[0].code?.coding?[0].code, "8480-6") - XCTAssertEqual(inst.component?[0].code?.coding?[0].display, "Systolic blood pressure") - XCTAssertEqual(inst.component?[0].code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.component?[0].code?.coding?[1].code, "271649006") - XCTAssertEqual(inst.component?[0].code?.coding?[1].display, "Systolic blood pressure") - XCTAssertEqual(inst.component?[0].code?.coding?[1].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.component?[0].code?.coding?[2].code, "bp-s") - XCTAssertEqual(inst.component?[0].code?.coding?[2].display, "Systolic Blood pressure") - XCTAssertEqual(inst.component?[0].code?.coding?[2].system?.absoluteString, "http://acme.org/devices/clinical-codes") - XCTAssertEqual(inst.component?[0].dataAbsentReason?.coding?[0].code, "not-asked") - XCTAssertEqual(inst.component?[0].dataAbsentReason?.coding?[0].display, "Not Asked") - XCTAssertEqual(inst.component?[0].dataAbsentReason?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/data-absent-reason") - XCTAssertEqual(inst.component?[1].code?.coding?[0].code, "8462-4") - XCTAssertEqual(inst.component?[1].code?.coding?[0].display, "Diastolic blood pressure") - XCTAssertEqual(inst.component?[1].code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.component?[1].dataAbsentReason?.coding?[0].code, "not-asked") - XCTAssertEqual(inst.component?[1].dataAbsentReason?.coding?[0].display, "Not Asked") - XCTAssertEqual(inst.component?[1].dataAbsentReason?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/data-absent-reason") - XCTAssertEqual(inst.effectiveDateTime?.description, "2012-09-17") - XCTAssertEqual(inst.id, "blood-pressure-cancel") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "urn:ietf:rfc:3986") - XCTAssertEqual(inst.identifier?[0].value, "urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281") - XCTAssertEqual(inst.interpretation?.coding?[0].code, "L") - XCTAssertEqual(inst.interpretation?.coding?[0].display, "low") + XCTAssertEqual(inst.comments, "The EGFR p.L858R mutation has been associated with response to anti-EGFR therapy") + XCTAssertEqual(inst.contained?[0].id, "c1") + XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsGenomeBuild") + XCTAssertEqual(inst.extension_fhir?[0].valueString, "GRCh 37") + XCTAssertEqual(inst.extension_fhir?[1].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsChromosome") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].code, "NC_000007") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.ncbi.nlm.nih.gov/gene") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.text, "Homo sapiens chromosome 7") + XCTAssertEqual(inst.extension_fhir?[2].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsGenomicStart") + XCTAssertEqual(inst.extension_fhir?[2].valueInteger, 55259515) + XCTAssertEqual(inst.extension_fhir?[3].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsGenomicStop") + XCTAssertEqual(inst.extension_fhir?[3].valueInteger, 55259516) + XCTAssertEqual(inst.extension_fhir?[4].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsSpecies") + XCTAssertEqual(inst.extension_fhir?[4].valueCodeableConcept?.coding?[0].code, "337915000") + XCTAssertEqual(inst.extension_fhir?[4].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.extension_fhir?[4].valueCodeableConcept?.text, "Homo sapiens") + XCTAssertEqual(inst.extension_fhir?[5].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsCIGAR") + XCTAssertEqual(inst.extension_fhir?[5].valueString, "1M") + XCTAssertEqual(inst.extension_fhir?[6].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsAssessedCondition") + XCTAssertEqual(inst.extension_fhir?[6].valueReference?.reference, "#c1") + XCTAssertEqual(inst.extension_fhir?[7].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsReferenceAllele") + XCTAssertEqual(inst.extension_fhir?[7].valueString, "T") + XCTAssertEqual(inst.extension_fhir?[8].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsObservedAllele") + XCTAssertEqual(inst.extension_fhir?[8].valueString, "G") + XCTAssertEqual(inst.extension_fhir?[9].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsGene") + XCTAssertEqual(inst.extension_fhir?[9].valueCodeableConcept?.coding?[0].code, "3236") + XCTAssertEqual(inst.extension_fhir?[9].valueCodeableConcept?.coding?[0].display, "EGFR") + XCTAssertEqual(inst.extension_fhir?[9].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.genenames.org") + XCTAssertEqual(inst.id, "genetics-example1-somatic") + XCTAssertEqual(inst.interpretation?.coding?[0].code, "POS") XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0078") - XCTAssertEqual(inst.interpretation?.text, "Below low normal") - XCTAssertEqual(inst.meta?.lastUpdated?.description, "2014-01-30T22:35:23+11:00") - XCTAssertEqual(inst.performer?[0].reference, "Practitioner/example") - XCTAssertEqual(inst.status, "cancelled") - XCTAssertEqual(inst.subject?.reference, "Patient/example") + XCTAssertEqual(inst.interpretation?.text, "positive") + XCTAssertEqual(inst.performer?[0].display, "Molecular Diagnostic Laboratory") + XCTAssertEqual(inst.performer?[0].reference, "Practitioner/genetics-example1-somatic") + XCTAssertEqual(inst.specimen?.display, "Molecular Specimen ID: MLD45-Z4-1234") + XCTAssertEqual(inst.specimen?.reference, "Specimen/genetics-example1-somatic") + XCTAssertEqual(inst.status, "final") + XCTAssertEqual(inst.subject?.display, "Molecular Lab Patient ID: HOSP-23456") + XCTAssertEqual(inst.subject?.reference, "Patient/genetics-example1-somatic") XCTAssertEqual(inst.text?.status, "generated") return inst @@ -90,49 +94,45 @@ class ObservationTests: XCTestCase { @discardableResult func runObservation2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Observation { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-bloodpressure.json") + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "obs-genetics-example2-germline.json") - XCTAssertEqual(inst.bodySite?.coding?[0].code, "368209003") - XCTAssertEqual(inst.bodySite?.coding?[0].display, "Right arm") - XCTAssertEqual(inst.bodySite?.coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.category?.coding?[0].code, "vital-signs") - XCTAssertEqual(inst.category?.coding?[0].display, "Vital Signs") - XCTAssertEqual(inst.category?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/observation-category") - XCTAssertEqual(inst.code?.coding?[0].code, "55284-4") - XCTAssertEqual(inst.code?.coding?[0].display, "Blood pressure systolic & diastolic") + XCTAssertEqual(inst.code?.coding?[0].code, "21636-6") + XCTAssertEqual(inst.code?.coding?[0].display, "BRCA1 gene mutation analysis") XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.component?[0].code?.coding?[0].code, "8480-6") - XCTAssertEqual(inst.component?[0].code?.coding?[0].display, "Systolic blood pressure") - XCTAssertEqual(inst.component?[0].code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.component?[0].code?.coding?[1].code, "271649006") - XCTAssertEqual(inst.component?[0].code?.coding?[1].display, "Systolic blood pressure") - XCTAssertEqual(inst.component?[0].code?.coding?[1].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.component?[0].code?.coding?[2].code, "bp-s") - XCTAssertEqual(inst.component?[0].code?.coding?[2].display, "Systolic Blood pressure") - XCTAssertEqual(inst.component?[0].code?.coding?[2].system?.absoluteString, "http://acme.org/devices/clinical-codes") - XCTAssertEqual(inst.component?[0].valueQuantity?.code, "mm[Hg]") - XCTAssertEqual(inst.component?[0].valueQuantity?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.component?[0].valueQuantity?.unit, "mmHg") - XCTAssertEqual(inst.component?[0].valueQuantity?.value, NSDecimalNumber(string: "107")) - XCTAssertEqual(inst.component?[1].code?.coding?[0].code, "8462-4") - XCTAssertEqual(inst.component?[1].code?.coding?[0].display, "Diastolic blood pressure") - XCTAssertEqual(inst.component?[1].code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.component?[1].valueQuantity?.code, "mm[Hg]") - XCTAssertEqual(inst.component?[1].valueQuantity?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.component?[1].valueQuantity?.unit, "mmHg") - XCTAssertEqual(inst.component?[1].valueQuantity?.value, NSDecimalNumber(string: "60")) - XCTAssertEqual(inst.effectiveDateTime?.description, "2012-09-17") - XCTAssertEqual(inst.id, "blood-pressure") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "urn:ietf:rfc:3986") - XCTAssertEqual(inst.identifier?[0].value, "urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281") - XCTAssertEqual(inst.interpretation?.coding?[0].code, "L") - XCTAssertEqual(inst.interpretation?.coding?[0].display, "low") - XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0078") - XCTAssertEqual(inst.interpretation?.text, "Below low normal") - XCTAssertEqual(inst.meta?.lastUpdated?.description, "2014-01-30T22:35:23+11:00") - XCTAssertEqual(inst.performer?[0].reference, "Practitioner/example") + XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsGenomeBuild") + XCTAssertEqual(inst.extension_fhir?[0].valueString, "GRCh 37") + XCTAssertEqual(inst.extension_fhir?[1].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsChromosome") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].code, "NC_000017") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.ncbi.nlm.nih.gov/gene") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.text, "Homo sapiens chromosome 17") + XCTAssertEqual(inst.extension_fhir?[2].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsGenomicStart") + XCTAssertEqual(inst.extension_fhir?[2].valueInteger, 41258504) + XCTAssertEqual(inst.extension_fhir?[3].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsGenomicStop") + XCTAssertEqual(inst.extension_fhir?[3].valueInteger, 41258505) + XCTAssertEqual(inst.extension_fhir?[4].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsReferenceAllele") + XCTAssertEqual(inst.extension_fhir?[4].valueString, "A") + XCTAssertEqual(inst.extension_fhir?[5].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsObservedAllele") + XCTAssertEqual(inst.extension_fhir?[5].valueString, "C") + XCTAssertEqual(inst.extension_fhir?[6].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsGene") + XCTAssertEqual(inst.extension_fhir?[6].valueCodeableConcept?.coding?[0].code, "1100") + XCTAssertEqual(inst.extension_fhir?[6].valueCodeableConcept?.coding?[0].display, "BRCA1") + XCTAssertEqual(inst.extension_fhir?[6].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.genenames.org") + XCTAssertEqual(inst.extension_fhir?[7].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsDNASequenceVariation") + XCTAssertEqual(inst.extension_fhir?[7].valueString, "c.181T>G") + XCTAssertEqual(inst.extension_fhir?[8].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsVariationId") + XCTAssertEqual(inst.extension_fhir?[8].valueCodeableConcept?.coding?[0].code, "17661") + XCTAssertEqual(inst.extension_fhir?[8].valueCodeableConcept?.coding?[0].display, "c.181T>G") + XCTAssertEqual(inst.extension_fhir?[8].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.ncbi.nlm.nih.gov/clinvar") + XCTAssertEqual(inst.extension_fhir?[9].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsDNARegionName") + XCTAssertEqual(inst.extension_fhir?[9].valueString, "Exon 4") + XCTAssertEqual(inst.id, "genetics-example2-germline") + XCTAssertEqual(inst.performer?[0].display, "Molecular Diagnostic Laboratory") + XCTAssertEqual(inst.performer?[0].reference, "Practitioner/genetics-example2-germline") + XCTAssertEqual(inst.specimen?.display, "Molecular Specimen ID: MLD45-Z4-1234") + XCTAssertEqual(inst.specimen?.reference, "Specimen/genetics-example2-germline") XCTAssertEqual(inst.status, "final") - XCTAssertEqual(inst.subject?.reference, "Patient/example") + XCTAssertEqual(inst.subject?.display, "Molecular Lab Patient ID: HOSP-23456") + XCTAssertEqual(inst.subject?.reference, "Patient/genetics-example2-germline") XCTAssertEqual(inst.text?.status, "generated") return inst @@ -150,39 +150,32 @@ class ObservationTests: XCTestCase { @discardableResult func runObservation3(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Observation { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-f001-glucose.json") + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "obs-genetics-example3-mutationlist-1.json") - XCTAssertEqual(inst.code?.coding?[0].code, "15074-8") - XCTAssertEqual(inst.code?.coding?[0].display, "Glucose [Moles/volume] in Blood") + XCTAssertEqual(inst.code?.coding?[0].code, "49874-1") + XCTAssertEqual(inst.code?.coding?[0].display, "ABCB4 gene mutation analysis") XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.effectivePeriod?.end?.description, "2013-04-05T09:30:10+01:00") - XCTAssertEqual(inst.effectivePeriod?.start?.description, "2013-04-02T09:30:10+01:00") - XCTAssertEqual(inst.id, "f001") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.bmc.nl/zorgportal/identifiers/observations") - XCTAssertEqual(inst.identifier?[0].use, "official") - XCTAssertEqual(inst.identifier?[0].value, "6323") - XCTAssertEqual(inst.interpretation?.coding?[0].code, "H") - XCTAssertEqual(inst.interpretation?.coding?[0].display, "High") - XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0078") - XCTAssertEqual(inst.issued?.description, "2013-04-03T15:30:10+01:00") - XCTAssertEqual(inst.performer?[0].display, "A. Langeveld") - XCTAssertEqual(inst.performer?[0].reference, "Practitioner/f005") - XCTAssertEqual(inst.referenceRange?[0].high?.code, "mmol/L") - XCTAssertEqual(inst.referenceRange?[0].high?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.referenceRange?[0].high?.unit, "mmol/l") - XCTAssertEqual(inst.referenceRange?[0].high?.value, NSDecimalNumber(string: "6.2")) - XCTAssertEqual(inst.referenceRange?[0].low?.code, "mmol/L") - XCTAssertEqual(inst.referenceRange?[0].low?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.referenceRange?[0].low?.unit, "mmol/l") - XCTAssertEqual(inst.referenceRange?[0].low?.value, NSDecimalNumber(string: "3.1")) + XCTAssertEqual(inst.component?[0].code?.coding?[0].code, "53037-8") + XCTAssertEqual(inst.component?[0].code?.coding?[0].display, "Genetic disease sequence variation interpretation") + XCTAssertEqual(inst.component?[0].code?.coding?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].code, "LA6682-4") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].display, "Unknown significance") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.genenames.org") + XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsDNASequenceVariation") + XCTAssertEqual(inst.extension_fhir?[0].valueString, "c.2708T>C") + XCTAssertEqual(inst.extension_fhir?[1].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsDNARegionName") + XCTAssertEqual(inst.extension_fhir?[1].valueString, "Exon 23") + XCTAssertEqual(inst.extension_fhir?[2].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsAminoAcidChange") + XCTAssertEqual(inst.extension_fhir?[2].valueString, "p.R969H") + XCTAssertEqual(inst.id, "genetics-example3-mutationlist-1") + XCTAssertEqual(inst.performer?[0].display, "Molecular Diagnostic Laboratory") + XCTAssertEqual(inst.performer?[0].reference, "Practitioner/genetics-example2") + XCTAssertEqual(inst.specimen?.display, "Molecular Specimen ID: MLD45-Z4-1234") + XCTAssertEqual(inst.specimen?.reference, "Specimen/genetics-example2") XCTAssertEqual(inst.status, "final") - XCTAssertEqual(inst.subject?.display, "P. van de Heuvel") - XCTAssertEqual(inst.subject?.reference, "Patient/f001") + XCTAssertEqual(inst.subject?.display, "Molecular Lab Patient ID: HOSP-23456") + XCTAssertEqual(inst.subject?.reference, "Patient/genetics-example2") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.valueQuantity?.code, "mmol/L") - XCTAssertEqual(inst.valueQuantity?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.valueQuantity?.unit, "mmol/l") - XCTAssertEqual(inst.valueQuantity?.value, NSDecimalNumber(string: "6.3")) return inst } @@ -199,39 +192,34 @@ class ObservationTests: XCTestCase { @discardableResult func runObservation4(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Observation { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-f002-excess.json") + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "obs-genetics-example3-mutationlist-2.json") - XCTAssertEqual(inst.code?.coding?[0].code, "11555-0") - XCTAssertEqual(inst.code?.coding?[0].display, "Base excess in Blood by calculation") + XCTAssertEqual(inst.code?.coding?[0].code, "49874-1") + XCTAssertEqual(inst.code?.coding?[0].display, "ABCB4 gene mutation analysis") XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.effectivePeriod?.end?.description, "2013-04-05T10:30:10+01:00") - XCTAssertEqual(inst.effectivePeriod?.start?.description, "2013-04-02T10:30:10+01:00") - XCTAssertEqual(inst.id, "f002") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.bmc.nl/zorgportal/identifiers/observations") - XCTAssertEqual(inst.identifier?[0].use, "official") - XCTAssertEqual(inst.identifier?[0].value, "6324") - XCTAssertEqual(inst.interpretation?.coding?[0].code, "H") - XCTAssertEqual(inst.interpretation?.coding?[0].display, "High") - XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0078") - XCTAssertEqual(inst.issued?.description, "2013-04-03T15:30:10+01:00") - XCTAssertEqual(inst.performer?[0].display, "A. Langeveld") - XCTAssertEqual(inst.performer?[0].reference, "Practitioner/f005") - XCTAssertEqual(inst.referenceRange?[0].high?.code, "mmol/L") - XCTAssertEqual(inst.referenceRange?[0].high?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.referenceRange?[0].high?.unit, "mmol/l") - XCTAssertEqual(inst.referenceRange?[0].high?.value, NSDecimalNumber(string: "11.2")) - XCTAssertEqual(inst.referenceRange?[0].low?.code, "mmol/L") - XCTAssertEqual(inst.referenceRange?[0].low?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.referenceRange?[0].low?.unit, "mmol/l") - XCTAssertEqual(inst.referenceRange?[0].low?.value, NSDecimalNumber(string: "7.1")) + XCTAssertEqual(inst.component?[0].code?.coding?[0].code, "53037-8") + XCTAssertEqual(inst.component?[0].code?.coding?[0].display, "Genetic disease sequence variation interpretation") + XCTAssertEqual(inst.component?[0].code?.coding?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].code, "LA6675-8") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].display, "Benign") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.genenames.org") + XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsDNARegionName") + XCTAssertEqual(inst.extension_fhir?[0].valueString, "Exon 6") + XCTAssertEqual(inst.extension_fhir?[1].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsAminoAcidChange") + XCTAssertEqual(inst.extension_fhir?[1].valueString, "p.N168N") + XCTAssertEqual(inst.extension_fhir?[2].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsVariationId") + XCTAssertEqual(inst.extension_fhir?[2].valueCodeableConcept?.coding?[0].code, "1202283") + XCTAssertEqual(inst.extension_fhir?[2].valueCodeableConcept?.coding?[0].display, "c.181T>G") + XCTAssertEqual(inst.extension_fhir?[2].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.ncbi.nlm.nih.gov/projects/SNP") + XCTAssertEqual(inst.id, "genetics-example3-mutationlist-2") + XCTAssertEqual(inst.performer?[0].display, "Molecular Diagnostic Laboratory") + XCTAssertEqual(inst.performer?[0].reference, "Practitioner/genetics-example2") + XCTAssertEqual(inst.specimen?.display, "Molecular Specimen ID: MLD45-Z4-1234") + XCTAssertEqual(inst.specimen?.reference, "Specimen/genetics-example2") XCTAssertEqual(inst.status, "final") - XCTAssertEqual(inst.subject?.display, "P. van de Heuvel") - XCTAssertEqual(inst.subject?.reference, "Patient/f001") + XCTAssertEqual(inst.subject?.display, "Molecular Lab Patient ID: HOSP-23456") + XCTAssertEqual(inst.subject?.reference, "Patient/genetics-example2") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.valueQuantity?.code, "mmol/L") - XCTAssertEqual(inst.valueQuantity?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.valueQuantity?.unit, "mmol/l") - XCTAssertEqual(inst.valueQuantity?.value, NSDecimalNumber(string: "12.6")) return inst } @@ -248,39 +236,32 @@ class ObservationTests: XCTestCase { @discardableResult func runObservation5(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Observation { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-f003-co2.json") + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "obs-genetics-example3-mutationlist-3.json") - XCTAssertEqual(inst.code?.coding?[0].code, "11557-6") - XCTAssertEqual(inst.code?.coding?[0].display, "Carbon dioxide in blood") + XCTAssertEqual(inst.code?.coding?[0].code, "49874-1") + XCTAssertEqual(inst.code?.coding?[0].display, "ABCB4 gene mutation analysis") XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.effectivePeriod?.end?.description, "2013-04-05T10:30:10+01:00") - XCTAssertEqual(inst.effectivePeriod?.start?.description, "2013-04-02T10:30:10+01:00") - XCTAssertEqual(inst.id, "f003") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.bmc.nl/zorgportal/identifiers/observations") - XCTAssertEqual(inst.identifier?[0].use, "official") - XCTAssertEqual(inst.identifier?[0].value, "6325") - XCTAssertEqual(inst.interpretation?.coding?[0].code, "H") - XCTAssertEqual(inst.interpretation?.coding?[0].display, "High") - XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0078") - XCTAssertEqual(inst.issued?.description, "2013-04-03T15:30:10+01:00") - XCTAssertEqual(inst.performer?[0].display, "A. Langeveld") - XCTAssertEqual(inst.performer?[0].reference, "Practitioner/f005") - XCTAssertEqual(inst.referenceRange?[0].high?.code, "kPa") - XCTAssertEqual(inst.referenceRange?[0].high?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.referenceRange?[0].high?.unit, "kPa") - XCTAssertEqual(inst.referenceRange?[0].high?.value, NSDecimalNumber(string: "6.0")) - XCTAssertEqual(inst.referenceRange?[0].low?.code, "kPa") - XCTAssertEqual(inst.referenceRange?[0].low?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.referenceRange?[0].low?.unit, "kPa") - XCTAssertEqual(inst.referenceRange?[0].low?.value, NSDecimalNumber(string: "4.8")) + XCTAssertEqual(inst.component?[0].code?.coding?[0].code, "53037-8") + XCTAssertEqual(inst.component?[0].code?.coding?[0].display, "Genetic disease sequence variation interpretation") + XCTAssertEqual(inst.component?[0].code?.coding?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].code, "LA6675-8") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].display, "Benign") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.genenames.org") + XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsDNARegionName") + XCTAssertEqual(inst.extension_fhir?[0].valueString, "intron 16") + XCTAssertEqual(inst.extension_fhir?[1].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsVariationId") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].code, "31668") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].display, "c.2211+16C>T") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.ncbi.nlm.nih.gov/projects/SNP") + XCTAssertEqual(inst.id, "genetics-example3-mutationlist-3") + XCTAssertEqual(inst.performer?[0].display, "Molecular Diagnostic Laboratory") + XCTAssertEqual(inst.performer?[0].reference, "Practitioner/genetics-example2") + XCTAssertEqual(inst.specimen?.display, "Molecular Specimen ID: MLD45-Z4-1234") + XCTAssertEqual(inst.specimen?.reference, "Specimen/genetics-example2") XCTAssertEqual(inst.status, "final") - XCTAssertEqual(inst.subject?.display, "P. van de Heuvel") - XCTAssertEqual(inst.subject?.reference, "Patient/f001") + XCTAssertEqual(inst.subject?.display, "Molecular Lab Patient ID: HOSP-23456") + XCTAssertEqual(inst.subject?.reference, "Patient/genetics-example2") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.valueQuantity?.code, "kPa") - XCTAssertEqual(inst.valueQuantity?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.valueQuantity?.unit, "kPa") - XCTAssertEqual(inst.valueQuantity?.value, NSDecimalNumber(string: "6.2")) return inst } @@ -297,39 +278,32 @@ class ObservationTests: XCTestCase { @discardableResult func runObservation6(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Observation { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-f004-erythrocyte.json") + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "obs-genetics-example3-mutationlist-4.json") - XCTAssertEqual(inst.code?.coding?[0].code, "789-8") - XCTAssertEqual(inst.code?.coding?[0].display, "Erythrocytes [#/volume] in Blood by Automated count") + XCTAssertEqual(inst.code?.coding?[0].code, "49874-1") + XCTAssertEqual(inst.code?.coding?[0].display, "ABCB4 gene mutation analysis") XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.effectivePeriod?.end?.description, "2013-04-05T10:30:10+01:00") - XCTAssertEqual(inst.effectivePeriod?.start?.description, "2013-04-02T10:30:10+01:00") - XCTAssertEqual(inst.id, "f004") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.bmc.nl/zorgportal/identifiers/observations") - XCTAssertEqual(inst.identifier?[0].use, "official") - XCTAssertEqual(inst.identifier?[0].value, "6326") - XCTAssertEqual(inst.interpretation?.coding?[0].code, "L") - XCTAssertEqual(inst.interpretation?.coding?[0].display, "Low") - XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0078") - XCTAssertEqual(inst.issued?.description, "2013-04-03T15:30:10+01:00") - XCTAssertEqual(inst.performer?[0].display, "A. Langeveld") - XCTAssertEqual(inst.performer?[0].reference, "Practitioner/f005") - XCTAssertEqual(inst.referenceRange?[0].high?.code, "10*12/L") - XCTAssertEqual(inst.referenceRange?[0].high?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.referenceRange?[0].high?.unit, "10^12/L") - XCTAssertEqual(inst.referenceRange?[0].high?.value, NSDecimalNumber(string: "5.8")) - XCTAssertEqual(inst.referenceRange?[0].low?.code, "10*12/L") - XCTAssertEqual(inst.referenceRange?[0].low?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.referenceRange?[0].low?.unit, "10^12/L") - XCTAssertEqual(inst.referenceRange?[0].low?.value, NSDecimalNumber(string: "4.4")) + XCTAssertEqual(inst.component?[0].code?.coding?[0].code, "53037-8") + XCTAssertEqual(inst.component?[0].code?.coding?[0].display, "Genetic disease sequence variation interpretation") + XCTAssertEqual(inst.component?[0].code?.coding?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].code, "LA6675-8") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].display, "Benign") + XCTAssertEqual(inst.component?[0].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.genenames.org") + XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsDNARegionName") + XCTAssertEqual(inst.extension_fhir?[0].valueString, "intron 26") + XCTAssertEqual(inst.extension_fhir?[1].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsVariationId") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].code, "31653") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].display, "c.3487-16T>C") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.ncbi.nlm.nih.gov/projects/SNP") + XCTAssertEqual(inst.id, "genetics-example3-mutationlist-4") + XCTAssertEqual(inst.performer?[0].display, "Molecular Diagnostic Laboratory") + XCTAssertEqual(inst.performer?[0].reference, "Practitioner/genetics-example2") + XCTAssertEqual(inst.specimen?.display, "Molecular Specimen ID: MLD45-Z4-1234") + XCTAssertEqual(inst.specimen?.reference, "Specimen/genetics-example2") XCTAssertEqual(inst.status, "final") - XCTAssertEqual(inst.subject?.display, "P. van de Heuvel") - XCTAssertEqual(inst.subject?.reference, "Patient/f001") + XCTAssertEqual(inst.subject?.display, "Molecular Lab Patient ID: HOSP-23456") + XCTAssertEqual(inst.subject?.reference, "Patient/genetics-example2") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.valueQuantity?.code, "10*12/L") - XCTAssertEqual(inst.valueQuantity?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.valueQuantity?.unit, "10 trillion/L") - XCTAssertEqual(inst.valueQuantity?.value, NSDecimalNumber(string: "4.12")) return inst } @@ -346,39 +320,38 @@ class ObservationTests: XCTestCase { @discardableResult func runObservation7(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Observation { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-f005-hemoglobin.json") + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "obs-genetics-example3-mutationlist.json") - XCTAssertEqual(inst.code?.coding?[0].code, "718-7") - XCTAssertEqual(inst.code?.coding?[0].display, "Hemoglobin [Mass/volume] in Blood") + XCTAssertEqual(inst.code?.coding?[0].code, "49874-1") + XCTAssertEqual(inst.code?.coding?[0].display, "ABCB4 gene mutation analysis") XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.effectivePeriod?.end?.description, "2013-04-05T10:30:10+01:00") - XCTAssertEqual(inst.effectivePeriod?.start?.description, "2013-04-02T10:30:10+01:00") - XCTAssertEqual(inst.id, "f005") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.bmc.nl/zorgportal/identifiers/observations") - XCTAssertEqual(inst.identifier?[0].use, "official") - XCTAssertEqual(inst.identifier?[0].value, "6327") - XCTAssertEqual(inst.interpretation?.coding?[0].code, "L") - XCTAssertEqual(inst.interpretation?.coding?[0].display, "Low") - XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0078") - XCTAssertEqual(inst.issued?.description, "2013-04-03T15:30:10+01:00") - XCTAssertEqual(inst.performer?[0].display, "A. Langeveld") - XCTAssertEqual(inst.performer?[0].reference, "Practitioner/f005") - XCTAssertEqual(inst.referenceRange?[0].high?.code, "g/dL") - XCTAssertEqual(inst.referenceRange?[0].high?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.referenceRange?[0].high?.unit, "g/dl") - XCTAssertEqual(inst.referenceRange?[0].high?.value, NSDecimalNumber(string: "10")) - XCTAssertEqual(inst.referenceRange?[0].low?.code, "g/dL") - XCTAssertEqual(inst.referenceRange?[0].low?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.referenceRange?[0].low?.unit, "g/dl") - XCTAssertEqual(inst.referenceRange?[0].low?.value, NSDecimalNumber(string: "7.5")) + XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsGenomeBuild") + XCTAssertEqual(inst.extension_fhir?[0].valueString, "GRCh 37") + XCTAssertEqual(inst.extension_fhir?[1].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsGene") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].code, "5244") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].display, "ABCB4") + XCTAssertEqual(inst.extension_fhir?[1].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://www.genenames.org") + XCTAssertEqual(inst.extension_fhir?[2].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsSpecies") + XCTAssertEqual(inst.extension_fhir?[2].valueCodeableConcept?.coding?[0].code, "337915000") + XCTAssertEqual(inst.extension_fhir?[2].valueCodeableConcept?.coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.extension_fhir?[2].valueCodeableConcept?.text, "Homo sapiens") + XCTAssertEqual(inst.extension_fhir?[3].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsResult") + XCTAssertEqual(inst.extension_fhir?[3].valueReference?.reference, "genetics-example3-mutationlist-1") + XCTAssertEqual(inst.extension_fhir?[4].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsResult") + XCTAssertEqual(inst.extension_fhir?[4].valueReference?.reference, "genetics-example3-mutationlist-2") + XCTAssertEqual(inst.extension_fhir?[5].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsResult") + XCTAssertEqual(inst.extension_fhir?[5].valueReference?.reference, "genetics-example3-mutationlist-3") + XCTAssertEqual(inst.extension_fhir?[6].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/geneticsResult") + XCTAssertEqual(inst.extension_fhir?[6].valueReference?.reference, "genetics-example3-mutationlist-4") + XCTAssertEqual(inst.id, "genetics-example3-mutationlist") + XCTAssertEqual(inst.performer?[0].display, "Molecular Diagnostic Laboratory") + XCTAssertEqual(inst.performer?[0].reference, "Practitioner/genetics-example2") + XCTAssertEqual(inst.specimen?.display, "Molecular Specimen ID: MLD45-Z4-1234") + XCTAssertEqual(inst.specimen?.reference, "Specimen/genetics-example2") XCTAssertEqual(inst.status, "final") - XCTAssertEqual(inst.subject?.display, "P. van de Heuvel") - XCTAssertEqual(inst.subject?.reference, "Patient/f001") + XCTAssertEqual(inst.subject?.display, "Molecular Lab Patient ID: HOSP-23456") + XCTAssertEqual(inst.subject?.reference, "Patient/genetics-example2") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.valueQuantity?.code, "g/dL") - XCTAssertEqual(inst.valueQuantity?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.valueQuantity?.unit, "g/dl") - XCTAssertEqual(inst.valueQuantity?.value, NSDecimalNumber(string: "7.2")) return inst } @@ -395,45 +368,46 @@ class ObservationTests: XCTestCase { @discardableResult func runObservation8(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Observation { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-f202-temperature.json") + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-bloodpressure-cancel.json") - XCTAssertEqual(inst.bodySite?.coding?[0].code, "74262004") - XCTAssertEqual(inst.bodySite?.coding?[0].display, "Oral cavity") + XCTAssertEqual(inst.bodySite?.coding?[0].code, "368209003") + XCTAssertEqual(inst.bodySite?.coding?[0].display, "Right arm") XCTAssertEqual(inst.bodySite?.coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.category?.coding?[0].code, "vital-signs") - XCTAssertEqual(inst.category?.coding?[0].display, "Vital Signs") - XCTAssertEqual(inst.category?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/observation-category") - XCTAssertEqual(inst.code?.coding?[0].code, "BT") - XCTAssertEqual(inst.code?.coding?[0].display, "Body temperature") - XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://acme.lab") - XCTAssertEqual(inst.code?.coding?[1].code, "8310-5") - XCTAssertEqual(inst.code?.coding?[1].display, "Body temperature") - XCTAssertEqual(inst.code?.coding?[1].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.code?.coding?[2].code, "8331-1") - XCTAssertEqual(inst.code?.coding?[2].display, "Oral temperature") - XCTAssertEqual(inst.code?.coding?[2].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.code?.coding?[3].code, "56342008") - XCTAssertEqual(inst.code?.coding?[3].display, "Temperature taking") - XCTAssertEqual(inst.code?.coding?[3].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.code?.text, "Temperature") - XCTAssertEqual(inst.id, "f202") - XCTAssertEqual(inst.interpretation?.coding?[0].code, "H") + XCTAssertEqual(inst.code?.coding?[0].code, "55284-4") + XCTAssertEqual(inst.code?.coding?[0].display, "Blood pressure systolic & diastolic") + XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.comments, "In this example, the blood pressure measurements are not available due to cancellation of the order. Data absent reason is present for each component") + XCTAssertEqual(inst.component?[0].code?.coding?[0].code, "8480-6") + XCTAssertEqual(inst.component?[0].code?.coding?[0].display, "Systolic blood pressure") + XCTAssertEqual(inst.component?[0].code?.coding?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.component?[0].code?.coding?[1].code, "271649006") + XCTAssertEqual(inst.component?[0].code?.coding?[1].display, "Systolic blood pressure") + XCTAssertEqual(inst.component?[0].code?.coding?[1].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.component?[0].code?.coding?[2].code, "bp-s") + XCTAssertEqual(inst.component?[0].code?.coding?[2].display, "Systolic Blood pressure") + XCTAssertEqual(inst.component?[0].code?.coding?[2].system?.absoluteString, "http://acme.org/devices/clinical-codes") + XCTAssertEqual(inst.component?[0].dataAbsentReason?.coding?[0].code, "not-asked") + XCTAssertEqual(inst.component?[0].dataAbsentReason?.coding?[0].display, "Not Asked") + XCTAssertEqual(inst.component?[0].dataAbsentReason?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/data-absent-reason") + XCTAssertEqual(inst.component?[1].code?.coding?[0].code, "8462-4") + XCTAssertEqual(inst.component?[1].code?.coding?[0].display, "Diastolic blood pressure") + XCTAssertEqual(inst.component?[1].code?.coding?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.component?[1].dataAbsentReason?.coding?[0].code, "not-asked") + XCTAssertEqual(inst.component?[1].dataAbsentReason?.coding?[0].display, "Not Asked") + XCTAssertEqual(inst.component?[1].dataAbsentReason?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/data-absent-reason") + XCTAssertEqual(inst.effectiveDateTime?.description, "2012-09-17") + XCTAssertEqual(inst.id, "blood-pressure-cancel") + XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "urn:ietf:rfc:3986") + XCTAssertEqual(inst.identifier?[0].value, "urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281") + XCTAssertEqual(inst.interpretation?.coding?[0].code, "L") + XCTAssertEqual(inst.interpretation?.coding?[0].display, "Below low normal") XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0078") - XCTAssertEqual(inst.issued?.description, "2013-04-04T13:27:00+01:00") - XCTAssertEqual(inst.method?.coding?[0].code, "89003005") - XCTAssertEqual(inst.method?.coding?[0].display, "Oral temperature taking") - XCTAssertEqual(inst.method?.coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.performer?[0].reference, "Practitioner/f201") - XCTAssertEqual(inst.referenceRange?[0].high?.unit, "degrees C") - XCTAssertEqual(inst.referenceRange?[0].high?.value, NSDecimalNumber(string: "38.2")) - XCTAssertEqual(inst.status, "entered-in-error") - XCTAssertEqual(inst.subject?.display, "Roel") - XCTAssertEqual(inst.subject?.reference, "Patient/f201") + XCTAssertEqual(inst.interpretation?.text, "low") + XCTAssertEqual(inst.meta?.lastUpdated?.description, "2014-01-30T22:35:23+11:00") + XCTAssertEqual(inst.performer?[0].reference, "Practitioner/example") + XCTAssertEqual(inst.status, "cancelled") + XCTAssertEqual(inst.subject?.reference, "Patient/example") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.valueQuantity?.code, "Cel") - XCTAssertEqual(inst.valueQuantity?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.valueQuantity?.unit, "degrees C") - XCTAssertEqual(inst.valueQuantity?.value, NSDecimalNumber(string: "39")) return inst } @@ -450,39 +424,43 @@ class ObservationTests: XCTestCase { @discardableResult func runObservation9(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Observation { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-f203-bicarbonate.json") + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-bloodpressure.json") - XCTAssertEqual(inst.code?.coding?[0].code, "1963-8") - XCTAssertEqual(inst.code?.coding?[0].display, "Bicarbonate [Moles/?volume] in Serum") + XCTAssertEqual(inst.bodySite?.coding?[0].code, "368209003") + XCTAssertEqual(inst.bodySite?.coding?[0].display, "Right arm") + XCTAssertEqual(inst.bodySite?.coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.code?.coding?[0].code, "55284-4") + XCTAssertEqual(inst.code?.coding?[0].display, "Blood pressure systolic & diastolic") XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.code?.coding?[1].code, "365722008") - XCTAssertEqual(inst.code?.coding?[1].display, "Bicarbonate level") - XCTAssertEqual(inst.code?.coding?[1].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.id, "f203") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "https://intranet.aumc.nl/labvalues") - XCTAssertEqual(inst.identifier?[0].value, "1304-03720-Bicarbonate") - XCTAssertEqual(inst.interpretation?.coding?[0].code, "166698001") - XCTAssertEqual(inst.interpretation?.coding?[0].display, "Serum bicarbonate level normal") - XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.interpretation?.coding?[1].code, "N") - XCTAssertEqual(inst.interpretation?.coding?[1].system?.absoluteString, "http://hl7.org/fhir/v2/0078") - XCTAssertEqual(inst.issued?.description, "2013-04-04T14:34:00+01:00") - XCTAssertEqual(inst.method?.text, "enzymatic method") - XCTAssertEqual(inst.performer?[0].display, "Luigi Maas") - XCTAssertEqual(inst.performer?[0].reference, "Practitioner/f202") - XCTAssertEqual(inst.referenceRange?[0].high?.value, NSDecimalNumber(string: "29")) - XCTAssertEqual(inst.referenceRange?[0].low?.value, NSDecimalNumber(string: "22")) - XCTAssertEqual(inst.referenceRange?[0].meaning?.coding?[0].code, "normal") - XCTAssertEqual(inst.referenceRange?[0].meaning?.coding?[0].display, "Normal Range") - XCTAssertEqual(inst.referenceRange?[0].meaning?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/referencerange-meaning") + XCTAssertEqual(inst.component?[0].code?.coding?[0].code, "8480-6") + XCTAssertEqual(inst.component?[0].code?.coding?[0].display, "Systolic blood pressure") + XCTAssertEqual(inst.component?[0].code?.coding?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.component?[0].code?.coding?[1].code, "271649006") + XCTAssertEqual(inst.component?[0].code?.coding?[1].display, "Systolic blood pressure") + XCTAssertEqual(inst.component?[0].code?.coding?[1].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.component?[0].code?.coding?[2].code, "bp-s") + XCTAssertEqual(inst.component?[0].code?.coding?[2].display, "Systolic Blood pressure") + XCTAssertEqual(inst.component?[0].code?.coding?[2].system?.absoluteString, "http://acme.org/devices/clinical-codes") + XCTAssertEqual(inst.component?[0].valueQuantity?.unit, "mm[Hg]") + XCTAssertEqual(inst.component?[0].valueQuantity?.value, NSDecimalNumber(string: "107")) + XCTAssertEqual(inst.component?[1].code?.coding?[0].code, "8462-4") + XCTAssertEqual(inst.component?[1].code?.coding?[0].display, "Diastolic blood pressure") + XCTAssertEqual(inst.component?[1].code?.coding?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.component?[1].valueQuantity?.unit, "mm[Hg]") + XCTAssertEqual(inst.component?[1].valueQuantity?.value, NSDecimalNumber(string: "60")) + XCTAssertEqual(inst.effectiveDateTime?.description, "2012-09-17") + XCTAssertEqual(inst.id, "blood-pressure") + XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "urn:ietf:rfc:3986") + XCTAssertEqual(inst.identifier?[0].value, "urn:uuid:187e0c12-8dd2-67e2-99b2-bf273c878281") + XCTAssertEqual(inst.interpretation?.coding?[0].code, "L") + XCTAssertEqual(inst.interpretation?.coding?[0].display, "Below low normal") + XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0078") + XCTAssertEqual(inst.interpretation?.text, "low") + XCTAssertEqual(inst.meta?.lastUpdated?.description, "2014-01-30T22:35:23+11:00") + XCTAssertEqual(inst.performer?[0].reference, "Practitioner/example") XCTAssertEqual(inst.status, "final") - XCTAssertEqual(inst.subject?.display, "Roel") - XCTAssertEqual(inst.subject?.reference, "Patient/f201") + XCTAssertEqual(inst.subject?.reference, "Patient/example") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.valueQuantity?.code, "258813002") - XCTAssertEqual(inst.valueQuantity?.system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.valueQuantity?.unit, "mmol/L") - XCTAssertEqual(inst.valueQuantity?.value, NSDecimalNumber(string: "28")) return inst } @@ -499,35 +477,39 @@ class ObservationTests: XCTestCase { @discardableResult func runObservation10(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Observation { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-f204-creatinine.json") + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "observation-example-f001-glucose.json") - XCTAssertEqual(inst.code?.coding?[0].code, "20005") - XCTAssertEqual(inst.code?.coding?[0].display, "Creatinine(Serum)") - XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "https://intranet.aumc.nl/labtestcodes") - XCTAssertEqual(inst.id, "f204") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "https://intranet.aumc.nl/labvalues") - XCTAssertEqual(inst.identifier?[0].value, "1304-03720-Creatinine") - XCTAssertEqual(inst.interpretation?.coding?[0].code, "166717003") - XCTAssertEqual(inst.interpretation?.coding?[0].display, "Serum creatinine raised") - XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.interpretation?.coding?[1].code, "H") - XCTAssertEqual(inst.interpretation?.coding?[1].system?.absoluteString, "http://hl7.org/fhir/v2/0078") - XCTAssertEqual(inst.issued?.description, "2013-04-04T14:34:00+01:00") - XCTAssertEqual(inst.performer?[0].display, "Luigi Maas") - XCTAssertEqual(inst.performer?[0].reference, "Practitioner/f202") - XCTAssertEqual(inst.referenceRange?[0].high?.value, NSDecimalNumber(string: "104")) - XCTAssertEqual(inst.referenceRange?[0].low?.value, NSDecimalNumber(string: "64")) - XCTAssertEqual(inst.referenceRange?[0].meaning?.coding?[0].code, "normal") - XCTAssertEqual(inst.referenceRange?[0].meaning?.coding?[0].display, "Normal Range") - XCTAssertEqual(inst.referenceRange?[0].meaning?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/referencerange-meaning") + XCTAssertEqual(inst.code?.coding?[0].code, "15074-8") + XCTAssertEqual(inst.code?.coding?[0].display, "Glucose [Moles/volume] in Blood") + XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.effectivePeriod?.end?.description, "2013-04-05T09:30:10+01:00") + XCTAssertEqual(inst.effectivePeriod?.start?.description, "2013-04-02T09:30:10+01:00") + XCTAssertEqual(inst.id, "f001") + XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.bmc.nl/zorgportal/identifiers/observations") + XCTAssertEqual(inst.identifier?[0].use, "official") + XCTAssertEqual(inst.identifier?[0].value, "6323") + XCTAssertEqual(inst.interpretation?.coding?[0].code, "H") + XCTAssertEqual(inst.interpretation?.coding?[0].display, "Above high normal") + XCTAssertEqual(inst.interpretation?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0078") + XCTAssertEqual(inst.issued?.description, "2013-04-03T15:30:10+01:00") + XCTAssertEqual(inst.performer?[0].display, "A. Langeveld") + XCTAssertEqual(inst.performer?[0].reference, "Practitioner/f005") + XCTAssertEqual(inst.referenceRange?[0].high?.code, "mmol/L") + XCTAssertEqual(inst.referenceRange?[0].high?.system?.absoluteString, "http://unitsofmeasure.org") + XCTAssertEqual(inst.referenceRange?[0].high?.unit, "mmol/l") + XCTAssertEqual(inst.referenceRange?[0].high?.value, NSDecimalNumber(string: "6.2")) + XCTAssertEqual(inst.referenceRange?[0].low?.code, "mmol/L") + XCTAssertEqual(inst.referenceRange?[0].low?.system?.absoluteString, "http://unitsofmeasure.org") + XCTAssertEqual(inst.referenceRange?[0].low?.unit, "mmol/l") + XCTAssertEqual(inst.referenceRange?[0].low?.value, NSDecimalNumber(string: "3.1")) XCTAssertEqual(inst.status, "final") - XCTAssertEqual(inst.subject?.display, "Roel") - XCTAssertEqual(inst.subject?.reference, "Patient/f201") + XCTAssertEqual(inst.subject?.display, "P. van de Heuvel") + XCTAssertEqual(inst.subject?.reference, "Patient/f001") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.valueQuantity?.code, "258814008") - XCTAssertEqual(inst.valueQuantity?.system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.valueQuantity?.unit, "umol/L") - XCTAssertEqual(inst.valueQuantity?.value, NSDecimalNumber(string: "122")) + XCTAssertEqual(inst.valueQuantity?.code, "mmol/L") + XCTAssertEqual(inst.valueQuantity?.system?.absoluteString, "http://unitsofmeasure.org") + XCTAssertEqual(inst.valueQuantity?.unit, "mmol/l") + XCTAssertEqual(inst.valueQuantity?.value, NSDecimalNumber(string: "6.3")) return inst } diff --git a/Tests/ModelTests/OperationDefinitionTests.swift b/Tests/ModelTests/OperationDefinitionTests.swift index 48cde98b..a7b4ee12 100644 --- a/Tests/ModelTests/OperationDefinitionTests.swift +++ b/Tests/ModelTests/OperationDefinitionTests.swift @@ -2,7 +2,7 @@ // OperationDefinitionTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -38,7 +38,6 @@ class OperationDefinitionTests: XCTestCase { XCTAssertEqual(inst.base?.reference, "OperationDefinition/Questionnaire-populate") XCTAssertEqual(inst.code, "populate") - XCTAssertEqual(inst.comment, "Only implemented for Labs and Medications so far") XCTAssertEqual(inst.contact?[0].name, "System Administrator") XCTAssertEqual(inst.contact?[0].telecom?[0].system, "email") XCTAssertEqual(inst.contact?[0].telecom?[0].value, "beep@coyote.acme.com") @@ -48,6 +47,7 @@ class OperationDefinitionTests: XCTestCase { XCTAssertTrue(inst.instance ?? false) XCTAssertEqual(inst.kind, "operation") XCTAssertEqual(inst.name, "Populate Questionnaire") + XCTAssertEqual(inst.notes, "Only implemented for Labs and Medications so far") XCTAssertEqual(inst.parameter?[0].max, "1") XCTAssertEqual(inst.parameter?[0].min, 1) XCTAssertEqual(inst.parameter?[0].name, "subject") diff --git a/Tests/ModelTests/OperationOutcomeTests.swift b/Tests/ModelTests/OperationOutcomeTests.swift index 0c32364d..4da39070 100644 --- a/Tests/ModelTests/OperationOutcomeTests.swift +++ b/Tests/ModelTests/OperationOutcomeTests.swift @@ -2,7 +2,7 @@ // OperationOutcomeTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/OrderResponseTests.swift b/Tests/ModelTests/OrderResponseTests.swift index 5a723093..00e3c140 100644 --- a/Tests/ModelTests/OrderResponseTests.swift +++ b/Tests/ModelTests/OrderResponseTests.swift @@ -2,7 +2,7 @@ // OrderResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/OrderSetTests.swift b/Tests/ModelTests/OrderSetTests.swift deleted file mode 100644 index 17dbb916..00000000 --- a/Tests/ModelTests/OrderSetTests.swift +++ /dev/null @@ -1,143 +0,0 @@ -// -// OrderSetTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class OrderSetTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.OrderSet { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.OrderSet { - let instance = SwiftFHIR.OrderSet(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testOrderSet1() { - do { - let instance = try runOrderSet1() - try runOrderSet1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test OrderSet successfully, but threw") - } - } - - @discardableResult - func runOrderSet1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.OrderSet { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "orderset-example.json") - - XCTAssertEqual(inst.action?[0].action?[0].action?[0].customization?[0].expression, "ReferralRequestFulfillmentTime") - XCTAssertEqual(inst.action?[0].action?[0].action?[0].customization?[0].path, "fulfillmentTime") - XCTAssertEqual(inst.action?[0].action?[0].action?[0].customization?[1].expression, "Patient") - XCTAssertEqual(inst.action?[0].action?[0].action?[0].customization?[1].path, "patient") - XCTAssertEqual(inst.action?[0].action?[0].action?[0].customization?[2].expression, "Practitioner") - XCTAssertEqual(inst.action?[0].action?[0].action?[0].customization?[2].path, "requester") - XCTAssertEqual(inst.action?[0].action?[0].action?[0].customization?[3].expression, "RiskAssessmentScore") - XCTAssertEqual(inst.action?[0].action?[0].action?[0].customization?[3].path, "reason") - XCTAssertEqual(inst.action?[0].action?[0].action?[0].customization?[4].expression, "RiskAssessment") - XCTAssertEqual(inst.action?[0].action?[0].action?[0].customization?[4].path, "supportingInformation") - XCTAssertEqual(inst.action?[0].action?[0].action?[0].resource?.reference, "#referralRequest") - XCTAssertEqual(inst.action?[0].action?[0].action?[0].textEquivalent, "Refer to outpatient mental health program for evaluation and treatment of mental health conditions now") - XCTAssertEqual(inst.action?[0].action?[0].behavior?[0].type?.code, "grouping-behavior") - XCTAssertEqual(inst.action?[0].action?[0].behavior?[0].value?.code, "logical-group") - XCTAssertEqual(inst.action?[0].action?[0].behavior?[1].type?.code, "selection-behavior") - XCTAssertEqual(inst.action?[0].action?[0].behavior?[1].value?.code, "any") - XCTAssertEqual(inst.action?[0].action?[0].title, "Consults and Referrals") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].action?[0].resource?.reference, "#citalopramPrescription") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].action?[0].textEquivalent, "citalopram 20 mg tablet 1 tablet oral 1 time daily now (30 table; 3 refills)") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].action?[1].textEquivalent, "escitalopram 10 mg tablet 1 tablet oral 1 time daily now (30 tablet; 3 refills)") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].action?[2].textEquivalent, "fluoxetine 20 mg capsule 1 capsule oral 1 time daily now (30 tablet; 3 refills)") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].action?[3].textEquivalent, "paroxetine 20 mg tablet 1 tablet oral 1 time daily now (30 tablet; 3 refills)") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].action?[4].textEquivalent, "sertraline 50 mg tablet 1 tablet oral 1 time daily now (30 tablet; 3 refills)") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].behavior?[0].type?.code, "grouping-behavior") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].behavior?[0].value?.code, "logical-group") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].behavior?[1].type?.code, "selection-behavior") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].behavior?[1].value?.code, "at-most-one") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].documentation?[0].contentType, "text/html") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].documentation?[0].title, "National Library of Medicine. DailyMed website. CITALOPRAM- citalopram hydrobromide tablet, film coated.") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].documentation?[0].url?.absoluteString, "http://dailymed.nlm.nih.gov/dailymed/drugInfo.cfm?setid=6daeb45c-451d-b135-bf8f-2d6dff4b6b01") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[0].title, "Selective Serotonin Reuptake Inhibitors (Choose a mazimum of one or document reasons for exception)") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[1].textEquivalent, "Dopamine Norepinephrine Reuptake Inhibitors (Choose a maximum of one or document reasons for exception)") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[2].textEquivalent, "Serotonin Norepinephrine Reuptake Inhibitors (Choose a maximum of one or doument reasons for exception)") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].action?[3].textEquivalent, "Norepinephrine-Serotonin Modulators (Choose a maximum of one or document reasons for exception)") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].behavior?[0].type?.code, "grouping-behavior") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].behavior?[0].value?.code, "logical-group") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].behavior?[1].type?.code, "selection-behavior") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].behavior?[1].value?.code, "at-most-one") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].supportingEvidence?[0].contentType, "text/html") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].supportingEvidence?[0].title, "Practice Guideline for the Treatment of Patients with Major Depressive Disorder") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].supportingEvidence?[0].url?.absoluteString, "http://psychiatryonline.org/pb/assets/raw/sitewide/practice_guidelines/guidelines/mdd.pdf") - XCTAssertEqual(inst.action?[0].action?[1].action?[0].title, "First-Line Antidepressants") - XCTAssertEqual(inst.action?[0].action?[1].behavior?[0].type?.code, "grouping-behavior") - XCTAssertEqual(inst.action?[0].action?[1].behavior?[0].value?.code, "logical-group") - XCTAssertEqual(inst.action?[0].action?[1].behavior?[1].type?.code, "selection-behavior") - XCTAssertEqual(inst.action?[0].action?[1].behavior?[1].value?.code, "at-most-one") - XCTAssertEqual(inst.action?[0].action?[1].title, "Medications") - XCTAssertEqual(inst.action?[0].title, "Suicide Risk Assessment and Outpatient Management") - XCTAssertEqual(inst.contained?[0].id, "referralRequest") - XCTAssertEqual(inst.contained?[1].id, "citalopramPrescription") - XCTAssertEqual(inst.contained?[2].id, "citalopramMedication") - XCTAssertEqual(inst.contained?[3].id, "citalopramSubstance") - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.library?[0].reference, "Library/mmi-suiciderisk-orderset-logic") - XCTAssertEqual(inst.moduleMetadata?.contact?[0].telecom?[0].system, "phone") - XCTAssertEqual(inst.moduleMetadata?.contact?[0].telecom?[0].use, "work") - XCTAssertEqual(inst.moduleMetadata?.contact?[0].telecom?[0].value, "415-362-4007") - XCTAssertEqual(inst.moduleMetadata?.contact?[0].telecom?[1].system, "email") - XCTAssertEqual(inst.moduleMetadata?.contact?[0].telecom?[1].use, "work") - XCTAssertEqual(inst.moduleMetadata?.contact?[0].telecom?[1].value, "info@motivemi.com") - XCTAssertEqual(inst.moduleMetadata?.contributor?[0].contact?[0].telecom?[0].system, "phone") - XCTAssertEqual(inst.moduleMetadata?.contributor?[0].contact?[0].telecom?[0].use, "work") - XCTAssertEqual(inst.moduleMetadata?.contributor?[0].contact?[0].telecom?[0].value, "415-362-4007") - XCTAssertEqual(inst.moduleMetadata?.contributor?[0].contact?[0].telecom?[1].system, "email") - XCTAssertEqual(inst.moduleMetadata?.contributor?[0].contact?[0].telecom?[1].use, "work") - XCTAssertEqual(inst.moduleMetadata?.contributor?[0].contact?[0].telecom?[1].value, "info@motivemi.com") - XCTAssertEqual(inst.moduleMetadata?.contributor?[0].name, "Motive Medical Intelligence") - XCTAssertEqual(inst.moduleMetadata?.contributor?[0].type, "author") - XCTAssertEqual(inst.moduleMetadata?.coverage?[0].focus?.code, "patient-age-group") - XCTAssertEqual(inst.moduleMetadata?.coverage?[0].value?.coding?[0].code, "133936004") - XCTAssertEqual(inst.moduleMetadata?.coverage?[0].value?.coding?[0].display, "Adult") - XCTAssertEqual(inst.moduleMetadata?.coverage?[1].focus?.code, "clinical-focus") - XCTAssertEqual(inst.moduleMetadata?.coverage?[1].value?.coding?[0].code, "87512008") - XCTAssertEqual(inst.moduleMetadata?.coverage?[1].value?.coding?[0].display, "Mild major depression") - XCTAssertEqual(inst.moduleMetadata?.coverage?[2].focus?.code, "clinical-focus") - XCTAssertEqual(inst.moduleMetadata?.coverage?[2].value?.coding?[0].code, "40379007") - XCTAssertEqual(inst.moduleMetadata?.coverage?[2].value?.coding?[0].display, "Major depression, recurrent, mild") - XCTAssertEqual(inst.moduleMetadata?.coverage?[3].focus?.code, "clinical-focus") - XCTAssertEqual(inst.moduleMetadata?.coverage?[3].value?.coding?[0].code, "394687007") - XCTAssertEqual(inst.moduleMetadata?.coverage?[3].value?.coding?[0].display, "Low suicide risk") - XCTAssertEqual(inst.moduleMetadata?.coverage?[4].focus?.code, "clinical-focus") - XCTAssertEqual(inst.moduleMetadata?.coverage?[4].value?.coding?[0].code, "225337009") - XCTAssertEqual(inst.moduleMetadata?.coverage?[4].value?.coding?[0].display, "Suicide risk assessment") - XCTAssertEqual(inst.moduleMetadata?.coverage?[5].focus?.code, "clinical-venue") - XCTAssertEqual(inst.moduleMetadata?.coverage?[5].value?.coding?[0].code, "440655000") - XCTAssertEqual(inst.moduleMetadata?.coverage?[5].value?.coding?[0].display, "Outpatient environment") - XCTAssertEqual(inst.moduleMetadata?.coverage?[6].focus?.code, "target-user") - XCTAssertEqual(inst.moduleMetadata?.coverage?[6].value?.coding?[0].code, "309343006") - XCTAssertEqual(inst.moduleMetadata?.coverage?[6].value?.coding?[0].display, "Physician") - XCTAssertEqual(inst.moduleMetadata?.description_fhir, "...") - XCTAssertEqual(inst.moduleMetadata?.identifier?[0].use, "official") - XCTAssertEqual(inst.moduleMetadata?.identifier?[0].value, "mmi:low-suicide-risk-order-set") - XCTAssertEqual(inst.moduleMetadata?.publicationDate?.description, "2015-08-15") - XCTAssertEqual(inst.moduleMetadata?.publisher, "Motive Medical Intelligence") - XCTAssertEqual(inst.moduleMetadata?.status, "draft") - XCTAssertEqual(inst.moduleMetadata?.title, "Low Suicide Risk Order Set") - XCTAssertEqual(inst.moduleMetadata?.topic?[0].text, "Chlamydia Screeening") - XCTAssertEqual(inst.moduleMetadata?.type, "order-set") - XCTAssertEqual(inst.moduleMetadata?.version, "1.0.0") - XCTAssertEqual(inst.text?.div, "
Low Suicide Risk Order Set...
") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } -} diff --git a/Tests/ModelTests/OrderTests.swift b/Tests/ModelTests/OrderTests.swift index 78ff4efa..3a2b21e2 100644 --- a/Tests/ModelTests/OrderTests.swift +++ b/Tests/ModelTests/OrderTests.swift @@ -2,7 +2,7 @@ // OrderTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/OrganizationTests.swift b/Tests/ModelTests/OrganizationTests.swift index 9140f9a7..aedee156 100644 --- a/Tests/ModelTests/OrganizationTests.swift +++ b/Tests/ModelTests/OrganizationTests.swift @@ -2,7 +2,7 @@ // OrganizationTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -90,7 +90,7 @@ class OrganizationTests: XCTestCase { func runOrganization2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Organization { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "organization-example-f002-burgers-card.json") - XCTAssertFalse(inst.active ?? true) + XCTAssertTrue(inst.active ?? false) XCTAssertEqual(inst.address?[0].line?[0], "South Wing, floor 2") XCTAssertEqual(inst.contact?[0].address?.line?[0], "South Wing, floor 2") XCTAssertEqual(inst.contact?[0].name?.text, "mevr. D. de Haan") @@ -129,7 +129,7 @@ class OrganizationTests: XCTestCase { func runOrganization3(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Organization { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "organization-example-f003-burgers-ENT.json") - XCTAssertFalse(inst.active ?? true) + XCTAssertTrue(inst.active ?? false) XCTAssertEqual(inst.address?[0].line?[0], "West Wing, floor 5") XCTAssertEqual(inst.contact?[0].address?.line?[0], "West Wing, floor 5") XCTAssertEqual(inst.contact?[0].name?.text, "mr. F. de Hond") diff --git a/Tests/ModelTests/ParametersTests.swift b/Tests/ModelTests/ParametersTests.swift index b4c40b80..32028942 100644 --- a/Tests/ModelTests/ParametersTests.swift +++ b/Tests/ModelTests/ParametersTests.swift @@ -2,7 +2,7 @@ // ParametersTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/PatientTests.swift b/Tests/ModelTests/PatientTests.swift index e2d04fe0..dcfbd7fc 100644 --- a/Tests/ModelTests/PatientTests.swift +++ b/Tests/ModelTests/PatientTests.swift @@ -2,7 +2,7 @@ // PatientTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/PaymentNoticeTests.swift b/Tests/ModelTests/PaymentNoticeTests.swift index 3b014313..edf92dd8 100644 --- a/Tests/ModelTests/PaymentNoticeTests.swift +++ b/Tests/ModelTests/PaymentNoticeTests.swift @@ -2,7 +2,7 @@ // PaymentNoticeTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -40,10 +40,10 @@ class PaymentNoticeTests: XCTestCase { XCTAssertEqual(inst.id, "77654") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://benefitsinc.com/paymentnotice") XCTAssertEqual(inst.identifier?[0].value, "776543") - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") XCTAssertEqual(inst.paymentStatus?.code, "paid") XCTAssertEqual(inst.paymentStatus?.system?.absoluteString, "http://hl7.org/fhir/paymentstatus") - XCTAssertEqual(inst.requestReference?.reference, "http://benefitsinc.com/fhir/oralhealthclaim/12345") + XCTAssertEqual(inst.request?.reference, "http://benefitsinc.com/fhir/oralhealthclaim/12345") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the PaymentNotice
") XCTAssertEqual(inst.text?.status, "generated") diff --git a/Tests/ModelTests/PaymentReconciliationTests.swift b/Tests/ModelTests/PaymentReconciliationTests.swift index 30343f33..f7c6f84a 100644 --- a/Tests/ModelTests/PaymentReconciliationTests.swift +++ b/Tests/ModelTests/PaymentReconciliationTests.swift @@ -2,7 +2,7 @@ // PaymentReconciliationTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -41,14 +41,14 @@ class PaymentReconciliationTests: XCTestCase { XCTAssertEqual(inst.detail?[0].amount?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.detail?[0].amount?.value, NSDecimalNumber(string: "1000.0")) XCTAssertEqual(inst.detail?[0].date?.description, "2014-08-16") - XCTAssertEqual(inst.detail?[0].requestReference?.reference, "http://www.BenefitsInc.com/fhir/oralhealthclaim/225476332402") + XCTAssertEqual(inst.detail?[0].request?.reference, "http://www.BenefitsInc.com/fhir/oralhealthclaim/225476332402") XCTAssertEqual(inst.detail?[0].type?.code, "payment") XCTAssertEqual(inst.detail?[0].type?.system?.absoluteString, "http://hl7.org/fhir/paymenttype") XCTAssertEqual(inst.detail?[1].amount?.code, "USD") XCTAssertEqual(inst.detail?[1].amount?.system?.absoluteString, "urn:iso:std:iso:4217") XCTAssertEqual(inst.detail?[1].amount?.value, NSDecimalNumber(string: "4000.0")) XCTAssertEqual(inst.detail?[1].date?.description, "2014-08-12") - XCTAssertEqual(inst.detail?[1].requestReference?.reference, "http://www.BenefitsInc.com/fhir/oralhealthclaim/225476332699") + XCTAssertEqual(inst.detail?[1].request?.reference, "http://www.BenefitsInc.com/fhir/oralhealthclaim/225476332699") XCTAssertEqual(inst.detail?[1].type?.code, "payment") XCTAssertEqual(inst.detail?[1].type?.system?.absoluteString, "http://hl7.org/fhir/paymenttype") XCTAssertEqual(inst.detail?[2].amount?.code, "USD") @@ -61,9 +61,10 @@ class PaymentReconciliationTests: XCTestCase { XCTAssertEqual(inst.id, "ER2500") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.BenefitsInc.com/fhir/enrollmentresponse") XCTAssertEqual(inst.identifier?[0].value, "781234") - XCTAssertEqual(inst.organizationReference?.reference, "Organization/2") + XCTAssertEqual(inst.organization?.reference, "Organization/2") XCTAssertEqual(inst.outcome, "complete") - XCTAssertEqual(inst.requestReference?.reference, "http://www.BenefitsInc.com/fhir/eligibility/225476332402") + XCTAssertEqual(inst.request?.reference, "http://www.BenefitsInc.com/fhir/eligibility/225476332402") + XCTAssertEqual(inst.requestOrganization?.reference, "Organization/1") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the PaymentReconciliation
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.total?.code, "USD") diff --git a/Tests/ModelTests/PersonTests.swift b/Tests/ModelTests/PersonTests.swift index c25c0113..065b554d 100644 --- a/Tests/ModelTests/PersonTests.swift +++ b/Tests/ModelTests/PersonTests.swift @@ -2,7 +2,7 @@ // PersonTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/PractitionerRoleTests.swift b/Tests/ModelTests/PractitionerRoleTests.swift deleted file mode 100644 index b05e6888..00000000 --- a/Tests/ModelTests/PractitionerRoleTests.swift +++ /dev/null @@ -1,58 +0,0 @@ -// -// PractitionerRoleTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class PractitionerRoleTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.PractitionerRole { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.PractitionerRole { - let instance = SwiftFHIR.PractitionerRole(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testPractitionerRole1() { - do { - let instance = try runPractitionerRole1() - try runPractitionerRole1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test PractitionerRole successfully, but threw") - } - } - - @discardableResult - func runPractitionerRole1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.PractitionerRole { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "practitionerrole-example.json") - - XCTAssertTrue(inst.active ?? false) - XCTAssertEqual(inst.healthcareService?[0].reference, "HealthcareService/example") - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.acme.org/practitioners") - XCTAssertEqual(inst.identifier?[0].value, "23") - XCTAssertEqual(inst.location?[0].display, "South Wing, second floor") - XCTAssertEqual(inst.location?[0].reference, "Location/1") - XCTAssertEqual(inst.organization?.reference, "Organization/f001") - XCTAssertEqual(inst.period?.end?.description, "2012-03-31") - XCTAssertEqual(inst.period?.start?.description, "2012-01-01") - XCTAssertEqual(inst.role?[0].coding?[0].code, "RP") - XCTAssertEqual(inst.role?[0].coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0286") - XCTAssertEqual(inst.telecom?[0].system, "phone") - XCTAssertEqual(inst.telecom?[0].use, "home") - XCTAssertEqual(inst.telecom?[0].value, "(03) 5555 6473") - XCTAssertEqual(inst.text?.status, "generated") - - return inst - } -} diff --git a/Tests/ModelTests/PractitionerTests.swift b/Tests/ModelTests/PractitionerTests.swift index b1f327be..45fa7be8 100644 --- a/Tests/ModelTests/PractitionerTests.swift +++ b/Tests/ModelTests/PractitionerTests.swift @@ -2,7 +2,7 @@ // PractitionerTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -50,12 +50,12 @@ class PractitionerTests: XCTestCase { XCTAssertEqual(inst.identifier?[1].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.6.3") XCTAssertEqual(inst.identifier?[1].use, "usual") XCTAssertEqual(inst.identifier?[1].value, "129IDH4OP733") - XCTAssertEqual(inst.name?[0].family?[0], "van den broek") - XCTAssertEqual(inst.name?[0].given?[0], "Eric") - XCTAssertEqual(inst.name?[0].suffix?[0], "MD") - XCTAssertEqual(inst.name?[0].use, "official") - XCTAssertEqual(inst.practitionerRole?[0].organization?.display, "BMC") - XCTAssertEqual(inst.practitionerRole?[0].organization?.reference, "Organization/f001") + XCTAssertEqual(inst.name?.family?[0], "van den broek") + XCTAssertEqual(inst.name?.given?[0], "Eric") + XCTAssertEqual(inst.name?.suffix?[0], "MD") + XCTAssertEqual(inst.name?.use, "official") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.display, "BMC") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.reference, "Organization/f001") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].code, "01.000") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].display, "Arts") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.15.111") @@ -106,12 +106,12 @@ class PractitionerTests: XCTestCase { XCTAssertEqual(inst.identifier?[1].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.6.3") XCTAssertEqual(inst.identifier?[1].use, "usual") XCTAssertEqual(inst.identifier?[1].value, "174BIP3JH438") - XCTAssertEqual(inst.name?[0].family?[0], "Voigt") - XCTAssertEqual(inst.name?[0].given?[0], "Pieter") - XCTAssertEqual(inst.name?[0].suffix?[0], "MD") - XCTAssertEqual(inst.name?[0].use, "official") - XCTAssertEqual(inst.practitionerRole?[0].organization?.display, "BMC") - XCTAssertEqual(inst.practitionerRole?[0].organization?.reference, "Organization/f001") + XCTAssertEqual(inst.name?.family?[0], "Voigt") + XCTAssertEqual(inst.name?.given?[0], "Pieter") + XCTAssertEqual(inst.name?.suffix?[0], "MD") + XCTAssertEqual(inst.name?.use, "official") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.display, "BMC") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.reference, "Organization/f001") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].code, "01.000") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].display, "Arts") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.15.111") @@ -165,12 +165,12 @@ class PractitionerTests: XCTestCase { XCTAssertEqual(inst.identifier?[1].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.6.3") XCTAssertEqual(inst.identifier?[1].use, "usual") XCTAssertEqual(inst.identifier?[1].value, "243HID3RT938") - XCTAssertEqual(inst.name?[0].family?[0], "Versteegh") - XCTAssertEqual(inst.name?[0].given?[0], "Marc") - XCTAssertEqual(inst.name?[0].suffix?[0], "MD") - XCTAssertEqual(inst.name?[0].use, "official") - XCTAssertEqual(inst.practitionerRole?[0].organization?.display, "BMC") - XCTAssertEqual(inst.practitionerRole?[0].organization?.reference, "Organization/f001") + XCTAssertEqual(inst.name?.family?[0], "Versteegh") + XCTAssertEqual(inst.name?.given?[0], "Marc") + XCTAssertEqual(inst.name?.suffix?[0], "MD") + XCTAssertEqual(inst.name?.use, "official") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.display, "BMC") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.reference, "Organization/f001") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].code, "01.000") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].display, "Arts") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.15.111") @@ -225,12 +225,12 @@ class PractitionerTests: XCTestCase { XCTAssertEqual(inst.identifier?[1].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.6.3") XCTAssertEqual(inst.identifier?[1].use, "usual") XCTAssertEqual(inst.identifier?[1].value, "523ASA1LK927") - XCTAssertEqual(inst.name?[0].family?[0], "Briet") - XCTAssertEqual(inst.name?[0].given?[0], "Ronald") - XCTAssertEqual(inst.name?[0].suffix?[0], "MD") - XCTAssertEqual(inst.name?[0].use, "official") - XCTAssertEqual(inst.practitionerRole?[0].organization?.display, "BMC") - XCTAssertEqual(inst.practitionerRole?[0].organization?.reference, "Organization/f001") + XCTAssertEqual(inst.name?.family?[0], "Briet") + XCTAssertEqual(inst.name?.given?[0], "Ronald") + XCTAssertEqual(inst.name?.suffix?[0], "MD") + XCTAssertEqual(inst.name?.use, "official") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.display, "BMC") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.reference, "Organization/f001") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].code, "01.000") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].display, "Arts") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.15.111") @@ -284,13 +284,13 @@ class PractitionerTests: XCTestCase { XCTAssertEqual(inst.identifier?[1].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.6.3") XCTAssertEqual(inst.identifier?[1].use, "usual") XCTAssertEqual(inst.identifier?[1].value, "191REW8WE916") - XCTAssertEqual(inst.name?[0].family?[0], "Anne") - XCTAssertEqual(inst.name?[0].given?[0], "Langeveld") - XCTAssertEqual(inst.name?[0].suffix?[0], "MD") - XCTAssertEqual(inst.name?[0].use, "official") + XCTAssertEqual(inst.name?.family?[0], "Anne") + XCTAssertEqual(inst.name?.given?[0], "Langeveld") + XCTAssertEqual(inst.name?.suffix?[0], "MD") + XCTAssertEqual(inst.name?.use, "official") XCTAssertEqual(inst.photo?[0].contentType, "image/jpeg") - XCTAssertEqual(inst.practitionerRole?[0].organization?.display, "BMC") - XCTAssertEqual(inst.practitionerRole?[0].organization?.reference, "Organization/f001") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.display, "BMC") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.reference, "Organization/f001") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].code, "01.000") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].display, "Arts") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.15.111") @@ -341,12 +341,12 @@ class PractitionerTests: XCTestCase { XCTAssertEqual(inst.identifier?[1].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.6.3") XCTAssertEqual(inst.identifier?[1].use, "usual") XCTAssertEqual(inst.identifier?[1].value, "134IDY41W988") - XCTAssertEqual(inst.name?[0].family?[0], "van den Berk") - XCTAssertEqual(inst.name?[0].given?[0], "Rob") - XCTAssertEqual(inst.name?[0].suffix?[0], "MD") - XCTAssertEqual(inst.name?[0].use, "official") - XCTAssertEqual(inst.practitionerRole?[0].organization?.display, "BMC") - XCTAssertEqual(inst.practitionerRole?[0].organization?.reference, "Organization/f001") + XCTAssertEqual(inst.name?.family?[0], "van den Berk") + XCTAssertEqual(inst.name?.given?[0], "Rob") + XCTAssertEqual(inst.name?.suffix?[0], "MD") + XCTAssertEqual(inst.name?.use, "official") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.display, "BMC") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.reference, "Organization/f001") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].code, "01.000") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].display, "Arts") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.15.111") @@ -397,12 +397,12 @@ class PractitionerTests: XCTestCase { XCTAssertEqual(inst.identifier?[1].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.6.3") XCTAssertEqual(inst.identifier?[1].use, "usual") XCTAssertEqual(inst.identifier?[1].value, "567IUI51C154") - XCTAssertEqual(inst.name?[0].family?[0], "Heps") - XCTAssertEqual(inst.name?[0].given?[0], "Simone") - XCTAssertEqual(inst.name?[0].suffix?[0], "MD") - XCTAssertEqual(inst.name?[0].use, "official") - XCTAssertEqual(inst.practitionerRole?[0].organization?.display, "BMC") - XCTAssertEqual(inst.practitionerRole?[0].organization?.reference, "Organization/f001") + XCTAssertEqual(inst.name?.family?[0], "Heps") + XCTAssertEqual(inst.name?.given?[0], "Simone") + XCTAssertEqual(inst.name?.suffix?[0], "MD") + XCTAssertEqual(inst.name?.use, "official") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.display, "BMC") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.reference, "Organization/f001") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].code, "01.000") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].display, "Arts") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].system?.absoluteString, "urn:oid:2.16.840.1.113883.2.4.15.111") @@ -453,13 +453,13 @@ class PractitionerTests: XCTestCase { XCTAssertEqual(inst.identifier?[0].type?.text, "UZI-nummer") XCTAssertEqual(inst.identifier?[0].use, "official") XCTAssertEqual(inst.identifier?[0].value, "12345678901") - XCTAssertEqual(inst.name?[0].family?[0], "Bronsig") - XCTAssertEqual(inst.name?[0].given?[0], "Arend") - XCTAssertEqual(inst.name?[0].prefix?[0], "Dr.") - XCTAssertEqual(inst.name?[0].text, "Dokter Bronsig") - XCTAssertEqual(inst.name?[0].use, "official") - XCTAssertEqual(inst.practitionerRole?[0].organization?.display, "AUMC") - XCTAssertEqual(inst.practitionerRole?[0].organization?.reference, "Organization/f201") + XCTAssertEqual(inst.name?.family?[0], "Bronsig") + XCTAssertEqual(inst.name?.given?[0], "Arend") + XCTAssertEqual(inst.name?.prefix?[0], "Dr.") + XCTAssertEqual(inst.name?.text, "Dokter Bronsig") + XCTAssertEqual(inst.name?.use, "official") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.display, "AUMC") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.reference, "Organization/f201") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].code, "225304007") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].display, "Implementation of planned interventions") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].system?.absoluteString, "http://snomed.info/sct") @@ -509,13 +509,13 @@ class PractitionerTests: XCTestCase { XCTAssertEqual(inst.identifier?[1].type?.text, "BIG-nummer") XCTAssertEqual(inst.identifier?[1].use, "official") XCTAssertEqual(inst.identifier?[1].value, "12345678902") - XCTAssertEqual(inst.name?[0].family?[0], "Maas") - XCTAssertEqual(inst.name?[0].given?[0], "Luigi") - XCTAssertEqual(inst.name?[0].prefix?[0], "Dr.") - XCTAssertEqual(inst.name?[0].text, "Luigi Maas") - XCTAssertEqual(inst.name?[0].use, "official") - XCTAssertEqual(inst.practitionerRole?[0].organization?.display, "AUMC") - XCTAssertEqual(inst.practitionerRole?[0].organization?.reference, "Organization/f201") + XCTAssertEqual(inst.name?.family?[0], "Maas") + XCTAssertEqual(inst.name?.given?[0], "Luigi") + XCTAssertEqual(inst.name?.prefix?[0], "Dr.") + XCTAssertEqual(inst.name?.text, "Luigi Maas") + XCTAssertEqual(inst.name?.use, "official") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.display, "AUMC") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.reference, "Organization/f201") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].code, "33526004") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].display, "Electronic laboratory reporting") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].system?.absoluteString, "http://snomed.info/sct") @@ -561,10 +561,10 @@ class PractitionerTests: XCTestCase { XCTAssertEqual(inst.identifier?[1].type?.text, "BIG-nummer") XCTAssertEqual(inst.identifier?[1].use, "official") XCTAssertEqual(inst.identifier?[1].value, "12345678903") - XCTAssertEqual(inst.name?[0].text, "Juri van Gelder") - XCTAssertEqual(inst.name?[0].use, "official") - XCTAssertEqual(inst.practitionerRole?[0].organization?.display, "AUMC") - XCTAssertEqual(inst.practitionerRole?[0].organization?.reference, "Organization/f201") + XCTAssertEqual(inst.name?.text, "Juri van Gelder") + XCTAssertEqual(inst.name?.use, "official") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.display, "AUMC") + XCTAssertEqual(inst.practitionerRole?[0].managingOrganization?.reference, "Organization/f201") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].code, "36682004") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].display, "Physical therapist") XCTAssertEqual(inst.practitionerRole?[0].role?.coding?[0].system?.absoluteString, "http://snomed.info/sct") diff --git a/Tests/ModelTests/ProcedureRequestTests.swift b/Tests/ModelTests/ProcedureRequestTests.swift index a025d401..87fdfda3 100644 --- a/Tests/ModelTests/ProcedureRequestTests.swift +++ b/Tests/ModelTests/ProcedureRequestTests.swift @@ -2,7 +2,7 @@ // ProcedureRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -36,8 +36,8 @@ class ProcedureRequestTests: XCTestCase { func runProcedureRequest1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ProcedureRequest { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "procedurerequest-example.json") - XCTAssertEqual(inst.code?.coding?[0].code, "303653007") - XCTAssertEqual(inst.code?.coding?[0].display, "Computed tomography of head") + XCTAssertEqual(inst.code?.coding?[0].code, "323418000") + XCTAssertEqual(inst.code?.coding?[0].display, "Fix me up") XCTAssertEqual(inst.code?.coding?[0].system?.absoluteString, "http://snomed.info/sct") XCTAssertEqual(inst.id, "example") XCTAssertEqual(inst.subject?.reference, "Patient/example") diff --git a/Tests/ModelTests/ProcedureTests.swift b/Tests/ModelTests/ProcedureTests.swift index a34b953a..72463b4c 100644 --- a/Tests/ModelTests/ProcedureTests.swift +++ b/Tests/ModelTests/ProcedureTests.swift @@ -2,7 +2,7 @@ // ProcedureTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ProcessRequestTests.swift b/Tests/ModelTests/ProcessRequestTests.swift index 4da03a6a..47714562 100644 --- a/Tests/ModelTests/ProcessRequestTests.swift +++ b/Tests/ModelTests/ProcessRequestTests.swift @@ -2,7 +2,7 @@ // ProcessRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -69,7 +69,7 @@ class ProcessRequestTests: XCTestCase { XCTAssertEqual(inst.id, "1113") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/processrequest") XCTAssertEqual(inst.identifier?[0].value, "113") - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Poll ProcessRequest
") XCTAssertEqual(inst.text?.status, "generated") @@ -96,7 +96,7 @@ class ProcessRequestTests: XCTestCase { XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/processrequest") XCTAssertEqual(inst.identifier?[0].value, "112") XCTAssertEqual(inst.include?[0], "Reconciliation") - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Poll ProcessRequest
") XCTAssertEqual(inst.text?.status, "generated") @@ -123,7 +123,7 @@ class ProcessRequestTests: XCTestCase { XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/processrequest") XCTAssertEqual(inst.identifier?[0].value, "114") XCTAssertEqual(inst.include?[0], "Reconciliation") - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") XCTAssertEqual(inst.period?.end?.description, "2014-08-20") XCTAssertEqual(inst.period?.start?.description, "2014-08-10") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Poll ProcessRequest
") @@ -151,8 +151,8 @@ class ProcessRequestTests: XCTestCase { XCTAssertEqual(inst.id, "1111") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/processrequest") XCTAssertEqual(inst.identifier?[0].value, "111") - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") - XCTAssertEqual(inst.requestReference?.reference, "http://benefitco.com/oralhealthclaim/12345") + XCTAssertEqual(inst.organization?.reference, "Organization/1") + XCTAssertEqual(inst.request?.reference, "http://benefitco.com/oralhealthclaim/12345") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Poll ProcessRequest
") XCTAssertEqual(inst.text?.status, "generated") @@ -179,9 +179,9 @@ class ProcessRequestTests: XCTestCase { XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/processrequest") XCTAssertEqual(inst.identifier?[0].value, "44543") XCTAssertEqual(inst.item?[0].sequenceLinkId, 1) - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") XCTAssertEqual(inst.reference, "ABC12345G") - XCTAssertEqual(inst.requestReference?.reference, "http://BenefitsInc.com/fhir/oralhealthclaim/12345") + XCTAssertEqual(inst.request?.reference, "http://BenefitsInc.com/fhir/oralhealthclaim/12345") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the ReProcess ProcessRequest resource.
") XCTAssertEqual(inst.text?.status, "generated") @@ -208,8 +208,8 @@ class ProcessRequestTests: XCTestCase { XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/processrequest") XCTAssertEqual(inst.identifier?[0].value, "76543") XCTAssertFalse(inst.nullify ?? true) - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") - XCTAssertEqual(inst.requestReference?.reference, "http://BenefitsInc.com/fhir/oralhealthclaim/12345") + XCTAssertEqual(inst.organization?.reference, "Organization/1") + XCTAssertEqual(inst.request?.reference, "http://BenefitsInc.com/fhir/oralhealthclaim/12345") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Reversal ProcessRequest
") XCTAssertEqual(inst.text?.status, "generated") @@ -235,9 +235,9 @@ class ProcessRequestTests: XCTestCase { XCTAssertEqual(inst.id, "87655") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/processrequest") XCTAssertEqual(inst.identifier?[0].value, "1776543") - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") - XCTAssertEqual(inst.requestReference?.reference, "http://BenefitsInc.com/oralhealthclaim/12345") - XCTAssertEqual(inst.responseReference?.reference, "http://BenefitsInc.com/fhir/claimresponse/3500") + XCTAssertEqual(inst.organization?.reference, "Organization/1") + XCTAssertEqual(inst.request?.reference, "http://BenefitsInc.com/oralhealthclaim/12345") + XCTAssertEqual(inst.response?.reference, "http://BenefitsInc.com/fhir/claimresponse/3500") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Status ProcessRequest
") XCTAssertEqual(inst.text?.status, "generated") @@ -263,7 +263,7 @@ class ProcessRequestTests: XCTestCase { XCTAssertEqual(inst.id, "1110") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://happyvalley.com/processrequest") XCTAssertEqual(inst.identifier?[0].value, "110") - XCTAssertEqual(inst.organizationReference?.reference, "Organization/1") + XCTAssertEqual(inst.organization?.reference, "Organization/1") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the Poll ProcessRequest
") XCTAssertEqual(inst.text?.status, "generated") diff --git a/Tests/ModelTests/ProcessResponseTests.swift b/Tests/ModelTests/ProcessResponseTests.swift index b9757436..7a8a5a15 100644 --- a/Tests/ModelTests/ProcessResponseTests.swift +++ b/Tests/ModelTests/ProcessResponseTests.swift @@ -2,7 +2,7 @@ // ProcessResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -41,10 +41,11 @@ class ProcessResponseTests: XCTestCase { XCTAssertEqual(inst.id, "SR2500") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://www.BenefitsInc.com/fhir/processresponse") XCTAssertEqual(inst.identifier?[0].value, "881234") - XCTAssertEqual(inst.organizationReference?.reference, "Organization/2") + XCTAssertEqual(inst.organization?.reference, "Organization/2") XCTAssertEqual(inst.outcome?.code, "complete") XCTAssertEqual(inst.outcome?.system?.absoluteString, "http://hl7.org/fhir/processoutcomecodes") - XCTAssertEqual(inst.requestReference?.reference, "http://www.BenefitsInc.com/fhir/eligibility/225476332402") + XCTAssertEqual(inst.request?.reference, "http://www.BenefitsInc.com/fhir/eligibility/225476332402") + XCTAssertEqual(inst.requestOrganization?.reference, "Organization/1") XCTAssertEqual(inst.text?.div, "
A human-readable rendering of the ProcessResponse
") XCTAssertEqual(inst.text?.status, "generated") diff --git a/Tests/ModelTests/ProtocolFHIRTests.swift b/Tests/ModelTests/ProtocolFHIRTests.swift deleted file mode 100644 index f7245457..00000000 --- a/Tests/ModelTests/ProtocolFHIRTests.swift +++ /dev/null @@ -1,221 +0,0 @@ -// -// ProtocolFHIRTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class ProtocolFHIRTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.ProtocolFHIR { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.ProtocolFHIR { - let instance = SwiftFHIR.ProtocolFHIR(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testProtocolFHIR1() { - do { - let instance = try runProtocolFHIR1() - try runProtocolFHIR1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test ProtocolFHIR successfully, but threw") - } - } - - @discardableResult - func runProtocolFHIR1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ProtocolFHIR { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "protocol-example.json") - - XCTAssertEqual(inst.author?.display, "National Heart, Lung, and Blood Institute http://www.nhlbi.nih.gov/health-pro/guidelines/current/obesity-guidelines/e_textbook/txgd/algorthm/algorthm.htm") - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://acme.org") - XCTAssertEqual(inst.identifier?[0].value, "example-1") - XCTAssertEqual(inst.purpose, "Example of A medical algorithm for assessment and treatment of overweight and obesity") - XCTAssertEqual(inst.status, "draft") - XCTAssertEqual(inst.step?[0].activity?[0].detail?.category, "procedure") - XCTAssertEqual(inst.step?[0].activity?[0].detail?.code?.coding?[0].code, "39156-5") - XCTAssertEqual(inst.step?[0].activity?[0].detail?.code?.coding?[0].display, "Body mass index (BMI) [Ratio]") - XCTAssertEqual(inst.step?[0].activity?[0].detail?.code?.coding?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.step?[0].activity?[0].detail?.description_fhir, "Extra information on activity ") - XCTAssertEqual(inst.step?[0].activity?[0].detail?.performer?[0].display, "Nurse Ratched") - XCTAssertEqual(inst.step?[0].name, "Measure BMI") - XCTAssertEqual(inst.step?[0].precondition?.union?[0].condition?.type?.coding?[0].code, "1234") - XCTAssertEqual(inst.step?[0].precondition?.union?[0].condition?.type?.coding?[0].display, "Obesity") - XCTAssertEqual(inst.step?[0].precondition?.union?[0].condition?.type?.coding?[0].system?.absoluteString, "http://acme.org") - XCTAssertTrue(inst.step?[0].precondition?.union?[0].condition?.valueBoolean ?? false) - XCTAssertEqual(inst.step?[0].precondition?.union?[1].condition?.type?.text, "BMI in last 2 years") - XCTAssertFalse(inst.step?[0].precondition?.union?[1].condition?.valueBoolean ?? true) - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.title, "Obesity Assessment Protocol") - XCTAssertEqual(inst.type, "condition") - - return inst - } - - func testProtocolFHIR2() { - do { - let instance = try runProtocolFHIR2() - try runProtocolFHIR2(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test ProtocolFHIR successfully, but threw") - } - } - - @discardableResult - func runProtocolFHIR2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ProtocolFHIR { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "protocol-study-profile-example.json") - - XCTAssertEqual(inst.extension_fhir?[0].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#arm.name") - XCTAssertEqual(inst.extension_fhir?[0].extension_fhir?[0].valueString, "0.5 mg Dose") - XCTAssertEqual(inst.extension_fhir?[0].extension_fhir?[1].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#arm.description") - XCTAssertEqual(inst.extension_fhir?[0].extension_fhir?[1].valueString, "Administering 0.5mg of [Drug A]") - XCTAssertEqual(inst.extension_fhir?[0].id, "arm-dose1") - XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#arm") - XCTAssertEqual(inst.extension_fhir?[1].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#arm.name") - XCTAssertEqual(inst.extension_fhir?[1].extension_fhir?[0].valueString, "dose2") - XCTAssertEqual(inst.extension_fhir?[1].extension_fhir?[1].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#arm.description") - XCTAssertEqual(inst.extension_fhir?[1].extension_fhir?[1].valueString, "Administering 1.0mg of [Drug A]") - XCTAssertEqual(inst.extension_fhir?[1].id, "arm-dose2") - XCTAssertEqual(inst.extension_fhir?[1].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#arm") - XCTAssertEqual(inst.extension_fhir?[2].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#epoch.name") - XCTAssertEqual(inst.extension_fhir?[2].extension_fhir?[0].valueString, "Screening") - XCTAssertEqual(inst.extension_fhir?[2].id, "epoch-screening") - XCTAssertEqual(inst.extension_fhir?[2].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#epoch") - XCTAssertEqual(inst.extension_fhir?[3].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#epoch.name") - XCTAssertEqual(inst.extension_fhir?[3].extension_fhir?[0].valueString, "Single blind run-in") - XCTAssertEqual(inst.extension_fhir?[3].id, "epoch-single-blind-run-in") - XCTAssertEqual(inst.extension_fhir?[3].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#epoch") - XCTAssertEqual(inst.extension_fhir?[4].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#epoch.name") - XCTAssertEqual(inst.extension_fhir?[4].extension_fhir?[0].valueString, "Treatment") - XCTAssertEqual(inst.extension_fhir?[4].id, "epoch-treatment-phase") - XCTAssertEqual(inst.extension_fhir?[4].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#epoch") - XCTAssertEqual(inst.extension_fhir?[5].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#epoch.name") - XCTAssertEqual(inst.extension_fhir?[5].extension_fhir?[0].valueString, "Follow up") - XCTAssertEqual(inst.extension_fhir?[5].id, "epoch-follow-up") - XCTAssertEqual(inst.extension_fhir?[5].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#epoch") - XCTAssertEqual(inst.id, "study") - XCTAssertEqual(inst.purpose, "Defines the execution of study AD-4833PNFP-341") - XCTAssertEqual(inst.status, "active") - XCTAssertEqual(inst.step?[0].description_fhir, "Screen") - XCTAssertEqual(inst.step?[0].exit?.description_fhir, "Screening assessments complete") - XCTAssertEqual(inst.step?[0].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.arm") - XCTAssertEqual(inst.step?[0].extension_fhir?[0].valueUri?.absoluteString, "#arm-dose1") - XCTAssertEqual(inst.step?[0].extension_fhir?[1].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.epoch") - XCTAssertEqual(inst.step?[0].extension_fhir?[1].valueUri?.absoluteString, "#epoch-screening") - XCTAssertEqual(inst.step?[0].extension_fhir?[2].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armSequence") - XCTAssertEqual(inst.step?[0].extension_fhir?[2].valueInteger, 1) - XCTAssertEqual(inst.step?[0].name, "SCRN") - XCTAssertEqual(inst.step?[0].precondition?.description_fhir, "Informed Consent") - XCTAssertEqual(inst.step?[1].description_fhir, "Single Blind Run-In") - XCTAssertEqual(inst.step?[1].duration?.code, "wk") - XCTAssertEqual(inst.step?[1].duration?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.step?[1].duration?.value, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.step?[1].exit?.description_fhir, "1 week after start of Element") - XCTAssertEqual(inst.step?[1].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.arm") - XCTAssertEqual(inst.step?[1].extension_fhir?[0].valueUri?.absoluteString, "#arm-dose1") - XCTAssertEqual(inst.step?[1].extension_fhir?[1].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.epoch") - XCTAssertEqual(inst.step?[1].extension_fhir?[1].valueUri?.absoluteString, "#epoch-single-blind-run-in") - XCTAssertEqual(inst.step?[1].extension_fhir?[2].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armSequence") - XCTAssertEqual(inst.step?[1].extension_fhir?[2].valueInteger, 2) - XCTAssertEqual(inst.step?[1].extension_fhir?[3].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armAssignment") - XCTAssertEqual(inst.step?[1].extension_fhir?[3].valueString, "Randomized to Dose 1") - XCTAssertEqual(inst.step?[1].name, "SBRI") - XCTAssertEqual(inst.step?[1].precondition?.description_fhir, "Initial Single Blind Placebo dose") - XCTAssertEqual(inst.step?[2].description_fhir, "Administer 0.5mg [Drug A] QD") - XCTAssertEqual(inst.step?[2].duration?.code, "wk") - XCTAssertEqual(inst.step?[2].duration?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.step?[2].duration?.value, NSDecimalNumber(string: "30")) - XCTAssertEqual(inst.step?[2].exit?.description_fhir, "30 weeks after start of Element") - XCTAssertEqual(inst.step?[2].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.arm") - XCTAssertEqual(inst.step?[2].extension_fhir?[0].valueUri?.absoluteString, "#arm-dose1") - XCTAssertEqual(inst.step?[2].extension_fhir?[1].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.epoch") - XCTAssertEqual(inst.step?[2].extension_fhir?[1].valueUri?.absoluteString, "#epoch-treatment-phase") - XCTAssertEqual(inst.step?[2].extension_fhir?[2].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armSequence") - XCTAssertEqual(inst.step?[2].extension_fhir?[2].valueInteger, 3) - XCTAssertEqual(inst.step?[2].name, "DOSE 1") - XCTAssertEqual(inst.step?[2].precondition?.description_fhir, "First dose of treatment where total drug dose of [Drug A] per day is 0.5 mg.") - XCTAssertEqual(inst.step?[3].description_fhir, "Follow-Up") - XCTAssertEqual(inst.step?[3].exit?.description_fhir, "2 weeks after start of Element") - XCTAssertEqual(inst.step?[3].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.arm") - XCTAssertEqual(inst.step?[3].extension_fhir?[0].valueUri?.absoluteString, "#arm-dose1") - XCTAssertEqual(inst.step?[3].extension_fhir?[1].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.epoch") - XCTAssertEqual(inst.step?[3].extension_fhir?[1].valueUri?.absoluteString, "#epoch-follow-up") - XCTAssertEqual(inst.step?[3].extension_fhir?[2].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armSequence") - XCTAssertEqual(inst.step?[3].extension_fhir?[2].valueInteger, 4) - XCTAssertEqual(inst.step?[3].name, "FLWUP") - XCTAssertEqual(inst.step?[3].precondition?.description_fhir, "Last dose of treatment") - XCTAssertEqual(inst.step?[4].description_fhir, "Screen") - XCTAssertEqual(inst.step?[4].exit?.description_fhir, "Screening assessments complete") - XCTAssertEqual(inst.step?[4].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.arm") - XCTAssertEqual(inst.step?[4].extension_fhir?[0].valueUri?.absoluteString, "#arm-dose2") - XCTAssertEqual(inst.step?[4].extension_fhir?[1].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.epoch") - XCTAssertEqual(inst.step?[4].extension_fhir?[1].valueUri?.absoluteString, "#epoch-screening") - XCTAssertEqual(inst.step?[4].extension_fhir?[2].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armSequence") - XCTAssertEqual(inst.step?[4].extension_fhir?[2].valueInteger, 1) - XCTAssertEqual(inst.step?[4].name, "SCRN") - XCTAssertEqual(inst.step?[4].precondition?.description_fhir, "Informed Consent") - XCTAssertEqual(inst.step?[5].description_fhir, "Single Blind Run-In") - XCTAssertEqual(inst.step?[5].duration?.code, "wk") - XCTAssertEqual(inst.step?[5].duration?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.step?[5].duration?.value, NSDecimalNumber(string: "1")) - XCTAssertEqual(inst.step?[5].exit?.description_fhir, "1 week after start of Element") - XCTAssertEqual(inst.step?[5].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.arm") - XCTAssertEqual(inst.step?[5].extension_fhir?[0].valueUri?.absoluteString, "#arm-dose2") - XCTAssertEqual(inst.step?[5].extension_fhir?[1].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.epoch") - XCTAssertEqual(inst.step?[5].extension_fhir?[1].valueUri?.absoluteString, "#epoch-single-blind-run-in") - XCTAssertEqual(inst.step?[5].extension_fhir?[2].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armSequence") - XCTAssertEqual(inst.step?[5].extension_fhir?[2].valueInteger, 2) - XCTAssertEqual(inst.step?[5].extension_fhir?[3].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armAssignment") - XCTAssertEqual(inst.step?[5].extension_fhir?[3].valueString, "Randomized to 1.0 mg") - XCTAssertEqual(inst.step?[5].name, "SBRI") - XCTAssertEqual(inst.step?[5].precondition?.description_fhir, "First dose of Single Blind Placebo") - XCTAssertEqual(inst.step?[6].description_fhir, "Administer 1.0 mg [Drug A] QD") - XCTAssertEqual(inst.step?[6].duration?.code, "wk") - XCTAssertEqual(inst.step?[6].duration?.system?.absoluteString, "http://unitsofmeasure.org") - XCTAssertEqual(inst.step?[6].duration?.value, NSDecimalNumber(string: "30")) - XCTAssertEqual(inst.step?[6].exit?.description_fhir, "30 weeks after start of Element") - XCTAssertEqual(inst.step?[6].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.arm") - XCTAssertEqual(inst.step?[6].extension_fhir?[0].valueUri?.absoluteString, "#arm-dose2") - XCTAssertEqual(inst.step?[6].extension_fhir?[1].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.epoch") - XCTAssertEqual(inst.step?[6].extension_fhir?[1].valueUri?.absoluteString, "#epoch-treatment-phase") - XCTAssertEqual(inst.step?[6].extension_fhir?[2].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armSequence") - XCTAssertEqual(inst.step?[6].extension_fhir?[2].valueInteger, 3) - XCTAssertEqual(inst.step?[6].name, "1.0 mg Dose") - XCTAssertEqual(inst.step?[6].precondition?.description_fhir, "Intial dose of treatment where total drug dose of [Drug A] per day is 1.0 mg.") - XCTAssertEqual(inst.step?[7].description_fhir, "Follow-Up") - XCTAssertEqual(inst.step?[7].exit?.description_fhir, "2 weeks after start of Element") - XCTAssertEqual(inst.step?[7].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.arm") - XCTAssertEqual(inst.step?[7].extension_fhir?[0].valueUri?.absoluteString, "#arm-pio45mgs") - XCTAssertEqual(inst.step?[7].extension_fhir?[1].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.epoch") - XCTAssertEqual(inst.step?[7].extension_fhir?[1].valueUri?.absoluteString, "#epoch-follow-up") - XCTAssertEqual(inst.step?[7].extension_fhir?[2].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armSequence") - XCTAssertEqual(inst.step?[7].extension_fhir?[2].valueInteger, 4) - XCTAssertEqual(inst.step?[7].name, "FLWUP") - XCTAssertEqual(inst.step?[7].precondition?.description_fhir, "Last dose of treatment") - XCTAssertEqual(inst.step?[8].activity?[0].detail?.category, "encounter") - XCTAssertEqual(inst.step?[8].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armSequence") - XCTAssertEqual(inst.step?[8].extension_fhir?[0].valueInteger, 1) - XCTAssertEqual(inst.step?[8].name, "VISIT 1") - XCTAssertEqual(inst.step?[8].precondition?.description_fhir, "Screening") - XCTAssertEqual(inst.step?[9].activity?[0].detail?.category, "encounter") - XCTAssertEqual(inst.step?[9].extension_fhir?[0].url?.absoluteString, "http://example.org/example-do-not-use/Profilestudyprotocol#step.armSequence") - XCTAssertEqual(inst.step?[9].extension_fhir?[0].valueInteger, 2) - XCTAssertEqual(inst.step?[9].name, "VISIT 2") - XCTAssertEqual(inst.step?[9].precondition?.description_fhir, "single-blind placebo start") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type, "study") - - return inst - } -} diff --git a/Tests/ModelTests/ProvenanceTests.swift b/Tests/ModelTests/ProvenanceTests.swift index c79a096c..031b866a 100644 --- a/Tests/ModelTests/ProvenanceTests.swift +++ b/Tests/ModelTests/ProvenanceTests.swift @@ -2,7 +2,7 @@ // ProvenanceTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -36,23 +36,23 @@ class ProvenanceTests: XCTestCase { func runProvenance1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Provenance { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "provenance-example-sig.json") - XCTAssertEqual(inst.activity?.code, "AU") - XCTAssertEqual(inst.activity?.display, "authenticated") - XCTAssertEqual(inst.activity?.system?.absoluteString, "http://hl7.org/fhir/v3/DocumentCompletion") + XCTAssertEqual(inst.activity?.coding?[0].code, "AU") + XCTAssertEqual(inst.activity?.coding?[0].display, "authenticated") + XCTAssertEqual(inst.activity?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v3/DocumentCompletion") XCTAssertEqual(inst.agent?[0].actor?.reference, "Practitioner/xcda-author") XCTAssertEqual(inst.agent?[0].role?.code, "verifier") XCTAssertEqual(inst.agent?[0].role?.system?.absoluteString, "http://hl7.org/fhir/provenance-participant-role") XCTAssertEqual(inst.agent?[0].userId?.system?.absoluteString, "http://acme.com/fhir/users/sso") XCTAssertEqual(inst.agent?[0].userId?.value, "hhd") XCTAssertEqual(inst.id, "signature") - XCTAssertEqual(inst.reason?[0].code, "TREAT") - XCTAssertEqual(inst.reason?[0].display, "treatment") - XCTAssertEqual(inst.reason?[0].system?.absoluteString, "http://hl7.org/fhir/v3/ActReason") + XCTAssertEqual(inst.reason?[0].coding?[0].code, "TREAT") + XCTAssertEqual(inst.reason?[0].coding?[0].display, "treatment") + XCTAssertEqual(inst.reason?[0].coding?[0].system?.absoluteString, "http://hl7.org/fhir/v3/ActReason") XCTAssertEqual(inst.recorded?.description, "2015-08-27T08:39:24+10:00") XCTAssertEqual(inst.signature?[0].blob, Base64Binary(value: "Li4u")) XCTAssertEqual(inst.signature?[0].contentType, "application/signature+xml") XCTAssertEqual(inst.signature?[0].type?[0].code, "1.2.840.10065.1.12.1.5") - XCTAssertEqual(inst.signature?[0].type?[0].display, "Verification Signature") + XCTAssertEqual(inst.signature?[0].type?[0].display, "Verification") XCTAssertEqual(inst.signature?[0].type?[0].system?.absoluteString, "http://hl7.org/fhir/valueset-signature-type") XCTAssertEqual(inst.signature?[0].when?.description, "2015-08-27T08:39:24+10:00") XCTAssertEqual(inst.signature?[0].whoReference?.reference, "Practitioner/xcda-author") @@ -98,9 +98,10 @@ class ProvenanceTests: XCTestCase { XCTAssertEqual(inst.location?.reference, "Location/1") XCTAssertEqual(inst.period?.start?.description, "2015-06-27") XCTAssertEqual(inst.policy?[0].absoluteString, "http://acme.com/fhir/Consent/25") - XCTAssertEqual(inst.reason?[0].code, "3457005") - XCTAssertEqual(inst.reason?[0].display, "Referral") - XCTAssertEqual(inst.reason?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.reason?[0].coding?[0].code, "3457005") + XCTAssertEqual(inst.reason?[0].coding?[0].display, "Referral") + XCTAssertEqual(inst.reason?[0].coding?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.reason?[0].text, "Accepting a referral") XCTAssertEqual(inst.recorded?.description, "2015-06-27T08:39:24+10:00") XCTAssertEqual(inst.target?[0].reference, "Procedure/example/_history/1") XCTAssertEqual(inst.text?.div, "
procedure record authored on 27-June 2015 by Harold Hippocrates, MD Content extracted from Referral received 26-June
") diff --git a/Tests/ModelTests/QuestionnaireResponseTests.swift b/Tests/ModelTests/QuestionnaireResponseTests.swift index 37551320..96ca98b2 100644 --- a/Tests/ModelTests/QuestionnaireResponseTests.swift +++ b/Tests/ModelTests/QuestionnaireResponseTests.swift @@ -2,7 +2,7 @@ // QuestionnaireResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -38,42 +38,46 @@ class QuestionnaireResponseTests: XCTestCase { XCTAssertEqual(inst.author?.reference, "http://hl7.org/fhir/Practitioner/example") XCTAssertEqual(inst.authored?.description, "2013-02-19T14:15:00+10:00") + XCTAssertEqual(inst.group?.group?[0].group?[0].question?[0].answer?[0].valueString, "Cathy Jones") + XCTAssertEqual(inst.group?.group?[0].group?[0].question?[0].linkId, "nameOfChild") + XCTAssertEqual(inst.group?.group?[0].group?[0].question?[0].text, "Name of child") + XCTAssertEqual(inst.group?.group?[0].group?[0].question?[1].answer?[0].valueCoding?.code, "f") + XCTAssertEqual(inst.group?.group?[0].group?[0].question?[1].linkId, "sex") + XCTAssertEqual(inst.group?.group?[0].group?[0].question?[1].text, "Sex") + XCTAssertEqual(inst.group?.group?[0].group?[1].linkId, "neonatalInformation") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[0].answer?[0].valueDecimal, NSDecimalNumber(string: "3.25")) + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[0].linkId, "birthWeight") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[0].text, "Birth weight (kg)") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[1].answer?[0].valueDecimal, NSDecimalNumber(string: "44.3")) + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[1].linkId, "birthLength") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[1].text, "Birth length (cm)") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].answer?[0].group?[0].extension_fhir?[0].url?.absoluteString, "http://example.org/Profile/questionnaire#visibilityCondition") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].answer?[0].group?[0].extension_fhir?[0].valueString, "HAS_VALUE(../choice/code) AND NEQ(../choice/code,'NO')") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].answer?[0].group?[0].linkId, "vitaminKgivenDoses") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].answer?[0].group?[0].question?[0].answer?[0].valueDate?.description, "1972-11-30") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].answer?[0].group?[0].question?[0].linkId, "vitaminiKDose1") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].answer?[0].group?[0].question?[0].text, "1st dose") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].answer?[0].group?[0].question?[1].answer?[0].valueDate?.description, "1972-12-11") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].answer?[0].group?[0].question?[1].linkId, "vitaminiKDose2") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].answer?[0].group?[0].question?[1].text, "2nd dose") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].answer?[0].valueCoding?.code, "INJECTION") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].linkId, "vitaminKgiven") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].text, "Vitamin K given") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[3].answer?[0].group?[0].linkId, "hepBgivenDate") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[3].answer?[0].group?[0].question?[0].answer?[0].valueDate?.description, "1972-12-04") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[3].answer?[0].group?[0].question?[0].text, "Date given") + XCTAssertTrue(inst.group?.group?[0].group?[1].question?[3].answer?[0].valueBoolean ?? false) + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[3].linkId, "hepBgiven") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[3].text, "Hep B given y / n") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[4].answer?[0].valueString, "Already able to speak Chinese") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[4].linkId, "abnormalitiesAtBirth") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[4].text, "Abnormalities noted at birth") + XCTAssertEqual(inst.group?.group?[0].group?[1].title, "Neonatal Information") + XCTAssertEqual(inst.group?.group?[0].linkId, "birthDetails") + XCTAssertEqual(inst.group?.group?[0].title, "Birth details - To be completed by health professional") + XCTAssertEqual(inst.group?.linkId, "PHR") + XCTAssertEqual(inst.group?.title, "NSW Government My Personal Health Record, january 2013") XCTAssertEqual(inst.id, "bb") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].answer?[0].valueString, "Cathy Jones") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].linkId, "nameOfChild") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].text, "Name of child") - XCTAssertEqual(inst.item?[0].item?[0].item?[1].answer?[0].valueCoding?.code, "f") - XCTAssertEqual(inst.item?[0].item?[0].item?[1].linkId, "sex") - XCTAssertEqual(inst.item?[0].item?[0].item?[1].text, "Sex") - XCTAssertEqual(inst.item?[0].item?[1].item?[0].answer?[0].valueDecimal, NSDecimalNumber(string: "3.25")) - XCTAssertEqual(inst.item?[0].item?[1].item?[0].linkId, "birthWeight") - XCTAssertEqual(inst.item?[0].item?[1].item?[0].text, "Birth weight (kg)") - XCTAssertEqual(inst.item?[0].item?[1].item?[1].answer?[0].valueDecimal, NSDecimalNumber(string: "44.3")) - XCTAssertEqual(inst.item?[0].item?[1].item?[1].linkId, "birthLength") - XCTAssertEqual(inst.item?[0].item?[1].item?[1].text, "Birth length (cm)") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].answer?[0].item?[0].item?[0].answer?[0].valueDate?.description, "1972-11-30") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].answer?[0].item?[0].item?[0].linkId, "vitaminKDose1") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].answer?[0].item?[0].item?[0].text, "1st dose") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].answer?[0].item?[0].item?[1].answer?[0].valueDate?.description, "1972-12-11") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].answer?[0].item?[0].item?[1].linkId, "vitaminKDose2") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].answer?[0].item?[0].item?[1].text, "2nd dose") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].answer?[0].item?[0].linkId, "vitaminKgivenDoses") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].answer?[0].valueCoding?.code, "INJECTION") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].linkId, "vitaminKgiven") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].text, "Vitamin K given") - XCTAssertEqual(inst.item?[0].item?[1].item?[3].answer?[0].item?[0].item?[0].answer?[0].valueDate?.description, "1972-12-04") - XCTAssertEqual(inst.item?[0].item?[1].item?[3].answer?[0].item?[0].item?[0].text, "Date given") - XCTAssertEqual(inst.item?[0].item?[1].item?[3].answer?[0].item?[0].linkId, "hepBgivenDate") - XCTAssertTrue(inst.item?[0].item?[1].item?[3].answer?[0].valueBoolean ?? false) - XCTAssertEqual(inst.item?[0].item?[1].item?[3].linkId, "hepBgiven") - XCTAssertEqual(inst.item?[0].item?[1].item?[3].text, "Hep B given y / n") - XCTAssertEqual(inst.item?[0].item?[1].item?[4].answer?[0].valueString, "Already able to speak Chinese") - XCTAssertEqual(inst.item?[0].item?[1].item?[4].linkId, "abnormalitiesAtBirth") - XCTAssertEqual(inst.item?[0].item?[1].item?[4].text, "Abnormalities noted at birth") - XCTAssertEqual(inst.item?[0].item?[1].linkId, "neonatalInformation") - XCTAssertEqual(inst.item?[0].item?[1].text, "Neonatal Information") - XCTAssertEqual(inst.item?[0].linkId, "birthDetails") - XCTAssertEqual(inst.item?[0].text, "Birth details - To be completed by health professional") XCTAssertEqual(inst.status, "completed") XCTAssertEqual(inst.subject?.reference, "http://hl7.org/fhir/Patient/1") XCTAssertEqual(inst.text?.status, "generated") @@ -97,33 +101,34 @@ class QuestionnaireResponseTests: XCTestCase { XCTAssertEqual(inst.author?.reference, "Practitioner/f201") XCTAssertEqual(inst.authored?.description, "2013-06-18T00:00:00+01:00") + XCTAssertEqual(inst.group?.group?[0].linkId, "1") + XCTAssertEqual(inst.group?.group?[0].question?[0].answer?[0].valueString, "I am allergic to house dust") + XCTAssertEqual(inst.group?.group?[0].question?[0].linkId, "1.1") + XCTAssertEqual(inst.group?.group?[0].question?[0].text, "Do you have allergies?") + XCTAssertEqual(inst.group?.group?[1].linkId, "2") + XCTAssertEqual(inst.group?.group?[1].question?[0].answer?[0].valueString, "Male") + XCTAssertEqual(inst.group?.group?[1].question?[0].linkId, "2.1") + XCTAssertEqual(inst.group?.group?[1].question?[0].text, "What is your gender?") + XCTAssertEqual(inst.group?.group?[1].question?[1].answer?[0].valueDate?.description, "1960-03-13") + XCTAssertEqual(inst.group?.group?[1].question?[1].linkId, "2.2") + XCTAssertEqual(inst.group?.group?[1].question?[1].text, "What is your date of birth?") + XCTAssertEqual(inst.group?.group?[1].question?[2].answer?[0].valueString, "The Netherlands") + XCTAssertEqual(inst.group?.group?[1].question?[2].linkId, "2.3") + XCTAssertEqual(inst.group?.group?[1].question?[2].text, "What is your country of birth?") + XCTAssertEqual(inst.group?.group?[1].question?[3].answer?[0].valueString, "married") + XCTAssertEqual(inst.group?.group?[1].question?[3].linkId, "2.4") + XCTAssertEqual(inst.group?.group?[1].question?[3].text, "What is your marital status?") + XCTAssertEqual(inst.group?.group?[1].title, "General questions") + XCTAssertEqual(inst.group?.group?[2].linkId, "3") + XCTAssertEqual(inst.group?.group?[2].question?[0].answer?[0].valueString, "No") + XCTAssertEqual(inst.group?.group?[2].question?[0].linkId, "3.1") + XCTAssertEqual(inst.group?.group?[2].question?[0].text, "Do you smoke?") + XCTAssertEqual(inst.group?.group?[2].question?[1].answer?[0].valueString, "No, but I used to drink") + XCTAssertEqual(inst.group?.group?[2].question?[1].linkId, "3.2") + XCTAssertEqual(inst.group?.group?[2].question?[1].text, "Do you drink alchohol?") + XCTAssertEqual(inst.group?.group?[2].title, "Intoxications") + XCTAssertEqual(inst.group?.linkId, "root") XCTAssertEqual(inst.id, "f201") - XCTAssertEqual(inst.item?[0].item?[0].answer?[0].valueString, "I am allergic to house dust") - XCTAssertEqual(inst.item?[0].item?[0].linkId, "1.1") - XCTAssertEqual(inst.item?[0].item?[0].text, "Do you have allergies?") - XCTAssertEqual(inst.item?[0].linkId, "1") - XCTAssertEqual(inst.item?[1].item?[0].answer?[0].valueString, "Male") - XCTAssertEqual(inst.item?[1].item?[0].linkId, "2.1") - XCTAssertEqual(inst.item?[1].item?[0].text, "What is your gender?") - XCTAssertEqual(inst.item?[1].item?[1].answer?[0].valueDate?.description, "1960-03-13") - XCTAssertEqual(inst.item?[1].item?[1].linkId, "2.2") - XCTAssertEqual(inst.item?[1].item?[1].text, "What is your date of birth?") - XCTAssertEqual(inst.item?[1].item?[2].answer?[0].valueString, "The Netherlands") - XCTAssertEqual(inst.item?[1].item?[2].linkId, "2.3") - XCTAssertEqual(inst.item?[1].item?[2].text, "What is your country of birth?") - XCTAssertEqual(inst.item?[1].item?[3].answer?[0].valueString, "married") - XCTAssertEqual(inst.item?[1].item?[3].linkId, "2.4") - XCTAssertEqual(inst.item?[1].item?[3].text, "What is your marital status?") - XCTAssertEqual(inst.item?[1].linkId, "2") - XCTAssertEqual(inst.item?[1].text, "General questions") - XCTAssertEqual(inst.item?[2].item?[0].answer?[0].valueString, "No") - XCTAssertEqual(inst.item?[2].item?[0].linkId, "3.1") - XCTAssertEqual(inst.item?[2].item?[0].text, "Do you smoke?") - XCTAssertEqual(inst.item?[2].item?[1].answer?[0].valueString, "No, but I used to drink") - XCTAssertEqual(inst.item?[2].item?[1].linkId, "3.2") - XCTAssertEqual(inst.item?[2].item?[1].text, "Do you drink alchohol?") - XCTAssertEqual(inst.item?[2].linkId, "3") - XCTAssertEqual(inst.item?[2].text, "Intoxications") XCTAssertEqual(inst.source?.reference, "Practitioner/f201") XCTAssertEqual(inst.status, "completed") XCTAssertEqual(inst.subject?.display, "Roel") @@ -148,25 +153,27 @@ class QuestionnaireResponseTests: XCTestCase { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "questionnaireresponse-example-gcs.json") XCTAssertEqual(inst.authored?.description, "2014-12-11T04:44:16Z") + XCTAssertEqual(inst.group?.linkId, "1") + XCTAssertEqual(inst.group?.question?[0].answer?[0].valueCoding?.code, "LA6560-2") + XCTAssertEqual(inst.group?.question?[0].answer?[0].valueCoding?.display, "Confused") + XCTAssertEqual(inst.group?.question?[0].answer?[0].valueCoding?.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") + XCTAssertEqual(inst.group?.question?[0].answer?[0].valueCoding?.extension_fhir?[0].valueDecimal, NSDecimalNumber(string: "4")) + XCTAssertEqual(inst.group?.question?[0].answer?[0].valueCoding?.system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.group?.question?[0].linkId, "1.1") + XCTAssertEqual(inst.group?.question?[1].answer?[0].valueCoding?.code, "LA6566-9") + XCTAssertEqual(inst.group?.question?[1].answer?[0].valueCoding?.display, "Localizing pain") + XCTAssertEqual(inst.group?.question?[1].answer?[0].valueCoding?.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") + XCTAssertEqual(inst.group?.question?[1].answer?[0].valueCoding?.extension_fhir?[0].valueDecimal, NSDecimalNumber(string: "5")) + XCTAssertEqual(inst.group?.question?[1].answer?[0].valueCoding?.system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.group?.question?[1].linkId, "1.2") + XCTAssertEqual(inst.group?.question?[2].answer?[0].valueCoding?.code, "LA6556-0") + XCTAssertEqual(inst.group?.question?[2].answer?[0].valueCoding?.display, "Eyes open spontaneously") + XCTAssertEqual(inst.group?.question?[2].answer?[0].valueCoding?.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") + XCTAssertEqual(inst.group?.question?[2].answer?[0].valueCoding?.extension_fhir?[0].valueDecimal, NSDecimalNumber(string: "4")) + XCTAssertEqual(inst.group?.question?[2].answer?[0].valueCoding?.system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.group?.question?[2].linkId, "1.3") + XCTAssertEqual(inst.group?.title, "Glasgow Coma Score") XCTAssertEqual(inst.id, "gcs") - XCTAssertEqual(inst.item?[0].answer?[0].valueCoding?.code, "LA6560-2") - XCTAssertEqual(inst.item?[0].answer?[0].valueCoding?.display, "Confused") - XCTAssertEqual(inst.item?[0].answer?[0].valueCoding?.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - XCTAssertEqual(inst.item?[0].answer?[0].valueCoding?.extension_fhir?[0].valueDecimal, NSDecimalNumber(string: "4")) - XCTAssertEqual(inst.item?[0].answer?[0].valueCoding?.system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.item?[0].linkId, "1.1") - XCTAssertEqual(inst.item?[1].answer?[0].valueCoding?.code, "LA6566-9") - XCTAssertEqual(inst.item?[1].answer?[0].valueCoding?.display, "Localizing pain") - XCTAssertEqual(inst.item?[1].answer?[0].valueCoding?.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - XCTAssertEqual(inst.item?[1].answer?[0].valueCoding?.extension_fhir?[0].valueDecimal, NSDecimalNumber(string: "5")) - XCTAssertEqual(inst.item?[1].answer?[0].valueCoding?.system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.item?[1].linkId, "1.2") - XCTAssertEqual(inst.item?[2].answer?[0].valueCoding?.code, "LA6556-0") - XCTAssertEqual(inst.item?[2].answer?[0].valueCoding?.display, "Eyes open spontaneously") - XCTAssertEqual(inst.item?[2].answer?[0].valueCoding?.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/iso21090-CO-value") - XCTAssertEqual(inst.item?[2].answer?[0].valueCoding?.extension_fhir?[0].valueDecimal, NSDecimalNumber(string: "4")) - XCTAssertEqual(inst.item?[2].answer?[0].valueCoding?.system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.item?[2].linkId, "1.3") XCTAssertEqual(inst.questionnaire?.reference, "Questionnaire/gcs") XCTAssertEqual(inst.source?.reference, "Practitioner/f007") XCTAssertEqual(inst.status, "completed") @@ -196,16 +203,17 @@ class QuestionnaireResponseTests: XCTestCase { XCTAssertEqual(inst.contained?[0].id, "patsub") XCTAssertEqual(inst.contained?[1].id, "questauth") XCTAssertEqual(inst.contained?[2].id, "obs.pt-category") + XCTAssertEqual(inst.group?.group?[0].question?[0].answer?[0].group?[0].question?[0].answer?[0].valueCoding?.code, "1") + XCTAssertEqual(inst.group?.group?[0].question?[0].answer?[0].group?[0].question?[0].answer?[0].valueCoding?.system?.absoluteString, "http://cancer.questionnaire.org/system/code/yesno") + XCTAssertEqual(inst.group?.group?[0].question?[0].answer?[0].group?[0].question?[1].answer?[0].valueCoding?.code, "1") + XCTAssertEqual(inst.group?.group?[0].question?[0].answer?[0].group?[0].question?[1].answer?[0].valueCoding?.system?.absoluteString, "http://cancer.questionnaire.org/system/code/yesno") + XCTAssertEqual(inst.group?.group?[0].question?[0].answer?[0].group?[0].question?[2].answer?[0].valueCoding?.code, "0") + XCTAssertEqual(inst.group?.group?[0].question?[0].answer?[0].group?[0].question?[2].answer?[0].valueCoding?.system?.absoluteString, "http://cancer.questionnaire.org/system/code/yesno") + XCTAssertEqual(inst.group?.group?[0].question?[0].answer?[0].valueCoding?.code, "1") + XCTAssertEqual(inst.group?.group?[0].question?[0].answer?[0].valueCoding?.display, "Yes") + XCTAssertEqual(inst.group?.group?[0].question?[0].answer?[0].valueCoding?.system?.absoluteString, "http://cancer.questionnaire.org/system/code/yesno") + XCTAssertEqual(inst.group?.title, "Cancer Quality Forum Questionnaire 2012") XCTAssertEqual(inst.id, "3141") - XCTAssertEqual(inst.item?[0].item?[0].answer?[0].item?[0].item?[0].answer?[0].valueCoding?.code, "1") - XCTAssertEqual(inst.item?[0].item?[0].answer?[0].item?[0].item?[0].answer?[0].valueCoding?.system?.absoluteString, "http://cancer.questionnaire.org/system/code/yesno") - XCTAssertEqual(inst.item?[0].item?[0].answer?[0].item?[0].item?[1].answer?[0].valueCoding?.code, "1") - XCTAssertEqual(inst.item?[0].item?[0].answer?[0].item?[0].item?[1].answer?[0].valueCoding?.system?.absoluteString, "http://cancer.questionnaire.org/system/code/yesno") - XCTAssertEqual(inst.item?[0].item?[0].answer?[0].item?[0].item?[2].answer?[0].valueCoding?.code, "0") - XCTAssertEqual(inst.item?[0].item?[0].answer?[0].item?[0].item?[2].answer?[0].valueCoding?.system?.absoluteString, "http://cancer.questionnaire.org/system/code/yesno") - XCTAssertEqual(inst.item?[0].item?[0].answer?[0].valueCoding?.code, "1") - XCTAssertEqual(inst.item?[0].item?[0].answer?[0].valueCoding?.display, "Yes") - XCTAssertEqual(inst.item?[0].item?[0].answer?[0].valueCoding?.system?.absoluteString, "http://cancer.questionnaire.org/system/code/yesno") XCTAssertEqual(inst.status, "completed") XCTAssertEqual(inst.subject?.reference, "#patsub") XCTAssertEqual(inst.text?.status, "generated") diff --git a/Tests/ModelTests/QuestionnaireTests.swift b/Tests/ModelTests/QuestionnaireTests.swift index 249a42b5..f6663806 100644 --- a/Tests/ModelTests/QuestionnaireTests.swift +++ b/Tests/ModelTests/QuestionnaireTests.swift @@ -2,7 +2,7 @@ // QuestionnaireTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -37,56 +37,41 @@ class QuestionnaireTests: XCTestCase { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "questionnaire-example-bluebook.json") XCTAssertEqual(inst.date?.description, "2013-02-19") + XCTAssertEqual(inst.group?.group?[0].group?[0].question?[0].linkId, "nameOfChild") + XCTAssertEqual(inst.group?.group?[0].group?[0].question?[0].text, "Name of child") + XCTAssertEqual(inst.group?.group?[0].group?[0].question?[1].linkId, "sex") + XCTAssertEqual(inst.group?.group?[0].group?[0].question?[1].text, "Sex") + XCTAssertEqual(inst.group?.group?[0].group?[1].linkId, "neonatalInformation") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[0].linkId, "birthWeight") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[0].text, "Birth weight (kg)") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[1].linkId, "birthLength") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[1].text, "Birth length (cm)") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].group?[0].extension_fhir?[0].url?.absoluteString, "http://example.org/Profile/questionnaire#visibilityCondition") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].group?[0].extension_fhir?[0].valueString, "HAS_VALUE(../choice/code) AND NEQ(../choice/code,'NO')") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].group?[0].linkId, "vitaminKgivenDoses") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].group?[0].question?[0].linkId, "vitaminiKDose1") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].group?[0].question?[0].text, "1st dose") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].group?[0].question?[1].linkId, "vitaminiKDose2") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].group?[0].question?[1].text, "2nd dose") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].linkId, "vitaminKgiven") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[2].text, "Vitamin K given") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[3].group?[0].question?[0].linkId, "hepBgivenDate") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[3].group?[0].question?[0].text, "Date given") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[3].linkId, "hepBgiven") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[3].text, "Hep B given y / n") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[4].linkId, "abnormalitiesAtBirth") + XCTAssertEqual(inst.group?.group?[0].group?[1].question?[4].text, "Abnormalities noted at birth") + XCTAssertEqual(inst.group?.group?[0].group?[1].title, "Neonatal Information") + XCTAssertEqual(inst.group?.group?[0].linkId, "birthDetails") + XCTAssertEqual(inst.group?.group?[0].title, "Birth details - To be completed by health professional") + XCTAssertEqual(inst.group?.linkId, "PHR") + XCTAssertTrue(inst.group?.required ?? false) + XCTAssertEqual(inst.group?.title, "NSW Government My Personal Health Record") XCTAssertEqual(inst.id, "bb") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].linkId, "nameOfChild") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].text, "Name of child") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].type, "string") - XCTAssertEqual(inst.item?[0].item?[0].item?[1].linkId, "sex") - XCTAssertEqual(inst.item?[0].item?[0].item?[1].option?[0].valueCoding?.code, "F") - XCTAssertEqual(inst.item?[0].item?[0].item?[1].option?[1].valueCoding?.code, "M") - XCTAssertEqual(inst.item?[0].item?[0].item?[1].text, "Sex") - XCTAssertEqual(inst.item?[0].item?[0].item?[1].type, "choice") - XCTAssertEqual(inst.item?[0].item?[0].type, "group") - XCTAssertEqual(inst.item?[0].item?[1].item?[0].linkId, "birthWeight") - XCTAssertEqual(inst.item?[0].item?[1].item?[0].text, "Birth weight (kg)") - XCTAssertEqual(inst.item?[0].item?[1].item?[0].type, "decimal") - XCTAssertEqual(inst.item?[0].item?[1].item?[1].linkId, "birthLength") - XCTAssertEqual(inst.item?[0].item?[1].item?[1].text, "Birth length (cm)") - XCTAssertEqual(inst.item?[0].item?[1].item?[1].type, "decimal") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].item?[0].item?[0].linkId, "vitaminiKDose1") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].item?[0].item?[0].text, "1st dose") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].item?[0].item?[0].type, "dateTime") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].item?[0].item?[1].linkId, "vitaminiKDose2") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].item?[0].item?[1].text, "2nd dose") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].item?[0].item?[1].type, "dateTime") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].item?[0].linkId, "vitaminKgivenDoses") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].item?[0].type, "group") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].linkId, "vitaminKgiven") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].option?[0].valueCoding?.code, "INJECTION") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].option?[1].valueCoding?.code, "INTRAVENOUS") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].option?[2].valueCoding?.code, "ORAL") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].text, "Vitamin K given") - XCTAssertEqual(inst.item?[0].item?[1].item?[2].type, "choice") - XCTAssertEqual(inst.item?[0].item?[1].item?[3].item?[0].linkId, "hepBgivenDate") - XCTAssertEqual(inst.item?[0].item?[1].item?[3].item?[0].text, "Date given") - XCTAssertEqual(inst.item?[0].item?[1].item?[3].item?[0].type, "date") - XCTAssertEqual(inst.item?[0].item?[1].item?[3].linkId, "hepBgiven") - XCTAssertEqual(inst.item?[0].item?[1].item?[3].text, "Hep B given y / n") - XCTAssertEqual(inst.item?[0].item?[1].item?[3].type, "boolean") - XCTAssertEqual(inst.item?[0].item?[1].item?[4].linkId, "abnormalitiesAtBirth") - XCTAssertEqual(inst.item?[0].item?[1].item?[4].text, "Abnormalities noted at birth") - XCTAssertEqual(inst.item?[0].item?[1].item?[4].type, "string") - XCTAssertEqual(inst.item?[0].item?[1].linkId, "neonatalInformation") - XCTAssertEqual(inst.item?[0].item?[1].text, "Neonatal Information") - XCTAssertEqual(inst.item?[0].item?[1].type, "group") - XCTAssertEqual(inst.item?[0].linkId, "birthDetails") - XCTAssertEqual(inst.item?[0].text, "Birth details - To be completed by health professional") - XCTAssertEqual(inst.item?[0].type, "group") XCTAssertEqual(inst.publisher, "New South Wales Department of Health") XCTAssertEqual(inst.status, "draft") XCTAssertEqual(inst.subjectType?[0], "Patient") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.title, "NSW Government My Personal Health Record") return inst } @@ -105,38 +90,32 @@ class QuestionnaireTests: XCTestCase { func runQuestionnaire2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Questionnaire { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "questionnaire-example-f201-lifelines.json") - XCTAssertEqual(inst.concept?[0].code, "VL 1-1, 18-65_1.2.2") - XCTAssertEqual(inst.concept?[0].display, "Lifelines Questionnaire 1 part 1") - XCTAssertEqual(inst.concept?[0].system?.absoluteString, "http://example.org/system/code/lifelines/nl") XCTAssertEqual(inst.date?.description, "2010") + XCTAssertEqual(inst.group?.concept?[0].code, "VL 1-1, 18-65_1.2.2") + XCTAssertEqual(inst.group?.concept?[0].display, "Lifelines Questionnaire 1 part 1") + XCTAssertEqual(inst.group?.concept?[0].system?.absoluteString, "http://example.org/system/code/lifelines/nl") + XCTAssertEqual(inst.group?.group?[0].linkId, "1") + XCTAssertEqual(inst.group?.group?[0].question?[0].linkId, "1.1") + XCTAssertEqual(inst.group?.group?[0].question?[0].text, "Do you have allergies?") + XCTAssertEqual(inst.group?.group?[1].linkId, "2") + XCTAssertEqual(inst.group?.group?[1].question?[0].linkId, "2.1") + XCTAssertEqual(inst.group?.group?[1].question?[0].text, "What is your gender?") + XCTAssertEqual(inst.group?.group?[1].question?[1].linkId, "2.2") + XCTAssertEqual(inst.group?.group?[1].question?[1].text, "What is your date of birth?") + XCTAssertEqual(inst.group?.group?[1].question?[2].linkId, "2.3") + XCTAssertEqual(inst.group?.group?[1].question?[2].text, "What is your country of birth?") + XCTAssertEqual(inst.group?.group?[1].question?[3].linkId, "2.4") + XCTAssertEqual(inst.group?.group?[1].question?[3].text, "What is your marital status?") + XCTAssertEqual(inst.group?.group?[1].text, "General questions") + XCTAssertEqual(inst.group?.group?[2].linkId, "3") + XCTAssertEqual(inst.group?.group?[2].question?[0].linkId, "3.1") + XCTAssertEqual(inst.group?.group?[2].question?[0].text, "Do you smoke?") + XCTAssertEqual(inst.group?.group?[2].question?[1].linkId, "3.2") + XCTAssertEqual(inst.group?.group?[2].question?[1].text, "Do you drink alchohol?") + XCTAssertEqual(inst.group?.group?[2].title, "Intoxications") + XCTAssertEqual(inst.group?.linkId, "root") + XCTAssertTrue(inst.group?.required ?? false) XCTAssertEqual(inst.id, "f201") - XCTAssertEqual(inst.item?[0].linkId, "1") - XCTAssertEqual(inst.item?[0].text, "Do you have allergies?") - XCTAssertEqual(inst.item?[0].type, "boolean") - XCTAssertEqual(inst.item?[1].item?[0].linkId, "2.1") - XCTAssertEqual(inst.item?[1].item?[0].text, "What is your gender?") - XCTAssertEqual(inst.item?[1].item?[0].type, "string") - XCTAssertEqual(inst.item?[1].item?[1].linkId, "2.2") - XCTAssertEqual(inst.item?[1].item?[1].text, "What is your date of birth?") - XCTAssertEqual(inst.item?[1].item?[1].type, "date") - XCTAssertEqual(inst.item?[1].item?[2].linkId, "2.3") - XCTAssertEqual(inst.item?[1].item?[2].text, "What is your country of birth?") - XCTAssertEqual(inst.item?[1].item?[2].type, "string") - XCTAssertEqual(inst.item?[1].item?[3].linkId, "2.4") - XCTAssertEqual(inst.item?[1].item?[3].text, "What is your marital status?") - XCTAssertEqual(inst.item?[1].item?[3].type, "string") - XCTAssertEqual(inst.item?[1].linkId, "2") - XCTAssertEqual(inst.item?[1].text, "General questions") - XCTAssertEqual(inst.item?[1].type, "group") - XCTAssertEqual(inst.item?[2].item?[0].linkId, "3.1") - XCTAssertEqual(inst.item?[2].item?[0].text, "Do you smoke?") - XCTAssertEqual(inst.item?[2].item?[0].type, "boolean") - XCTAssertEqual(inst.item?[2].item?[1].linkId, "3.2") - XCTAssertEqual(inst.item?[2].item?[1].text, "Do you drink alchohol?") - XCTAssertEqual(inst.item?[2].item?[1].type, "boolean") - XCTAssertEqual(inst.item?[2].linkId, "3") - XCTAssertEqual(inst.item?[2].text, "Intoxications") - XCTAssertEqual(inst.item?[2].type, "group") XCTAssertEqual(inst.status, "published") XCTAssertEqual(inst.subjectType?[0], "Patient") XCTAssertEqual(inst.text?.status, "generated") @@ -158,33 +137,35 @@ class QuestionnaireTests: XCTestCase { func runQuestionnaire3(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Questionnaire { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "questionnaire-example-gcs.json") - XCTAssertEqual(inst.concept?[0].code, "9269-2") - XCTAssertEqual(inst.concept?[0].system?.absoluteString, "http://loinc.org") XCTAssertEqual(inst.contained?[0].id, "motor") XCTAssertEqual(inst.contained?[1].id, "verbal") XCTAssertEqual(inst.contained?[2].id, "eye") XCTAssertEqual(inst.date?.description, "2015-08-03") + XCTAssertEqual(inst.group?.concept?[0].code, "9269-2") + XCTAssertEqual(inst.group?.concept?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.group?.linkId, "1") + XCTAssertEqual(inst.group?.question?[0].concept?[0].code, "9270-0") + XCTAssertEqual(inst.group?.question?[0].concept?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.group?.question?[0].linkId, "1.1") + XCTAssertEqual(inst.group?.question?[0].options?.reference, "#verbal") + XCTAssertEqual(inst.group?.question?[0].type, "choice") + XCTAssertEqual(inst.group?.question?[1].concept?[0].code, "9268-4") + XCTAssertEqual(inst.group?.question?[1].concept?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.group?.question?[1].linkId, "1.2") + XCTAssertEqual(inst.group?.question?[1].options?.reference, "#motor") + XCTAssertEqual(inst.group?.question?[1].type, "choice") + XCTAssertEqual(inst.group?.question?[2].concept?[0].code, "9267-6") + XCTAssertEqual(inst.group?.question?[2].concept?[0].system?.absoluteString, "http://loinc.org") + XCTAssertEqual(inst.group?.question?[2].linkId, "1.3") + XCTAssertEqual(inst.group?.question?[2].options?.reference, "#eye") + XCTAssertEqual(inst.group?.question?[2].type, "choice") + XCTAssertTrue(inst.group?.required ?? false) + XCTAssertEqual(inst.group?.title, "Glasgow Coma Score") XCTAssertEqual(inst.id, "gcs") - XCTAssertEqual(inst.item?[0].concept?[0].code, "9270-0") - XCTAssertEqual(inst.item?[0].concept?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.item?[0].linkId, "1.1") - XCTAssertEqual(inst.item?[0].options?.reference, "#verbal") - XCTAssertEqual(inst.item?[0].type, "choice") - XCTAssertEqual(inst.item?[1].concept?[0].code, "9268-4") - XCTAssertEqual(inst.item?[1].concept?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.item?[1].linkId, "1.2") - XCTAssertEqual(inst.item?[1].options?.reference, "#motor") - XCTAssertEqual(inst.item?[1].type, "choice") - XCTAssertEqual(inst.item?[2].concept?[0].code, "9267-6") - XCTAssertEqual(inst.item?[2].concept?[0].system?.absoluteString, "http://loinc.org") - XCTAssertEqual(inst.item?[2].linkId, "1.3") - XCTAssertEqual(inst.item?[2].options?.reference, "#eye") - XCTAssertEqual(inst.item?[2].type, "choice") XCTAssertEqual(inst.publisher, "FHIR Project team") XCTAssertEqual(inst.status, "draft") XCTAssertEqual(inst.subjectType?[0], "Patient") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.title, "Glasgow Coma Score") return inst } @@ -203,58 +184,59 @@ class QuestionnaireTests: XCTestCase { func runQuestionnaire4(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Questionnaire { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "questionnaire-example.json") + XCTAssertEqual(inst.contained?[0].id, "yesno") XCTAssertEqual(inst.date?.description, "2012-01") + XCTAssertEqual(inst.group?.group?[0].concept?[0].code, "COMORBIDITY") + XCTAssertEqual(inst.group?.group?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/sections") + XCTAssertEqual(inst.group?.group?[0].linkId, "1.1") + XCTAssertEqual(inst.group?.group?[0].question?[0].concept?[0].code, "COMORB") + XCTAssertEqual(inst.group?.group?[0].question?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/questions") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].concept?[0].code, "CARDIAL") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/sections") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].linkId, "1.1.1.1") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[0].concept?[0].code, "COMORBCAR") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/questions") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[0].linkId, "1.1.1.1.1") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[0].options?.reference, "#yesno") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[0].type, "choice") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[1].concept?[0].code, "COMCAR00") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[1].concept?[0].display, "Angina Pectoris") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[1].concept?[0].system?.absoluteString, "http://example.org/system/code/questions") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[1].concept?[1].code, "194828000") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[1].concept?[1].display, "Angina (disorder)") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[1].concept?[1].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[1].linkId, "1.1.1.1.2") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[1].options?.reference, "#yesno") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[1].type, "choice") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[2].concept?[0].code, "22298006") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[2].concept?[0].display, "Myocardial infarction (disorder)") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[2].concept?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[2].linkId, "1.1.1.1.3") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[2].options?.reference, "#yesno") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[0].question?[2].type, "choice") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[1].concept?[0].code, "VASCULAR") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[1].concept?[0].system?.absoluteString, "http://example.org/system/code/sections") + XCTAssertEqual(inst.group?.group?[0].question?[0].group?[1].linkId, "1.1.1.2") + XCTAssertEqual(inst.group?.group?[0].question?[0].linkId, "1.1.1") + XCTAssertEqual(inst.group?.group?[0].question?[0].options?.reference, "#yesno") + XCTAssertEqual(inst.group?.group?[0].question?[0].type, "choice") + XCTAssertEqual(inst.group?.group?[1].concept?[0].code, "HISTOPATHOLOGY") + XCTAssertEqual(inst.group?.group?[1].concept?[0].system?.absoluteString, "http://example.org/system/code/sections") + XCTAssertEqual(inst.group?.group?[1].group?[0].concept?[0].code, "ABDOMINAL") + XCTAssertEqual(inst.group?.group?[1].group?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/sections") + XCTAssertEqual(inst.group?.group?[1].group?[0].linkId, "1.2.1") + XCTAssertEqual(inst.group?.group?[1].group?[0].question?[0].concept?[0].code, "STADPT") + XCTAssertEqual(inst.group?.group?[1].group?[0].question?[0].concept?[0].display, "pT category") + XCTAssertEqual(inst.group?.group?[1].group?[0].question?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/questions") + XCTAssertEqual(inst.group?.group?[1].group?[0].question?[0].linkId, "1.2.1.2") + XCTAssertEqual(inst.group?.group?[1].linkId, "1.2") + XCTAssertEqual(inst.group?.linkId, "1") + XCTAssertTrue(inst.group?.required ?? false) + XCTAssertEqual(inst.group?.title, "Cancer Quality Forum Questionnaire 2012") XCTAssertEqual(inst.id, "3141") - XCTAssertEqual(inst.item?[0].concept?[0].code, "COMORBIDITY") - XCTAssertEqual(inst.item?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/sections") - XCTAssertEqual(inst.item?[0].item?[0].concept?[0].code, "COMORB") - XCTAssertEqual(inst.item?[0].item?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/questions") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].concept?[0].code, "CARDIAL") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/sections") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[0].concept?[0].code, "COMORBCAR") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/questions") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[0].linkId, "1.1.1.1") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[0].options?.reference, "http://hl7.org/fhir/ValueSet/yesnodontknow") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[0].type, "choice") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[1].concept?[0].code, "COMCAR00") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[1].concept?[0].display, "Angina Pectoris") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[1].concept?[0].system?.absoluteString, "http://example.org/system/code/questions") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[1].concept?[1].code, "194828000") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[1].concept?[1].display, "Angina (disorder)") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[1].concept?[1].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[1].linkId, "1.1.1.2") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[1].options?.reference, "http://hl7.org/fhir/ValueSet/yesnodontknow") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[1].type, "choice") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[2].concept?[0].code, "22298006") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[2].concept?[0].display, "Myocardial infarction (disorder)") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[2].concept?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[2].linkId, "1.1.1.3") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[2].options?.reference, "http://hl7.org/fhir/ValueSet/yesnodontknow") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].item?[2].type, "choice") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].linkId, "1.1.1") - XCTAssertEqual(inst.item?[0].item?[0].item?[0].type, "group") - XCTAssertEqual(inst.item?[0].item?[0].linkId, "1.1") - XCTAssertEqual(inst.item?[0].item?[0].options?.reference, "http://hl7.org/fhir/ValueSet/yesnodontknow") - XCTAssertEqual(inst.item?[0].item?[0].type, "choice") - XCTAssertEqual(inst.item?[0].linkId, "1") - XCTAssertEqual(inst.item?[0].type, "group") - XCTAssertEqual(inst.item?[1].concept?[0].code, "HISTOPATHOLOGY") - XCTAssertEqual(inst.item?[1].concept?[0].system?.absoluteString, "http://example.org/system/code/sections") - XCTAssertEqual(inst.item?[1].item?[0].concept?[0].code, "ABDOMINAL") - XCTAssertEqual(inst.item?[1].item?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/sections") - XCTAssertEqual(inst.item?[1].item?[0].item?[0].concept?[0].code, "STADPT") - XCTAssertEqual(inst.item?[1].item?[0].item?[0].concept?[0].display, "pT category") - XCTAssertEqual(inst.item?[1].item?[0].item?[0].concept?[0].system?.absoluteString, "http://example.org/system/code/questions") - XCTAssertEqual(inst.item?[1].item?[0].item?[0].linkId, "2.1.2") - XCTAssertEqual(inst.item?[1].item?[0].item?[0].type, "choice") - XCTAssertEqual(inst.item?[1].item?[0].linkId, "2.1") - XCTAssertEqual(inst.item?[1].item?[0].type, "group") - XCTAssertEqual(inst.item?[1].linkId, "2") - XCTAssertEqual(inst.item?[1].type, "group") XCTAssertEqual(inst.status, "draft") XCTAssertEqual(inst.subjectType?[0], "Patient") XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.title, "Cancer Quality Forum Questionnaire 2012") return inst } diff --git a/Tests/ModelTests/ReferralRequestTests.swift b/Tests/ModelTests/ReferralRequestTests.swift index ca15dd36..16d6b6d7 100644 --- a/Tests/ModelTests/ReferralRequestTests.swift +++ b/Tests/ModelTests/ReferralRequestTests.swift @@ -2,7 +2,7 @@ // ReferralRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -36,8 +36,7 @@ class ReferralRequestTests: XCTestCase { func runReferralRequest1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ReferralRequest { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "referralrequest-example.json") - XCTAssertEqual(inst.authored?.description, "2014-02-14") - XCTAssertEqual(inst.category, "request") + XCTAssertEqual(inst.dateSent?.description, "2014-02-14") XCTAssertEqual(inst.description_fhir, "In the past 2 years Beverly has had 6 instances of r) sided Otitis media. She is falling behind her peers at school, and displaying some learning difficulties.") XCTAssertEqual(inst.id, "example") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://orionhealth.com/fhir/apps/referralids") @@ -59,7 +58,7 @@ class ReferralRequestTests: XCTestCase { XCTAssertEqual(inst.specialty?.coding?[0].code, "ent") XCTAssertEqual(inst.specialty?.coding?[0].display, "ENT") XCTAssertEqual(inst.specialty?.coding?[0].system?.absoluteString, "http://orionhealth.com/fhir/apps/specialties") - XCTAssertEqual(inst.status, "active") + XCTAssertEqual(inst.status, "requested") XCTAssertEqual(inst.text?.div, "
Referral to Dr Dave for Beverly weaver to have grommets inserted in her r) ear
") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.type?.coding?[0].code, "rfs") diff --git a/Tests/ModelTests/RelatedPersonTests.swift b/Tests/ModelTests/RelatedPersonTests.swift index ab23511c..f1c7b88d 100644 --- a/Tests/ModelTests/RelatedPersonTests.swift +++ b/Tests/ModelTests/RelatedPersonTests.swift @@ -2,7 +2,7 @@ // RelatedPersonTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/RiskAssessmentTests.swift b/Tests/ModelTests/RiskAssessmentTests.swift index 76209a6b..9eb64cc8 100644 --- a/Tests/ModelTests/RiskAssessmentTests.swift +++ b/Tests/ModelTests/RiskAssessmentTests.swift @@ -2,7 +2,7 @@ // RiskAssessmentTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ScheduleTests.swift b/Tests/ModelTests/ScheduleTests.swift index 1213fdab..1f82bef6 100644 --- a/Tests/ModelTests/ScheduleTests.swift +++ b/Tests/ModelTests/ScheduleTests.swift @@ -2,7 +2,7 @@ // ScheduleTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -38,20 +38,16 @@ class ScheduleTests: XCTestCase { XCTAssertEqual(inst.actor?.display, "Burgers UMC, South Wing, second floor") XCTAssertEqual(inst.actor?.reference, "Location/1") - XCTAssertEqual(inst.comment, "The slots attached to this schedule should be specialized to cover immunizations within the clinic") + XCTAssertEqual(inst.comment, "Assessments should be performed before requesting appointments in this slot.") XCTAssertEqual(inst.id, "example") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://example.org/scheduleid") XCTAssertEqual(inst.identifier?[0].use, "usual") XCTAssertEqual(inst.identifier?[0].value, "45") XCTAssertEqual(inst.planningHorizon?.end?.description, "2013-12-25T09:30:00Z") XCTAssertEqual(inst.planningHorizon?.start?.description, "2013-12-25T09:15:00Z") - XCTAssertEqual(inst.serviceCategory?.coding?[0].code, "17") - XCTAssertEqual(inst.serviceCategory?.coding?[0].display, "General Practice") - XCTAssertEqual(inst.serviceType?[0].coding?[0].code, "57") - XCTAssertEqual(inst.serviceType?[0].coding?[0].display, "Immunisation") - XCTAssertEqual(inst.specialty?[0].coding?[0].code, "408480009") - XCTAssertEqual(inst.specialty?[0].coding?[0].display, "Clinical immunology") XCTAssertEqual(inst.text?.status, "generated") + XCTAssertEqual(inst.type?[0].coding?[0].code, "45") + XCTAssertEqual(inst.type?[0].coding?[0].display, "Physiotherapy") return inst } diff --git a/Tests/ModelTests/SearchParameterTests.swift b/Tests/ModelTests/SearchParameterTests.swift index 5b788a6d..23dd435c 100644 --- a/Tests/ModelTests/SearchParameterTests.swift +++ b/Tests/ModelTests/SearchParameterTests.swift @@ -2,7 +2,7 @@ // SearchParameterTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/SequenceTests.swift b/Tests/ModelTests/SequenceTests.swift deleted file mode 100644 index 7ae2c04b..00000000 --- a/Tests/ModelTests/SequenceTests.swift +++ /dev/null @@ -1,60 +0,0 @@ -// -// SequenceTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class SequenceTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.Sequence { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.Sequence { - let instance = SwiftFHIR.Sequence(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testSequence1() { - do { - let instance = try runSequence1() - try runSequence1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test Sequence successfully, but threw") - } - } - - @discardableResult - func runSequence1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Sequence { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "sequence-example.json") - - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.patient?.reference, "Patient/example") - XCTAssertEqual(inst.referenceSeq?[0].referenceSeqId?.coding?[0].code, "NC_000007.14") - XCTAssertEqual(inst.referenceSeq?[0].referenceSeqId?.coding?[0].system?.absoluteString, "http://www.ncbi.nlm.nih.gov/nuccore") - XCTAssertEqual(inst.referenceSeq?[0].windowEnd, 55227980) - XCTAssertEqual(inst.referenceSeq?[0].windowStart, 55227970) - XCTAssertEqual(inst.repository?[0].name, "ga4gh") - XCTAssertEqual(inst.repository?[0].url?.absoluteString, "https://www.googleapis.com/genomics/v1beta2") - XCTAssertEqual(inst.repository?[0].variantId, "A1A2") - XCTAssertEqual(inst.species?.coding?[0].code, "337915000") - XCTAssertEqual(inst.species?.coding?[0].system?.absoluteString, "http://snomed.info/sct") - XCTAssertEqual(inst.species?.text, "Homo sapiens") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type, "DNA") - XCTAssertEqual(inst.variation?.end, 55227977) - XCTAssertEqual(inst.variation?.observedAllele, "T") - XCTAssertEqual(inst.variation?.referenceAllele, "A") - XCTAssertEqual(inst.variation?.start, 55227976) - - return inst - } -} diff --git a/Tests/ModelTests/SlotTests.swift b/Tests/ModelTests/SlotTests.swift index e5b11c67..f66a4a95 100644 --- a/Tests/ModelTests/SlotTests.swift +++ b/Tests/ModelTests/SlotTests.swift @@ -2,7 +2,7 @@ // SlotTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -38,16 +38,16 @@ class SlotTests: XCTestCase { XCTAssertEqual(inst.comment, "Assessments should be performed before requesting appointments in this slot.") XCTAssertEqual(inst.end?.description, "2013-12-25T09:15:00Z") + XCTAssertEqual(inst.freeBusyType, "busy") XCTAssertEqual(inst.id, "1") XCTAssertEqual(inst.identifier?[0].system?.absoluteString, "http://example.org/identifiers/slots") XCTAssertEqual(inst.identifier?[0].value, "123132") XCTAssertTrue(inst.overbooked ?? false) XCTAssertEqual(inst.schedule?.reference, "Schedule/example") - XCTAssertEqual(inst.serviceCategory?.coding?[0].code, "17") - XCTAssertEqual(inst.serviceCategory?.coding?[0].display, "General Practice") XCTAssertEqual(inst.start?.description, "2013-12-25T09:00:00Z") - XCTAssertEqual(inst.status, "busy") XCTAssertEqual(inst.text?.status, "generated") + XCTAssertEqual(inst.type?.coding?[0].code, "45") + XCTAssertEqual(inst.type?.coding?[0].display, "Physiotherapy") return inst } @@ -68,13 +68,13 @@ class SlotTests: XCTestCase { XCTAssertEqual(inst.comment, "Dr Careful is out of the office") XCTAssertEqual(inst.end?.description, "2013-12-25T10:00:00Z") + XCTAssertEqual(inst.freeBusyType, "busy-tentative") XCTAssertEqual(inst.id, "2") XCTAssertEqual(inst.schedule?.reference, "Schedule/example") - XCTAssertEqual(inst.serviceCategory?.coding?[0].code, "17") - XCTAssertEqual(inst.serviceCategory?.coding?[0].display, "General Practice") XCTAssertEqual(inst.start?.description, "2013-12-25T09:45:00Z") - XCTAssertEqual(inst.status, "busy-tentative") XCTAssertEqual(inst.text?.status, "generated") + XCTAssertEqual(inst.type?.coding?[0].code, "45") + XCTAssertEqual(inst.type?.coding?[0].display, "Physiotherapy") return inst } @@ -95,13 +95,13 @@ class SlotTests: XCTestCase { XCTAssertEqual(inst.comment, "Dr Careful is out of the office") XCTAssertEqual(inst.end?.description, "2013-12-25T09:45:00Z") + XCTAssertEqual(inst.freeBusyType, "busy-unavailable") XCTAssertEqual(inst.id, "3") XCTAssertEqual(inst.schedule?.reference, "Schedule/example") - XCTAssertEqual(inst.serviceCategory?.coding?[0].code, "17") - XCTAssertEqual(inst.serviceCategory?.coding?[0].display, "General Practice") XCTAssertEqual(inst.start?.description, "2013-12-25T09:30:00Z") - XCTAssertEqual(inst.status, "busy-unavailable") XCTAssertEqual(inst.text?.status, "generated") + XCTAssertEqual(inst.type?.coding?[0].code, "45") + XCTAssertEqual(inst.type?.coding?[0].display, "Physiotherapy") return inst } @@ -120,22 +120,15 @@ class SlotTests: XCTestCase { func runSlot4(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Slot { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "slot-example.json") - XCTAssertEqual(inst.appointmentType?.coding?[0].code, "walkin") - XCTAssertEqual(inst.appointmentType?.coding?[0].display, "A previously unscheduled walk-in visit") - XCTAssertEqual(inst.appointmentType?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2-0276") XCTAssertEqual(inst.comment, "Assessments should be performed before requesting appointments in this slot.") XCTAssertEqual(inst.end?.description, "2013-12-25T09:30:00Z") + XCTAssertEqual(inst.freeBusyType, "free") XCTAssertEqual(inst.id, "example") XCTAssertEqual(inst.schedule?.reference, "Schedule/example") - XCTAssertEqual(inst.serviceCategory?.coding?[0].code, "17") - XCTAssertEqual(inst.serviceCategory?.coding?[0].display, "General Practice") - XCTAssertEqual(inst.serviceType?[0].coding?[0].code, "57") - XCTAssertEqual(inst.serviceType?[0].coding?[0].display, "Immunisation") - XCTAssertEqual(inst.specialty?[0].coding?[0].code, "408480009") - XCTAssertEqual(inst.specialty?[0].coding?[0].display, "Clinical immunology") XCTAssertEqual(inst.start?.description, "2013-12-25T09:15:00Z") - XCTAssertEqual(inst.status, "free") XCTAssertEqual(inst.text?.status, "generated") + XCTAssertEqual(inst.type?.coding?[0].code, "45") + XCTAssertEqual(inst.type?.coding?[0].display, "Physiotherapy") return inst } diff --git a/Tests/ModelTests/SpecimenTests.swift b/Tests/ModelTests/SpecimenTests.swift index e6fcfa92..bb1debcb 100644 --- a/Tests/ModelTests/SpecimenTests.swift +++ b/Tests/ModelTests/SpecimenTests.swift @@ -2,7 +2,7 @@ // SpecimenTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -112,7 +112,7 @@ class SpecimenTests: XCTestCase { XCTAssertEqual(inst.accessionIdentifier?.value, "X352356") XCTAssertEqual(inst.collection?.collectedDateTime?.description, "2011-05-30T06:15:00Z") XCTAssertEqual(inst.collection?.collector?.reference, "Practitioner/example") - XCTAssertEqual(inst.collection?.comment, "Specimen is grossly lipemic") + XCTAssertEqual(inst.collection?.comment?[0], "Specimen is grossly lipemic") XCTAssertEqual(inst.collection?.method?.coding?[0].code, "LNV") XCTAssertEqual(inst.collection?.method?.coding?[0].system?.absoluteString, "http://hl7.org/fhir/v2/0488") XCTAssertEqual(inst.collection?.quantity?.unit, "mL") diff --git a/Tests/ModelTests/StructureDefinitionTests.swift b/Tests/ModelTests/StructureDefinitionTests.swift index 4a7f616a..9b8b4969 100644 --- a/Tests/ModelTests/StructureDefinitionTests.swift +++ b/Tests/ModelTests/StructureDefinitionTests.swift @@ -2,7 +2,7 @@ // StructureDefinitionTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -34,217 +34,19 @@ class StructureDefinitionTests: XCTestCase { @discardableResult func runStructureDefinition1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.StructureDefinition { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "extension-structuredefinition-example.json") - - XCTAssertFalse(inst.abstract ?? true) - XCTAssertEqual(inst.baseDefinition?.absoluteString, "http://hl7.org/fhir/StructureDefinition/Extension") - XCTAssertEqual(inst.baseType, "Extension") - XCTAssertEqual(inst.contact?[0].telecom?[0].system, "other") - XCTAssertEqual(inst.contact?[0].telecom?[0].value, "http://hl7.org/special/committees/FHIR") - XCTAssertEqual(inst.context?[0], "ElementDefinition") - XCTAssertEqual(inst.contextType, "datatype") - XCTAssertEqual(inst.date?.description, "2014-01-31") - XCTAssertEqual(inst.derivation, "constraint") - XCTAssertEqual(inst.description_fhir, "An additional example value.") - XCTAssertEqual(inst.differential?.element?[0].definition, "An additional example value.") - XCTAssertEqual(inst.differential?.element?[0].max, "*") - XCTAssertEqual(inst.differential?.element?[0].min, 0) - XCTAssertEqual(inst.differential?.element?[0].path, "Extension") - XCTAssertEqual(inst.differential?.element?[0].short, "An additional example value") - XCTAssertEqual(inst.differential?.element?[0].type?[0].code, "Extension") - XCTAssertEqual(inst.differential?.element?[1].definition, "Key for this example.") - XCTAssertEqual(inst.differential?.element?[1].max, "1") - XCTAssertEqual(inst.differential?.element?[1].min, 1) - XCTAssertEqual(inst.differential?.element?[1].name, "index") - XCTAssertEqual(inst.differential?.element?[1].path, "Extension.extension") - XCTAssertEqual(inst.differential?.element?[1].short, "Key for this example") - XCTAssertEqual(inst.differential?.element?[1].type?[0].code, "Extension") - XCTAssertEqual(inst.differential?.element?[2].max, "0") - XCTAssertEqual(inst.differential?.element?[2].name, "extension") - XCTAssertEqual(inst.differential?.element?[2].path, "Extension.extension.extension") - XCTAssertEqual(inst.differential?.element?[3].fixedUri?.absoluteString, "index") - XCTAssertEqual(inst.differential?.element?[3].path, "Extension.extension.url") - XCTAssertEqual(inst.differential?.element?[3].type?[0].code, "uri") - XCTAssertEqual(inst.differential?.element?[4].min, 1) - XCTAssertEqual(inst.differential?.element?[4].path, "Extension.extension.value[x]") - XCTAssertEqual(inst.differential?.element?[4].type?[0].code, "string") - XCTAssertEqual(inst.differential?.element?[5].definition, "Value of the example.") - XCTAssertEqual(inst.differential?.element?[5].max, "1") - XCTAssertEqual(inst.differential?.element?[5].min, 0) - XCTAssertEqual(inst.differential?.element?[5].name, "exValue") - XCTAssertEqual(inst.differential?.element?[5].path, "Extension.extension") - XCTAssertEqual(inst.differential?.element?[5].short, "Value of the example") - XCTAssertEqual(inst.differential?.element?[5].type?[0].code, "Extension") - XCTAssertEqual(inst.differential?.element?[6].max, "0") - XCTAssertEqual(inst.differential?.element?[6].name, "extension") - XCTAssertEqual(inst.differential?.element?[6].path, "Extension.extension.extension") - XCTAssertEqual(inst.differential?.element?[7].fixedUri?.absoluteString, "exValue") - XCTAssertEqual(inst.differential?.element?[7].path, "Extension.extension.url") - XCTAssertEqual(inst.differential?.element?[7].type?[0].code, "uri") - XCTAssertEqual(inst.differential?.element?[8].min, 1) - XCTAssertEqual(inst.differential?.element?[8].path, "Extension.extension.value[x]") - XCTAssertEqual(inst.differential?.element?[8].type?[0].code, "boolean") - XCTAssertEqual(inst.differential?.element?[8].type?[1].code, "integer") - XCTAssertEqual(inst.differential?.element?[8].type?[2].code, "decimal") - XCTAssertEqual(inst.differential?.element?[8].type?[3].code, "base64Binary") - XCTAssertEqual(inst.differential?.element?[8].type?[4].code, "instant") - XCTAssertEqual(inst.differential?.element?[8].type?[5].code, "string") - XCTAssertEqual(inst.differential?.element?[8].type?[6].code, "uri") - XCTAssertEqual(inst.differential?.element?[8].type?[7].code, "date") - XCTAssertEqual(inst.differential?.element?[8].type?[8].code, "dateTime") - XCTAssertEqual(inst.differential?.element?[8].type?[9].code, "time") - XCTAssertEqual(inst.differential?.element?[9].fixedUri?.absoluteString, "http://hl7.org/fhir/StructureDefinition/structuredefinition-example") - XCTAssertEqual(inst.differential?.element?[9].path, "Extension.url") - XCTAssertEqual(inst.differential?.element?[9].type?[0].code, "uri") - XCTAssertEqual(inst.display, "example") - XCTAssertEqual(inst.fhirVersion, "1.4.0") - XCTAssertEqual(inst.id, "structuredefinition-example") - XCTAssertEqual(inst.kind, "datatype") - XCTAssertEqual(inst.name, "An additional example value") - XCTAssertEqual(inst.publisher, "Health Level Seven, Inc. - [WG Name] WG") - XCTAssertEqual(inst.snapshot?.element?[0].base?.max, "*") - XCTAssertEqual(inst.snapshot?.element?[0].base?.min, 0) - XCTAssertEqual(inst.snapshot?.element?[0].base?.path, "Extension") - XCTAssertEqual(inst.snapshot?.element?[0].definition, "An additional example value.") - XCTAssertEqual(inst.snapshot?.element?[0].max, "*") - XCTAssertEqual(inst.snapshot?.element?[0].min, 0) - XCTAssertEqual(inst.snapshot?.element?[0].path, "Extension") - XCTAssertEqual(inst.snapshot?.element?[0].short, "An additional example value") - XCTAssertEqual(inst.snapshot?.element?[0].type?[0].code, "Extension") - XCTAssertEqual(inst.snapshot?.element?[1].base?.max, "*") - XCTAssertEqual(inst.snapshot?.element?[1].base?.min, 0) - XCTAssertEqual(inst.snapshot?.element?[1].base?.path, "Element.id") - XCTAssertEqual(inst.snapshot?.element?[1].definition, "unique id for the element within a resource (for internal references).") - XCTAssertEqual(inst.snapshot?.element?[1].mapping?[0].identity, "rim") - XCTAssertEqual(inst.snapshot?.element?[1].mapping?[0].map, "n/a") - XCTAssertEqual(inst.snapshot?.element?[1].max, "1") - XCTAssertEqual(inst.snapshot?.element?[1].min, 0) - XCTAssertEqual(inst.snapshot?.element?[1].path, "Extension.id") - XCTAssertEqual(inst.snapshot?.element?[1].representation?[0], "xmlAttr") - XCTAssertEqual(inst.snapshot?.element?[1].short, "xml:id (or equivalent in JSON)") - XCTAssertEqual(inst.snapshot?.element?[1].type?[0].code, "id") - XCTAssertEqual(inst.snapshot?.element?[2].base?.max, "*") - XCTAssertEqual(inst.snapshot?.element?[2].base?.min, 0) - XCTAssertEqual(inst.snapshot?.element?[2].base?.path, "Element.extension") - XCTAssertEqual(inst.snapshot?.element?[2].definition, "An Extension") - XCTAssertEqual(inst.snapshot?.element?[2].max, "*") - XCTAssertEqual(inst.snapshot?.element?[2].min, 0) - XCTAssertEqual(inst.snapshot?.element?[2].path, "Extension.extension") - XCTAssertEqual(inst.snapshot?.element?[2].short, "Extension") - XCTAssertEqual(inst.snapshot?.element?[2].slicing?.discriminator?[0], "url") - XCTAssertFalse(inst.snapshot?.element?[2].slicing?.ordered ?? true) - XCTAssertEqual(inst.snapshot?.element?[2].slicing?.rules, "open") - XCTAssertEqual(inst.snapshot?.element?[2].type?[0].code, "Extension") - XCTAssertEqual(inst.snapshot?.element?[3].base?.max, "*") - XCTAssertEqual(inst.snapshot?.element?[3].base?.min, 0) - XCTAssertEqual(inst.snapshot?.element?[3].base?.path, "Element.extension") - XCTAssertEqual(inst.snapshot?.element?[3].definition, "Key for this example.") - XCTAssertEqual(inst.snapshot?.element?[3].max, "1") - XCTAssertEqual(inst.snapshot?.element?[3].min, 1) - XCTAssertEqual(inst.snapshot?.element?[3].name, "index") - XCTAssertEqual(inst.snapshot?.element?[3].path, "Extension.extension") - XCTAssertEqual(inst.snapshot?.element?[3].short, "Key for this example") - XCTAssertEqual(inst.snapshot?.element?[3].type?[0].code, "Extension") - XCTAssertEqual(inst.snapshot?.element?[4].base?.max, "*") - XCTAssertEqual(inst.snapshot?.element?[4].base?.min, 0) - XCTAssertEqual(inst.snapshot?.element?[4].base?.path, "Element.id") - XCTAssertEqual(inst.snapshot?.element?[4].definition, "unique id for the element within a resource (for internal references).") - XCTAssertEqual(inst.snapshot?.element?[4].mapping?[0].identity, "rim") - XCTAssertEqual(inst.snapshot?.element?[4].mapping?[0].map, "n/a") - XCTAssertEqual(inst.snapshot?.element?[4].max, "1") - XCTAssertEqual(inst.snapshot?.element?[4].min, 0) - XCTAssertEqual(inst.snapshot?.element?[4].path, "Extension.extension.id") - XCTAssertEqual(inst.snapshot?.element?[4].representation?[0], "xmlAttr") - XCTAssertEqual(inst.snapshot?.element?[4].short, "xml:id (or equivalent in JSON)") - XCTAssertEqual(inst.snapshot?.element?[4].type?[0].code, "id") - XCTAssertEqual(inst.snapshot?.element?[5].base?.max, "*") - XCTAssertEqual(inst.snapshot?.element?[5].base?.min, 0) - XCTAssertEqual(inst.snapshot?.element?[5].base?.path, "Element.extension") - XCTAssertEqual(inst.snapshot?.element?[5].definition, "An Extension") - XCTAssertEqual(inst.snapshot?.element?[5].max, "0") - XCTAssertEqual(inst.snapshot?.element?[5].min, 0) - XCTAssertEqual(inst.snapshot?.element?[5].name, "extension") - XCTAssertEqual(inst.snapshot?.element?[5].path, "Extension.extension.extension") - XCTAssertEqual(inst.snapshot?.element?[5].short, "Extension") - XCTAssertEqual(inst.snapshot?.element?[5].type?[0].code, "Extension") - XCTAssertEqual(inst.snapshot?.element?[6].base?.max, "1") - XCTAssertEqual(inst.snapshot?.element?[6].base?.min, 1) - XCTAssertEqual(inst.snapshot?.element?[6].base?.path, "Extension.url") - XCTAssertEqual(inst.snapshot?.element?[6].definition, "Source of the definition for the extension code - a logical name or a URL.") - XCTAssertEqual(inst.snapshot?.element?[6].fixedUri?.absoluteString, "index") - XCTAssertEqual(inst.snapshot?.element?[6].mapping?[0].identity, "rim") - XCTAssertEqual(inst.snapshot?.element?[6].mapping?[0].map, "N/A") - XCTAssertEqual(inst.snapshot?.element?[6].max, "1") - XCTAssertEqual(inst.snapshot?.element?[6].min, 1) - XCTAssertEqual(inst.snapshot?.element?[6].path, "Extension.extension.url") - XCTAssertEqual(inst.snapshot?.element?[6].representation?[0], "xmlAttr") - XCTAssertEqual(inst.snapshot?.element?[6].short, "identifies the meaning of the extension") - XCTAssertEqual(inst.snapshot?.element?[6].type?[0].code, "uri") - XCTAssertEqual(inst.snapshot?.element?[7].base?.max, "1") - XCTAssertEqual(inst.snapshot?.element?[7].base?.min, 0) - XCTAssertEqual(inst.snapshot?.element?[7].base?.path, "Extension.value[x]") - XCTAssertEqual(inst.snapshot?.element?[7].definition, "Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).") - XCTAssertEqual(inst.snapshot?.element?[7].mapping?[0].identity, "rim") - XCTAssertEqual(inst.snapshot?.element?[7].mapping?[0].map, "N/A") - XCTAssertEqual(inst.snapshot?.element?[7].max, "1") - XCTAssertEqual(inst.snapshot?.element?[7].min, 1) - XCTAssertEqual(inst.snapshot?.element?[7].path, "Extension.extension.valueString") - XCTAssertEqual(inst.snapshot?.element?[7].short, "Value of extension") - XCTAssertEqual(inst.snapshot?.element?[7].type?[0].code, "string") - XCTAssertEqual(inst.snapshot?.element?[8].base?.max, "*") - XCTAssertEqual(inst.snapshot?.element?[8].base?.min, 0) - XCTAssertEqual(inst.snapshot?.element?[8].base?.path, "Element.extension") - XCTAssertEqual(inst.snapshot?.element?[8].definition, "Value of the example.") - XCTAssertEqual(inst.snapshot?.element?[8].max, "1") - XCTAssertEqual(inst.snapshot?.element?[8].min, 0) - XCTAssertEqual(inst.snapshot?.element?[8].name, "exValue") - XCTAssertEqual(inst.snapshot?.element?[8].path, "Extension.extension") - XCTAssertEqual(inst.snapshot?.element?[8].short, "Value of the example") - XCTAssertEqual(inst.snapshot?.element?[8].type?[0].code, "Extension") - XCTAssertEqual(inst.snapshot?.element?[9].base?.max, "*") - XCTAssertEqual(inst.snapshot?.element?[9].base?.min, 0) - XCTAssertEqual(inst.snapshot?.element?[9].base?.path, "Element.id") - XCTAssertEqual(inst.snapshot?.element?[9].definition, "unique id for the element within a resource (for internal references).") - XCTAssertEqual(inst.snapshot?.element?[9].mapping?[0].identity, "rim") - XCTAssertEqual(inst.snapshot?.element?[9].mapping?[0].map, "n/a") - XCTAssertEqual(inst.snapshot?.element?[9].max, "1") - XCTAssertEqual(inst.snapshot?.element?[9].min, 0) - XCTAssertEqual(inst.snapshot?.element?[9].path, "Extension.extension.id") - XCTAssertEqual(inst.snapshot?.element?[9].representation?[0], "xmlAttr") - XCTAssertEqual(inst.snapshot?.element?[9].short, "xml:id (or equivalent in JSON)") - XCTAssertEqual(inst.snapshot?.element?[9].type?[0].code, "id") - XCTAssertEqual(inst.status, "draft") - XCTAssertEqual(inst.url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/structuredefinition-example") - - return inst - } - - func testStructureDefinition2() { - do { - let instance = try runStructureDefinition2() - try runStructureDefinition2(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test StructureDefinition successfully, but threw") - } - } - - @discardableResult - func runStructureDefinition2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.StructureDefinition { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "structuredefinition-example.json") XCTAssertFalse(inst.abstract ?? true) - XCTAssertEqual(inst.baseDefinition?.absoluteString, "http://hl7.org/fhir/StructureDefinition/DiagnosticReport") - XCTAssertEqual(inst.baseType, "DiagnosticReport") + XCTAssertEqual(inst.base?.absoluteString, "http://hl7.org/fhir/StructureDefinition/DiagnosticReport") XCTAssertEqual(inst.code?[0].code, "314079002") XCTAssertEqual(inst.code?[0].display, "314079002") XCTAssertEqual(inst.code?[0].system?.absoluteString, "http://snomed.info/sct") + XCTAssertEqual(inst.constrainedType, "DiagnosticReport") XCTAssertEqual(inst.contact?[0].name, "Grahame Grieve") XCTAssertEqual(inst.contact?[0].telecom?[0].system, "email") XCTAssertEqual(inst.contact?[0].telecom?[0].value, "grahame@healthintersections.com.au") XCTAssertEqual(inst.copyright, "Createive Commons 0, per FHIR specification") XCTAssertEqual(inst.date?.description, "2012-05-12") - XCTAssertEqual(inst.derivation, "constraint") XCTAssertEqual(inst.description_fhir, "Describes how the lab report is used for a standard Lipid Profile - Cholesterol, Triglyceride and Cholesterol fractions. Uses LOINC codes") XCTAssertEqual(inst.display, "Example Lipid Profile") XCTAssertTrue(inst.experimental ?? false) diff --git a/Tests/ModelTests/StructureMapTests.swift b/Tests/ModelTests/StructureMapTests.swift deleted file mode 100644 index fa4f05ef..00000000 --- a/Tests/ModelTests/StructureMapTests.swift +++ /dev/null @@ -1,57 +0,0 @@ -// -// StructureMapTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class StructureMapTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.StructureMap { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.StructureMap { - let instance = SwiftFHIR.StructureMap(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testStructureMap1() { - do { - let instance = try runStructureMap1() - try runStructureMap1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test StructureMap successfully, but threw") - } - } - - @discardableResult - func runStructureMap1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.StructureMap { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "structuremap-example.json") - - XCTAssertEqual(inst.group?[0].input?[0].mode, "source") - XCTAssertEqual(inst.group?[0].input?[0].name, "test") - XCTAssertEqual(inst.group?[0].name, "Examples") - XCTAssertEqual(inst.group?[0].rule?[0].name, "rule1") - XCTAssertEqual(inst.group?[0].rule?[0].source?[0].context, "test") - XCTAssertEqual(inst.group?[0].rule?[0].source?[0].contextType, "variable") - XCTAssertEqual(inst.group?[0].rule?[0].source?[0].element, "test") - XCTAssertTrue(inst.group?[0].rule?[0].source?[0].required ?? false) - XCTAssertEqual(inst.group?[0].rule?[0].source?[0].variable, "t") - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.name, "Example Map") - XCTAssertEqual(inst.status, "draft") - XCTAssertEqual(inst.text?.div, "
[Put rendering here]
") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.url?.absoluteString, "http://hl7.org/fhir/StructureMap/example") - - return inst - } -} diff --git a/Tests/ModelTests/SubscriptionTests.swift b/Tests/ModelTests/SubscriptionTests.swift index 11c58125..504acb47 100644 --- a/Tests/ModelTests/SubscriptionTests.swift +++ b/Tests/ModelTests/SubscriptionTests.swift @@ -2,7 +2,7 @@ // SubscriptionTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/SubstanceTests.swift b/Tests/ModelTests/SubstanceTests.swift index 287e6448..9410beb5 100644 --- a/Tests/ModelTests/SubstanceTests.swift +++ b/Tests/ModelTests/SubstanceTests.swift @@ -2,7 +2,7 @@ // SubstanceTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/SupplyDeliveryTests.swift b/Tests/ModelTests/SupplyDeliveryTests.swift index 9e365b3c..2e04cc8a 100644 --- a/Tests/ModelTests/SupplyDeliveryTests.swift +++ b/Tests/ModelTests/SupplyDeliveryTests.swift @@ -2,7 +2,7 @@ // SupplyDeliveryTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/SupplyRequestTests.swift b/Tests/ModelTests/SupplyRequestTests.swift index 05478401..56854e28 100644 --- a/Tests/ModelTests/SupplyRequestTests.swift +++ b/Tests/ModelTests/SupplyRequestTests.swift @@ -2,7 +2,7 @@ // SupplyRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/TaskTests.swift b/Tests/ModelTests/TaskTests.swift deleted file mode 100644 index 1a5256f5..00000000 --- a/Tests/ModelTests/TaskTests.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// TaskTests.swift -// SwiftFHIR -// -// Generated from FHIR 1.4.0.8139 on 2016-07-07. -// 2016, SMART Health IT. -// - -import XCTest -import SwiftFHIR - - -class TaskTests: XCTestCase { - - func instantiateFrom(filename: String) throws -> SwiftFHIR.Task { - return instantiateFrom(json: try readJSONFile(filename)) - } - - func instantiateFrom(json: FHIRJSON) -> SwiftFHIR.Task { - let instance = SwiftFHIR.Task(json: json) - XCTAssertNotNil(instance, "Must have instantiated a test instance") - return instance - } - - func testTask1() { - do { - let instance = try runTask1() - try runTask1(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test Task successfully, but threw") - } - } - - @discardableResult - func runTask1(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.Task { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "task-example.json") - - XCTAssertEqual(inst.created?.description, "2016-03-10T22:39:32-04:00") - XCTAssertEqual(inst.creator?.reference, "Patient/Keith") - XCTAssertEqual(inst.id, "example") - XCTAssertEqual(inst.lastModified?.description, "2016-03-10T22:39:32-04:00") - XCTAssertEqual(inst.owner?.reference, "Practitioner/MyDoc") - XCTAssertEqual(inst.status, "draft") - XCTAssertEqual(inst.subject?.reference, "Medication/123") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.type?.text, "Refill Request") - - return inst - } -} diff --git a/Tests/ModelTests/TestScriptTests.swift b/Tests/ModelTests/TestScriptTests.swift index e42b1e3a..8efe436b 100644 --- a/Tests/ModelTests/TestScriptTests.swift +++ b/Tests/ModelTests/TestScriptTests.swift @@ -2,7 +2,7 @@ // TestScriptTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -37,26 +37,19 @@ class TestScriptTests: XCTestCase { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "testscript-example-multiserver.json") XCTAssertEqual(inst.description_fhir, "Multiserver Test Script") - XCTAssertEqual(inst.destination?[0].index, 1) - XCTAssertEqual(inst.destination?[0].profile?.code, "FHIR-Server") XCTAssertEqual(inst.fixture?[0].id, "F1") XCTAssertEqual(inst.fixture?[0].resource?.reference, "Patient/example") XCTAssertEqual(inst.id, "multiserver") + XCTAssertTrue(inst.multiserver ?? false) XCTAssertEqual(inst.name, "Multiserver Test Script") - XCTAssertEqual(inst.origin?[0].index, 1) - XCTAssertEqual(inst.origin?[0].profile?.code, "FHIR-Client") XCTAssertEqual(inst.setup?.action?[0].operation?.contentType, "xml") XCTAssertEqual(inst.setup?.action?[0].operation?.destination, 0) - XCTAssertEqual(inst.setup?.action?[0].operation?.origin, 0) XCTAssertEqual(inst.setup?.action?[0].operation?.sourceId, "F1") XCTAssertEqual(inst.setup?.action?[0].operation?.type?.code, "create") XCTAssertEqual(inst.setup?.metadata?.capability?[0].conformance?.reference, "Conformance/example") XCTAssertEqual(inst.setup?.metadata?.capability?[0].description_fhir, "Patient Create Operation") - XCTAssertEqual(inst.setup?.metadata?.capability?[0].destination, 1) XCTAssertEqual(inst.setup?.metadata?.capability?[0].link?[0].absoluteString, "http://hl7.org/implement/standards/FHIR-Develop/http.html#create") - XCTAssertEqual(inst.setup?.metadata?.capability?[0].origin?[0], 1) XCTAssertTrue(inst.setup?.metadata?.capability?[0].required ?? false) - XCTAssertTrue(inst.setup?.metadata?.capability?[0].validated ?? false) XCTAssertEqual(inst.setup?.metadata?.link?[0].description_fhir, "FHIR Patient") XCTAssertEqual(inst.setup?.metadata?.link?[0].url?.absoluteString, "http://hl7.org/implement/standards/FHIR-Develop/patient.html") XCTAssertEqual(inst.status, "draft") @@ -79,10 +72,7 @@ class TestScriptTests: XCTestCase { XCTAssertEqual(inst.test?[0].id, "READ01") XCTAssertEqual(inst.test?[0].metadata?.capability?[0].conformance?.reference, "Conformance/example") XCTAssertEqual(inst.test?[0].metadata?.capability?[0].description_fhir, "Patient Read Operation") - XCTAssertEqual(inst.test?[0].metadata?.capability?[0].destination, 1) XCTAssertEqual(inst.test?[0].metadata?.capability?[0].link?[0].absoluteString, "http://hl7.org/implement/standards/FHIR-Develop/http.html#read") - XCTAssertEqual(inst.test?[0].metadata?.capability?[0].origin?[0], 1) - XCTAssertTrue(inst.test?[0].metadata?.capability?[0].required ?? false) XCTAssertTrue(inst.test?[0].metadata?.capability?[0].validated ?? false) XCTAssertEqual(inst.test?[0].name, "Read Patient") XCTAssertEqual(inst.test?[1].action?[0].operation?.destination, 1) @@ -151,115 +141,6 @@ class TestScriptTests: XCTestCase { @discardableResult func runTestScript2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.TestScript { - let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "testscript-example-rule.json") - - XCTAssertEqual(inst.contact?[0].name, "Support") - XCTAssertEqual(inst.contact?[0].telecom?[0].system, "email") - XCTAssertEqual(inst.contact?[0].telecom?[0].use, "temp") - XCTAssertEqual(inst.contact?[0].telecom?[0].value, "support@gmail.com") - XCTAssertEqual(inst.copyright, "© HL7.org 2011+") - XCTAssertEqual(inst.date?.description, "2015-08-31") - XCTAssertEqual(inst.description_fhir, "Example Test Script") - XCTAssertTrue(inst.experimental ?? false) - XCTAssertFalse(inst.fixture?[0].autocreate ?? true) - XCTAssertFalse(inst.fixture?[0].autodelete ?? true) - XCTAssertEqual(inst.fixture?[0].id, "F1") - XCTAssertEqual(inst.fixture?[0].resource?.display, "Patient resource") - XCTAssertEqual(inst.fixture?[0].resource?.reference, "Patient/example") - XCTAssertEqual(inst.id, "example-rule") - XCTAssertEqual(inst.identifier?.system?.absoluteString, "urn:ietf:rfc:3986") - XCTAssertEqual(inst.identifier?.value, "urn:oid:1.3.6.1.4.1.21367.2005.3.7.9876") - XCTAssertEqual(inst.metadata?.capability?[0].conformance?.reference, "Conformance/example") - XCTAssertEqual(inst.metadata?.capability?[0].description_fhir, "Patient Create, Read, and Update Operations") - XCTAssertEqual(inst.metadata?.capability?[0].destination, 1) - XCTAssertEqual(inst.metadata?.capability?[0].link?[0].absoluteString, "http://hl7.org/implement/standards/FHIR-Develop/http.html#create") - XCTAssertEqual(inst.metadata?.capability?[0].link?[1].absoluteString, "http://hl7.org/implement/standards/FHIR-Develop/http.html#read") - XCTAssertEqual(inst.metadata?.capability?[0].link?[2].absoluteString, "http://hl7.org/implement/standards/FHIR-Develop/http.html#update") - XCTAssertTrue(inst.metadata?.capability?[0].required ?? false) - XCTAssertEqual(inst.name, "Test Script 1") - XCTAssertEqual(inst.profile?[0].id, "patient-profile") - XCTAssertEqual(inst.profile?[0].reference, "http://hl7.org/fhir/StructureDefinition/Patient") - XCTAssertEqual(inst.publisher, "HL7") - XCTAssertEqual(inst.requirements, "Patient Create, Read, and Update Operations") - XCTAssertEqual(inst.rule?[0].id, "ruleResponseOkay") - XCTAssertEqual(inst.rule?[0].param?[0].name, "expectedStatusCode") - XCTAssertEqual(inst.rule?[0].param?[0].value, "200") - XCTAssertEqual(inst.rule?[0].resource?.reference, "TestScript/example") - XCTAssertEqual(inst.ruleset?[0].id, "ruleset-responseResourcePatient") - XCTAssertEqual(inst.ruleset?[0].resource?.reference, "TestScript/example") - XCTAssertEqual(inst.ruleset?[0].rule?[0].id, "RuleResponseContentType") - XCTAssertEqual(inst.ruleset?[0].rule?[0].param?[0].name, "expectedContentType") - XCTAssertEqual(inst.ruleset?[0].rule?[0].param?[0].value, "JSON") - XCTAssertEqual(inst.ruleset?[0].rule?[1].id, "RuleResponseStatusCode") - XCTAssertEqual(inst.ruleset?[0].rule?[1].param?[0].name, "expectedStatusCode") - XCTAssertEqual(inst.ruleset?[0].rule?[1].param?[0].value, "200") - XCTAssertEqual(inst.setup?.action?[0].operation?.accept, "json") - XCTAssertEqual(inst.setup?.action?[0].operation?.description_fhir, "Create patient resource on test server") - XCTAssertEqual(inst.setup?.action?[0].operation?.label, "SetupPatient") - XCTAssertEqual(inst.setup?.action?[0].operation?.responseId, "create-response") - XCTAssertEqual(inst.setup?.action?[0].operation?.sourceId, "F1") - XCTAssertEqual(inst.setup?.action?[0].operation?.type?.code, "create") - XCTAssertEqual(inst.setup?.action?[1].assert?.direction, "request") - XCTAssertEqual(inst.setup?.action?[1].assert?.responseCode, "201") - XCTAssertEqual(inst.status, "draft") - XCTAssertFalse(inst.test?[0].action?[0].operation?.encodeRequestUrl ?? true) - XCTAssertEqual(inst.test?[0].action?[0].operation?.responseId, "F1-read") - XCTAssertEqual(inst.test?[0].action?[0].operation?.targetId, "F1") - XCTAssertEqual(inst.test?[0].action?[0].operation?.type?.code, "read") - XCTAssertEqual(inst.test?[0].action?[1].assert?.label, "RuleReadOK") - XCTAssertEqual(inst.test?[0].action?[1].assert?.rule?.id, "ruleResponseOkay") - XCTAssertEqual(inst.test?[0].action?[1].assert?.rule?.param?[0].name, "expectedStatusCode") - XCTAssertEqual(inst.test?[0].action?[1].assert?.rule?.param?[0].value, "200") - XCTAssertEqual(inst.test?[0].action?[2].assert?.label, "RuleContentTypeResponse") - XCTAssertEqual(inst.test?[0].action?[2].assert?.ruleset?.id, "ruleset-responseResourcePatient") - XCTAssertEqual(inst.test?[0].action?[2].assert?.ruleset?.rule?[0].id, "RuleResponseContentType") - XCTAssertEqual(inst.test?[0].action?[2].assert?.ruleset?.rule?[0].param?[0].name, "expectedContentType") - XCTAssertEqual(inst.test?[0].action?[2].assert?.ruleset?.rule?[0].param?[0].value, "XML") - XCTAssertEqual(inst.test?[0].action?[3].assert?.headerField, "Last-Modified") - XCTAssertEqual(inst.test?[0].action?[3].assert?.operator_fhir, "notEmpty") - XCTAssertTrue(inst.test?[0].action?[3].assert?.warningOnly ?? false) - XCTAssertEqual(inst.test?[0].action?[4].assert?.resource, "Patient") - XCTAssertEqual(inst.test?[0].action?[5].assert?.validateProfileId, "patient-profile") - XCTAssertEqual(inst.test?[0].action?[6].assert?.operator_fhir, "equals") - XCTAssertEqual(inst.test?[0].action?[6].assert?.path, "fhir:Patient/fhir:name/fhir:family/@value") - XCTAssertEqual(inst.test?[0].action?[6].assert?.value, "Chalmers") - XCTAssertEqual(inst.test?[0].action?[7].assert?.operator_fhir, "equals") - XCTAssertEqual(inst.test?[0].action?[7].assert?.path, "fhir:Patient/fhir:name/fhir:family/@value") - XCTAssertEqual(inst.test?[0].action?[7].assert?.sourceId, "F1") - XCTAssertEqual(inst.test?[0].action?[7].assert?.value, "Chalmers") - XCTAssertEqual(inst.test?[0].action?[8].assert?.compareToSourceId, "F1-read") - XCTAssertEqual(inst.test?[0].action?[8].assert?.compareToSourcePath, "fhir:Patient/fhir:name/fhir:family/@value") - XCTAssertEqual(inst.test?[0].action?[8].assert?.operator_fhir, "equals") - XCTAssertEqual(inst.test?[0].action?[8].assert?.path, "fhir:Patient/fhir:name/fhir:family/@value") - XCTAssertEqual(inst.test?[0].action?[9].assert?.compareToSourceId, "F1-read") - XCTAssertEqual(inst.test?[0].action?[9].assert?.compareToSourcePath, "fhir:Patient/fhir:name/fhir:family/@value") - XCTAssertEqual(inst.test?[0].action?[9].assert?.path, "fhir:Patient/fhir:name/fhir:family/@value") - XCTAssertEqual(inst.test?[0].action?[9].assert?.sourceId, "F1") - XCTAssertEqual(inst.test?[0].description_fhir, "Read a patient and validate response.") - XCTAssertEqual(inst.test?[0].id, "READ01") - XCTAssertEqual(inst.test?[0].name, "Read Patient") - XCTAssertEqual(inst.text?.status, "generated") - XCTAssertEqual(inst.url?.absoluteString, "http://hl7.org/fhir/TestScript/example-rule") - XCTAssertEqual(inst.useContext?[0].coding?[0].code, "US") - XCTAssertEqual(inst.useContext?[0].coding?[0].display, "United States of America (the)") - XCTAssertEqual(inst.useContext?[0].coding?[0].system?.absoluteString, "urn:iso:std:iso:3166") - XCTAssertEqual(inst.version, "1.0") - - return inst - } - - func testTestScript3() { - do { - let instance = try runTestScript3() - try runTestScript3(instance.asJSON()) - } - catch { - XCTAssertTrue(false, "Must instantiate and test TestScript successfully, but threw") - } - } - - @discardableResult - func runTestScript3(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.TestScript { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "testscript-example.json") XCTAssertEqual(inst.contact?[0].name, "Support") diff --git a/Tests/ModelTests/ValueSetTests.swift b/Tests/ModelTests/ValueSetTests.swift index ee9c4032..cc468755 100644 --- a/Tests/ModelTests/ValueSetTests.swift +++ b/Tests/ModelTests/ValueSetTests.swift @@ -2,7 +2,7 @@ // ValueSetTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // @@ -114,6 +114,61 @@ class ValueSetTests: XCTestCase { @discardableResult func runValueSet2(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ValueSet { + let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "valueset-example-inline.json") + + XCTAssertTrue(inst.codeSystem?.caseSensitive ?? false) + XCTAssertEqual(inst.codeSystem?.concept?[0].code, "chol-mmol") + XCTAssertEqual(inst.codeSystem?.concept?[0].definition, "Serum Cholesterol, in mmol/L") + XCTAssertEqual(inst.codeSystem?.concept?[0].designation?[0].use?.code, "internal-label") + XCTAssertEqual(inst.codeSystem?.concept?[0].designation?[0].use?.system?.absoluteString, "http://acme.com/config/fhir/codesystems/internal") + XCTAssertEqual(inst.codeSystem?.concept?[0].designation?[0].value, "From ACME POC Testing") + XCTAssertEqual(inst.codeSystem?.concept?[0].display, "SChol (mmol/L)") + XCTAssertEqual(inst.codeSystem?.concept?[1].code, "chol-mass") + XCTAssertEqual(inst.codeSystem?.concept?[1].definition, "Serum Cholesterol, in mg/L") + XCTAssertEqual(inst.codeSystem?.concept?[1].designation?[0].use?.code, "internal-label") + XCTAssertEqual(inst.codeSystem?.concept?[1].designation?[0].use?.system?.absoluteString, "http://acme.com/config/fhir/codesystems/internal") + XCTAssertEqual(inst.codeSystem?.concept?[1].designation?[0].value, "From Paragon Labs") + XCTAssertEqual(inst.codeSystem?.concept?[1].display, "SChol (mg/L)") + XCTAssertEqual(inst.codeSystem?.concept?[2].code, "chol") + XCTAssertEqual(inst.codeSystem?.concept?[2].definition, "Serum Cholesterol") + XCTAssertEqual(inst.codeSystem?.concept?[2].designation?[0].use?.code, "internal-label") + XCTAssertEqual(inst.codeSystem?.concept?[2].designation?[0].use?.system?.absoluteString, "http://acme.com/config/fhir/codesystems/internal") + XCTAssertEqual(inst.codeSystem?.concept?[2].designation?[0].value, "Obdurate Labs uses this with both kinds of units...") + XCTAssertEqual(inst.codeSystem?.concept?[2].display, "SChol") + XCTAssertEqual(inst.codeSystem?.system?.absoluteString, "http://acme.com/config/fhir/codesystems/cholesterol") + XCTAssertEqual(inst.codeSystem?.version, "4.2.3") + XCTAssertEqual(inst.contact?[0].name, "FHIR project team") + XCTAssertEqual(inst.contact?[0].telecom?[0].system, "other") + XCTAssertEqual(inst.contact?[0].telecom?[0].value, "http://hl7.org/fhir") + XCTAssertEqual(inst.date?.description, "2015-06-22") + XCTAssertEqual(inst.description_fhir, "This is an example value set that includes all the ACME codes for serum/plasma cholesterol from v2.36.") + XCTAssertTrue(inst.experimental ?? false) + XCTAssertEqual(inst.id, "example-inline") + XCTAssertEqual(inst.identifier?.system?.absoluteString, "http://acme.com/identifiers/valuesets") + XCTAssertEqual(inst.identifier?.value, "loinc-cholesterol-inl") + XCTAssertEqual(inst.meta?.profile?[0].absoluteString, "http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition") + XCTAssertEqual(inst.name, "ACME Codes for Cholesterol in Serum/Plasma") + XCTAssertEqual(inst.publisher, "HL7 International") + XCTAssertEqual(inst.status, "draft") + XCTAssertEqual(inst.text?.status, "generated") + XCTAssertEqual(inst.url?.absoluteString, "http://hl7.org/fhir/ValueSet/example-inline") + XCTAssertEqual(inst.version, "20150622") + + return inst + } + + func testValueSet3() { + do { + let instance = try runValueSet3() + try runValueSet3(instance.asJSON()) + } + catch { + XCTAssertTrue(false, "Must instantiate and test ValueSet successfully, but threw") + } + } + + @discardableResult + func runValueSet3(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ValueSet { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "valueset-example-intensional.json") XCTAssertEqual(inst.compose?.exclude?[0].concept?[0].code, "5932-9") @@ -144,10 +199,10 @@ class ValueSetTests: XCTestCase { return inst } - func testValueSet3() { + func testValueSet4() { do { - let instance = try runValueSet3() - try runValueSet3(instance.asJSON()) + let instance = try runValueSet4() + try runValueSet4(instance.asJSON()) } catch { XCTAssertTrue(false, "Must instantiate and test ValueSet successfully, but threw") @@ -155,7 +210,7 @@ class ValueSetTests: XCTestCase { } @discardableResult - func runValueSet3(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ValueSet { + func runValueSet4(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ValueSet { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "valueset-example-yesnodontknow.json") XCTAssertEqual(inst.compose?.import_fhir?[0].absoluteString, "http://hl7.org/fhir/ValueSet/v2-0136") @@ -183,10 +238,10 @@ class ValueSetTests: XCTestCase { return inst } - func testValueSet4() { + func testValueSet5() { do { - let instance = try runValueSet4() - try runValueSet4(instance.asJSON()) + let instance = try runValueSet5() + try runValueSet5(instance.asJSON()) } catch { XCTAssertTrue(false, "Must instantiate and test ValueSet successfully, but threw") @@ -194,7 +249,7 @@ class ValueSetTests: XCTestCase { } @discardableResult - func runValueSet4(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ValueSet { + func runValueSet5(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ValueSet { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "valueset-example.json") XCTAssertEqual(inst.compose?.include?[0].concept?[0].code, "14647-2") @@ -229,10 +284,10 @@ class ValueSetTests: XCTestCase { return inst } - func testValueSet5() { + func testValueSet6() { do { - let instance = try runValueSet5() - try runValueSet5(instance.asJSON()) + let instance = try runValueSet6() + try runValueSet6(instance.asJSON()) } catch { XCTAssertTrue(false, "Must instantiate and test ValueSet successfully, but threw") @@ -240,26 +295,56 @@ class ValueSetTests: XCTestCase { } @discardableResult - func runValueSet5(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ValueSet { + func runValueSet6(_ json: FHIRJSON? = nil) throws -> SwiftFHIR.ValueSet { let inst = (nil != json) ? instantiateFrom(json: json!) : try instantiateFrom(filename: "valueset-list-example-codes.json") - XCTAssertEqual(inst.compose?.include?[0].system?.absoluteString, "http://hl7.org/fhir/list-example-use-codes") + XCTAssertTrue(inst.codeSystem?.caseSensitive ?? false) + XCTAssertEqual(inst.codeSystem?.concept?[0].code, "alerts") + XCTAssertEqual(inst.codeSystem?.concept?[0].definition, "A list of alerts for the patient.") + XCTAssertEqual(inst.codeSystem?.concept?[0].display, "Alerts") + XCTAssertEqual(inst.codeSystem?.concept?[1].code, "adverserxns") + XCTAssertEqual(inst.codeSystem?.concept?[1].definition, "A list of part adverse reactions.") + XCTAssertEqual(inst.codeSystem?.concept?[1].display, "Adverse Reactions") + XCTAssertEqual(inst.codeSystem?.concept?[2].code, "allergies") + XCTAssertEqual(inst.codeSystem?.concept?[2].definition, "A list of Allergies for the patient.") + XCTAssertEqual(inst.codeSystem?.concept?[2].display, "Allergies") + XCTAssertEqual(inst.codeSystem?.concept?[3].code, "medications") + XCTAssertEqual(inst.codeSystem?.concept?[3].definition, "A list of medication statements for the patient.") + XCTAssertEqual(inst.codeSystem?.concept?[3].display, "Medication List") + XCTAssertEqual(inst.codeSystem?.concept?[4].code, "problems") + XCTAssertEqual(inst.codeSystem?.concept?[4].definition, "A list of problems that the patient is known of have (or have had in the past).") + XCTAssertEqual(inst.codeSystem?.concept?[4].display, "Problem List") + XCTAssertEqual(inst.codeSystem?.concept?[5].code, "worklist") + XCTAssertEqual(inst.codeSystem?.concept?[5].definition, "A list of items that constitute a set of work to be performed (typically this code would be specialized for more specific uses, such as a ward round list).") + XCTAssertEqual(inst.codeSystem?.concept?[5].display, "Worklist") + XCTAssertEqual(inst.codeSystem?.concept?[6].code, "waiting") + XCTAssertEqual(inst.codeSystem?.concept?[6].definition, "A list of items waiting for an event (perhaps a surgical patient waiting list).") + XCTAssertEqual(inst.codeSystem?.concept?[6].display, "Waiting List") + XCTAssertEqual(inst.codeSystem?.concept?[7].code, "protocols") + XCTAssertEqual(inst.codeSystem?.concept?[7].definition, "A set of protocols to be followed.") + XCTAssertEqual(inst.codeSystem?.concept?[7].display, "Protocols") + XCTAssertEqual(inst.codeSystem?.concept?[8].code, "plans") + XCTAssertEqual(inst.codeSystem?.concept?[8].definition, "A set of care plans that apply in a particular context of care.") + XCTAssertEqual(inst.codeSystem?.concept?[8].display, "Care Plans") + XCTAssertEqual(inst.codeSystem?.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/valueset-oid") + XCTAssertEqual(inst.codeSystem?.extension_fhir?[0].valueUri?.absoluteString, "urn:oid:2.16.840.1.113883.4.642.1.173") + XCTAssertEqual(inst.codeSystem?.system?.absoluteString, "http://hl7.org/fhir/list-example-use-codes") XCTAssertEqual(inst.contact?[0].telecom?[0].system, "other") XCTAssertEqual(inst.contact?[0].telecom?[0].value, "http://hl7.org/fhir") - XCTAssertEqual(inst.date?.description, "2016-03-31T08:01:25+11:00") + XCTAssertEqual(inst.date?.description, "2015-10-24T07:41:03+11:00") XCTAssertEqual(inst.description_fhir, "Example use codes for the List resource - typical kinds of use.") XCTAssertTrue(inst.experimental ?? false) XCTAssertEqual(inst.extension_fhir?[0].url?.absoluteString, "http://hl7.org/fhir/StructureDefinition/valueset-oid") XCTAssertEqual(inst.extension_fhir?[0].valueUri?.absoluteString, "urn:oid:2.16.840.1.113883.4.642.2.173") XCTAssertEqual(inst.id, "list-example-codes") - XCTAssertEqual(inst.meta?.lastUpdated?.description, "2016-03-31T08:01:25.570+11:00") + XCTAssertEqual(inst.meta?.lastUpdated?.description, "2015-10-24T07:41:03.495+11:00") XCTAssertEqual(inst.meta?.profile?[0].absoluteString, "http://hl7.org/fhir/StructureDefinition/valueset-shareable-definition") XCTAssertEqual(inst.name, "Example Use Codes for List") XCTAssertEqual(inst.publisher, "FHIR Project") XCTAssertEqual(inst.status, "draft") XCTAssertEqual(inst.text?.status, "generated") XCTAssertEqual(inst.url?.absoluteString, "http://hl7.org/fhir/ValueSet/list-example-codes") - XCTAssertEqual(inst.version, "1.4.0") + XCTAssertEqual(inst.version, "1.0.2") return inst } diff --git a/Tests/ModelTests/VisionPrescriptionTests.swift b/Tests/ModelTests/VisionPrescriptionTests.swift index fa62fdb8..2bbbe68c 100644 --- a/Tests/ModelTests/VisionPrescriptionTests.swift +++ b/Tests/ModelTests/VisionPrescriptionTests.swift @@ -2,7 +2,7 @@ // VisionPrescriptionTests.swift // SwiftFHIR // -// Generated from FHIR 1.4.0.8139 on 2016-07-07. +// Generated from FHIR 1.0.2.7202 on 2016-08-09. // 2016, SMART Health IT. // diff --git a/fhir-parser b/fhir-parser index a957a4d9..7e15a4ce 160000 --- a/fhir-parser +++ b/fhir-parser @@ -1 +1 @@ -Subproject commit a957a4d94825aa38c244ab4055cbb9f7b02f5d79 +Subproject commit 7e15a4ce425dae7b92bd1723fca9789e93c1a623 diff --git a/generate-docs.sh b/generate-docs.sh index cdb737b9..58d869ad 100755 --- a/generate-docs.sh +++ b/generate-docs.sh @@ -10,4 +10,4 @@ jazzy \ -g "https://github.com/smart-on-fhir/Swift-FHIR" \ -r "http://smart-on-fhir.github.io/Swift-FHIR" \ -o "docs" \ - --module-version "2.2.3" + --module-version "2.8" diff --git a/generator-settings.py b/generator-settings.py index 9080a630..d33c9810 100644 --- a/generator-settings.py +++ b/generator-settings.py @@ -1,9 +1,9 @@ # These are settings for the FHIR class generator -from Swift.mappings import * -from Swift.settings import * +from Swift3.mappings import * +from Swift3.settings import * -specification_url = 'http://hl7.org/fhir/2016May/' +specification_url = 'http://hl7.org/fhir/dstu2/' write_resources = True write_searchparams = False From cfdfb3159d2e3da2b626193d7d37b28756e37aad Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Wed, 17 Aug 2016 16:52:51 +0200 Subject: [PATCH 09/20] Bump last remaining version number --- generate-docs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generate-docs.sh b/generate-docs.sh index cdb737b9..3697c1cd 100755 --- a/generate-docs.sh +++ b/generate-docs.sh @@ -10,4 +10,4 @@ jazzy \ -g "https://github.com/smart-on-fhir/Swift-FHIR" \ -r "http://smart-on-fhir.github.io/Swift-FHIR" \ -o "docs" \ - --module-version "2.2.3" + --module-version "2.3" From b9411a0058e0168cae37e0c790e1fc11ce770652 Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Fri, 16 Sep 2016 00:24:15 +0200 Subject: [PATCH 10/20] Update for Xcode 8GM --- Sources/Client/FHIROpenServer.swift | 58 +- Sources/Client/FHIROperation.swift | 18 +- Sources/Client/FHIRSearch.swift | 66 +- Sources/Client/FHIRServerDataResponse.swift | 54 +- Sources/Client/FHIRServerRequestHandler.swift | 62 +- Sources/Client/Reference+Resolving.swift | 2 +- Sources/Client/Resource+Instantiation.swift | 2 +- Sources/Client/Resource+REST.swift | 96 +- Sources/Models/Account.swift | 52 +- Sources/Models/Address.swift | 50 +- Sources/Models/Age.swift | 4 +- Sources/Models/AllergyIntolerance.swift | 102 +- Sources/Models/Annotation.swift | 24 +- Sources/Models/Appointment.swift | 78 +- Sources/Models/AppointmentResponse.swift | 40 +- Sources/Models/Attachment.swift | 40 +- Sources/Models/AuditEvent.swift | 202 ++-- Sources/Models/BackboneElement.swift | 12 +- Sources/Models/Basic.swift | 28 +- Sources/Models/Binary.swift | 16 +- Sources/Models/BodySite.swift | 32 +- Sources/Models/Bundle.swift | 140 +-- Sources/Models/CarePlan.swift | 200 ++-- Sources/Models/Claim.swift | 400 +++---- Sources/Models/ClaimResponse.swift | 390 +++---- Sources/Models/ClinicalImpression.swift | 122 +- Sources/Models/CodeableConcept.swift | 16 +- Sources/Models/Coding.swift | 28 +- Sources/Models/Communication.swift | 78 +- Sources/Models/CommunicationRequest.swift | 86 +- Sources/Models/Composition.swift | 140 +-- Sources/Models/ConceptMap.swift | 160 +-- Sources/Models/Condition.swift | 136 +-- Sources/Models/Conformance.swift | 448 +++---- Sources/Models/ContactPoint.swift | 28 +- Sources/Models/Contract.swift | 310 ++--- Sources/Models/Count.swift | 4 +- Sources/Models/Coverage.swift | 64 +- Sources/Models/DataElement.swift | 100 +- Sources/Models/DateAndTime.swift | 168 +-- Sources/Models/DetectedIssue.swift | 66 +- Sources/Models/Device.swift | 72 +- Sources/Models/DeviceComponent.swift | 66 +- Sources/Models/DeviceMetric.swift | 66 +- Sources/Models/DeviceUseRequest.swift | 74 +- Sources/Models/DeviceUseStatement.swift | 58 +- Sources/Models/DiagnosticOrder.swift | 104 +- Sources/Models/DiagnosticReport.swift | 94 +- Sources/Models/Distance.swift | 4 +- Sources/Models/DocumentManifest.swift | 84 +- Sources/Models/DocumentReference.swift | 152 +-- Sources/Models/DomainResource.swift | 24 +- Sources/Models/Duration.swift | 4 +- Sources/Models/Element.swift | 16 +- Sources/Models/ElementDefinition.swift | 1036 ++++++++--------- Sources/Models/EligibilityRequest.swift | 36 +- Sources/Models/EligibilityResponse.swift | 48 +- Sources/Models/Encounter.swift | 184 +-- Sources/Models/EnrollmentRequest.swift | 48 +- Sources/Models/EnrollmentResponse.swift | 48 +- Sources/Models/EpisodeOfCare.swift | 84 +- Sources/Models/ExplanationOfBenefit.swift | 48 +- Sources/Models/Extension.swift | 144 +-- Sources/Models/FHIRAbstractBase+Factory.swift | 2 +- Sources/Models/FHIRAbstractBase.swift | 50 +- Sources/Models/FHIRAbstractResource.swift | 22 +- Sources/Models/FHIRServer.swift | 4 +- Sources/Models/FHIRServerResponse.swift | 8 +- Sources/Models/FHIRTypes.swift | 44 +- Sources/Models/FamilyMemberHistory.swift | 122 +- Sources/Models/Flag.swift | 40 +- Sources/Models/Goal.swift | 86 +- Sources/Models/Group.swift | 92 +- Sources/Models/HealthcareService.swift | 150 +-- Sources/Models/HumanName.swift | 44 +- Sources/Models/Identifier.swift | 32 +- Sources/Models/ImagingObjectSelection.swift | 114 +- Sources/Models/ImagingStudy.swift | 152 +-- Sources/Models/Immunization.swift | 162 +-- .../Models/ImmunizationRecommendation.swift | 94 +- Sources/Models/ImplementationGuide.swift | 210 ++-- Sources/Models/List.swift | 82 +- Sources/Models/Location.swift | 74 +- Sources/Models/Media.swift | 56 +- Sources/Models/Medication.swift | 102 +- Sources/Models/MedicationAdministration.swift | 110 +- Sources/Models/MedicationDispense.swift | 156 +-- Sources/Models/MedicationOrder.swift | 182 +-- Sources/Models/MedicationStatement.swift | 130 +-- Sources/Models/MessageHeader.swift | 114 +- Sources/Models/Meta.swift | 30 +- Sources/Models/Money.swift | 4 +- Sources/Models/NamingSystem.swift | 96 +- Sources/Models/Narrative.swift | 16 +- Sources/Models/NutritionOrder.swift | 204 ++-- Sources/Models/Observation.swift | 226 ++-- Sources/Models/OperationDefinition.swift | 160 +-- Sources/Models/OperationOutcome.swift | 40 +- Sources/Models/Order.swift | 58 +- Sources/Models/OrderResponse.swift | 36 +- Sources/Models/Organization.swift | 62 +- Sources/Models/Parameters.swift | 164 +-- Sources/Models/Patient.swift | 164 +-- Sources/Models/PaymentNotice.swift | 48 +- Sources/Models/PaymentReconciliation.swift | 116 +- Sources/Models/Period.swift | 16 +- Sources/Models/Person.swift | 62 +- Sources/Models/Practitioner.swift | 104 +- Sources/Models/Procedure.swift | 128 +- Sources/Models/ProcedureRequest.swift | 80 +- Sources/Models/ProcessRequest.swift | 86 +- Sources/Models/ProcessResponse.swift | 74 +- Sources/Models/Provenance.swift | 112 +- Sources/Models/Quantity.swift | 28 +- Sources/Models/Questionnaire.swift | 122 +- Sources/Models/QuestionnaireResponse.swift | 154 +-- Sources/Models/Range.swift | 16 +- Sources/Models/Ratio.swift | 16 +- Sources/Models/Reference.swift | 16 +- Sources/Models/ReferralRequest.swift | 72 +- Sources/Models/RelatedPerson.swift | 48 +- Sources/Models/Resource.swift | 24 +- Sources/Models/RiskAssessment.swift | 86 +- Sources/Models/SampledData.swift | 36 +- Sources/Models/Schedule.swift | 28 +- Sources/Models/SearchParameter.swift | 84 +- Sources/Models/Signature.swift | 32 +- Sources/Models/Slot.swift | 40 +- Sources/Models/Specimen.swift | 136 +-- Sources/Models/StructureDefinition.swift | 166 +-- Sources/Models/Subscription.swift | 62 +- Sources/Models/Substance.swift | 64 +- Sources/Models/SupplyDelivery.swift | 52 +- Sources/Models/SupplyRequest.swift | 66 +- Sources/Models/TestScript.swift | 444 +++---- Sources/Models/Timing.swift | 80 +- Sources/Models/ValueSet.swift | 340 +++--- Sources/Models/VisionPrescription.swift | 106 +- Tests/ModelTests/AccountTests.swift | 2 +- .../ModelTests/AllergyIntoleranceTests.swift | 2 +- .../ModelTests/AppointmentResponseTests.swift | 2 +- Tests/ModelTests/AppointmentTests.swift | 2 +- Tests/ModelTests/AuditEventTests.swift | 2 +- Tests/ModelTests/BasicTests.swift | 2 +- Tests/ModelTests/BinaryTests.swift | 2 +- Tests/ModelTests/BodySiteTests.swift | 2 +- Tests/ModelTests/BundleTests.swift | 2 +- Tests/ModelTests/CarePlanTests.swift | 2 +- Tests/ModelTests/ClaimResponseTests.swift | 2 +- Tests/ModelTests/ClaimTests.swift | 2 +- .../ModelTests/ClinicalImpressionTests.swift | 2 +- .../CommunicationRequestTests.swift | 2 +- Tests/ModelTests/CommunicationTests.swift | 2 +- Tests/ModelTests/CompositionTests.swift | 2 +- Tests/ModelTests/ConceptMapTests.swift | 2 +- Tests/ModelTests/ConditionTests.swift | 2 +- Tests/ModelTests/ConformanceTests.swift | 2 +- Tests/ModelTests/ContractTests.swift | 2 +- Tests/ModelTests/CoverageTests.swift | 2 +- Tests/ModelTests/DataElementTests.swift | 2 +- Tests/ModelTests/DetectedIssueTests.swift | 2 +- Tests/ModelTests/DeviceComponentTests.swift | 2 +- Tests/ModelTests/DeviceMetricTests.swift | 2 +- Tests/ModelTests/DeviceTests.swift | 2 +- Tests/ModelTests/DeviceUseRequestTests.swift | 2 +- .../ModelTests/DeviceUseStatementTests.swift | 2 +- Tests/ModelTests/DiagnosticOrderTests.swift | 2 +- Tests/ModelTests/DiagnosticReportTests.swift | 2 +- Tests/ModelTests/DocumentManifestTests.swift | 2 +- Tests/ModelTests/DocumentReferenceTests.swift | 2 +- .../ModelTests/EligibilityRequestTests.swift | 2 +- .../ModelTests/EligibilityResponseTests.swift | 2 +- Tests/ModelTests/EncounterTests.swift | 2 +- Tests/ModelTests/EnrollmentRequestTests.swift | 2 +- .../ModelTests/EnrollmentResponseTests.swift | 2 +- Tests/ModelTests/EpisodeOfCareTests.swift | 2 +- .../ExplanationOfBenefitTests.swift | 2 +- .../ModelTests/FamilyMemberHistoryTests.swift | 2 +- Tests/ModelTests/FlagTests.swift | 2 +- Tests/ModelTests/GoalTests.swift | 2 +- Tests/ModelTests/GroupTests.swift | 2 +- Tests/ModelTests/HealthcareServiceTests.swift | 2 +- .../ImagingObjectSelectionTests.swift | 2 +- Tests/ModelTests/ImagingStudyTests.swift | 2 +- .../ImmunizationRecommendationTests.swift | 2 +- Tests/ModelTests/ImmunizationTests.swift | 2 +- .../ModelTests/ImplementationGuideTests.swift | 2 +- Tests/ModelTests/ListTests.swift | 2 +- Tests/ModelTests/LocationTests.swift | 2 +- Tests/ModelTests/MediaTests.swift | 2 +- Tests/ModelTests/MedicationOrderTests.swift | 2 +- Tests/ModelTests/MedicationTests.swift | 2 +- Tests/ModelTests/MessageHeaderTests.swift | 2 +- Tests/ModelTests/NamingSystemTests.swift | 2 +- Tests/ModelTests/NutritionOrderTests.swift | 2 +- Tests/ModelTests/ObservationTests.swift | 2 +- .../ModelTests/OperationDefinitionTests.swift | 2 +- Tests/ModelTests/OperationOutcomeTests.swift | 2 +- Tests/ModelTests/OrderResponseTests.swift | 2 +- Tests/ModelTests/OrderTests.swift | 2 +- Tests/ModelTests/OrganizationTests.swift | 2 +- Tests/ModelTests/ParametersTests.swift | 2 +- Tests/ModelTests/PatientTests.swift | 2 +- Tests/ModelTests/PaymentNoticeTests.swift | 2 +- .../PaymentReconciliationTests.swift | 2 +- Tests/ModelTests/PersonTests.swift | 2 +- Tests/ModelTests/PractitionerTests.swift | 2 +- Tests/ModelTests/ProcedureRequestTests.swift | 2 +- Tests/ModelTests/ProcedureTests.swift | 2 +- Tests/ModelTests/ProcessRequestTests.swift | 2 +- Tests/ModelTests/ProcessResponseTests.swift | 2 +- Tests/ModelTests/ProvenanceTests.swift | 2 +- .../QuestionnaireResponseTests.swift | 2 +- Tests/ModelTests/QuestionnaireTests.swift | 2 +- Tests/ModelTests/ReferralRequestTests.swift | 2 +- Tests/ModelTests/RelatedPersonTests.swift | 2 +- Tests/ModelTests/RiskAssessmentTests.swift | 2 +- Tests/ModelTests/ScheduleTests.swift | 2 +- Tests/ModelTests/SearchParameterTests.swift | 2 +- Tests/ModelTests/SlotTests.swift | 2 +- Tests/ModelTests/SpecimenTests.swift | 2 +- .../ModelTests/StructureDefinitionTests.swift | 2 +- Tests/ModelTests/SubscriptionTests.swift | 2 +- Tests/ModelTests/SubstanceTests.swift | 2 +- Tests/ModelTests/SupplyDeliveryTests.swift | 2 +- Tests/ModelTests/SupplyRequestTests.swift | 2 +- Tests/ModelTests/TestScriptTests.swift | 2 +- Tests/ModelTests/ValueSetTests.swift | 2 +- .../ModelTests/VisionPrescriptionTests.swift | 2 +- Tests/ModelTests/XCTestCase+FHIR.swift | 2 +- Tests/ReferenceTests.swift | 48 +- Tests/RequestTests.swift | 6 +- Tests/ResourceTests.swift | 18 +- fhir-parser | 2 +- 234 files changed, 6861 insertions(+), 6851 deletions(-) diff --git a/Sources/Client/FHIROpenServer.swift b/Sources/Client/FHIROpenServer.swift index 1825c316..a01b4aab 100644 --- a/Sources/Client/FHIROpenServer.swift +++ b/Sources/Client/FHIROpenServer.swift @@ -22,7 +22,7 @@ These methods are of interest to you when you create a subclass: - `handlerForRequest(ofType:resource:)`: what kind of handler your server wants to use. Returns `FHIRServerJSONRequestHandler`. - `configurableRequest(forURL:)`: the SMART framework returns a request that already has an Authorization headers set, if needed. */ -public class FHIROpenServer: FHIRServer { +open class FHIROpenServer: FHIRServer { /// The server's base URL. public final let baseURL: URL @@ -34,7 +34,7 @@ public class FHIROpenServer: FHIRServer { /** Main initializer. Makes sure the base URL ends with a "/" to facilitate URL generation later on. */ - public required init(baseURL base: URL, auth: [String: AnyObject]? = nil) { + public required init(baseURL base: URL, auth: [String: Any]? = nil) { if let last = base.absoluteString.characters.last, last != "/" { baseURL = base.appendingPathComponent("/") } @@ -51,7 +51,7 @@ public class FHIROpenServer: FHIRServer { A chance for subclasses to mess with URL generation if needed. */ - public func absoluteURLForPath(_ path: String, handler: FHIRServerRequestHandler) -> URL? { + open func absoluteURLForPath(_ path: String, handler: FHIRServerRequestHandler) -> URL? { return URL(string: path, relativeTo: baseURL) } @@ -61,13 +61,13 @@ public class FHIROpenServer: FHIRServer { /** Perform a request of given type against the given path with the (optional) given resource and headers. */ - public func performRequest(ofType type: FHIRRequestType, path: String, resource: Resource?, additionalHeaders: FHIRRequestHeaders? = nil, callback: ((response: FHIRServerResponse) -> Void)) { - if let handler = handlerForRequest(ofType: type, resource: resource, headers: additionalHeaders) { + open func performRequest(ofType type: FHIRRequestType, path: String, resource: Resource?, additionalHeaders: FHIRRequestHeaders? = nil, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { + if let handler = handlerForRequest(type, resource: resource, headers: additionalHeaders) { performRequest(againstPath: path, handler: handler, callback: callback) } else { let res = FHIRServerRequestHandler.noneAvailable(forType: type) - callback(response: res) + callback(res) } } @@ -83,8 +83,8 @@ public class FHIROpenServer: FHIRServer { - parameter resource: The resource to be involved in the request, if any - returns: An appropriate `FHIRServerRequestHandler`, for example a _FHIRServerJSONRequestHandler_ if sending and receiving JSON */ - public func handlerForRequest(ofType: FHIRRequestType, resource: Resource?, headers: FHIRRequestHeaders? = nil) -> FHIRServerRequestHandler? { - let handler = FHIRServerJSONRequestHandler(ofType, resource: resource) + open func handlerForRequest(_ ofType: FHIRRequestType, resource: Resource?, headers: FHIRRequestHeaders? = nil) -> FHIRServerRequestHandler? { + let handler = FHIRServerJSONRequestHandler(type: ofType, resource: resource) if let headers = headers { handler.add(headers: headers) } @@ -96,7 +96,7 @@ public class FHIROpenServer: FHIRServer { - parameter forURL: The url to use for the request */ - public func configurableRequest(forURL url: URL) -> URLRequest { + open func configurableRequest(forURL url: URL) -> URLRequest { return URLRequest(url: url) } @@ -108,10 +108,10 @@ public class FHIROpenServer: FHIRServer { - parameter handler: The RequestHandler that prepares the request and processes the response - parameter callback: The callback to execute; NOT guaranteed to be performed on the main thread! */ - public func performRequest(againstPath path: String, handler: R, callback: ((response: FHIRServerResponse) -> Void)) { + open func performRequest(againstPath path: String, handler: R, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { guard let url = absoluteURLForPath(path, handler: handler) else { let res = handler.notSent("Failed to parse path «\(path)» relative to server base URL") - callback(response: res) + callback(res) return } performRequest(withURL: url, handler: handler, callback: callback) @@ -124,14 +124,14 @@ public class FHIROpenServer: FHIRServer { - parameter handler: The RequestHandler that prepares the request and processes the response - parameter callback: The callback to execute; NOT guaranteed to be performed on the main thread! */ - public func performRequest(withURL url: URL, handler: R, callback: ((response: FHIRServerResponse) -> Void)) { + open func performRequest(withURL url: URL, handler: R, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { var request = configurableRequest(forURL: url) do { try handler.prepare(request: &request) self.performPreparedRequest(request, handler: handler, callback: callback) } catch let error { - callback(response: handler.notSent("Failed to prepare request against \(url): \(error)")) + callback(handler.notSent("Failed to prepare request against \(url): \(error)")) } } @@ -145,7 +145,7 @@ public class FHIROpenServer: FHIRServer { - parameter handler: The RequestHandler that prepares the request and processes the response - parameter callback: The callback to execute; NOT guaranteed to be performed on the main thread! */ - public func performPreparedRequest(_ request: URLRequest, handler: R, callback: ((response: FHIRServerResponse) -> Void)) { + open func performPreparedRequest(_ request: URLRequest, handler: R, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { performPreparedRequest(request, withSession: URLSession(), handler: handler, callback: callback) } @@ -157,10 +157,10 @@ public class FHIROpenServer: FHIRServer { - parameter handler: The RequestHandler that prepares the request and processes the response - parameter callback: The callback to execute; NOT guaranteed to be performed on the main thread! */ - public func performPreparedRequest(_ request: URLRequest, withSession session: URLSession, handler: R, callback: ((response: FHIRServerResponse) -> Void)) { + open func performPreparedRequest(_ request: URLRequest, withSession session: URLSession, handler: R, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { let task = session.dataTask(with: request) { data, response, error in - let res = handler.response(response: response, data: data, error: error) - callback(response: res) + let res = handler.response(response, data: data, error: error as NSError?) + callback(res) } task.resume() } @@ -177,7 +177,7 @@ public class FHIROpenServer: FHIRServer { } } - public func didSetConformance(_ conformance: Conformance) { + open func didSetConformance(_ conformance: Conformance) { // look at ConformanceRest entries for security and operation information if let rests = conformance.rest { @@ -199,7 +199,7 @@ public class FHIROpenServer: FHIRServer { } } - public func didFindConformanceRestStatement(_ rest: ConformanceRest) { + open func didFindConformanceRestStatement(_ rest: ConformanceRest) { if let operations = rest.operation { conformanceOperations = operations } @@ -209,9 +209,9 @@ public class FHIROpenServer: FHIRServer { Executes a `read` action against the server's "metadata" path, as returned from `conformancePath()`, which should return the Conformance statement. */ - final func getConformance(_ callback: (error: FHIRError?) -> ()) { + final func getConformance(_ callback: @escaping (_ error: FHIRError?) -> ()) { if nil != conformance { - callback(error: nil) + callback(nil) return } @@ -219,10 +219,10 @@ public class FHIROpenServer: FHIRServer { Conformance.readFrom(conformancePath(), server: self) { resource, error in if let conf = resource as? Conformance { self.conformance = conf - callback(error: nil) + callback(nil) } else { - callback(error: error ?? FHIRError.error("Conformance.readFrom() did not return a Conformance instance but \(resource)")) + callback(error ?? FHIRError.error("Conformance.readFrom() did not return a Conformance instance but \(resource)")) } } } @@ -230,7 +230,7 @@ public class FHIROpenServer: FHIRServer { /** Return the relative path to the Conformance statement. This should be "metadata", we're also adding "_summary=true" to only request the summary, not the entire statement. */ - public func conformancePath() -> String { + open func conformancePath() -> String { return "metadata?_summary=true" } @@ -261,7 +261,7 @@ public class FHIROpenServer: FHIRServer { Once an OperationDefinition has been retrieved, it is cached into the instance's `operations` dictionary. Must be used after the conformance statement has been fetched, i.e. after using `ready` or `getConformance`. */ - public func operation(_ name: String, callback: ((OperationDefinition?) -> Void)) { + open func operation(_ name: String, callback: @escaping ((OperationDefinition?) -> Void)) { if let op = operations?[name] { callback(op) } @@ -293,7 +293,7 @@ public class FHIROpenServer: FHIRServer { - parameter operation: The operation instance to perform - parameter callback: The callback to call when the request ends (success or failure) */ - public func perform(operation: FHIROperation, callback: ((response: FHIRServerResponse) -> Void)) { + open func perform(_ operation: FHIROperation, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { self.operation(operation.name) { definition in if let def = definition { do { @@ -301,11 +301,11 @@ public class FHIROpenServer: FHIRServer { try operation.perform(onServer: self, callback: callback) } catch let error { - callback(response: FHIRServerJSONResponse(error: error)) + callback(FHIRServerJSONResponse(error: error)) } } else { - callback(response: FHIRServerJSONResponse(error: FHIRError.operationNotSupported(operation.name))) + callback(FHIRServerJSONResponse(error: FHIRError.operationNotSupported(operation.name))) } } } @@ -321,7 +321,7 @@ public class FHIROpenServer: FHIRServer { } /** Create the server's default session. Override in subclasses to customize URLSession behavior. */ - public func createDefaultSession() -> URLSession { + open func createDefaultSession() -> URLSession { return Foundation.URLSession.shared } diff --git a/Sources/Client/FHIROperation.swift b/Sources/Client/FHIROperation.swift index 00c693e9..3081e6fb 100644 --- a/Sources/Client/FHIROperation.swift +++ b/Sources/Client/FHIROperation.swift @@ -23,7 +23,7 @@ public enum FHIROperationContext { /** Named operations to be performed against a FHIR REST endpoint. */ -public class FHIROperation: CustomStringConvertible { +open class FHIROperation: CustomStringConvertible { /// The name of the operation. let name: String @@ -47,7 +47,7 @@ public class FHIROperation: CustomStringConvertible { var instance: Resource? { didSet { if let inst = instance { - type = inst.dynamicType + type = type(of: inst) context = .instance } } @@ -65,7 +65,7 @@ public class FHIROperation: CustomStringConvertible { - parameter with: The OperationDefinition with which to validate the operation */ - public func validate(with definition: OperationDefinition) throws { + open func validate(with definition: OperationDefinition) throws { try validateContext(with: definition) try validateInParams(with: definition) } @@ -87,7 +87,7 @@ public class FHIROperation: CustomStringConvertible { if nil == definition.type { throw FHIRError.operationConfigurationError("Operation \(self) cannot be executed in type context") } - else if nil == type || !(definition.type!).contains(type!.resourceName) { + else if nil == type || !(definition.type!).contains(type!.resourceType) { throw FHIRError.operationConfigurationError("Operation \(self) cannot be executed against \(type ?? nil) type") } case .instance: @@ -116,7 +116,7 @@ public class FHIROperation: CustomStringConvertible { if "in" == param.use { // have the parameter, validate it - if let _: AnyObject = inParams?[param.name!] { + if let _ = inParams?[param.name!] { leftover.removeValue(forKey: param.name!) // TODO: actually validate! @@ -144,14 +144,14 @@ public class FHIROperation: CustomStringConvertible { /** Return the relative server URL the operation will call. */ - public func serverPath() throws -> String { + open func serverPath() throws -> String { switch context { case .none: throw FHIRError.operationConfigurationError("Operation \(self) has not been properly set up") case .system: return "$\(name)" case .resourceType: - return "\(type!.resourceName)/$\(name)" + return "\(type!.resourceType)/$\(name)" case .instance: let path = try instance!.relativeURLPath() return "\(path)/$\(name)" @@ -163,7 +163,7 @@ public class FHIROperation: CustomStringConvertible { - parameter on Server: The server on which to perform the operation */ - public func perform(onServer server: FHIRServer, callback: ((response: FHIRServerResponse) -> Void)) throws { + open func perform(onServer server: FHIRServer, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) throws { let path = try serverPath() server.performRequest(ofType: .GET, path: path, resource: nil, additionalHeaders: nil, callback: callback) } @@ -171,7 +171,7 @@ public class FHIROperation: CustomStringConvertible { // MARK: - Printable - public var description: String { + open var description: String { return "" } } diff --git a/Sources/Client/FHIRSearch.swift b/Sources/Client/FHIRSearch.swift index 02bff251..d759f5d7 100644 --- a/Sources/Client/FHIRSearch.swift +++ b/Sources/Client/FHIRSearch.swift @@ -23,19 +23,19 @@ import Models "Patient?address=Boston&gender=male&given:exact=Willis" */ -public class FHIRSearch +open class FHIRSearch { /// Search must define a resource type to which the search is applied. - public var profileType: Resource.Type? + open var profileType: Resource.Type? /// The query construct used to describe the search let query: FHIRSearchConstruct /// The sorting to request. Use tuples with the value followed by "asc" or "desc": [("given", "asc"), ("family", "asc")]. - public var sort: [(String, String)]? + open var sort: [(String, String)]? /// The number of results to return per page; leave nil to let the server decide. - public var pageCount: Int? + open var pageCount: Int? /// The URL to retrieve the next page of results from; nil if there are no more results. var nextPageURL: URL? @@ -43,18 +43,18 @@ public class FHIRSearch var busy = false /// Returns true if there are more search results to be fetched. - public var hasMore: Bool { + open var hasMore: Bool { return (nil != nextPageURL) } /** Designated initializer. */ - public init(query: AnyObject) { + public init(query: Any) { self.query = FHIRSearchConstruct(construct: query) } /** Convenience initializer. */ - public convenience init(type: Resource.Type, query: AnyObject) { + public convenience init(type: Resource.Type, query: Any) { self.init(query: query) profileType = type } @@ -69,7 +69,7 @@ public class FHIRSearch /** Creates the relative server path and query URL string. */ - public func construct() -> String { + open func construct() -> String { var extra = [FHIRURLParam]() if let count = pageCount { extra.append(FHIRURLParam(name: "_count", value: "\(count)")) @@ -84,9 +84,9 @@ public class FHIRSearch let qry = query.expand(extra) if let type = profileType { if qry.characters.count > 0 { - return "\(type.resourceName)?\(qry)" + return "\(type.resourceType)?\(qry)" } - return type.resourceName + return type.resourceType } if qry.characters.count > 0 { return "?\(qry)" @@ -103,9 +103,9 @@ public class FHIRSearch - parameter server: The FHIRServer instance on which to perform the search - parameter callback: The callback, receives the response Bundle or an NSError message describing what went wrong */ - public func perform(_ server: FHIRServer, callback: ((bundle: Bundle?, error: FHIRError?) -> Void)) { + open func perform(_ server: FHIRServer, callback: @escaping ((_ bundle: Bundle?, _ error: FHIRError?) -> Void)) { if nil == profileType { - callback(bundle: nil, error: FHIRError.searchResourceTypeNotDefined) + callback(nil, FHIRError.searchResourceTypeNotDefined) return } @@ -120,18 +120,18 @@ public class FHIRSearch - parameter server: The FHIRServer instance on which to perform the search - parameter callback: The callback, receives the response Bundle or an NSError message describing what went wrong */ - public func nextPage(_ server: FHIRServer, callback: ((bundle: Bundle?, error: FHIRError?) -> Void)) { + open func nextPage(_ server: FHIRServer, callback: @escaping ((_ bundle: Bundle?, _ error: FHIRError?) -> Void)) { if let next = nextPageURL?.absoluteString { performSearch(server, queryPath: next, callback: callback) } else { - callback(bundle: nil, error: nil) + callback(nil, nil) } } - func performSearch(_ server: FHIRServer, queryPath: String, callback: ((bundle: Bundle?, error: FHIRError?) -> Void)) { + func performSearch(_ server: FHIRServer, queryPath: String, callback: @escaping ((_ bundle: Bundle?, _ error: FHIRError?) -> Void)) { if busy { - callback(bundle: nil, error: nil) + callback(nil, nil) return } @@ -140,7 +140,7 @@ public class FHIRSearch self.busy = false if let error = response.error { - callback(bundle: nil, error: error) + callback(nil, error) } else { let jsonres = response as! FHIRServerJSONResponse @@ -163,7 +163,7 @@ public class FHIRSearch } } - callback(bundle: bundle, error: nil) + callback(bundle, nil) } } } @@ -221,7 +221,7 @@ class FHIRSearchParam: CustomStringConvertible } /** Instantiate from any object, delegating to FHIRSearchConstruct to figure out what the object means. */ - class func from(_ any: AnyObject, parent: FHIRSearchParam?) -> [FHIRSearchParam] { + class func from(_ any: Any, parent: FHIRSearchParam?) -> [FHIRSearchParam] { if let str = any as? String { return [FHIRSearchParam(value: str, parent: parent)] } @@ -289,9 +289,9 @@ struct FHIRSearchConstruct } - let construct: AnyObject + let construct: Any - init(construct: AnyObject) { + init(construct: Any) { self.construct = construct } @@ -313,7 +313,7 @@ struct FHIRSearchConstruct func prepare(_ parent: FHIRSearchParam?) -> [FHIRSearchParam] { var arr = [FHIRSearchParam]() - if let myarr = construct as? [AnyObject] { + if let myarr = construct as? [Any] { for any in myarr { let sub = FHIRSearchConstruct(construct: any) arr.append(contentsOf: sub.prepare(nil)) @@ -321,18 +321,18 @@ struct FHIRSearchConstruct return arr } - if let dict = construct as? [String: AnyObject] { + if let dict = construct as? [String: Any] { for (key, val) in dict { //println("-> \(key): \(val)") let param = FHIRSearchParam(name: key, parent: parent) // special handling? - if let handler = self.dynamicType.handlerFor(key) { + if let handler = type(of: self).handlerFor(key) { handler.handle(param, value: val) } // this is a sub-structure, expand - else if let dict = val as? [String: AnyObject] { + else if let dict = val as? [String: Any] { let construct = FHIRSearchConstruct(construct: dict) param.children = construct.prepare(param) } @@ -360,7 +360,7 @@ struct FHIRSearchConstruct protocol FHIRSearchConstructHandler { func handles(_ key: String) -> Bool - func handle(_ param: FHIRSearchParam, value: AnyObject) + func handle(_ param: FHIRSearchParam, value: Any) } @@ -370,8 +370,8 @@ struct FHIRSearchConstructAndHandler: FHIRSearchConstructHandler return ("$and" == key) } - func handle(_ param: FHIRSearchParam, value: AnyObject) { - if let arr = value as? [AnyObject] { + func handle(_ param: FHIRSearchParam, value: Any) { + if let arr = value as? [Any] { param.name = nil var ret = [FHIRSearchParam]() for obj in arr { @@ -398,8 +398,8 @@ struct FHIRSearchConstructOrHandler: FHIRSearchConstructHandler return ("$or" == key) } - func handle(_ param: FHIRSearchParam, value: AnyObject) { - if let arr = value as? [AnyObject] { + func handle(_ param: FHIRSearchParam, value: Any) { + if let arr = value as? [Any] { var strs = [String]() for obj in arr { if let str = obj as? String { @@ -434,7 +434,7 @@ struct FHIRSearchConstructModifierHandler: FHIRSearchConstructHandler return FHIRSearchConstructModifierHandler.map.keys.contains(key) } - func handle(_ param: FHIRSearchParam, value: AnyObject) { + func handle(_ param: FHIRSearchParam, value: Any) { if let modifier = FHIRSearchConstructModifierHandler.map[param.name ?? ""] { param.name = modifier param.isModifier = true @@ -460,7 +460,7 @@ struct FHIRSearchConstructOperatorHandler: FHIRSearchConstructHandler return FHIRSearchConstructOperatorHandler.map.keys.contains(key) } - func handle(_ param: FHIRSearchParam, value: AnyObject) { + func handle(_ param: FHIRSearchParam, value: Any) { if let modifier = FHIRSearchConstructOperatorHandler.map[param.name!] { if let str = value as? String { param.name = nil @@ -480,7 +480,7 @@ struct FHIRSearchConstructTypeHandler: FHIRSearchConstructHandler return ("$type" == key) } - func handle(_ param: FHIRSearchParam, value: AnyObject) { + func handle(_ param: FHIRSearchParam, value: Any) { if let type = value as? String { if let parent = param.parent { parent.name = (parent.name ?? "") + ":\(type)" diff --git a/Sources/Client/FHIRServerDataResponse.swift b/Sources/Client/FHIRServerDataResponse.swift index 780a1806..c6be1093 100644 --- a/Sources/Client/FHIRServerDataResponse.swift +++ b/Sources/Client/FHIRServerDataResponse.swift @@ -22,7 +22,7 @@ extension FHIRServerResponse { - parameter resource: The resource to apply response data to */ - public func applyHeadersTo(resource: Resource) throws { + public func applyHeaders(to resource: Resource) throws { // inspect Location header to update `id` and `meta`. It has the form "Location: [base]/[type]/[id]/_history/[vid]" if let location = headers["Location"] { @@ -30,8 +30,8 @@ extension FHIRServerResponse { if location.hasPrefix(base) { let path = location.replacingOccurrences(of: base, with: "") let components = path.components(separatedBy: "/") - guard components.count > 1 && resource.dynamicType.resourceName == components[0] else { - throw FHIRError.responseLocationHeaderResourceTypeMismatch(location, resource.dynamicType.resourceName) + guard components.count > 1 && type(of: resource).resourceType == components[0] else { + throw FHIRError.responseLocationHeaderResourceTypeMismatch(location, type(of: resource).resourceType) } resource.id = components[1] @@ -87,27 +87,27 @@ extension FHIRServerResponse { Encapsulates a server response, which can also indicate that there was no response or not even a request, in which case the `error` property carries the only useful information. */ -public class FHIRServerDataResponse: FHIRServerResponse { +open class FHIRServerDataResponse: FHIRServerResponse { /// The HTTP status code. - public let status: Int + open let status: Int /// Response headers. - public let headers: [String: String] + open let headers: [String: String] /// The response body data. - public var body: Data? + open var body: Data? /// The request's operation outcome, if any. - public internal(set) var outcome: OperationOutcome? + open internal(set) var outcome: OperationOutcome? /// The error encountered, if any. - public var error: FHIRError? + open var error: FHIRError? /** Instantiate a FHIRServerResponse from an NS(HTTP)URLResponse, NSData and an optional NSError. */ - public required init(response: URLResponse, data: Data?, urlError: NSError?) { + public required init(response: URLResponse, data: Data?, error: Error?) { var status = 0 var headers = [String: String]() @@ -127,11 +127,11 @@ public class FHIRServerDataResponse: FHIRServerResponse { } // was there an error? - if let error = urlError, NSURLErrorDomain == error.domain { + if let error = error as? NSError, NSURLErrorDomain == error.domain { self.error = FHIRError.requestError(status, NSURLErrorHumanize(error)) } - else if let error = urlError { - self.error = FHIRError.error(error.description) + else if let error = error { + self.error = FHIRError.error("\(error)") } self.status = status @@ -156,12 +156,12 @@ public class FHIRServerDataResponse: FHIRServerResponse { // MARK: - Responses - public func responseResource(_ expectType: T.Type) -> T? { + open func responseResource(_ expectType: T.Type) -> T? { return nil } /** Initializes with a no-response error. */ - public class func noneReceived() -> Self { + open class func noneReceived() -> Self { return self.init(error: FHIRError.noResponseReceived) } @@ -171,7 +171,7 @@ public class FHIRServerDataResponse: FHIRServerResponse { - parameter resource: The resource to apply the response data to */ - public func applyBodyTo(resource: Resource) throws { + open func applyBody(to resource: Resource) throws { guard nil != body else { throw FHIRError.responseNoResourceReceived } @@ -182,16 +182,16 @@ public class FHIRServerDataResponse: FHIRServerResponse { /** Encapsulates a server response with JSON response body, if any. */ -public class FHIRServerJSONResponse: FHIRServerDataResponse { +open class FHIRServerJSONResponse: FHIRServerDataResponse { /// The response body, decoded into a FHIRJSON - public var json: FHIRJSON? + open var json: FHIRJSON? /** If the status is >= 400, the response body is checked for an OperationOutcome and its first issue item is turned into an error message. */ - public required init(response: URLResponse, data inData: Data?, urlError: NSError?) { - super.init(response: response, data: inData, urlError: urlError) + public required init(response: URLResponse, data inData: Data?, error: Error?) { + super.init(response: response, data: inData, error: error) // parse data as JSON if let data = inData, data.count > 0 { @@ -213,7 +213,7 @@ public class FHIRServerJSONResponse: FHIRServerDataResponse { } catch let error as NSError { // Cocoa error 3840 is JSON parsing error; some error responses may not return JSON, don't report an error on those - if 3840 != error.code || NSCocoaErrorDomain != (error.domain ?? "") || status < 400 { + if 3840 != error.code || NSCocoaErrorDomain != error.domain || status < 400 { let raw = NSString(data: data, encoding: String.Encoding.utf8.rawValue) as? String ?? "" self.error = FHIRError.jsonParsingError(error.localizedDescription, raw) } @@ -235,9 +235,9 @@ public class FHIRServerJSONResponse: FHIRServerDataResponse { Uses FHIRElement's factory method to instantiate a resource from the response JSON, if any, and returns that resource if it is indeed of the expected type. */ - public override func responseResource(_ expectType: T.Type) -> T? { + open override func responseResource(_ expectType: T.Type) -> T? { if let json = json { - let resource = Resource.instantiate(fromJSON: json, owner: nil) + let resource = Resource.instantiate(from: json, owner: nil) return resource as? T } return nil @@ -251,15 +251,15 @@ public class FHIRServerJSONResponse: FHIRServerDataResponse { - parameter resource: The resource to apply the response data to */ - public override func applyBodyTo(resource: Resource) throws { + open override func applyBody(to resource: Resource) throws { guard let json = json else { throw FHIRError.responseNoResourceReceived } - if let resourceType = json["resourceType"] as? String, resourceType != resource.dynamicType.resourceName { - throw FHIRError.responseResourceTypeMismatch(resourceType, resource.dynamicType.resourceName) + if let resourceType = json["resourceType"] as? String, resourceType != type(of: resource).resourceType { + throw FHIRError.responseResourceTypeMismatch(resourceType, type(of: resource).resourceType) } - if let errors = resource.populate(fromJSON: json) { + if let errors = resource.populate(from: json) { for error in errors { fhir_warn("\(resource) \(error)") } diff --git a/Sources/Client/FHIRServerRequestHandler.swift b/Sources/Client/FHIRServerRequestHandler.swift index 6be681c0..9984f911 100644 --- a/Sources/Client/FHIRServerRequestHandler.swift +++ b/Sources/Client/FHIRServerRequestHandler.swift @@ -17,27 +17,27 @@ Base for different request/response handlers. Would love to make this a protocol but since it has an associated type it cannot be used nicely, hence a class. */ -public class FHIRServerRequestHandler { +open class FHIRServerRequestHandler { - public class var defaultHeaders: FHIRRequestHeaders { + open class var defaultHeaders: FHIRRequestHeaders { return FHIRRequestHeaders() } /// The HTTP type of the request. - public let type: FHIRRequestType + open let type: FHIRRequestType /// Headers to be used on the request. - public var headers: FHIRRequestHeaders + open var headers: FHIRRequestHeaders /// The data to be used in the request body. - public var data: Data? + open var data: Data? /// The receiver may hold on to a resource that supplies the request's body data. - public var resource: Resource? + open var resource: Resource? - public init(_ type: FHIRRequestType, resource: Resource? = nil) { + public init(type: FHIRRequestType, resource: Resource? = nil) { self.type = type - self.headers = self.dynamicType.defaultHeaders + self.headers = type(of: self).defaultHeaders self.resource = resource } @@ -49,7 +49,7 @@ public class FHIRServerRequestHandler { - parameter headers: The headers to add to the receiver */ - public func add(headers inHeaders: FHIRRequestHeaders) { + open func add(headers inHeaders: FHIRRequestHeaders) { var hdrs = headers inHeaders.headers.forEach() { hdrs[$0] = $1 } headers = hdrs @@ -59,7 +59,7 @@ public class FHIRServerRequestHandler { /** Prepare body data for the request. */ - public func prepareData() throws { + open func prepareData() throws { if nil == resource { return } @@ -71,13 +71,13 @@ public class FHIRServerRequestHandler { Typically the FHIRRequestType instance sets the correct HTTPMethod as well as correct FHIR headers. */ - public func prepare(request: inout URLRequest) throws { + open func prepare(request: inout URLRequest) throws { try prepareData() type.prepare(request: &request, body: data) headers.prepare(request: &request) } - public class var ResponseType: FHIRServerResponse.Type { + open class var ResponseType: FHIRServerResponse.Type { return FHIRServerDataResponse.self } @@ -87,21 +87,21 @@ public class FHIRServerRequestHandler { /** Instantiate an object of ResponseType-type based on the response and data that we get. */ - public func response(response: URLResponse?, data inData: Data? = nil, error: NSError? = nil) -> FHIRServerResponse { + open func response(_ response: URLResponse?, data inData: Data? = nil, error: Error? = nil) -> FHIRServerResponse { if let res = response { - return self.dynamicType.ResponseType.init(response: res, data: inData, urlError: error) + return type(of: self).ResponseType.init(response: res, data: inData, error: error) } if let error = error { - return self.dynamicType.ResponseType.init(error: error) + return type(of: self).ResponseType.init(error: error) } - return self.dynamicType.ResponseType.noneReceived() + return type(of: self).ResponseType.noneReceived() } /** Convenience method to indicate a request that has not actually been sent. */ - public func notSent(_ reason: String) -> FHIRServerResponse { - return self.dynamicType.ResponseType.init(error: FHIRError.requestNotSent(reason)) + open func notSent(_ reason: String) -> FHIRServerResponse { + return type(of: self).ResponseType.init(error: FHIRError.requestNotSent(reason)) } /** @@ -109,7 +109,7 @@ public class FHIRServerRequestHandler { - parameter forType: The request type */ - public class func noneAvailable(forType type: FHIRRequestType) -> FHIRServerResponse { + open class func noneAvailable(forType type: FHIRRequestType) -> FHIRServerResponse { return ResponseType.init(error: FHIRError.noRequestHandlerAvailable(type.rawValue)) } } @@ -121,16 +121,16 @@ Prepare and handle a request returning JSON data. JSON body data can be greated from the resource, if the receiver holds on to one. The header's content type for PUT and POST will be set to "application/json+fhir; charset=utf-8" no matter what. */ -public class FHIRServerJSONRequestHandler: FHIRServerRequestHandler { +open class FHIRServerJSONRequestHandler: FHIRServerRequestHandler { - override public class var defaultHeaders: FHIRRequestHeaders { + override open class var defaultHeaders: FHIRRequestHeaders { return FHIRRequestHeaders([.accept: "application/json+fhir"]) } - public var json: FHIRJSON? + open var json: FHIRJSON? - override public func prepareData() throws { + override open func prepareData() throws { guard nil == data else { return } @@ -142,7 +142,7 @@ public class FHIRServerJSONRequestHandler: FHIRServerRequestHandler { } // for GET requests we don't have data, which is fine too } - public override func prepare(request: inout URLRequest) throws { + open override func prepare(request: inout URLRequest) throws { switch type { case .PUT: headers[.contentType] = "application/json+fhir; charset=utf-8" @@ -154,7 +154,7 @@ public class FHIRServerJSONRequestHandler: FHIRServerRequestHandler { try super.prepare(request: &request) } - public override class var ResponseType: FHIRServerResponse.Type { + open override class var ResponseType: FHIRServerResponse.Type { return FHIRServerJSONResponse.self } } @@ -166,19 +166,19 @@ PRELIMINARY! Prepare and handle a request returning some type of data. If you use this as PUT/POST, you are responsible for setting the `data` property to an appropriate NSData representation. The "Accept" and "Content-Type" headers will be set to the `contentType` property */ -public class FHIRServerDataRequestHandler: FHIRServerRequestHandler { +open class FHIRServerDataRequestHandler: FHIRServerRequestHandler { - public let contentType: String + open let contentType: String init(_ type: FHIRRequestType, contentType: String) { self.contentType = contentType - super.init(type, resource: nil) + super.init(type: type, resource: nil) } - override public func prepareData() throws { + override open func prepareData() throws { } - public override func prepare(request: inout URLRequest) throws { + open override func prepare(request: inout URLRequest) throws { switch type { case .GET: headers[.accept] = contentType @@ -193,7 +193,7 @@ public class FHIRServerDataRequestHandler: FHIRServerRequestHandler { try super.prepare(request: &request) } - public override class var ResponseType: FHIRServerResponse.Type { + open override class var ResponseType: FHIRServerResponse.Type { return FHIRServerDataResponse.self } } diff --git a/Sources/Client/Reference+Resolving.swift b/Sources/Client/Reference+Resolving.swift index 62f407fd..acf12e7c 100644 --- a/Sources/Client/Reference+Resolving.swift +++ b/Sources/Client/Reference+Resolving.swift @@ -85,7 +85,7 @@ extension Reference { - parameter type: The type of the resource to expect - parameter callback: The callback to call upon success or failure, with the resolved resource or nil */ - public func resolve(_ type: T.Type, callback: ((T?) -> Void)) { + public func resolve(_ type: T.Type, callback: @escaping ((T?) -> Void)) { if let resolved = resolved(T.self) { callback(resolved) } diff --git a/Sources/Client/Resource+Instantiation.swift b/Sources/Client/Resource+Instantiation.swift index 6ea0ca6d..609c7b11 100644 --- a/Sources/Client/Resource+Instantiation.swift +++ b/Sources/Client/Resource+Instantiation.swift @@ -41,7 +41,7 @@ public extension Foundation.Bundle { public func fhir_bundledResource(_ name: String, type: T.Type) throws -> T { if let url = url(forResource: name, withExtension: "json"), let data = try? Data(contentsOf: url) { if let json = try JSONSerialization.jsonObject(with: data, options: []) as? FHIRJSON { - if let resource = Resource.instantiate(fromJSON: json, owner: nil) as? T { + if let resource = Resource.instantiate(from: json, owner: nil) as? T { return resource } throw FHIRError.responseResourceTypeMismatch(json["resourceType"] as? String ?? "Unknown", "\(T.self)") diff --git a/Sources/Client/Resource+REST.swift b/Sources/Client/Resource+REST.swift index 6cc52935..f463a6c5 100644 --- a/Sources/Client/Resource+REST.swift +++ b/Sources/Client/Resource+REST.swift @@ -13,10 +13,10 @@ import Models /// The block signature for server interaction callbacks that return an error. -public typealias FHIRErrorCallback = ((error: FHIRError?) -> Void) +public typealias FHIRErrorCallback = ((_ error: FHIRError?) -> Void) /// The block signature for most server interaction callbacks that return a resource and an error. -public typealias FHIRResourceErrorCallback = ((resource: Resource?, error: FHIRError?) -> Void) +public typealias FHIRResourceErrorCallback = ((_ resource: Resource?, _ error: FHIRError?) -> Void) /** @@ -54,7 +54,7 @@ public extension Resource { - returns: A string indicating the relative URL base, e.g. "MedicationPrescription" */ public func relativeURLBase() -> String { - return self.dynamicType.resourceName + return type(of: self).resourceType } /** @@ -90,8 +90,8 @@ public extension Resource { Forwards to class method `readFrom` with the resource's relative URL, created from the supplied id and the resource's base. */ - public class func read(_ id: String, server: FHIRServer, callback: FHIRResourceErrorCallback) { - let path = "\(resourceName)/\(id)" + public class func read(_ id: String, server: FHIRServer, callback: @escaping FHIRResourceErrorCallback) { + let path = "\(resourceType)/\(id)" readFrom(path, server: server, callback: callback) } @@ -104,15 +104,15 @@ public extension Resource { - parameter server: The server to use - parameter callback: The callback to execute once done. The callback is NOT guaranteed to be executed on the main thread! */ - public class func readFrom(_ path: String, server: FHIRServer, callback: FHIRResourceErrorCallback) { + public class func readFrom(_ path: String, server: FHIRServer, callback: @escaping FHIRResourceErrorCallback) { server.performRequest(ofType: .GET, path: path, resource: nil, additionalHeaders: nil) { response in if let error = response.error { - callback(resource: nil, error: error) + callback(nil, error) } else if let resource = response.responseResource(Resource.self) { resource._server = server do { - try response.applyHeadersTo(resource: resource) + try response.applyHeaders(to: resource) } catch let error { fhir_warn("Error applying response headers after `read` call: \(error)") @@ -120,10 +120,10 @@ public extension Resource { if nil == resource.id { resource.id = (path as NSString).lastPathComponent } - callback(resource: resource, error: nil) + callback(resource, nil) } else { - callback(resource: nil, error: FHIRError.resourceFailedToInstantiate(path)) + callback(nil, FHIRError.resourceFailedToInstantiate(path)) } } } @@ -141,9 +141,9 @@ public extension Resource { - parameter server: The server on which to create the resource - parameter callback: The callback to execute once done. The callback is NOT guaranteed to be executed on the main thread! */ - public func create(_ server: FHIRServer, callback: FHIRErrorCallback) { + public func create(_ server: FHIRServer, callback: @escaping FHIRErrorCallback) { guard nil == id else { - callback(error: FHIRError.resourceAlreadyHasId) + callback(FHIRError.resourceAlreadyHasId) return } @@ -152,13 +152,13 @@ public extension Resource { if nil == response.error { self._server = server do { - try response.applyHeadersTo(resource: self) + try response.applyHeaders(to: self) } catch let error { fhir_warn("Error applying response headers after `create` call: \(error)") } } - callback(error: response.error) + callback(response.error) } } @@ -176,9 +176,9 @@ public extension Resource { - parameter server: The server on which to create the resource - parameter callback: The callback to execute once done. The callback is NOT guaranteed to be executed on the main thread! */ - func createAndReturn(_ server: FHIRServer, callback: FHIRErrorCallback) { + func createAndReturn(_ server: FHIRServer, callback: @escaping FHIRErrorCallback) { guard nil == id else { - callback(error: FHIRError.resourceAlreadyHasId) + callback(FHIRError.resourceAlreadyHasId) return } @@ -187,22 +187,22 @@ public extension Resource { if nil == response.error { self._server = server do { - try response.applyHeadersTo(resource: self) - try response.applyBodyTo(resource: self) + try response.applyHeaders(to: self) + try response.applyBody(to: self) } // no resource, but hopefully the id was detected in the Location header, so go and read the resource catch FHIRError.responseNoResourceReceived { if let id = self.id { - self.dynamicType.read(id, server: server) { resource, error in + type(of: self).read(id, server: server) { resource, error in if let resource = resource { - _ = self.populate(fromJSON: resource.asJSON()) + _ = self.populate(from: resource.asJSON()) } - callback(error: error) + callback(error) } } else { - callback(error: FHIRError.resourceWithoutId) + callback(FHIRError.resourceWithoutId) } return } @@ -211,12 +211,12 @@ public extension Resource { // if we didn't manage to get the id one way or the other, we have a problem if nil == self.id { - callback(error: FHIRError.resourceWithoutId) + callback(FHIRError.resourceWithoutId) return } } } - callback(error: response.error) + callback(response.error) } } @@ -227,26 +227,26 @@ public extension Resource { - parameter callback: The callback to execute once done. The callback is NOT guaranteed to be executed on the main thread! */ - public func update(callback: FHIRErrorCallback) { + public func update(_ callback: @escaping FHIRErrorCallback) { if let server = _server { do { let path = try relativeURLPath() server.performRequest(ofType: .PUT, path: path, resource: self, additionalHeaders: nil) { response in do { - try response.applyHeadersTo(resource: self) + try response.applyHeaders(to: self) } catch let error { fhir_warn("Error applying response headers after `update` call: \(error)") } - callback(error: response.error) + callback(response.error) } } catch let error { - callback(error: (error as! FHIRError)) + callback((error as! FHIRError)) } } else { - callback(error: FHIRError.resourceWithoutServer) + callback(FHIRError.resourceWithoutServer) } } @@ -255,18 +255,18 @@ public extension Resource { This method forwards to the `delete` class method, substituting the receiver's path and server. */ - public func delete(callback: FHIRErrorCallback) { + public func delete(_ callback: @escaping FHIRErrorCallback) { if let server = _server { do { let path = try relativeURLPath() - self.dynamicType.delete(path, server: server, callback: callback) + type(of: self).delete(path, server: server, callback: callback) } catch let error { - callback(error: (error as! FHIRError)) + callback((error as! FHIRError)) } } else { - callback(error: FHIRError.resourceWithoutServer) + callback(FHIRError.resourceWithoutServer) } } @@ -275,10 +275,10 @@ public extension Resource { This implementation issues a DELETE call against the given path on the given server. */ - public class func delete(_ path: String, server: FHIRServer, callback: FHIRErrorCallback) { + public class func delete(_ path: String, server: FHIRServer, callback: @escaping FHIRErrorCallback) { server.performRequest(ofType: .DELETE, path: path, resource: nil, additionalHeaders: nil) { response in // TODO: should we do some header inspection (response.headers)? - callback(error: response.error) + callback(response.error) } } @@ -290,18 +290,18 @@ public extension Resource { UNFINISHED. */ - public func search(_ query: AnyObject) -> FHIRSearch { + public func search(_ query: Any) -> FHIRSearch { if let _ = self.id { NSLog("UNFINISHED, must add '_id' reference to search expression") //return FHIRSearch(subject: "_id", reference: myID, type: self.dynamicType) } - return FHIRSearch(type: self.dynamicType, query: query) + return FHIRSearch(type: type(of: self), query: query) } /** Perform a search, wich the given query construct, against the receiver's compartment. */ - public class func search(_ query: AnyObject) -> FHIRSearch { + public class func search(_ query: Any) -> FHIRSearch { return FHIRSearch(type: self, query: query) } @@ -311,38 +311,38 @@ public extension Resource { /** Perform a given operation on the receiver. */ - public func perform(operation: FHIROperation, callback: FHIRResourceErrorCallback) { + public func perform(_ operation: FHIROperation, callback: @escaping FHIRResourceErrorCallback) { if let server = _server { if let server = server as? FHIROpenServer { operation.instance = self - self.dynamicType._perform(operation: operation, server: server, callback: callback) + type(of: self)._perform(operation, server: server, callback: callback) } else { - callback(resource: nil, error: FHIRError.error("Must be living on a FHIROpenServer or subclass")) + callback(nil, FHIRError.error("Must be living on a FHIROpenServer or subclass")) } } else { - callback(resource: nil, error: FHIRError.resourceWithoutServer) + callback(nil, FHIRError.resourceWithoutServer) } } /** Perform a given operation on the receiving type. */ - public class func perform(operation: FHIROperation, server: FHIROpenServer, callback: FHIRResourceErrorCallback) { + public class func perform(_ operation: FHIROperation, server: FHIROpenServer, callback: @escaping FHIRResourceErrorCallback) { operation.type = self - _perform(operation: operation, server: server, callback: callback) + _perform(operation, server: server, callback: callback) } - class func _perform(operation: FHIROperation, server: FHIROpenServer, callback: FHIRResourceErrorCallback) { - server.perform(operation: operation) { response in + class func _perform(_ operation: FHIROperation, server: FHIROpenServer, callback: @escaping FHIRResourceErrorCallback) { + server.perform(operation) { response in if let error = response.error { - callback(resource: nil, error: error) + callback(nil, error) } else { let resource = response.responseResource(Resource.self) resource?._server = server - callback(resource: resource, error: nil) + callback(resource, nil) } } } diff --git a/Sources/Models/Account.swift b/Sources/Models/Account.swift index a385c9c6..f1d2fb64 100644 --- a/Sources/Models/Account.swift +++ b/Sources/Models/Account.swift @@ -2,7 +2,7 @@ // Account.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Account) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Account) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * charges for a patient, cost centres, etc. */ public class Account: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Account" } } @@ -59,106 +59,106 @@ public class Account: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["activePeriod"] { + if let exist = js["activePeriod"] { presentKeys.insert("activePeriod") if let val = exist as? FHIRJSON { self.activePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "activePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "activePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["balance"] { + if let exist = js["balance"] { presentKeys.insert("balance") if let val = exist as? FHIRJSON { self.balance = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "balance", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "balance", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["coveragePeriod"] { + if let exist = js["coveragePeriod"] { presentKeys.insert("coveragePeriod") if let val = exist as? FHIRJSON { self.coveragePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "coveragePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "coveragePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["currency"] { + if let exist = js["currency"] { presentKeys.insert("currency") if let val = exist as? FHIRJSON { self.currency = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "currency", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "currency", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["owner"] { + if let exist = js["owner"] { presentKeys.insert("owner") if let val = exist as? FHIRJSON { self.owner = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "owner", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "owner", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Address.swift b/Sources/Models/Address.swift index ff245f5d..ce7cc727 100644 --- a/Sources/Models/Address.swift +++ b/Sources/Models/Address.swift @@ -2,7 +2,7 @@ // Address.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Address) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Address) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * basis for all addresses around the world. */ public class Address: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Address" } } @@ -56,97 +56,97 @@ public class Address: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["city"] { + if let exist = js["city"] { presentKeys.insert("city") if let val = exist as? String { self.city = val } else { - errors.append(FHIRJSONError(key: "city", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "city", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["country"] { + if let exist = js["country"] { presentKeys.insert("country") if let val = exist as? String { self.country = val } else { - errors.append(FHIRJSONError(key: "country", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "country", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["district"] { + if let exist = js["district"] { presentKeys.insert("district") if let val = exist as? String { self.district = val } else { - errors.append(FHIRJSONError(key: "district", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "district", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["line"] { + if let exist = js["line"] { presentKeys.insert("line") if let val = exist as? [String] { self.line = val } else { - errors.append(FHIRJSONError(key: "line", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "line", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["postalCode"] { + if let exist = js["postalCode"] { presentKeys.insert("postalCode") if let val = exist as? String { self.postalCode = val } else { - errors.append(FHIRJSONError(key: "postalCode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "postalCode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["state"] { + if let exist = js["state"] { presentKeys.insert("state") if let val = exist as? String { self.state = val } else { - errors.append(FHIRJSONError(key: "state", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "state", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["use"] { + if let exist = js["use"] { presentKeys.insert("use") if let val = exist as? String { self.use = val } else { - errors.append(FHIRJSONError(key: "use", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "use", wants: String.self, has: type(of: exist))) } } } @@ -166,7 +166,7 @@ public class Address: Element { json["district"] = district.asJSON() } if let line = self.line { - var arr = [AnyObject]() + var arr = [Any]() for val in line { arr.append(val.asJSON()) } diff --git a/Sources/Models/Age.swift b/Sources/Models/Age.swift index d751c84c..13f29b1a 100644 --- a/Sources/Models/Age.swift +++ b/Sources/Models/Age.swift @@ -2,7 +2,7 @@ // Age.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Age) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Age) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * UCUM. If value is present, it SHALL be positive. */ public class Age: Quantity { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Age" } } diff --git a/Sources/Models/AllergyIntolerance.swift b/Sources/Models/AllergyIntolerance.swift index 0ae32a58..b2672d41 100644 --- a/Sources/Models/AllergyIntolerance.swift +++ b/Sources/Models/AllergyIntolerance.swift @@ -2,7 +2,7 @@ // AllergyIntolerance.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AllergyIntolerance) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * to a substance. */ public class AllergyIntolerance: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "AllergyIntolerance" } } @@ -75,139 +75,139 @@ public class AllergyIntolerance: DomainResource { self.substance = substance } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? String { self.category = val } else { - errors.append(FHIRJSONError(key: "category", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["criticality"] { + if let exist = js["criticality"] { presentKeys.insert("criticality") if let val = exist as? String { self.criticality = val } else { - errors.append(FHIRJSONError(key: "criticality", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "criticality", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["lastOccurence"] { + if let exist = js["lastOccurence"] { presentKeys.insert("lastOccurence") if let val = exist as? String { self.lastOccurence = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "lastOccurence", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "lastOccurence", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? FHIRJSON { self.note = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["onset"] { + if let exist = js["onset"] { presentKeys.insert("onset") if let val = exist as? String { self.onset = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "onset", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "onset", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["reaction"] { + if let exist = js["reaction"] { presentKeys.insert("reaction") if let val = exist as? [FHIRJSON] { self.reaction = AllergyIntoleranceReaction.instantiate(fromArray: val, owner: self) as? [AllergyIntoleranceReaction] } else { - errors.append(FHIRJSONError(key: "reaction", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reaction", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["recordedDate"] { + if let exist = js["recordedDate"] { presentKeys.insert("recordedDate") if let val = exist as? String { self.recordedDate = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "recordedDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "recordedDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["recorder"] { + if let exist = js["recorder"] { presentKeys.insert("recorder") if let val = exist as? FHIRJSON { self.recorder = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "recorder", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "recorder", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reporter"] { + if let exist = js["reporter"] { presentKeys.insert("reporter") if let val = exist as? FHIRJSON { self.reporter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reporter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reporter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["substance"] { + if let exist = js["substance"] { presentKeys.insert("substance") if let val = exist as? FHIRJSON { self.substance = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "substance", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "substance", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "substance")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } } @@ -271,7 +271,7 @@ public class AllergyIntolerance: DomainResource { * Details about each adverse reaction event linked to exposure to the identified Substance. */ public class AllergyIntoleranceReaction: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "AllergyIntoleranceReaction" } } @@ -311,82 +311,82 @@ public class AllergyIntoleranceReaction: BackboneElement { self.manifestation = manifestation } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["certainty"] { + if let exist = js["certainty"] { presentKeys.insert("certainty") if let val = exist as? String { self.certainty = val } else { - errors.append(FHIRJSONError(key: "certainty", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "certainty", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exposureRoute"] { + if let exist = js["exposureRoute"] { presentKeys.insert("exposureRoute") if let val = exist as? FHIRJSON { self.exposureRoute = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exposureRoute", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exposureRoute", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["manifestation"] { + if let exist = js["manifestation"] { presentKeys.insert("manifestation") if let val = exist as? [FHIRJSON] { self.manifestation = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "manifestation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "manifestation", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "manifestation")) } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? FHIRJSON { self.note = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["onset"] { + if let exist = js["onset"] { presentKeys.insert("onset") if let val = exist as? String { self.onset = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "onset", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "onset", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["severity"] { + if let exist = js["severity"] { presentKeys.insert("severity") if let val = exist as? String { self.severity = val } else { - errors.append(FHIRJSONError(key: "severity", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "severity", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["substance"] { + if let exist = js["substance"] { presentKeys.insert("substance") if let val = exist as? FHIRJSON { self.substance = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "substance", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "substance", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Annotation.swift b/Sources/Models/Annotation.swift index 62ae1abb..6e96e12a 100644 --- a/Sources/Models/Annotation.swift +++ b/Sources/Models/Annotation.swift @@ -2,7 +2,7 @@ // Annotation.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Annotation) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Annotation) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A text note which also contains information about who made the statement and when. */ public class Annotation: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Annotation" } } @@ -43,46 +43,46 @@ public class Annotation: Element { self.text = text } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["authorReference"] { + if let exist = js["authorReference"] { presentKeys.insert("authorReference") if let val = exist as? FHIRJSON { self.authorReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "authorReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "authorReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["authorString"] { + if let exist = js["authorString"] { presentKeys.insert("authorString") if let val = exist as? String { self.authorString = val } else { - errors.append(FHIRJSONError(key: "authorString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "authorString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "text")) } - if let exist: AnyObject = js["time"] { + if let exist = js["time"] { presentKeys.insert("time") if let val = exist as? String { self.time = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "time", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "time", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Appointment.swift b/Sources/Models/Appointment.swift index 2cb260ad..6cfee9b2 100644 --- a/Sources/Models/Appointment.swift +++ b/Sources/Models/Appointment.swift @@ -2,7 +2,7 @@ // Appointment.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Appointment) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Appointment) on 2016-09-16. // 2016, SMART Health IT. // @@ -14,7 +14,7 @@ import Foundation * date/time. This may result in one or more Encounter(s). */ public class Appointment: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Appointment" } } @@ -67,121 +67,121 @@ public class Appointment: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["comment"] { + if let exist = js["comment"] { presentKeys.insert("comment") if let val = exist as? String { self.comment = val } else { - errors.append(FHIRJSONError(key: "comment", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comment", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["end"] { + if let exist = js["end"] { presentKeys.insert("end") if let val = exist as? String { self.end = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "end", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "end", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minutesDuration"] { + if let exist = js["minutesDuration"] { presentKeys.insert("minutesDuration") if let val = exist as? UInt { self.minutesDuration = val } else { - errors.append(FHIRJSONError(key: "minutesDuration", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minutesDuration", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["participant"] { + if let exist = js["participant"] { presentKeys.insert("participant") if let val = exist as? [FHIRJSON] { self.participant = AppointmentParticipant.instantiate(fromArray: val, owner: self) as? [AppointmentParticipant] } else { - errors.append(FHIRJSONError(key: "participant", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "participant", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "participant")) } - if let exist: AnyObject = js["priority"] { + if let exist = js["priority"] { presentKeys.insert("priority") if let val = exist as? UInt { self.priority = val } else { - errors.append(FHIRJSONError(key: "priority", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priority", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? FHIRJSON { self.reason = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["slot"] { + if let exist = js["slot"] { presentKeys.insert("slot") if let val = exist as? [FHIRJSON] { self.slot = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "slot", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "slot", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["start"] { + if let exist = js["start"] { presentKeys.insert("start") if let val = exist as? String { self.start = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "start", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "start", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -239,7 +239,7 @@ public class Appointment: DomainResource { * List of participants involved in the appointment. */ public class AppointmentParticipant: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "AppointmentParticipant" } } @@ -267,46 +267,46 @@ public class AppointmentParticipant: BackboneElement { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["actor"] { + if let exist = js["actor"] { presentKeys.insert("actor") if let val = exist as? FHIRJSON { self.actor = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["required"] { + if let exist = js["required"] { presentKeys.insert("required") if let val = exist as? String { self.required = val } else { - errors.append(FHIRJSONError(key: "required", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "required", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? [FHIRJSON] { self.type = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: type(of: exist))) } } } diff --git a/Sources/Models/AppointmentResponse.swift b/Sources/Models/AppointmentResponse.swift index 01730433..acb39211 100644 --- a/Sources/Models/AppointmentResponse.swift +++ b/Sources/Models/AppointmentResponse.swift @@ -2,7 +2,7 @@ // AppointmentResponse.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AppointmentResponse) on 2016-09-16. // 2016, SMART Health IT. // @@ -13,7 +13,7 @@ import Foundation * A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection. */ public class AppointmentResponse: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "AppointmentResponse" } } @@ -54,85 +54,85 @@ public class AppointmentResponse: DomainResource { self.participantStatus = participantStatus } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["actor"] { + if let exist = js["actor"] { presentKeys.insert("actor") if let val = exist as? FHIRJSON { self.actor = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["appointment"] { + if let exist = js["appointment"] { presentKeys.insert("appointment") if let val = exist as? FHIRJSON { self.appointment = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "appointment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "appointment", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "appointment")) } - if let exist: AnyObject = js["comment"] { + if let exist = js["comment"] { presentKeys.insert("comment") if let val = exist as? String { self.comment = val } else { - errors.append(FHIRJSONError(key: "comment", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comment", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["end"] { + if let exist = js["end"] { presentKeys.insert("end") if let val = exist as? String { self.end = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "end", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "end", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["participantStatus"] { + if let exist = js["participantStatus"] { presentKeys.insert("participantStatus") if let val = exist as? String { self.participantStatus = val } else { - errors.append(FHIRJSONError(key: "participantStatus", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "participantStatus", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "participantStatus")) } - if let exist: AnyObject = js["participantType"] { + if let exist = js["participantType"] { presentKeys.insert("participantType") if let val = exist as? [FHIRJSON] { self.participantType = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "participantType", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "participantType", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["start"] { + if let exist = js["start"] { presentKeys.insert("start") if let val = exist as? String { self.start = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "start", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "start", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Attachment.swift b/Sources/Models/Attachment.swift index 2ceda10d..5f6b7421 100644 --- a/Sources/Models/Attachment.swift +++ b/Sources/Models/Attachment.swift @@ -2,7 +2,7 @@ // Attachment.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Attachment) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Attachment) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * For referring to data content defined in other formats. */ public class Attachment: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Attachment" } } @@ -49,79 +49,79 @@ public class Attachment: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contentType"] { + if let exist = js["contentType"] { presentKeys.insert("contentType") if let val = exist as? String { self.contentType = val } else { - errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["creation"] { + if let exist = js["creation"] { presentKeys.insert("creation") if let val = exist as? String { self.creation = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "creation", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "creation", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["data"] { + if let exist = js["data"] { presentKeys.insert("data") if let val = exist as? String { self.data = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "data", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "data", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["hash"] { + if let exist = js["hash"] { presentKeys.insert("hash") if let val = exist as? String { self.hash = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "hash", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "hash", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["language"] { + if let exist = js["language"] { presentKeys.insert("language") if let val = exist as? String { self.language = val } else { - errors.append(FHIRJSONError(key: "language", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "language", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["size"] { + if let exist = js["size"] { presentKeys.insert("size") if let val = exist as? UInt { self.size = val } else { - errors.append(FHIRJSONError(key: "size", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "size", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["title"] { + if let exist = js["title"] { presentKeys.insert("title") if let val = exist as? String { self.title = val } else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "title", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/AuditEvent.swift b/Sources/Models/AuditEvent.swift index abbbee4f..7b4610dc 100644 --- a/Sources/Models/AuditEvent.swift +++ b/Sources/Models/AuditEvent.swift @@ -2,7 +2,7 @@ // AuditEvent.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AuditEvent) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/AuditEvent) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * attempts and monitoring for inappropriate usage. */ public class AuditEvent: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "AuditEvent" } } @@ -46,49 +46,49 @@ public class AuditEvent: DomainResource { self.source = source } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["event"] { + if let exist = js["event"] { presentKeys.insert("event") if let val = exist as? FHIRJSON { self.event = AuditEventEvent(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "event", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "event", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "event")) } - if let exist: AnyObject = js["object"] { + if let exist = js["object"] { presentKeys.insert("object") if let val = exist as? [FHIRJSON] { self.object = AuditEventObject.instantiate(fromArray: val, owner: self) as? [AuditEventObject] } else { - errors.append(FHIRJSONError(key: "object", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "object", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["participant"] { + if let exist = js["participant"] { presentKeys.insert("participant") if let val = exist as? [FHIRJSON] { self.participant = AuditEventParticipant.instantiate(fromArray: val, owner: self) as? [AuditEventParticipant] } else { - errors.append(FHIRJSONError(key: "participant", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "participant", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "participant")) } - if let exist: AnyObject = js["source"] { + if let exist = js["source"] { presentKeys.insert("source") if let val = exist as? FHIRJSON { self.source = AuditEventSource(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -125,7 +125,7 @@ public class AuditEvent: DomainResource { * Identifies the name, action type, time, and disposition of the audited event. */ public class AuditEventEvent: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "AuditEventEvent" } } @@ -163,73 +163,73 @@ public class AuditEventEvent: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["action"] { + if let exist = js["action"] { presentKeys.insert("action") if let val = exist as? String { self.action = val } else { - errors.append(FHIRJSONError(key: "action", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "action", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dateTime"] { + if let exist = js["dateTime"] { presentKeys.insert("dateTime") if let val = exist as? String { self.dateTime = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "dateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateTime", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "dateTime")) } - if let exist: AnyObject = js["outcome"] { + if let exist = js["outcome"] { presentKeys.insert("outcome") if let val = exist as? String { self.outcome = val } else { - errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["outcomeDesc"] { + if let exist = js["outcomeDesc"] { presentKeys.insert("outcomeDesc") if let val = exist as? String { self.outcomeDesc = val } else { - errors.append(FHIRJSONError(key: "outcomeDesc", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcomeDesc", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["purposeOfEvent"] { + if let exist = js["purposeOfEvent"] { presentKeys.insert("purposeOfEvent") if let val = exist as? [FHIRJSON] { self.purposeOfEvent = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "purposeOfEvent", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "purposeOfEvent", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subtype"] { + if let exist = js["subtype"] { presentKeys.insert("subtype") if let val = exist as? [FHIRJSON] { self.subtype = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "subtype", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subtype", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -273,7 +273,7 @@ public class AuditEventEvent: BackboneElement { * Specific instances of data or objects that have been accessed. */ public class AuditEventObject: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "AuditEventObject" } } @@ -313,97 +313,97 @@ public class AuditEventObject: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["detail"] { + if let exist = js["detail"] { presentKeys.insert("detail") if let val = exist as? [FHIRJSON] { self.detail = AuditEventObjectDetail.instantiate(fromArray: val, owner: self) as? [AuditEventObjectDetail] } else { - errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["lifecycle"] { + if let exist = js["lifecycle"] { presentKeys.insert("lifecycle") if let val = exist as? FHIRJSON { self.lifecycle = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "lifecycle", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "lifecycle", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["query"] { + if let exist = js["query"] { presentKeys.insert("query") if let val = exist as? String { self.query = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "query", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "query", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reference"] { + if let exist = js["reference"] { presentKeys.insert("reference") if let val = exist as? FHIRJSON { self.reference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["role"] { + if let exist = js["role"] { presentKeys.insert("role") if let val = exist as? FHIRJSON { self.role = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["securityLabel"] { + if let exist = js["securityLabel"] { presentKeys.insert("securityLabel") if let val = exist as? [FHIRJSON] { self.securityLabel = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "securityLabel", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "securityLabel", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -453,7 +453,7 @@ public class AuditEventObject: BackboneElement { * Additional Information about the Object. */ public class AuditEventObjectDetail: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "AuditEventObjectDetail" } } @@ -476,28 +476,28 @@ public class AuditEventObjectDetail: BackboneElement { self.value = value } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? String { self.value = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: String.self, has: type(of: exist))) } } else { @@ -526,7 +526,7 @@ public class AuditEventObjectDetail: BackboneElement { * A person, a hardware device or software process. */ public class AuditEventParticipant: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "AuditEventParticipant" } } @@ -575,109 +575,109 @@ public class AuditEventParticipant: BackboneElement { self.requestor = requestor } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["altId"] { + if let exist = js["altId"] { presentKeys.insert("altId") if let val = exist as? String { self.altId = val } else { - errors.append(FHIRJSONError(key: "altId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "altId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? FHIRJSON { self.location = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["media"] { + if let exist = js["media"] { presentKeys.insert("media") if let val = exist as? FHIRJSON { self.media = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "media", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "media", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["network"] { + if let exist = js["network"] { presentKeys.insert("network") if let val = exist as? FHIRJSON { self.network = AuditEventParticipantNetwork(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "network", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "network", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["policy"] { + if let exist = js["policy"] { presentKeys.insert("policy") if let val = exist as? [String] { self.policy = URL.instantiate(fromArray: val) } else { - errors.append(FHIRJSONError(key: "policy", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "policy", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["purposeOfUse"] { + if let exist = js["purposeOfUse"] { presentKeys.insert("purposeOfUse") if let val = exist as? [FHIRJSON] { self.purposeOfUse = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "purposeOfUse", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "purposeOfUse", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reference"] { + if let exist = js["reference"] { presentKeys.insert("reference") if let val = exist as? FHIRJSON { self.reference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestor"] { + if let exist = js["requestor"] { presentKeys.insert("requestor") if let val = exist as? Bool { self.requestor = val } else { - errors.append(FHIRJSONError(key: "requestor", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestor", wants: Bool.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "requestor")) } - if let exist: AnyObject = js["role"] { + if let exist = js["role"] { presentKeys.insert("role") if let val = exist as? [FHIRJSON] { self.role = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "role", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "role", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["userId"] { + if let exist = js["userId"] { presentKeys.insert("userId") if let val = exist as? FHIRJSON { self.userId = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "userId", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "userId", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -703,7 +703,7 @@ public class AuditEventParticipant: BackboneElement { json["network"] = network.asJSON() } if let policy = self.policy { - var arr = [AnyObject]() + var arr = [Any]() for val in policy { arr.append(val.asJSON()) } @@ -736,7 +736,7 @@ public class AuditEventParticipant: BackboneElement { * Logical network location for application activity, if the activity has a network location. */ public class AuditEventParticipantNetwork: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "AuditEventParticipantNetwork" } } @@ -752,25 +752,25 @@ public class AuditEventParticipantNetwork: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["address"] { + if let exist = js["address"] { presentKeys.insert("address") if let val = exist as? String { self.address = val } else { - errors.append(FHIRJSONError(key: "address", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "address", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } } @@ -796,7 +796,7 @@ public class AuditEventParticipantNetwork: BackboneElement { * Application systems and processes. */ public class AuditEventSource: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "AuditEventSource" } } @@ -821,37 +821,37 @@ public class AuditEventSource: BackboneElement { self.identifier = identifier } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "identifier")) } - if let exist: AnyObject = js["site"] { + if let exist = js["site"] { presentKeys.insert("site") if let val = exist as? String { self.site = val } else { - errors.append(FHIRJSONError(key: "site", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "site", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? [FHIRJSON] { self.type = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: type(of: exist))) } } } diff --git a/Sources/Models/BackboneElement.swift b/Sources/Models/BackboneElement.swift index d01a2e36..5b217dae 100644 --- a/Sources/Models/BackboneElement.swift +++ b/Sources/Models/BackboneElement.swift @@ -2,7 +2,7 @@ // BackboneElement.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/BackboneElement) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/BackboneElement) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * Base definition for all elements that are defined inside a resource - but not those in a data type. */ public class BackboneElement: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "BackboneElement" } } @@ -28,16 +28,16 @@ public class BackboneElement: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["modifierExtension"] { + if let exist = js["modifierExtension"] { presentKeys.insert("modifierExtension") if let val = exist as? [FHIRJSON] { self.modifierExtension = Extension.instantiate(fromArray: val, owner: self) as? [Extension] } else { - errors.append(FHIRJSONError(key: "modifierExtension", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "modifierExtension", wants: Array.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Basic.swift b/Sources/Models/Basic.swift index 78ffa970..500790a4 100644 --- a/Sources/Models/Basic.swift +++ b/Sources/Models/Basic.swift @@ -2,7 +2,7 @@ // Basic.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Basic) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Basic) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * resource, and custom resources not appropriate for inclusion in the FHIR specification. */ public class Basic: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Basic" } } @@ -47,55 +47,55 @@ public class Basic: DomainResource { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? FHIRJSON { self.author = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Binary.swift b/Sources/Models/Binary.swift index f0267912..ea36ca01 100644 --- a/Sources/Models/Binary.swift +++ b/Sources/Models/Binary.swift @@ -2,7 +2,7 @@ // Binary.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Binary) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Binary) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A binary resource can contain any content, whether text, image, pdf, zip archive, etc. */ public class Binary: Resource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Binary" } } @@ -38,28 +38,28 @@ public class Binary: Resource { self.contentType = contentType } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["content"] { + if let exist = js["content"] { presentKeys.insert("content") if let val = exist as? String { self.content = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "content", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "content", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "content")) } - if let exist: AnyObject = js["contentType"] { + if let exist = js["contentType"] { presentKeys.insert("contentType") if let val = exist as? String { self.contentType = val } else { - errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/BodySite.swift b/Sources/Models/BodySite.swift index 204a72d6..24fbdc9c 100644 --- a/Sources/Models/BodySite.swift +++ b/Sources/Models/BodySite.swift @@ -2,7 +2,7 @@ // BodySite.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/BodySite) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/BodySite) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * concept does not provide the necessary detail needed for the use case. */ public class BodySite: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "BodySite" } } @@ -50,61 +50,61 @@ public class BodySite: DomainResource { self.patient = patient } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["image"] { + if let exist = js["image"] { presentKeys.insert("image") if let val = exist as? [FHIRJSON] { self.image = Attachment.instantiate(fromArray: val, owner: self) as? [Attachment] } else { - errors.append(FHIRJSONError(key: "image", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "image", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["modifier"] { + if let exist = js["modifier"] { presentKeys.insert("modifier") if let val = exist as? [FHIRJSON] { self.modifier = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "modifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "modifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Bundle.swift b/Sources/Models/Bundle.swift index ed370732..88580932 100644 --- a/Sources/Models/Bundle.swift +++ b/Sources/Models/Bundle.swift @@ -2,7 +2,7 @@ // Bundle.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Bundle) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Bundle) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A container for a collection of resources. */ public class Bundle: Resource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Bundle" } } @@ -46,52 +46,52 @@ public class Bundle: Resource { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["entry"] { + if let exist = js["entry"] { presentKeys.insert("entry") if let val = exist as? [FHIRJSON] { self.entry = BundleEntry.instantiate(fromArray: val, owner: self) as? [BundleEntry] } else { - errors.append(FHIRJSONError(key: "entry", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entry", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["link"] { + if let exist = js["link"] { presentKeys.insert("link") if let val = exist as? [FHIRJSON] { self.link = BundleLink.instantiate(fromArray: val, owner: self) as? [BundleLink] } else { - errors.append(FHIRJSONError(key: "link", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "link", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["signature"] { + if let exist = js["signature"] { presentKeys.insert("signature") if let val = exist as? FHIRJSON { self.signature = Signature(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "signature", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "signature", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["total"] { + if let exist = js["total"] { presentKeys.insert("total") if let val = exist as? UInt { self.total = val } else { - errors.append(FHIRJSONError(key: "total", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "total", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { @@ -132,7 +132,7 @@ public class Bundle: Resource { * history only). */ public class BundleEntry: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "BundleEntry" } } @@ -160,61 +160,61 @@ public class BundleEntry: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["fullUrl"] { + if let exist = js["fullUrl"] { presentKeys.insert("fullUrl") if let val = exist as? String { self.fullUrl = URL(string: val) } else { - errors.append(FHIRJSONError(key: "fullUrl", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fullUrl", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["link"] { + if let exist = js["link"] { presentKeys.insert("link") if let val = exist as? [FHIRJSON] { self.link = BundleLink.instantiate(fromArray: val, owner: self) as? [BundleLink] } else { - errors.append(FHIRJSONError(key: "link", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "link", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = BundleEntryRequest(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["resource"] { + if let exist = js["resource"] { presentKeys.insert("resource") if let val = exist as? FHIRJSON { - self.resource = Resource.instantiate(fromJSON: val, owner: self) as? Resource + self.resource = Resource.instantiate(from: val, owner: self) as? Resource } else { - errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["response"] { + if let exist = js["response"] { presentKeys.insert("response") if let val = exist as? FHIRJSON { self.response = BundleEntryResponse(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["search"] { + if let exist = js["search"] { presentKeys.insert("search") if let val = exist as? FHIRJSON { self.search = BundleEntrySearch(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "search", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "search", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -254,7 +254,7 @@ public class BundleEntry: BackboneElement { * Additional information about how this entry should be processed as part of a transaction. */ public class BundleEntryRequest: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "BundleEntryRequest" } } @@ -289,64 +289,64 @@ public class BundleEntryRequest: BackboneElement { self.url = url } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["ifMatch"] { + if let exist = js["ifMatch"] { presentKeys.insert("ifMatch") if let val = exist as? String { self.ifMatch = val } else { - errors.append(FHIRJSONError(key: "ifMatch", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ifMatch", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ifModifiedSince"] { + if let exist = js["ifModifiedSince"] { presentKeys.insert("ifModifiedSince") if let val = exist as? String { self.ifModifiedSince = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "ifModifiedSince", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ifModifiedSince", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ifNoneExist"] { + if let exist = js["ifNoneExist"] { presentKeys.insert("ifNoneExist") if let val = exist as? String { self.ifNoneExist = val } else { - errors.append(FHIRJSONError(key: "ifNoneExist", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ifNoneExist", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ifNoneMatch"] { + if let exist = js["ifNoneMatch"] { presentKeys.insert("ifNoneMatch") if let val = exist as? String { self.ifNoneMatch = val } else { - errors.append(FHIRJSONError(key: "ifNoneMatch", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ifNoneMatch", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["method"] { + if let exist = js["method"] { presentKeys.insert("method") if let val = exist as? String { self.method = val } else { - errors.append(FHIRJSONError(key: "method", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "method", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "method")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } else { @@ -389,7 +389,7 @@ public class BundleEntryRequest: BackboneElement { * Additional information about how this entry should be processed as part of a transaction. */ public class BundleEntryResponse: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "BundleEntryResponse" } } @@ -417,43 +417,43 @@ public class BundleEntryResponse: BackboneElement { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["etag"] { + if let exist = js["etag"] { presentKeys.insert("etag") if let val = exist as? String { self.etag = val } else { - errors.append(FHIRJSONError(key: "etag", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "etag", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["lastModified"] { + if let exist = js["lastModified"] { presentKeys.insert("lastModified") if let val = exist as? String { self.lastModified = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "lastModified", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "lastModified", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? String { self.location = URL(string: val) } else { - errors.append(FHIRJSONError(key: "location", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { @@ -490,7 +490,7 @@ public class BundleEntryResponse: BackboneElement { * Information about the search process that lead to the creation of this entry. */ public class BundleEntrySearch: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "BundleEntrySearch" } } @@ -506,25 +506,25 @@ public class BundleEntrySearch: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["mode"] { + if let exist = js["mode"] { presentKeys.insert("mode") if let val = exist as? String { self.mode = val } else { - errors.append(FHIRJSONError(key: "mode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["score"] { + if let exist = js["score"] { presentKeys.insert("score") if let val = exist as? NSNumber { self.score = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "score", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "score", wants: NSNumber.self, has: type(of: exist))) } } } @@ -552,7 +552,7 @@ public class BundleEntrySearch: BackboneElement { * A series of links that provide context to this bundle. */ public class BundleLink: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "BundleLink" } } @@ -575,28 +575,28 @@ public class BundleLink: BackboneElement { self.url = url } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["relation"] { + if let exist = js["relation"] { presentKeys.insert("relation") if let val = exist as? String { self.relation = val } else { - errors.append(FHIRJSONError(key: "relation", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "relation", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "relation")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/CarePlan.swift b/Sources/Models/CarePlan.swift index 65acbe53..27800ef3 100644 --- a/Sources/Models/CarePlan.swift +++ b/Sources/Models/CarePlan.swift @@ -2,7 +2,7 @@ // CarePlan.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CarePlan) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CarePlan) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * community for a period of time, possibly limited to care for a specific condition or set of conditions. */ public class CarePlan: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CarePlan" } } @@ -80,154 +80,154 @@ public class CarePlan: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["activity"] { + if let exist = js["activity"] { presentKeys.insert("activity") if let val = exist as? [FHIRJSON] { self.activity = CarePlanActivity.instantiate(fromArray: val, owner: self) as? [CarePlanActivity] } else { - errors.append(FHIRJSONError(key: "activity", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "activity", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["addresses"] { + if let exist = js["addresses"] { presentKeys.insert("addresses") if let val = exist as? [FHIRJSON] { self.addresses = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "addresses", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "addresses", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? [FHIRJSON] { self.author = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "author", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? [FHIRJSON] { self.category = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "category", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["context"] { + if let exist = js["context"] { presentKeys.insert("context") if let val = exist as? FHIRJSON { self.context = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "context", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "context", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["goal"] { + if let exist = js["goal"] { presentKeys.insert("goal") if let val = exist as? [FHIRJSON] { self.goal = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "goal", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "goal", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["modified"] { + if let exist = js["modified"] { presentKeys.insert("modified") if let val = exist as? String { self.modified = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "modified", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "modified", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? FHIRJSON { self.note = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["participant"] { + if let exist = js["participant"] { presentKeys.insert("participant") if let val = exist as? [FHIRJSON] { self.participant = CarePlanParticipant.instantiate(fromArray: val, owner: self) as? [CarePlanParticipant] } else { - errors.append(FHIRJSONError(key: "participant", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "participant", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["relatedPlan"] { + if let exist = js["relatedPlan"] { presentKeys.insert("relatedPlan") if let val = exist as? [FHIRJSON] { self.relatedPlan = CarePlanRelatedPlan.instantiate(fromArray: val, owner: self) as? [CarePlanRelatedPlan] } else { - errors.append(FHIRJSONError(key: "relatedPlan", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "relatedPlan", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["support"] { + if let exist = js["support"] { presentKeys.insert("support") if let val = exist as? [FHIRJSON] { self.support = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "support", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "support", wants: Array.self, has: type(of: exist))) } } } @@ -298,7 +298,7 @@ public class CarePlan: DomainResource { * perform, self-monitoring, education, etc. */ public class CarePlanActivity: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CarePlanActivity" } } @@ -320,43 +320,43 @@ public class CarePlanActivity: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["actionResulting"] { + if let exist = js["actionResulting"] { presentKeys.insert("actionResulting") if let val = exist as? [FHIRJSON] { self.actionResulting = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "actionResulting", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actionResulting", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["detail"] { + if let exist = js["detail"] { presentKeys.insert("detail") if let val = exist as? FHIRJSON { self.detail = CarePlanActivityDetail(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "detail", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detail", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["progress"] { + if let exist = js["progress"] { presentKeys.insert("progress") if let val = exist as? [FHIRJSON] { self.progress = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] } else { - errors.append(FHIRJSONError(key: "progress", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "progress", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reference"] { + if let exist = js["reference"] { presentKeys.insert("reference") if let val = exist as? FHIRJSON { self.reference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reference", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -391,7 +391,7 @@ public class CarePlanActivity: BackboneElement { * about specific resources such as procedure etc. */ public class CarePlanActivityDetail: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CarePlanActivityDetail" } } @@ -461,172 +461,172 @@ public class CarePlanActivityDetail: BackboneElement { self.prohibited = prohibited } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? FHIRJSON { self.category = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dailyAmount"] { + if let exist = js["dailyAmount"] { presentKeys.insert("dailyAmount") if let val = exist as? FHIRJSON { self.dailyAmount = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "dailyAmount", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dailyAmount", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["goal"] { + if let exist = js["goal"] { presentKeys.insert("goal") if let val = exist as? [FHIRJSON] { self.goal = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "goal", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "goal", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? FHIRJSON { self.location = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["performer"] { + if let exist = js["performer"] { presentKeys.insert("performer") if let val = exist as? [FHIRJSON] { self.performer = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "performer", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "performer", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["productCodeableConcept"] { + if let exist = js["productCodeableConcept"] { presentKeys.insert("productCodeableConcept") if let val = exist as? FHIRJSON { self.productCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "productCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "productCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["productReference"] { + if let exist = js["productReference"] { presentKeys.insert("productReference") if let val = exist as? FHIRJSON { self.productReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "productReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "productReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["prohibited"] { + if let exist = js["prohibited"] { presentKeys.insert("prohibited") if let val = exist as? Bool { self.prohibited = val } else { - errors.append(FHIRJSONError(key: "prohibited", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prohibited", wants: Bool.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "prohibited")) } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonCode"] { + if let exist = js["reasonCode"] { presentKeys.insert("reasonCode") if let val = exist as? [FHIRJSON] { self.reasonCode = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reasonCode", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonCode", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonReference"] { + if let exist = js["reasonReference"] { presentKeys.insert("reasonReference") if let val = exist as? [FHIRJSON] { self.reasonReference = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "reasonReference", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonReference", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["scheduledPeriod"] { + if let exist = js["scheduledPeriod"] { presentKeys.insert("scheduledPeriod") if let val = exist as? FHIRJSON { self.scheduledPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "scheduledPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "scheduledPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["scheduledString"] { + if let exist = js["scheduledString"] { presentKeys.insert("scheduledString") if let val = exist as? String { self.scheduledString = val } else { - errors.append(FHIRJSONError(key: "scheduledString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "scheduledString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["scheduledTiming"] { + if let exist = js["scheduledTiming"] { presentKeys.insert("scheduledTiming") if let val = exist as? FHIRJSON { self.scheduledTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "scheduledTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "scheduledTiming", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["statusReason"] { + if let exist = js["statusReason"] { presentKeys.insert("statusReason") if let val = exist as? FHIRJSON { self.statusReason = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "statusReason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "statusReason", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -702,7 +702,7 @@ public class CarePlanActivityDetail: BackboneElement { * Identifies all people and organizations who are expected to be involved in the care envisioned by this plan. */ public class CarePlanParticipant: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CarePlanParticipant" } } @@ -718,25 +718,25 @@ public class CarePlanParticipant: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["member"] { + if let exist = js["member"] { presentKeys.insert("member") if let val = exist as? FHIRJSON { self.member = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "member", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "member", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["role"] { + if let exist = js["role"] { presentKeys.insert("role") if let val = exist as? FHIRJSON { self.role = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -764,7 +764,7 @@ public class CarePlanParticipant: BackboneElement { * Identifies CarePlans with some sort of formal relationship to the current plan. */ public class CarePlanRelatedPlan: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CarePlanRelatedPlan" } } @@ -786,25 +786,25 @@ public class CarePlanRelatedPlan: BackboneElement { self.plan = plan } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["plan"] { + if let exist = js["plan"] { presentKeys.insert("plan") if let val = exist as? FHIRJSON { self.plan = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "plan", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "plan", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Claim.swift b/Sources/Models/Claim.swift index a2d57e55..3d9c2cb7 100644 --- a/Sources/Models/Claim.swift +++ b/Sources/Models/Claim.swift @@ -2,7 +2,7 @@ // Claim.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Claim) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Claim) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * insurer for payment recovery. */ public class Claim: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Claim" } } @@ -120,274 +120,274 @@ public class Claim: DomainResource { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["accident"] { + if let exist = js["accident"] { presentKeys.insert("accident") if let val = exist as? String { self.accident = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "accident", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "accident", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["accidentType"] { + if let exist = js["accidentType"] { presentKeys.insert("accidentType") if let val = exist as? FHIRJSON { self.accidentType = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "accidentType", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "accidentType", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["additionalMaterials"] { + if let exist = js["additionalMaterials"] { presentKeys.insert("additionalMaterials") if let val = exist as? [FHIRJSON] { self.additionalMaterials = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "additionalMaterials", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "additionalMaterials", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["condition"] { + if let exist = js["condition"] { presentKeys.insert("condition") if let val = exist as? [FHIRJSON] { self.condition = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "condition", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "condition", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["coverage"] { + if let exist = js["coverage"] { presentKeys.insert("coverage") if let val = exist as? [FHIRJSON] { self.coverage = ClaimCoverage.instantiate(fromArray: val, owner: self) as? [ClaimCoverage] } else { - errors.append(FHIRJSONError(key: "coverage", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "coverage", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["diagnosis"] { + if let exist = js["diagnosis"] { presentKeys.insert("diagnosis") if let val = exist as? [FHIRJSON] { self.diagnosis = ClaimDiagnosis.instantiate(fromArray: val, owner: self) as? [ClaimDiagnosis] } else { - errors.append(FHIRJSONError(key: "diagnosis", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "diagnosis", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["enterer"] { + if let exist = js["enterer"] { presentKeys.insert("enterer") if let val = exist as? FHIRJSON { self.enterer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "enterer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "enterer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exception"] { + if let exist = js["exception"] { presentKeys.insert("exception") if let val = exist as? [FHIRJSON] { self.exception = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "exception", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exception", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["facility"] { + if let exist = js["facility"] { presentKeys.insert("facility") if let val = exist as? FHIRJSON { self.facility = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "facility", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "facility", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fundsReserve"] { + if let exist = js["fundsReserve"] { presentKeys.insert("fundsReserve") if let val = exist as? FHIRJSON { self.fundsReserve = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fundsReserve", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fundsReserve", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["interventionException"] { + if let exist = js["interventionException"] { presentKeys.insert("interventionException") if let val = exist as? [FHIRJSON] { self.interventionException = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "interventionException", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "interventionException", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["item"] { + if let exist = js["item"] { presentKeys.insert("item") if let val = exist as? [FHIRJSON] { self.item = ClaimItem.instantiate(fromArray: val, owner: self) as? [ClaimItem] } else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["missingTeeth"] { + if let exist = js["missingTeeth"] { presentKeys.insert("missingTeeth") if let val = exist as? [FHIRJSON] { self.missingTeeth = ClaimMissingTeeth.instantiate(fromArray: val, owner: self) as? [ClaimMissingTeeth] } else { - errors.append(FHIRJSONError(key: "missingTeeth", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "missingTeeth", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalPrescription"] { + if let exist = js["originalPrescription"] { presentKeys.insert("originalPrescription") if let val = exist as? FHIRJSON { self.originalPrescription = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalPrescription", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalPrescription", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["payee"] { + if let exist = js["payee"] { presentKeys.insert("payee") if let val = exist as? FHIRJSON { self.payee = ClaimPayee(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "payee", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "payee", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["prescription"] { + if let exist = js["prescription"] { presentKeys.insert("prescription") if let val = exist as? FHIRJSON { self.prescription = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "prescription", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prescription", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["priority"] { + if let exist = js["priority"] { presentKeys.insert("priority") if let val = exist as? FHIRJSON { self.priority = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["provider"] { + if let exist = js["provider"] { presentKeys.insert("provider") if let val = exist as? FHIRJSON { self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["referral"] { + if let exist = js["referral"] { presentKeys.insert("referral") if let val = exist as? FHIRJSON { self.referral = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "referral", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "referral", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ruleset"] { + if let exist = js["ruleset"] { presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["school"] { + if let exist = js["school"] { presentKeys.insert("school") if let val = exist as? String { self.school = val } else { - errors.append(FHIRJSONError(key: "school", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "school", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? FHIRJSON { self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["use"] { + if let exist = js["use"] { presentKeys.insert("use") if let val = exist as? String { self.use = val } else { - errors.append(FHIRJSONError(key: "use", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "use", wants: String.self, has: type(of: exist))) } } } @@ -496,7 +496,7 @@ public class Claim: DomainResource { * Financial instrument by which payment information for health care. */ public class ClaimCoverage: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimCoverage" } } @@ -539,88 +539,88 @@ public class ClaimCoverage: BackboneElement { self.sequence = sequence } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["businessArrangement"] { + if let exist = js["businessArrangement"] { presentKeys.insert("businessArrangement") if let val = exist as? String { self.businessArrangement = val } else { - errors.append(FHIRJSONError(key: "businessArrangement", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "businessArrangement", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["claimResponse"] { + if let exist = js["claimResponse"] { presentKeys.insert("claimResponse") if let val = exist as? FHIRJSON { self.claimResponse = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "claimResponse", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "claimResponse", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["coverage"] { + if let exist = js["coverage"] { presentKeys.insert("coverage") if let val = exist as? FHIRJSON { self.coverage = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "coverage", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "coverage", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "coverage")) } - if let exist: AnyObject = js["focal"] { + if let exist = js["focal"] { presentKeys.insert("focal") if let val = exist as? Bool { self.focal = val } else { - errors.append(FHIRJSONError(key: "focal", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "focal", wants: Bool.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "focal")) } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["preAuthRef"] { + if let exist = js["preAuthRef"] { presentKeys.insert("preAuthRef") if let val = exist as? [String] { self.preAuthRef = val } else { - errors.append(FHIRJSONError(key: "preAuthRef", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "preAuthRef", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["relationship"] { + if let exist = js["relationship"] { presentKeys.insert("relationship") if let val = exist as? FHIRJSON { self.relationship = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "relationship")) } - if let exist: AnyObject = js["sequence"] { + if let exist = js["sequence"] { presentKeys.insert("sequence") if let val = exist as? UInt { self.sequence = val } else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: type(of: exist))) } } else { @@ -649,7 +649,7 @@ public class ClaimCoverage: BackboneElement { json["originalRuleset"] = originalRuleset.asJSON() } if let preAuthRef = self.preAuthRef { - var arr = [AnyObject]() + var arr = [Any]() for val in preAuthRef { arr.append(val.asJSON()) } @@ -673,7 +673,7 @@ public class ClaimCoverage: BackboneElement { * Ordered list of patient diagnosis for which care is sought. */ public class ClaimDiagnosis: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimDiagnosis" } } @@ -696,28 +696,28 @@ public class ClaimDiagnosis: BackboneElement { self.sequence = sequence } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["diagnosis"] { + if let exist = js["diagnosis"] { presentKeys.insert("diagnosis") if let val = exist as? FHIRJSON { self.diagnosis = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "diagnosis", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "diagnosis", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "diagnosis")) } - if let exist: AnyObject = js["sequence"] { + if let exist = js["sequence"] { presentKeys.insert("sequence") if let val = exist as? UInt { self.sequence = val } else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: type(of: exist))) } } else { @@ -748,7 +748,7 @@ public class ClaimDiagnosis: BackboneElement { * First tier of goods and services. */ public class ClaimItem: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimItem" } } @@ -817,169 +817,169 @@ public class ClaimItem: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["bodySite"] { + if let exist = js["bodySite"] { presentKeys.insert("bodySite") if let val = exist as? FHIRJSON { self.bodySite = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bodySite", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySite", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["detail"] { + if let exist = js["detail"] { presentKeys.insert("detail") if let val = exist as? [FHIRJSON] { self.detail = ClaimItemDetail.instantiate(fromArray: val, owner: self) as? [ClaimItemDetail] } else { - errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["diagnosisLinkId"] { + if let exist = js["diagnosisLinkId"] { presentKeys.insert("diagnosisLinkId") if let val = exist as? [UInt] { self.diagnosisLinkId = val } else { - errors.append(FHIRJSONError(key: "diagnosisLinkId", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "diagnosisLinkId", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["factor"] { + if let exist = js["factor"] { presentKeys.insert("factor") if let val = exist as? NSNumber { self.factor = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["modifier"] { + if let exist = js["modifier"] { presentKeys.insert("modifier") if let val = exist as? [FHIRJSON] { self.modifier = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "modifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "modifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["net"] { + if let exist = js["net"] { presentKeys.insert("net") if let val = exist as? FHIRJSON { self.net = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["points"] { + if let exist = js["points"] { presentKeys.insert("points") if let val = exist as? NSNumber { self.points = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["prosthesis"] { + if let exist = js["prosthesis"] { presentKeys.insert("prosthesis") if let val = exist as? FHIRJSON { self.prosthesis = ClaimItemProsthesis(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "prosthesis", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prosthesis", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["provider"] { + if let exist = js["provider"] { presentKeys.insert("provider") if let val = exist as? FHIRJSON { self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sequence"] { + if let exist = js["sequence"] { presentKeys.insert("sequence") if let val = exist as? UInt { self.sequence = val } else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "sequence")) } - if let exist: AnyObject = js["service"] { + if let exist = js["service"] { presentKeys.insert("service") if let val = exist as? FHIRJSON { self.service = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "service")) } - if let exist: AnyObject = js["serviceDate"] { + if let exist = js["serviceDate"] { presentKeys.insert("serviceDate") if let val = exist as? String { self.serviceDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "serviceDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "serviceDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subSite"] { + if let exist = js["subSite"] { presentKeys.insert("subSite") if let val = exist as? [FHIRJSON] { self.subSite = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "subSite", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subSite", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["udi"] { + if let exist = js["udi"] { presentKeys.insert("udi") if let val = exist as? FHIRJSON { self.udi = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "udi", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "udi", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["unitPrice"] { + if let exist = js["unitPrice"] { presentKeys.insert("unitPrice") if let val = exist as? FHIRJSON { self.unitPrice = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -996,7 +996,7 @@ public class ClaimItem: BackboneElement { json["detail"] = ClaimItemDetail.asJSONArray(detail) } if let diagnosisLinkId = self.diagnosisLinkId { - var arr = [AnyObject]() + var arr = [Any]() for val in diagnosisLinkId { arr.append(val.asJSON()) } @@ -1056,7 +1056,7 @@ public class ClaimItem: BackboneElement { * Second tier of goods and services. */ public class ClaimItemDetail: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimItemDetail" } } @@ -1104,106 +1104,106 @@ public class ClaimItemDetail: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["factor"] { + if let exist = js["factor"] { presentKeys.insert("factor") if let val = exist as? NSNumber { self.factor = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["net"] { + if let exist = js["net"] { presentKeys.insert("net") if let val = exist as? FHIRJSON { self.net = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["points"] { + if let exist = js["points"] { presentKeys.insert("points") if let val = exist as? NSNumber { self.points = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sequence"] { + if let exist = js["sequence"] { presentKeys.insert("sequence") if let val = exist as? UInt { self.sequence = val } else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "sequence")) } - if let exist: AnyObject = js["service"] { + if let exist = js["service"] { presentKeys.insert("service") if let val = exist as? FHIRJSON { self.service = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "service")) } - if let exist: AnyObject = js["subDetail"] { + if let exist = js["subDetail"] { presentKeys.insert("subDetail") if let val = exist as? [FHIRJSON] { self.subDetail = ClaimItemDetailSubDetail.instantiate(fromArray: val, owner: self) as? [ClaimItemDetailSubDetail] } else { - errors.append(FHIRJSONError(key: "subDetail", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subDetail", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["udi"] { + if let exist = js["udi"] { presentKeys.insert("udi") if let val = exist as? FHIRJSON { self.udi = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "udi", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "udi", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["unitPrice"] { + if let exist = js["unitPrice"] { presentKeys.insert("unitPrice") if let val = exist as? FHIRJSON { self.unitPrice = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -1255,7 +1255,7 @@ public class ClaimItemDetail: BackboneElement { * Third tier of goods and services. */ public class ClaimItemDetailSubDetail: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimItemDetailSubDetail" } } @@ -1300,97 +1300,97 @@ public class ClaimItemDetailSubDetail: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["factor"] { + if let exist = js["factor"] { presentKeys.insert("factor") if let val = exist as? NSNumber { self.factor = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["net"] { + if let exist = js["net"] { presentKeys.insert("net") if let val = exist as? FHIRJSON { self.net = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["points"] { + if let exist = js["points"] { presentKeys.insert("points") if let val = exist as? NSNumber { self.points = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sequence"] { + if let exist = js["sequence"] { presentKeys.insert("sequence") if let val = exist as? UInt { self.sequence = val } else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "sequence")) } - if let exist: AnyObject = js["service"] { + if let exist = js["service"] { presentKeys.insert("service") if let val = exist as? FHIRJSON { self.service = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "service")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["udi"] { + if let exist = js["udi"] { presentKeys.insert("udi") if let val = exist as? FHIRJSON { self.udi = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "udi", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "udi", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["unitPrice"] { + if let exist = js["unitPrice"] { presentKeys.insert("unitPrice") if let val = exist as? FHIRJSON { self.unitPrice = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -1439,7 +1439,7 @@ public class ClaimItemDetailSubDetail: BackboneElement { * The materials and placement date of prior fixed prosthesis. */ public class ClaimItemProsthesis: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimItemProsthesis" } } @@ -1458,34 +1458,34 @@ public class ClaimItemProsthesis: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["initial"] { + if let exist = js["initial"] { presentKeys.insert("initial") if let val = exist as? Bool { self.initial = val } else { - errors.append(FHIRJSONError(key: "initial", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "initial", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["priorDate"] { + if let exist = js["priorDate"] { presentKeys.insert("priorDate") if let val = exist as? String { self.priorDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "priorDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priorDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["priorMaterial"] { + if let exist = js["priorMaterial"] { presentKeys.insert("priorMaterial") if let val = exist as? FHIRJSON { self.priorMaterial = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "priorMaterial", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priorMaterial", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -1517,7 +1517,7 @@ public class ClaimItemProsthesis: BackboneElement { * reasons. */ public class ClaimMissingTeeth: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimMissingTeeth" } } @@ -1542,34 +1542,34 @@ public class ClaimMissingTeeth: BackboneElement { self.tooth = tooth } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["extractionDate"] { + if let exist = js["extractionDate"] { presentKeys.insert("extractionDate") if let val = exist as? String { self.extractionDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "extractionDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "extractionDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? FHIRJSON { self.reason = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["tooth"] { + if let exist = js["tooth"] { presentKeys.insert("tooth") if let val = exist as? FHIRJSON { self.tooth = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "tooth", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "tooth", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -1603,7 +1603,7 @@ public class ClaimMissingTeeth: BackboneElement { * The party to be reimbursed for the services. */ public class ClaimPayee: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimPayee" } } @@ -1625,43 +1625,43 @@ public class ClaimPayee: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["person"] { + if let exist = js["person"] { presentKeys.insert("person") if let val = exist as? FHIRJSON { self.person = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "person", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "person", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["provider"] { + if let exist = js["provider"] { presentKeys.insert("provider") if let val = exist as? FHIRJSON { self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/ClaimResponse.swift b/Sources/Models/ClaimResponse.swift index c8b44540..dd979d42 100644 --- a/Sources/Models/ClaimResponse.swift +++ b/Sources/Models/ClaimResponse.swift @@ -2,7 +2,7 @@ // ClaimResponse.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ClaimResponse) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ClaimResponse) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * This resource provides the adjudication details from the processing of a Claim resource. */ public class ClaimResponse: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponse" } } @@ -103,241 +103,241 @@ public class ClaimResponse: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["addItem"] { + if let exist = js["addItem"] { presentKeys.insert("addItem") if let val = exist as? [FHIRJSON] { self.addItem = ClaimResponseAddItem.instantiate(fromArray: val, owner: self) as? [ClaimResponseAddItem] } else { - errors.append(FHIRJSONError(key: "addItem", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "addItem", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["coverage"] { + if let exist = js["coverage"] { presentKeys.insert("coverage") if let val = exist as? [FHIRJSON] { self.coverage = ClaimResponseCoverage.instantiate(fromArray: val, owner: self) as? [ClaimResponseCoverage] } else { - errors.append(FHIRJSONError(key: "coverage", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "coverage", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["disposition"] { + if let exist = js["disposition"] { presentKeys.insert("disposition") if let val = exist as? String { self.disposition = val } else { - errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["error"] { + if let exist = js["error"] { presentKeys.insert("error") if let val = exist as? [FHIRJSON] { self.error = ClaimResponseError.instantiate(fromArray: val, owner: self) as? [ClaimResponseError] } else { - errors.append(FHIRJSONError(key: "error", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "error", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["form"] { + if let exist = js["form"] { presentKeys.insert("form") if let val = exist as? FHIRJSON { self.form = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "form", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "form", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["item"] { + if let exist = js["item"] { presentKeys.insert("item") if let val = exist as? [FHIRJSON] { self.item = ClaimResponseItem.instantiate(fromArray: val, owner: self) as? [ClaimResponseItem] } else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? [FHIRJSON] { self.note = ClaimResponseNote.instantiate(fromArray: val, owner: self) as? [ClaimResponseNote] } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["outcome"] { + if let exist = js["outcome"] { presentKeys.insert("outcome") if let val = exist as? String { self.outcome = val } else { - errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["payeeType"] { + if let exist = js["payeeType"] { presentKeys.insert("payeeType") if let val = exist as? FHIRJSON { self.payeeType = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "payeeType", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "payeeType", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["paymentAdjustment"] { + if let exist = js["paymentAdjustment"] { presentKeys.insert("paymentAdjustment") if let val = exist as? FHIRJSON { self.paymentAdjustment = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "paymentAdjustment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "paymentAdjustment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["paymentAdjustmentReason"] { + if let exist = js["paymentAdjustmentReason"] { presentKeys.insert("paymentAdjustmentReason") if let val = exist as? FHIRJSON { self.paymentAdjustmentReason = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "paymentAdjustmentReason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "paymentAdjustmentReason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["paymentAmount"] { + if let exist = js["paymentAmount"] { presentKeys.insert("paymentAmount") if let val = exist as? FHIRJSON { self.paymentAmount = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "paymentAmount", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "paymentAmount", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["paymentDate"] { + if let exist = js["paymentDate"] { presentKeys.insert("paymentDate") if let val = exist as? String { self.paymentDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "paymentDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "paymentDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["paymentRef"] { + if let exist = js["paymentRef"] { presentKeys.insert("paymentRef") if let val = exist as? FHIRJSON { self.paymentRef = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "paymentRef", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "paymentRef", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestOrganization"] { + if let exist = js["requestOrganization"] { presentKeys.insert("requestOrganization") if let val = exist as? FHIRJSON { self.requestOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestProvider"] { + if let exist = js["requestProvider"] { presentKeys.insert("requestProvider") if let val = exist as? FHIRJSON { self.requestProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reserved"] { + if let exist = js["reserved"] { presentKeys.insert("reserved") if let val = exist as? FHIRJSON { self.reserved = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reserved", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reserved", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ruleset"] { + if let exist = js["ruleset"] { presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["totalBenefit"] { + if let exist = js["totalBenefit"] { presentKeys.insert("totalBenefit") if let val = exist as? FHIRJSON { self.totalBenefit = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "totalBenefit", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "totalBenefit", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["totalCost"] { + if let exist = js["totalCost"] { presentKeys.insert("totalCost") if let val = exist as? FHIRJSON { self.totalCost = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "totalCost", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "totalCost", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["unallocDeductable"] { + if let exist = js["unallocDeductable"] { presentKeys.insert("unallocDeductable") if let val = exist as? FHIRJSON { self.unallocDeductable = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "unallocDeductable", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "unallocDeductable", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -437,7 +437,7 @@ public class ClaimResponse: DomainResource { * The first tier service adjudications for payor added services. */ public class ClaimResponseAddItem: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseAddItem" } } @@ -471,61 +471,61 @@ public class ClaimResponseAddItem: BackboneElement { self.service = service } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["adjudication"] { + if let exist = js["adjudication"] { presentKeys.insert("adjudication") if let val = exist as? [FHIRJSON] { self.adjudication = ClaimResponseAddItemAdjudication.instantiate(fromArray: val, owner: self) as? [ClaimResponseAddItemAdjudication] } else { - errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["detail"] { + if let exist = js["detail"] { presentKeys.insert("detail") if let val = exist as? [FHIRJSON] { self.detail = ClaimResponseAddItemDetail.instantiate(fromArray: val, owner: self) as? [ClaimResponseAddItemDetail] } else { - errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fee"] { + if let exist = js["fee"] { presentKeys.insert("fee") if let val = exist as? FHIRJSON { self.fee = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fee", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fee", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["noteNumberLinkId"] { + if let exist = js["noteNumberLinkId"] { presentKeys.insert("noteNumberLinkId") if let val = exist as? [UInt] { self.noteNumberLinkId = val } else { - errors.append(FHIRJSONError(key: "noteNumberLinkId", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "noteNumberLinkId", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sequenceLinkId"] { + if let exist = js["sequenceLinkId"] { presentKeys.insert("sequenceLinkId") if let val = exist as? [UInt] { self.sequenceLinkId = val } else { - errors.append(FHIRJSONError(key: "sequenceLinkId", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequenceLinkId", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["service"] { + if let exist = js["service"] { presentKeys.insert("service") if let val = exist as? FHIRJSON { self.service = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -548,14 +548,14 @@ public class ClaimResponseAddItem: BackboneElement { json["fee"] = fee.asJSON() } if let noteNumberLinkId = self.noteNumberLinkId { - var arr = [AnyObject]() + var arr = [Any]() for val in noteNumberLinkId { arr.append(val.asJSON()) } json["noteNumberLinkId"] = arr } if let sequenceLinkId = self.sequenceLinkId { - var arr = [AnyObject]() + var arr = [Any]() for val in sequenceLinkId { arr.append(val.asJSON()) } @@ -576,7 +576,7 @@ public class ClaimResponseAddItem: BackboneElement { * The adjudications results. */ public class ClaimResponseAddItemAdjudication: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseAddItemAdjudication" } } @@ -601,37 +601,37 @@ public class ClaimResponseAddItemAdjudication: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["amount"] { + if let exist = js["amount"] { presentKeys.insert("amount") if let val = exist as? FHIRJSON { self.amount = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? NSNumber { self.value = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: type(of: exist))) } } } @@ -662,7 +662,7 @@ public class ClaimResponseAddItemAdjudication: BackboneElement { * The second tier service adjudications for payor added services. */ public class ClaimResponseAddItemDetail: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseAddItemDetail" } } @@ -687,34 +687,34 @@ public class ClaimResponseAddItemDetail: BackboneElement { self.service = service } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["adjudication"] { + if let exist = js["adjudication"] { presentKeys.insert("adjudication") if let val = exist as? [FHIRJSON] { self.adjudication = ClaimResponseAddItemDetailAdjudication.instantiate(fromArray: val, owner: self) as? [ClaimResponseAddItemDetailAdjudication] } else { - errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fee"] { + if let exist = js["fee"] { presentKeys.insert("fee") if let val = exist as? FHIRJSON { self.fee = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fee", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fee", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["service"] { + if let exist = js["service"] { presentKeys.insert("service") if let val = exist as? FHIRJSON { self.service = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "service", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -748,7 +748,7 @@ public class ClaimResponseAddItemDetail: BackboneElement { * The adjudications results. */ public class ClaimResponseAddItemDetailAdjudication: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseAddItemDetailAdjudication" } } @@ -773,37 +773,37 @@ public class ClaimResponseAddItemDetailAdjudication: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["amount"] { + if let exist = js["amount"] { presentKeys.insert("amount") if let val = exist as? FHIRJSON { self.amount = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? NSNumber { self.value = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: type(of: exist))) } } } @@ -834,7 +834,7 @@ public class ClaimResponseAddItemDetailAdjudication: BackboneElement { * Financial instrument by which payment information for health care. */ public class ClaimResponseCoverage: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseCoverage" } } @@ -877,88 +877,88 @@ public class ClaimResponseCoverage: BackboneElement { self.sequence = sequence } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["businessArrangement"] { + if let exist = js["businessArrangement"] { presentKeys.insert("businessArrangement") if let val = exist as? String { self.businessArrangement = val } else { - errors.append(FHIRJSONError(key: "businessArrangement", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "businessArrangement", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["claimResponse"] { + if let exist = js["claimResponse"] { presentKeys.insert("claimResponse") if let val = exist as? FHIRJSON { self.claimResponse = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "claimResponse", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "claimResponse", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["coverage"] { + if let exist = js["coverage"] { presentKeys.insert("coverage") if let val = exist as? FHIRJSON { self.coverage = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "coverage", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "coverage", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "coverage")) } - if let exist: AnyObject = js["focal"] { + if let exist = js["focal"] { presentKeys.insert("focal") if let val = exist as? Bool { self.focal = val } else { - errors.append(FHIRJSONError(key: "focal", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "focal", wants: Bool.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "focal")) } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["preAuthRef"] { + if let exist = js["preAuthRef"] { presentKeys.insert("preAuthRef") if let val = exist as? [String] { self.preAuthRef = val } else { - errors.append(FHIRJSONError(key: "preAuthRef", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "preAuthRef", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["relationship"] { + if let exist = js["relationship"] { presentKeys.insert("relationship") if let val = exist as? FHIRJSON { self.relationship = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "relationship")) } - if let exist: AnyObject = js["sequence"] { + if let exist = js["sequence"] { presentKeys.insert("sequence") if let val = exist as? UInt { self.sequence = val } else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: type(of: exist))) } } else { @@ -987,7 +987,7 @@ public class ClaimResponseCoverage: BackboneElement { json["originalRuleset"] = originalRuleset.asJSON() } if let preAuthRef = self.preAuthRef { - var arr = [AnyObject]() + var arr = [Any]() for val in preAuthRef { arr.append(val.asJSON()) } @@ -1011,7 +1011,7 @@ public class ClaimResponseCoverage: BackboneElement { * Mutually exclusive with Services Provided (Item). */ public class ClaimResponseError: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseError" } } @@ -1039,46 +1039,46 @@ public class ClaimResponseError: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["detailSequenceLinkId"] { + if let exist = js["detailSequenceLinkId"] { presentKeys.insert("detailSequenceLinkId") if let val = exist as? UInt { self.detailSequenceLinkId = val } else { - errors.append(FHIRJSONError(key: "detailSequenceLinkId", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detailSequenceLinkId", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sequenceLinkId"] { + if let exist = js["sequenceLinkId"] { presentKeys.insert("sequenceLinkId") if let val = exist as? UInt { self.sequenceLinkId = val } else { - errors.append(FHIRJSONError(key: "sequenceLinkId", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequenceLinkId", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subdetailSequenceLinkId"] { + if let exist = js["subdetailSequenceLinkId"] { presentKeys.insert("subdetailSequenceLinkId") if let val = exist as? UInt { self.subdetailSequenceLinkId = val } else { - errors.append(FHIRJSONError(key: "subdetailSequenceLinkId", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subdetailSequenceLinkId", wants: UInt.self, has: type(of: exist))) } } } @@ -1112,7 +1112,7 @@ public class ClaimResponseError: BackboneElement { * The first tier service adjudications for submitted services. */ public class ClaimResponseItem: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseItem" } } @@ -1140,43 +1140,43 @@ public class ClaimResponseItem: BackboneElement { self.sequenceLinkId = sequenceLinkId } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["adjudication"] { + if let exist = js["adjudication"] { presentKeys.insert("adjudication") if let val = exist as? [FHIRJSON] { self.adjudication = ClaimResponseItemAdjudication.instantiate(fromArray: val, owner: self) as? [ClaimResponseItemAdjudication] } else { - errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["detail"] { + if let exist = js["detail"] { presentKeys.insert("detail") if let val = exist as? [FHIRJSON] { self.detail = ClaimResponseItemDetail.instantiate(fromArray: val, owner: self) as? [ClaimResponseItemDetail] } else { - errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["noteNumber"] { + if let exist = js["noteNumber"] { presentKeys.insert("noteNumber") if let val = exist as? [UInt] { self.noteNumber = val } else { - errors.append(FHIRJSONError(key: "noteNumber", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "noteNumber", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sequenceLinkId"] { + if let exist = js["sequenceLinkId"] { presentKeys.insert("sequenceLinkId") if let val = exist as? UInt { self.sequenceLinkId = val } else { - errors.append(FHIRJSONError(key: "sequenceLinkId", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequenceLinkId", wants: UInt.self, has: type(of: exist))) } } else { @@ -1196,7 +1196,7 @@ public class ClaimResponseItem: BackboneElement { json["detail"] = ClaimResponseItemDetail.asJSONArray(detail) } if let noteNumber = self.noteNumber { - var arr = [AnyObject]() + var arr = [Any]() for val in noteNumber { arr.append(val.asJSON()) } @@ -1217,7 +1217,7 @@ public class ClaimResponseItem: BackboneElement { * The adjudications results. */ public class ClaimResponseItemAdjudication: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseItemAdjudication" } } @@ -1242,37 +1242,37 @@ public class ClaimResponseItemAdjudication: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["amount"] { + if let exist = js["amount"] { presentKeys.insert("amount") if let val = exist as? FHIRJSON { self.amount = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? NSNumber { self.value = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: type(of: exist))) } } } @@ -1303,7 +1303,7 @@ public class ClaimResponseItemAdjudication: BackboneElement { * The second tier service adjudications for submitted services. */ public class ClaimResponseItemDetail: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseItemDetail" } } @@ -1328,37 +1328,37 @@ public class ClaimResponseItemDetail: BackboneElement { self.sequenceLinkId = sequenceLinkId } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["adjudication"] { + if let exist = js["adjudication"] { presentKeys.insert("adjudication") if let val = exist as? [FHIRJSON] { self.adjudication = ClaimResponseItemDetailAdjudication.instantiate(fromArray: val, owner: self) as? [ClaimResponseItemDetailAdjudication] } else { - errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sequenceLinkId"] { + if let exist = js["sequenceLinkId"] { presentKeys.insert("sequenceLinkId") if let val = exist as? UInt { self.sequenceLinkId = val } else { - errors.append(FHIRJSONError(key: "sequenceLinkId", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequenceLinkId", wants: UInt.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "sequenceLinkId")) } - if let exist: AnyObject = js["subDetail"] { + if let exist = js["subDetail"] { presentKeys.insert("subDetail") if let val = exist as? [FHIRJSON] { self.subDetail = ClaimResponseItemDetailSubDetail.instantiate(fromArray: val, owner: self) as? [ClaimResponseItemDetailSubDetail] } else { - errors.append(FHIRJSONError(key: "subDetail", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subDetail", wants: Array.self, has: type(of: exist))) } } } @@ -1389,7 +1389,7 @@ public class ClaimResponseItemDetail: BackboneElement { * The adjudications results. */ public class ClaimResponseItemDetailAdjudication: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseItemDetailAdjudication" } } @@ -1414,37 +1414,37 @@ public class ClaimResponseItemDetailAdjudication: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["amount"] { + if let exist = js["amount"] { presentKeys.insert("amount") if let val = exist as? FHIRJSON { self.amount = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? NSNumber { self.value = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: type(of: exist))) } } } @@ -1475,7 +1475,7 @@ public class ClaimResponseItemDetailAdjudication: BackboneElement { * The third tier service adjudications for submitted services. */ public class ClaimResponseItemDetailSubDetail: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseItemDetailSubDetail" } } @@ -1497,25 +1497,25 @@ public class ClaimResponseItemDetailSubDetail: BackboneElement { self.sequenceLinkId = sequenceLinkId } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["adjudication"] { + if let exist = js["adjudication"] { presentKeys.insert("adjudication") if let val = exist as? [FHIRJSON] { self.adjudication = ClaimResponseItemDetailSubDetailAdjudication.instantiate(fromArray: val, owner: self) as? [ClaimResponseItemDetailSubDetailAdjudication] } else { - errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "adjudication", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sequenceLinkId"] { + if let exist = js["sequenceLinkId"] { presentKeys.insert("sequenceLinkId") if let val = exist as? UInt { self.sequenceLinkId = val } else { - errors.append(FHIRJSONError(key: "sequenceLinkId", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequenceLinkId", wants: UInt.self, has: type(of: exist))) } } else { @@ -1546,7 +1546,7 @@ public class ClaimResponseItemDetailSubDetail: BackboneElement { * The adjudications results. */ public class ClaimResponseItemDetailSubDetailAdjudication: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseItemDetailSubDetailAdjudication" } } @@ -1571,37 +1571,37 @@ public class ClaimResponseItemDetailSubDetailAdjudication: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["amount"] { + if let exist = js["amount"] { presentKeys.insert("amount") if let val = exist as? FHIRJSON { self.amount = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? NSNumber { self.value = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: type(of: exist))) } } } @@ -1632,7 +1632,7 @@ public class ClaimResponseItemDetailSubDetailAdjudication: BackboneElement { * Note text. */ public class ClaimResponseNote: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClaimResponseNote" } } @@ -1651,34 +1651,34 @@ public class ClaimResponseNote: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["number"] { + if let exist = js["number"] { presentKeys.insert("number") if let val = exist as? UInt { self.number = val } else { - errors.append(FHIRJSONError(key: "number", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "number", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/ClinicalImpression.swift b/Sources/Models/ClinicalImpression.swift index 3851ee40..be44cfa2 100644 --- a/Sources/Models/ClinicalImpression.swift +++ b/Sources/Models/ClinicalImpression.swift @@ -2,7 +2,7 @@ // ClinicalImpression.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ClinicalImpression) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ClinicalImpression) on 2016-09-16. // 2016, SMART Health IT. // @@ -19,7 +19,7 @@ import Foundation * tools such as Apgar score. */ public class ClinicalImpression: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClinicalImpression" } } @@ -90,175 +90,175 @@ public class ClinicalImpression: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["action"] { + if let exist = js["action"] { presentKeys.insert("action") if let val = exist as? [FHIRJSON] { self.action = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "action", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["assessor"] { + if let exist = js["assessor"] { presentKeys.insert("assessor") if let val = exist as? FHIRJSON { self.assessor = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "assessor", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "assessor", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["finding"] { + if let exist = js["finding"] { presentKeys.insert("finding") if let val = exist as? [FHIRJSON] { self.finding = ClinicalImpressionFinding.instantiate(fromArray: val, owner: self) as? [ClinicalImpressionFinding] } else { - errors.append(FHIRJSONError(key: "finding", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "finding", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["investigations"] { + if let exist = js["investigations"] { presentKeys.insert("investigations") if let val = exist as? [FHIRJSON] { self.investigations = ClinicalImpressionInvestigations.instantiate(fromArray: val, owner: self) as? [ClinicalImpressionInvestigations] } else { - errors.append(FHIRJSONError(key: "investigations", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "investigations", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["plan"] { + if let exist = js["plan"] { presentKeys.insert("plan") if let val = exist as? [FHIRJSON] { self.plan = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "plan", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "plan", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["previous"] { + if let exist = js["previous"] { presentKeys.insert("previous") if let val = exist as? FHIRJSON { self.previous = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "previous", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "previous", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["problem"] { + if let exist = js["problem"] { presentKeys.insert("problem") if let val = exist as? [FHIRJSON] { self.problem = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "problem", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "problem", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["prognosis"] { + if let exist = js["prognosis"] { presentKeys.insert("prognosis") if let val = exist as? String { self.prognosis = val } else { - errors.append(FHIRJSONError(key: "prognosis", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prognosis", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["protocol"] { + if let exist = js["protocol"] { presentKeys.insert("protocol") if let val = exist as? String { self.protocol_fhir = URL(string: val) } else { - errors.append(FHIRJSONError(key: "protocol", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "protocol", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["resolved"] { + if let exist = js["resolved"] { presentKeys.insert("resolved") if let val = exist as? [FHIRJSON] { self.resolved = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "resolved", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "resolved", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ruledOut"] { + if let exist = js["ruledOut"] { presentKeys.insert("ruledOut") if let val = exist as? [FHIRJSON] { self.ruledOut = ClinicalImpressionRuledOut.instantiate(fromArray: val, owner: self) as? [ClinicalImpressionRuledOut] } else { - errors.append(FHIRJSONError(key: "ruledOut", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruledOut", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["summary"] { + if let exist = js["summary"] { presentKeys.insert("summary") if let val = exist as? String { self.summary = val } else { - errors.append(FHIRJSONError(key: "summary", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "summary", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["triggerCodeableConcept"] { + if let exist = js["triggerCodeableConcept"] { presentKeys.insert("triggerCodeableConcept") if let val = exist as? FHIRJSON { self.triggerCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "triggerCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "triggerCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["triggerReference"] { + if let exist = js["triggerReference"] { presentKeys.insert("triggerReference") if let val = exist as? FHIRJSON { self.triggerReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "triggerReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "triggerReference", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -334,7 +334,7 @@ public class ClinicalImpression: DomainResource { * Specific findings or diagnoses that was considered likely or relevant to ongoing treatment. */ public class ClinicalImpressionFinding: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClinicalImpressionFinding" } } @@ -356,25 +356,25 @@ public class ClinicalImpressionFinding: BackboneElement { self.item = item } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["cause"] { + if let exist = js["cause"] { presentKeys.insert("cause") if let val = exist as? String { self.cause = val } else { - errors.append(FHIRJSONError(key: "cause", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "cause", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["item"] { + if let exist = js["item"] { presentKeys.insert("item") if let val = exist as? FHIRJSON { self.item = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -407,7 +407,7 @@ public class ClinicalImpressionFinding: BackboneElement { * assessment process, or data previously generated and recorded that is pertinent to the outcomes. */ public class ClinicalImpressionInvestigations: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClinicalImpressionInvestigations" } } @@ -429,28 +429,28 @@ public class ClinicalImpressionInvestigations: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["item"] { + if let exist = js["item"] { presentKeys.insert("item") if let val = exist as? [FHIRJSON] { self.item = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: Array.self, has: type(of: exist))) } } } @@ -476,7 +476,7 @@ public class ClinicalImpressionInvestigations: BackboneElement { * Diagnosis considered not possible. */ public class ClinicalImpressionRuledOut: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ClinicalImpressionRuledOut" } } @@ -498,28 +498,28 @@ public class ClinicalImpressionRuledOut: BackboneElement { self.item = item } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["item"] { + if let exist = js["item"] { presentKeys.insert("item") if let val = exist as? FHIRJSON { self.item = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "item")) } - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? String { self.reason = val } else { - errors.append(FHIRJSONError(key: "reason", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/CodeableConcept.swift b/Sources/Models/CodeableConcept.swift index faee7ccd..948ae9b7 100644 --- a/Sources/Models/CodeableConcept.swift +++ b/Sources/Models/CodeableConcept.swift @@ -2,7 +2,7 @@ // CodeableConcept.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CodeableConcept) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CodeableConcept) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text. */ public class CodeableConcept: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CodeableConcept" } } @@ -31,25 +31,25 @@ public class CodeableConcept: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["coding"] { + if let exist = js["coding"] { presentKeys.insert("coding") if let val = exist as? [FHIRJSON] { self.coding = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "coding", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "coding", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Coding.swift b/Sources/Models/Coding.swift index d3fd4631..2b31ec28 100644 --- a/Sources/Models/Coding.swift +++ b/Sources/Models/Coding.swift @@ -2,7 +2,7 @@ // Coding.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Coding) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Coding) on 2016-09-16. // 2016, SMART Health IT. // @@ -13,7 +13,7 @@ import Foundation * A reference to a code defined by a terminology system. */ public class Coding: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Coding" } } @@ -38,52 +38,52 @@ public class Coding: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["display"] { + if let exist = js["display"] { presentKeys.insert("display") if let val = exist as? String { self.display = val } else { - errors.append(FHIRJSONError(key: "display", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "display", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["system"] { + if let exist = js["system"] { presentKeys.insert("system") if let val = exist as? String { self.system = URL(string: val) } else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "system", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["userSelected"] { + if let exist = js["userSelected"] { presentKeys.insert("userSelected") if let val = exist as? Bool { self.userSelected = val } else { - errors.append(FHIRJSONError(key: "userSelected", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "userSelected", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Communication.swift b/Sources/Models/Communication.swift index 9d0183a0..617030d3 100644 --- a/Sources/Models/Communication.swift +++ b/Sources/Models/Communication.swift @@ -2,7 +2,7 @@ // Communication.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Communication) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Communication) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * health agency was notified about a reportable condition. */ public class Communication: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Communication" } } @@ -65,124 +65,124 @@ public class Communication: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? FHIRJSON { self.category = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medium"] { + if let exist = js["medium"] { presentKeys.insert("medium") if let val = exist as? [FHIRJSON] { self.medium = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "medium", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medium", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["payload"] { + if let exist = js["payload"] { presentKeys.insert("payload") if let val = exist as? [FHIRJSON] { self.payload = CommunicationPayload.instantiate(fromArray: val, owner: self) as? [CommunicationPayload] } else { - errors.append(FHIRJSONError(key: "payload", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "payload", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? [FHIRJSON] { self.reason = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["received"] { + if let exist = js["received"] { presentKeys.insert("received") if let val = exist as? String { self.received = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "received", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "received", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["recipient"] { + if let exist = js["recipient"] { presentKeys.insert("recipient") if let val = exist as? [FHIRJSON] { self.recipient = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "recipient", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "recipient", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestDetail"] { + if let exist = js["requestDetail"] { presentKeys.insert("requestDetail") if let val = exist as? FHIRJSON { self.requestDetail = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestDetail", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestDetail", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sender"] { + if let exist = js["sender"] { presentKeys.insert("sender") if let val = exist as? FHIRJSON { self.sender = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "sender", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sender", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sent"] { + if let exist = js["sent"] { presentKeys.insert("sent") if let val = exist as? String { self.sent = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "sent", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sent", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -243,7 +243,7 @@ public class Communication: DomainResource { * Text, attachment(s), or resource(s) that was communicated to the recipient. */ public class CommunicationPayload: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CommunicationPayload" } } @@ -270,34 +270,34 @@ public class CommunicationPayload: BackboneElement { self.contentString = contentString } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contentAttachment"] { + if let exist = js["contentAttachment"] { presentKeys.insert("contentAttachment") if let val = exist as? FHIRJSON { self.contentAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "contentAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contentReference"] { + if let exist = js["contentReference"] { presentKeys.insert("contentReference") if let val = exist as? FHIRJSON { self.contentReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "contentReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contentString"] { + if let exist = js["contentString"] { presentKeys.insert("contentString") if let val = exist as? String { self.contentString = val } else { - errors.append(FHIRJSONError(key: "contentString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentString", wants: String.self, has: type(of: exist))) } } diff --git a/Sources/Models/CommunicationRequest.swift b/Sources/Models/CommunicationRequest.swift index 8873fb7e..b9ff1dbe 100644 --- a/Sources/Models/CommunicationRequest.swift +++ b/Sources/Models/CommunicationRequest.swift @@ -2,7 +2,7 @@ // CommunicationRequest.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CommunicationRequest) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/CommunicationRequest) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * CDS system proposes that the public health agency be notified about a reportable condition. */ public class CommunicationRequest: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CommunicationRequest" } } @@ -71,142 +71,142 @@ public class CommunicationRequest: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? FHIRJSON { self.category = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medium"] { + if let exist = js["medium"] { presentKeys.insert("medium") if let val = exist as? [FHIRJSON] { self.medium = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "medium", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medium", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["payload"] { + if let exist = js["payload"] { presentKeys.insert("payload") if let val = exist as? [FHIRJSON] { self.payload = CommunicationRequestPayload.instantiate(fromArray: val, owner: self) as? [CommunicationRequestPayload] } else { - errors.append(FHIRJSONError(key: "payload", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "payload", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["priority"] { + if let exist = js["priority"] { presentKeys.insert("priority") if let val = exist as? FHIRJSON { self.priority = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? [FHIRJSON] { self.reason = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["recipient"] { + if let exist = js["recipient"] { presentKeys.insert("recipient") if let val = exist as? [FHIRJSON] { self.recipient = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "recipient", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "recipient", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestedOn"] { + if let exist = js["requestedOn"] { presentKeys.insert("requestedOn") if let val = exist as? String { self.requestedOn = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "requestedOn", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestedOn", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requester"] { + if let exist = js["requester"] { presentKeys.insert("requester") if let val = exist as? FHIRJSON { self.requester = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requester", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requester", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["scheduledDateTime"] { + if let exist = js["scheduledDateTime"] { presentKeys.insert("scheduledDateTime") if let val = exist as? String { self.scheduledDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "scheduledDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "scheduledDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["scheduledPeriod"] { + if let exist = js["scheduledPeriod"] { presentKeys.insert("scheduledPeriod") if let val = exist as? FHIRJSON { self.scheduledPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "scheduledPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "scheduledPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sender"] { + if let exist = js["sender"] { presentKeys.insert("sender") if let val = exist as? FHIRJSON { self.sender = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "sender", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sender", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -273,7 +273,7 @@ public class CommunicationRequest: DomainResource { * Text, attachment(s), or resource(s) to be communicated to the recipient. */ public class CommunicationRequestPayload: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CommunicationRequestPayload" } } @@ -300,34 +300,34 @@ public class CommunicationRequestPayload: BackboneElement { self.contentString = contentString } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contentAttachment"] { + if let exist = js["contentAttachment"] { presentKeys.insert("contentAttachment") if let val = exist as? FHIRJSON { self.contentAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "contentAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contentReference"] { + if let exist = js["contentReference"] { presentKeys.insert("contentReference") if let val = exist as? FHIRJSON { self.contentReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "contentReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contentString"] { + if let exist = js["contentString"] { presentKeys.insert("contentString") if let val = exist as? String { self.contentString = val } else { - errors.append(FHIRJSONError(key: "contentString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentString", wants: String.self, has: type(of: exist))) } } diff --git a/Sources/Models/Composition.swift b/Sources/Models/Composition.swift index f5d34cbd..97b42ac5 100644 --- a/Sources/Models/Composition.swift +++ b/Sources/Models/Composition.swift @@ -2,7 +2,7 @@ // Composition.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Composition) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Composition) on 2016-09-16. // 2016, SMART Health IT. // @@ -19,7 +19,7 @@ import Foundation * contained. */ public class Composition: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Composition" } } @@ -82,148 +82,148 @@ public class Composition: DomainResource { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["attester"] { + if let exist = js["attester"] { presentKeys.insert("attester") if let val = exist as? [FHIRJSON] { self.attester = CompositionAttester.instantiate(fromArray: val, owner: self) as? [CompositionAttester] } else { - errors.append(FHIRJSONError(key: "attester", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "attester", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? [FHIRJSON] { self.author = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "author", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "author")) } - if let exist: AnyObject = js["class"] { + if let exist = js["class"] { presentKeys.insert("class") if let val = exist as? FHIRJSON { self.class_fhir = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "class", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "class", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["confidentiality"] { + if let exist = js["confidentiality"] { presentKeys.insert("confidentiality") if let val = exist as? String { self.confidentiality = val } else { - errors.append(FHIRJSONError(key: "confidentiality", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "confidentiality", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["custodian"] { + if let exist = js["custodian"] { presentKeys.insert("custodian") if let val = exist as? FHIRJSON { self.custodian = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "custodian", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "custodian", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "date")) } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["event"] { + if let exist = js["event"] { presentKeys.insert("event") if let val = exist as? [FHIRJSON] { self.event = CompositionEvent.instantiate(fromArray: val, owner: self) as? [CompositionEvent] } else { - errors.append(FHIRJSONError(key: "event", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "event", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["section"] { + if let exist = js["section"] { presentKeys.insert("section") if let val = exist as? [FHIRJSON] { self.section = CompositionSection.instantiate(fromArray: val, owner: self) as? [CompositionSection] } else { - errors.append(FHIRJSONError(key: "section", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "section", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "subject")) } - if let exist: AnyObject = js["title"] { + if let exist = js["title"] { presentKeys.insert("title") if let val = exist as? String { self.title = val } else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "title", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "title")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -290,7 +290,7 @@ public class Composition: DomainResource { * A participant who has attested to the accuracy of the composition/document. */ public class CompositionAttester: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CompositionAttester" } } @@ -315,37 +315,37 @@ public class CompositionAttester: BackboneElement { self.mode = mode } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["mode"] { + if let exist = js["mode"] { presentKeys.insert("mode") if let val = exist as? [String] { self.mode = val } else { - errors.append(FHIRJSONError(key: "mode", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mode", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "mode")) } - if let exist: AnyObject = js["party"] { + if let exist = js["party"] { presentKeys.insert("party") if let val = exist as? FHIRJSON { self.party = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "party", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "party", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["time"] { + if let exist = js["time"] { presentKeys.insert("time") if let val = exist as? String { self.time = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "time", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "time", wants: String.self, has: type(of: exist))) } } } @@ -356,7 +356,7 @@ public class CompositionAttester: BackboneElement { var json = super.asJSON() if let mode = self.mode { - var arr = [AnyObject]() + var arr = [Any]() for val in mode { arr.append(val.asJSON()) } @@ -380,7 +380,7 @@ public class CompositionAttester: BackboneElement { * The clinical service, such as a colonoscopy or an appendectomy, being documented. */ public class CompositionEvent: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CompositionEvent" } } @@ -399,34 +399,34 @@ public class CompositionEvent: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? [FHIRJSON] { self.code = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "code", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["detail"] { + if let exist = js["detail"] { presentKeys.insert("detail") if let val = exist as? [FHIRJSON] { self.detail = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -457,7 +457,7 @@ public class CompositionEvent: BackboneElement { * The root of the sections that make up the composition. */ public class CompositionSection: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "CompositionSection" } } @@ -491,79 +491,79 @@ public class CompositionSection: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["emptyReason"] { + if let exist = js["emptyReason"] { presentKeys.insert("emptyReason") if let val = exist as? FHIRJSON { self.emptyReason = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "emptyReason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "emptyReason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["entry"] { + if let exist = js["entry"] { presentKeys.insert("entry") if let val = exist as? [FHIRJSON] { self.entry = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "entry", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entry", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["mode"] { + if let exist = js["mode"] { presentKeys.insert("mode") if let val = exist as? String { self.mode = val } else { - errors.append(FHIRJSONError(key: "mode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["orderedBy"] { + if let exist = js["orderedBy"] { presentKeys.insert("orderedBy") if let val = exist as? FHIRJSON { self.orderedBy = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "orderedBy", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "orderedBy", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["section"] { + if let exist = js["section"] { presentKeys.insert("section") if let val = exist as? [FHIRJSON] { self.section = CompositionSection.instantiate(fromArray: val, owner: self) as? [CompositionSection] } else { - errors.append(FHIRJSONError(key: "section", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "section", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? FHIRJSON { self.text = Narrative(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "text", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["title"] { + if let exist = js["title"] { presentKeys.insert("title") if let val = exist as? String { self.title = val } else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "title", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/ConceptMap.swift b/Sources/Models/ConceptMap.swift index abdf32c1..4e6ff4ab 100644 --- a/Sources/Models/ConceptMap.swift +++ b/Sources/Models/ConceptMap.swift @@ -2,7 +2,7 @@ // ConceptMap.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ConceptMap) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ConceptMap) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * elements, or classes in class models. */ public class ConceptMap: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConceptMap" } } @@ -90,172 +90,172 @@ public class ConceptMap: DomainResource { self.targetUri = targetUri } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = ConceptMapContact.instantiate(fromArray: val, owner: self) as? [ConceptMapContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["copyright"] { + if let exist = js["copyright"] { presentKeys.insert("copyright") if let val = exist as? String { self.copyright = val } else { - errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["element"] { + if let exist = js["element"] { presentKeys.insert("element") if let val = exist as? [FHIRJSON] { self.element = ConceptMapElement.instantiate(fromArray: val, owner: self) as? [ConceptMapElement] } else { - errors.append(FHIRJSONError(key: "element", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "element", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["experimental"] { + if let exist = js["experimental"] { presentKeys.insert("experimental") if let val = exist as? Bool { self.experimental = val } else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["publisher"] { + if let exist = js["publisher"] { presentKeys.insert("publisher") if let val = exist as? String { self.publisher = val } else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requirements"] { + if let exist = js["requirements"] { presentKeys.insert("requirements") if let val = exist as? String { self.requirements = val } else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sourceReference"] { + if let exist = js["sourceReference"] { presentKeys.insert("sourceReference") if let val = exist as? FHIRJSON { self.sourceReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "sourceReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sourceReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sourceUri"] { + if let exist = js["sourceUri"] { presentKeys.insert("sourceUri") if let val = exist as? String { self.sourceUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "sourceUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sourceUri", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["targetReference"] { + if let exist = js["targetReference"] { presentKeys.insert("targetReference") if let val = exist as? FHIRJSON { self.targetReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "targetReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "targetReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["targetUri"] { + if let exist = js["targetUri"] { presentKeys.insert("targetUri") if let val = exist as? String { self.targetUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "targetUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "targetUri", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["useContext"] { + if let exist = js["useContext"] { presentKeys.insert("useContext") if let val = exist as? [FHIRJSON] { self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } @@ -339,7 +339,7 @@ public class ConceptMap: DomainResource { * Contacts to assist a user in finding and communicating with the publisher. */ public class ConceptMapContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConceptMapContact" } } @@ -355,25 +355,25 @@ public class ConceptMapContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -401,7 +401,7 @@ public class ConceptMapContact: BackboneElement { * Mappings for an individual concept in the source to one or more concepts in the target. */ public class ConceptMapElement: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConceptMapElement" } } @@ -420,34 +420,34 @@ public class ConceptMapElement: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["codeSystem"] { + if let exist = js["codeSystem"] { presentKeys.insert("codeSystem") if let val = exist as? String { self.codeSystem = URL(string: val) } else { - errors.append(FHIRJSONError(key: "codeSystem", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "codeSystem", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? [FHIRJSON] { self.target = ConceptMapElementTarget.instantiate(fromArray: val, owner: self) as? [ConceptMapElementTarget] } else { - errors.append(FHIRJSONError(key: "target", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: Array.self, has: type(of: exist))) } } } @@ -478,7 +478,7 @@ public class ConceptMapElement: BackboneElement { * A concept from the target value set that this concept maps to. */ public class ConceptMapElementTarget: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConceptMapElementTarget" } } @@ -512,64 +512,64 @@ public class ConceptMapElementTarget: BackboneElement { self.equivalence = equivalence } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["codeSystem"] { + if let exist = js["codeSystem"] { presentKeys.insert("codeSystem") if let val = exist as? String { self.codeSystem = URL(string: val) } else { - errors.append(FHIRJSONError(key: "codeSystem", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "codeSystem", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["comments"] { + if let exist = js["comments"] { presentKeys.insert("comments") if let val = exist as? String { self.comments = val } else { - errors.append(FHIRJSONError(key: "comments", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comments", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dependsOn"] { + if let exist = js["dependsOn"] { presentKeys.insert("dependsOn") if let val = exist as? [FHIRJSON] { self.dependsOn = ConceptMapElementTargetDependsOn.instantiate(fromArray: val, owner: self) as? [ConceptMapElementTargetDependsOn] } else { - errors.append(FHIRJSONError(key: "dependsOn", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dependsOn", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["equivalence"] { + if let exist = js["equivalence"] { presentKeys.insert("equivalence") if let val = exist as? String { self.equivalence = val } else { - errors.append(FHIRJSONError(key: "equivalence", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "equivalence", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "equivalence")) } - if let exist: AnyObject = js["product"] { + if let exist = js["product"] { presentKeys.insert("product") if let val = exist as? [FHIRJSON] { self.product = ConceptMapElementTargetDependsOn.instantiate(fromArray: val, owner: self) as? [ConceptMapElementTargetDependsOn] } else { - errors.append(FHIRJSONError(key: "product", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "product", wants: Array.self, has: type(of: exist))) } } } @@ -610,7 +610,7 @@ public class ConceptMapElementTarget: BackboneElement { * can be resolved, and it has the specified value. */ public class ConceptMapElementTargetDependsOn: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConceptMapElementTargetDependsOn" } } @@ -637,40 +637,40 @@ public class ConceptMapElementTargetDependsOn: BackboneElement { self.element = element } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["codeSystem"] { + if let exist = js["codeSystem"] { presentKeys.insert("codeSystem") if let val = exist as? String { self.codeSystem = URL(string: val) } else { - errors.append(FHIRJSONError(key: "codeSystem", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "codeSystem", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "codeSystem")) } - if let exist: AnyObject = js["element"] { + if let exist = js["element"] { presentKeys.insert("element") if let val = exist as? String { self.element = URL(string: val) } else { - errors.append(FHIRJSONError(key: "element", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "element", wants: String.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Condition.swift b/Sources/Models/Condition.swift index b5c89d79..4c5135a7 100644 --- a/Sources/Models/Condition.swift +++ b/Sources/Models/Condition.swift @@ -2,7 +2,7 @@ // Condition.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Condition) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Condition) on 2016-09-16. // 2016, SMART Health IT. // @@ -17,7 +17,7 @@ import Foundation * a discharge summary. */ public class Condition: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Condition" } } @@ -110,238 +110,238 @@ public class Condition: DomainResource { self.verificationStatus = verificationStatus } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["abatementBoolean"] { + if let exist = js["abatementBoolean"] { presentKeys.insert("abatementBoolean") if let val = exist as? Bool { self.abatementBoolean = val } else { - errors.append(FHIRJSONError(key: "abatementBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "abatementBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["abatementDateTime"] { + if let exist = js["abatementDateTime"] { presentKeys.insert("abatementDateTime") if let val = exist as? String { self.abatementDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "abatementDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "abatementDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["abatementPeriod"] { + if let exist = js["abatementPeriod"] { presentKeys.insert("abatementPeriod") if let val = exist as? FHIRJSON { self.abatementPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "abatementPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "abatementPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["abatementQuantity"] { + if let exist = js["abatementQuantity"] { presentKeys.insert("abatementQuantity") if let val = exist as? FHIRJSON { self.abatementQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "abatementQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "abatementQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["abatementRange"] { + if let exist = js["abatementRange"] { presentKeys.insert("abatementRange") if let val = exist as? FHIRJSON { self.abatementRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "abatementRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "abatementRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["abatementString"] { + if let exist = js["abatementString"] { presentKeys.insert("abatementString") if let val = exist as? String { self.abatementString = val } else { - errors.append(FHIRJSONError(key: "abatementString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "abatementString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["asserter"] { + if let exist = js["asserter"] { presentKeys.insert("asserter") if let val = exist as? FHIRJSON { self.asserter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "asserter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "asserter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["bodySite"] { + if let exist = js["bodySite"] { presentKeys.insert("bodySite") if let val = exist as? [FHIRJSON] { self.bodySite = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "bodySite", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySite", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? FHIRJSON { self.category = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["clinicalStatus"] { + if let exist = js["clinicalStatus"] { presentKeys.insert("clinicalStatus") if let val = exist as? String { self.clinicalStatus = val } else { - errors.append(FHIRJSONError(key: "clinicalStatus", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "clinicalStatus", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["dateRecorded"] { + if let exist = js["dateRecorded"] { presentKeys.insert("dateRecorded") if let val = exist as? String { self.dateRecorded = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "dateRecorded", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateRecorded", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["evidence"] { + if let exist = js["evidence"] { presentKeys.insert("evidence") if let val = exist as? [FHIRJSON] { self.evidence = ConditionEvidence.instantiate(fromArray: val, owner: self) as? [ConditionEvidence] } else { - errors.append(FHIRJSONError(key: "evidence", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "evidence", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["notes"] { + if let exist = js["notes"] { presentKeys.insert("notes") if let val = exist as? String { self.notes = val } else { - errors.append(FHIRJSONError(key: "notes", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "notes", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["onsetDateTime"] { + if let exist = js["onsetDateTime"] { presentKeys.insert("onsetDateTime") if let val = exist as? String { self.onsetDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "onsetDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "onsetDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["onsetPeriod"] { + if let exist = js["onsetPeriod"] { presentKeys.insert("onsetPeriod") if let val = exist as? FHIRJSON { self.onsetPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "onsetPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "onsetPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["onsetQuantity"] { + if let exist = js["onsetQuantity"] { presentKeys.insert("onsetQuantity") if let val = exist as? FHIRJSON { self.onsetQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "onsetQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "onsetQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["onsetRange"] { + if let exist = js["onsetRange"] { presentKeys.insert("onsetRange") if let val = exist as? FHIRJSON { self.onsetRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "onsetRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "onsetRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["onsetString"] { + if let exist = js["onsetString"] { presentKeys.insert("onsetString") if let val = exist as? String { self.onsetString = val } else { - errors.append(FHIRJSONError(key: "onsetString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "onsetString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["severity"] { + if let exist = js["severity"] { presentKeys.insert("severity") if let val = exist as? FHIRJSON { self.severity = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "severity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "severity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["stage"] { + if let exist = js["stage"] { presentKeys.insert("stage") if let val = exist as? FHIRJSON { self.stage = ConditionStage(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "stage", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "stage", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["verificationStatus"] { + if let exist = js["verificationStatus"] { presentKeys.insert("verificationStatus") if let val = exist as? String { self.verificationStatus = val } else { - errors.append(FHIRJSONError(key: "verificationStatus", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "verificationStatus", wants: String.self, has: type(of: exist))) } } else { @@ -441,7 +441,7 @@ public class Condition: DomainResource { * Supporting Evidence / manifestations that are the basis on which this condition is suspected or confirmed. */ public class ConditionEvidence: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConditionEvidence" } } @@ -457,25 +457,25 @@ public class ConditionEvidence: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["detail"] { + if let exist = js["detail"] { presentKeys.insert("detail") if let val = exist as? [FHIRJSON] { self.detail = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: type(of: exist))) } } } @@ -503,7 +503,7 @@ public class ConditionEvidence: BackboneElement { * Clinical stage or grade of a condition. May include formal severity assessments. */ public class ConditionStage: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConditionStage" } } @@ -519,25 +519,25 @@ public class ConditionStage: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["assessment"] { + if let exist = js["assessment"] { presentKeys.insert("assessment") if let val = exist as? [FHIRJSON] { self.assessment = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "assessment", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "assessment", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["summary"] { + if let exist = js["summary"] { presentKeys.insert("summary") if let val = exist as? FHIRJSON { self.summary = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "summary", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "summary", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Conformance.swift b/Sources/Models/Conformance.swift index fe1ea790..7e116c75 100644 --- a/Sources/Models/Conformance.swift +++ b/Sources/Models/Conformance.swift @@ -2,7 +2,7 @@ // Conformance.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Conformance) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Conformance) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * functionality or a statement of required or desired server implementation. */ public class Conformance: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Conformance" } } @@ -99,211 +99,211 @@ public class Conformance: DomainResource { self.kind = kind } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["acceptUnknown"] { + if let exist = js["acceptUnknown"] { presentKeys.insert("acceptUnknown") if let val = exist as? String { self.acceptUnknown = val } else { - errors.append(FHIRJSONError(key: "acceptUnknown", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "acceptUnknown", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "acceptUnknown")) } - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = ConformanceContact.instantiate(fromArray: val, owner: self) as? [ConformanceContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["copyright"] { + if let exist = js["copyright"] { presentKeys.insert("copyright") if let val = exist as? String { self.copyright = val } else { - errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "date")) } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["document"] { + if let exist = js["document"] { presentKeys.insert("document") if let val = exist as? [FHIRJSON] { self.document = ConformanceDocument.instantiate(fromArray: val, owner: self) as? [ConformanceDocument] } else { - errors.append(FHIRJSONError(key: "document", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "document", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["experimental"] { + if let exist = js["experimental"] { presentKeys.insert("experimental") if let val = exist as? Bool { self.experimental = val } else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fhirVersion"] { + if let exist = js["fhirVersion"] { presentKeys.insert("fhirVersion") if let val = exist as? String { self.fhirVersion = val } else { - errors.append(FHIRJSONError(key: "fhirVersion", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fhirVersion", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "fhirVersion")) } - if let exist: AnyObject = js["format"] { + if let exist = js["format"] { presentKeys.insert("format") if let val = exist as? [String] { self.format = val } else { - errors.append(FHIRJSONError(key: "format", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "format", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "format")) } - if let exist: AnyObject = js["implementation"] { + if let exist = js["implementation"] { presentKeys.insert("implementation") if let val = exist as? FHIRJSON { self.implementation = ConformanceImplementation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "implementation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "implementation", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["kind"] { + if let exist = js["kind"] { presentKeys.insert("kind") if let val = exist as? String { self.kind = val } else { - errors.append(FHIRJSONError(key: "kind", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "kind", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "kind")) } - if let exist: AnyObject = js["messaging"] { + if let exist = js["messaging"] { presentKeys.insert("messaging") if let val = exist as? [FHIRJSON] { self.messaging = ConformanceMessaging.instantiate(fromArray: val, owner: self) as? [ConformanceMessaging] } else { - errors.append(FHIRJSONError(key: "messaging", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "messaging", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["profile"] { + if let exist = js["profile"] { presentKeys.insert("profile") if let val = exist as? [FHIRJSON] { self.profile = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "profile", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "profile", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["publisher"] { + if let exist = js["publisher"] { presentKeys.insert("publisher") if let val = exist as? String { self.publisher = val } else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requirements"] { + if let exist = js["requirements"] { presentKeys.insert("requirements") if let val = exist as? String { self.requirements = val } else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rest"] { + if let exist = js["rest"] { presentKeys.insert("rest") if let val = exist as? [FHIRJSON] { self.rest = ConformanceRest.instantiate(fromArray: val, owner: self) as? [ConformanceRest] } else { - errors.append(FHIRJSONError(key: "rest", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rest", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["software"] { + if let exist = js["software"] { presentKeys.insert("software") if let val = exist as? FHIRJSON { self.software = ConformanceSoftware(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "software", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "software", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } @@ -338,7 +338,7 @@ public class Conformance: DomainResource { json["fhirVersion"] = fhirVersion.asJSON() } if let format = self.format { - var arr = [AnyObject]() + var arr = [Any]() for val in format { arr.append(val.asJSON()) } @@ -392,7 +392,7 @@ public class Conformance: DomainResource { * Contacts to assist a user in finding and communicating with the publisher. */ public class ConformanceContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceContact" } } @@ -408,25 +408,25 @@ public class ConformanceContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -454,7 +454,7 @@ public class ConformanceContact: BackboneElement { * A document definition. */ public class ConformanceDocument: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceDocument" } } @@ -480,37 +480,37 @@ public class ConformanceDocument: BackboneElement { self.profile = profile } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["documentation"] { + if let exist = js["documentation"] { presentKeys.insert("documentation") if let val = exist as? String { self.documentation = val } else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["mode"] { + if let exist = js["mode"] { presentKeys.insert("mode") if let val = exist as? String { self.mode = val } else { - errors.append(FHIRJSONError(key: "mode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mode", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "mode")) } - if let exist: AnyObject = js["profile"] { + if let exist = js["profile"] { presentKeys.insert("profile") if let val = exist as? FHIRJSON { self.profile = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -545,7 +545,7 @@ public class ConformanceDocument: BackboneElement { * installation, rather than the capabilities of a software program. */ public class ConformanceImplementation: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceImplementation" } } @@ -567,28 +567,28 @@ public class ConformanceImplementation: BackboneElement { self.description_fhir = description_fhir } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "description")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } } @@ -616,7 +616,7 @@ public class ConformanceImplementation: BackboneElement { * A description of the messaging capabilities of the solution. */ public class ConformanceMessaging: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceMessaging" } } @@ -644,46 +644,46 @@ public class ConformanceMessaging: BackboneElement { self.event = event } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["documentation"] { + if let exist = js["documentation"] { presentKeys.insert("documentation") if let val = exist as? String { self.documentation = val } else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["endpoint"] { + if let exist = js["endpoint"] { presentKeys.insert("endpoint") if let val = exist as? [FHIRJSON] { self.endpoint = ConformanceMessagingEndpoint.instantiate(fromArray: val, owner: self) as? [ConformanceMessagingEndpoint] } else { - errors.append(FHIRJSONError(key: "endpoint", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "endpoint", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["event"] { + if let exist = js["event"] { presentKeys.insert("event") if let val = exist as? [FHIRJSON] { self.event = ConformanceMessagingEvent.instantiate(fromArray: val, owner: self) as? [ConformanceMessagingEvent] } else { - errors.append(FHIRJSONError(key: "event", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "event", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "event")) } - if let exist: AnyObject = js["reliableCache"] { + if let exist = js["reliableCache"] { presentKeys.insert("reliableCache") if let val = exist as? UInt { self.reliableCache = val } else { - errors.append(FHIRJSONError(key: "reliableCache", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reliableCache", wants: UInt.self, has: type(of: exist))) } } } @@ -717,7 +717,7 @@ public class ConformanceMessaging: BackboneElement { * An endpoint (network accessible address) to which messages and/or replies are to be sent. */ public class ConformanceMessagingEndpoint: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceMessagingEndpoint" } } @@ -740,28 +740,28 @@ public class ConformanceMessagingEndpoint: BackboneElement { self.protocol_fhir = protocol_fhir } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["address"] { + if let exist = js["address"] { presentKeys.insert("address") if let val = exist as? String { self.address = URL(string: val) } else { - errors.append(FHIRJSONError(key: "address", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "address", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "address")) } - if let exist: AnyObject = js["protocol"] { + if let exist = js["protocol"] { presentKeys.insert("protocol") if let val = exist as? FHIRJSON { self.protocol_fhir = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "protocol", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "protocol", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -792,7 +792,7 @@ public class ConformanceMessagingEndpoint: BackboneElement { * A description of the solution's support for an event at this end-point. */ public class ConformanceMessagingEvent: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceMessagingEvent" } } @@ -833,82 +833,82 @@ public class ConformanceMessagingEvent: BackboneElement { self.response = response } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? String { self.category = val } else { - errors.append(FHIRJSONError(key: "category", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["documentation"] { + if let exist = js["documentation"] { presentKeys.insert("documentation") if let val = exist as? String { self.documentation = val } else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["focus"] { + if let exist = js["focus"] { presentKeys.insert("focus") if let val = exist as? String { self.focus = val } else { - errors.append(FHIRJSONError(key: "focus", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "focus", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "focus")) } - if let exist: AnyObject = js["mode"] { + if let exist = js["mode"] { presentKeys.insert("mode") if let val = exist as? String { self.mode = val } else { - errors.append(FHIRJSONError(key: "mode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mode", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "mode")) } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "request")) } - if let exist: AnyObject = js["response"] { + if let exist = js["response"] { presentKeys.insert("response") if let val = exist as? FHIRJSON { self.response = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -954,7 +954,7 @@ public class ConformanceMessagingEvent: BackboneElement { * A definition of the restful capabilities of the solution, if any. */ public class ConformanceRest: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceRest" } } @@ -998,94 +998,94 @@ public class ConformanceRest: BackboneElement { self.resource = resource } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["compartment"] { + if let exist = js["compartment"] { presentKeys.insert("compartment") if let val = exist as? [String] { self.compartment = URL.instantiate(fromArray: val) } else { - errors.append(FHIRJSONError(key: "compartment", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "compartment", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["documentation"] { + if let exist = js["documentation"] { presentKeys.insert("documentation") if let val = exist as? String { self.documentation = val } else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["interaction"] { + if let exist = js["interaction"] { presentKeys.insert("interaction") if let val = exist as? [FHIRJSON] { self.interaction = ConformanceRestInteraction.instantiate(fromArray: val, owner: self) as? [ConformanceRestInteraction] } else { - errors.append(FHIRJSONError(key: "interaction", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "interaction", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["mode"] { + if let exist = js["mode"] { presentKeys.insert("mode") if let val = exist as? String { self.mode = val } else { - errors.append(FHIRJSONError(key: "mode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mode", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "mode")) } - if let exist: AnyObject = js["operation"] { + if let exist = js["operation"] { presentKeys.insert("operation") if let val = exist as? [FHIRJSON] { self.operation = ConformanceRestOperation.instantiate(fromArray: val, owner: self) as? [ConformanceRestOperation] } else { - errors.append(FHIRJSONError(key: "operation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "operation", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["resource"] { + if let exist = js["resource"] { presentKeys.insert("resource") if let val = exist as? [FHIRJSON] { self.resource = ConformanceRestResource.instantiate(fromArray: val, owner: self) as? [ConformanceRestResource] } else { - errors.append(FHIRJSONError(key: "resource", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "resource", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "resource")) } - if let exist: AnyObject = js["searchParam"] { + if let exist = js["searchParam"] { presentKeys.insert("searchParam") if let val = exist as? [FHIRJSON] { self.searchParam = ConformanceRestResourceSearchParam.instantiate(fromArray: val, owner: self) as? [ConformanceRestResourceSearchParam] } else { - errors.append(FHIRJSONError(key: "searchParam", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "searchParam", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["security"] { + if let exist = js["security"] { presentKeys.insert("security") if let val = exist as? FHIRJSON { self.security = ConformanceRestSecurity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "security", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "security", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["transactionMode"] { + if let exist = js["transactionMode"] { presentKeys.insert("transactionMode") if let val = exist as? String { self.transactionMode = val } else { - errors.append(FHIRJSONError(key: "transactionMode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "transactionMode", wants: String.self, has: type(of: exist))) } } } @@ -1096,7 +1096,7 @@ public class ConformanceRest: BackboneElement { var json = super.asJSON() if let compartment = self.compartment { - var arr = [AnyObject]() + var arr = [Any]() for val in compartment { arr.append(val.asJSON()) } @@ -1138,7 +1138,7 @@ public class ConformanceRest: BackboneElement { * A specification of restful operations supported by the system. */ public class ConformanceRestInteraction: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceRestInteraction" } } @@ -1160,28 +1160,28 @@ public class ConformanceRestInteraction: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["documentation"] { + if let exist = js["documentation"] { presentKeys.insert("documentation") if let val = exist as? String { self.documentation = val } else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: type(of: exist))) } } } @@ -1209,7 +1209,7 @@ public class ConformanceRestInteraction: BackboneElement { * Definition of an operation or a named query and with its parameters and their meaning and type. */ public class ConformanceRestOperation: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceRestOperation" } } @@ -1232,28 +1232,28 @@ public class ConformanceRestOperation: BackboneElement { self.name = name } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["definition"] { + if let exist = js["definition"] { presentKeys.insert("definition") if let val = exist as? FHIRJSON { self.definition = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "definition", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "definition", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "definition")) } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { @@ -1284,7 +1284,7 @@ public class ConformanceRestOperation: BackboneElement { * A specification of the restful capabilities of the solution for a specific resource type. */ public class ConformanceRestResource: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceRestResource" } } @@ -1337,121 +1337,121 @@ public class ConformanceRestResource: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["conditionalCreate"] { + if let exist = js["conditionalCreate"] { presentKeys.insert("conditionalCreate") if let val = exist as? Bool { self.conditionalCreate = val } else { - errors.append(FHIRJSONError(key: "conditionalCreate", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "conditionalCreate", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["conditionalDelete"] { + if let exist = js["conditionalDelete"] { presentKeys.insert("conditionalDelete") if let val = exist as? String { self.conditionalDelete = val } else { - errors.append(FHIRJSONError(key: "conditionalDelete", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "conditionalDelete", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["conditionalUpdate"] { + if let exist = js["conditionalUpdate"] { presentKeys.insert("conditionalUpdate") if let val = exist as? Bool { self.conditionalUpdate = val } else { - errors.append(FHIRJSONError(key: "conditionalUpdate", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "conditionalUpdate", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["interaction"] { + if let exist = js["interaction"] { presentKeys.insert("interaction") if let val = exist as? [FHIRJSON] { self.interaction = ConformanceRestResourceInteraction.instantiate(fromArray: val, owner: self) as? [ConformanceRestResourceInteraction] } else { - errors.append(FHIRJSONError(key: "interaction", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "interaction", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "interaction")) } - if let exist: AnyObject = js["profile"] { + if let exist = js["profile"] { presentKeys.insert("profile") if let val = exist as? FHIRJSON { self.profile = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["readHistory"] { + if let exist = js["readHistory"] { presentKeys.insert("readHistory") if let val = exist as? Bool { self.readHistory = val } else { - errors.append(FHIRJSONError(key: "readHistory", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "readHistory", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["searchInclude"] { + if let exist = js["searchInclude"] { presentKeys.insert("searchInclude") if let val = exist as? [String] { self.searchInclude = val } else { - errors.append(FHIRJSONError(key: "searchInclude", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "searchInclude", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["searchParam"] { + if let exist = js["searchParam"] { presentKeys.insert("searchParam") if let val = exist as? [FHIRJSON] { self.searchParam = ConformanceRestResourceSearchParam.instantiate(fromArray: val, owner: self) as? [ConformanceRestResourceSearchParam] } else { - errors.append(FHIRJSONError(key: "searchParam", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "searchParam", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["searchRevInclude"] { + if let exist = js["searchRevInclude"] { presentKeys.insert("searchRevInclude") if let val = exist as? [String] { self.searchRevInclude = val } else { - errors.append(FHIRJSONError(key: "searchRevInclude", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "searchRevInclude", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["updateCreate"] { + if let exist = js["updateCreate"] { presentKeys.insert("updateCreate") if let val = exist as? Bool { self.updateCreate = val } else { - errors.append(FHIRJSONError(key: "updateCreate", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "updateCreate", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["versioning"] { + if let exist = js["versioning"] { presentKeys.insert("versioning") if let val = exist as? String { self.versioning = val } else { - errors.append(FHIRJSONError(key: "versioning", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "versioning", wants: String.self, has: type(of: exist))) } } } @@ -1480,7 +1480,7 @@ public class ConformanceRestResource: BackboneElement { json["readHistory"] = readHistory.asJSON() } if let searchInclude = self.searchInclude { - var arr = [AnyObject]() + var arr = [Any]() for val in searchInclude { arr.append(val.asJSON()) } @@ -1490,7 +1490,7 @@ public class ConformanceRestResource: BackboneElement { json["searchParam"] = ConformanceRestResourceSearchParam.asJSONArray(searchParam) } if let searchRevInclude = self.searchRevInclude { - var arr = [AnyObject]() + var arr = [Any]() for val in searchRevInclude { arr.append(val.asJSON()) } @@ -1517,7 +1517,7 @@ public class ConformanceRestResource: BackboneElement { * Identifies a restful operation supported by the solution. */ public class ConformanceRestResourceInteraction: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceRestResourceInteraction" } } @@ -1539,28 +1539,28 @@ public class ConformanceRestResourceInteraction: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["documentation"] { + if let exist = js["documentation"] { presentKeys.insert("documentation") if let val = exist as? String { self.documentation = val } else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: type(of: exist))) } } } @@ -1589,7 +1589,7 @@ public class ConformanceRestResourceInteraction: BackboneElement { * specification, or additional ones defined for/by the implementation. */ public class ConformanceRestResourceSearchParam: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceRestResourceSearchParam" } } @@ -1627,73 +1627,73 @@ public class ConformanceRestResourceSearchParam: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["chain"] { + if let exist = js["chain"] { presentKeys.insert("chain") if let val = exist as? [String] { self.chain = val } else { - errors.append(FHIRJSONError(key: "chain", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "chain", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["definition"] { + if let exist = js["definition"] { presentKeys.insert("definition") if let val = exist as? String { self.definition = URL(string: val) } else { - errors.append(FHIRJSONError(key: "definition", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "definition", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["documentation"] { + if let exist = js["documentation"] { presentKeys.insert("documentation") if let val = exist as? String { self.documentation = val } else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["modifier"] { + if let exist = js["modifier"] { presentKeys.insert("modifier") if let val = exist as? [String] { self.modifier = val } else { - errors.append(FHIRJSONError(key: "modifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "modifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? [String] { self.target = val } else { - errors.append(FHIRJSONError(key: "target", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { @@ -1707,7 +1707,7 @@ public class ConformanceRestResourceSearchParam: BackboneElement { var json = super.asJSON() if let chain = self.chain { - var arr = [AnyObject]() + var arr = [Any]() for val in chain { arr.append(val.asJSON()) } @@ -1720,7 +1720,7 @@ public class ConformanceRestResourceSearchParam: BackboneElement { json["documentation"] = documentation.asJSON() } if let modifier = self.modifier { - var arr = [AnyObject]() + var arr = [Any]() for val in modifier { arr.append(val.asJSON()) } @@ -1730,7 +1730,7 @@ public class ConformanceRestResourceSearchParam: BackboneElement { json["name"] = name.asJSON() } if let target = self.target { - var arr = [AnyObject]() + var arr = [Any]() for val in target { arr.append(val.asJSON()) } @@ -1751,7 +1751,7 @@ public class ConformanceRestResourceSearchParam: BackboneElement { * Information about security implementation from an interface perspective - what a client needs to know. */ public class ConformanceRestSecurity: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceRestSecurity" } } @@ -1773,43 +1773,43 @@ public class ConformanceRestSecurity: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["certificate"] { + if let exist = js["certificate"] { presentKeys.insert("certificate") if let val = exist as? [FHIRJSON] { self.certificate = ConformanceRestSecurityCertificate.instantiate(fromArray: val, owner: self) as? [ConformanceRestSecurityCertificate] } else { - errors.append(FHIRJSONError(key: "certificate", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "certificate", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["cors"] { + if let exist = js["cors"] { presentKeys.insert("cors") if let val = exist as? Bool { self.cors = val } else { - errors.append(FHIRJSONError(key: "cors", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "cors", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["service"] { + if let exist = js["service"] { presentKeys.insert("service") if let val = exist as? [FHIRJSON] { self.service = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "service", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "service", wants: Array.self, has: type(of: exist))) } } } @@ -1841,7 +1841,7 @@ public class ConformanceRestSecurity: BackboneElement { * Certificates associated with security profiles. */ public class ConformanceRestSecurityCertificate: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceRestSecurityCertificate" } } @@ -1857,25 +1857,25 @@ public class ConformanceRestSecurityCertificate: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["blob"] { + if let exist = js["blob"] { presentKeys.insert("blob") if let val = exist as? String { self.blob = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "blob", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "blob", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } } @@ -1904,7 +1904,7 @@ public class ConformanceRestSecurityCertificate: BackboneElement { * capabilities of a particular software version, independent of an installation. */ public class ConformanceSoftware: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ConformanceSoftware" } } @@ -1929,37 +1929,37 @@ public class ConformanceSoftware: BackboneElement { self.name = name } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["releaseDate"] { + if let exist = js["releaseDate"] { presentKeys.insert("releaseDate") if let val = exist as? String { self.releaseDate = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "releaseDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "releaseDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/ContactPoint.swift b/Sources/Models/ContactPoint.swift index d61d0add..bd545125 100644 --- a/Sources/Models/ContactPoint.swift +++ b/Sources/Models/ContactPoint.swift @@ -2,7 +2,7 @@ // ContactPoint.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ContactPoint) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * email, etc. */ public class ContactPoint: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ContactPoint" } } @@ -41,52 +41,52 @@ public class ContactPoint: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rank"] { + if let exist = js["rank"] { presentKeys.insert("rank") if let val = exist as? UInt { self.rank = val } else { - errors.append(FHIRJSONError(key: "rank", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rank", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["system"] { + if let exist = js["system"] { presentKeys.insert("system") if let val = exist as? String { self.system = val } else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "system", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["use"] { + if let exist = js["use"] { presentKeys.insert("use") if let val = exist as? String { self.use = val } else { - errors.append(FHIRJSONError(key: "use", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "use", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? String { self.value = val } else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Contract.swift b/Sources/Models/Contract.swift index cf2066bb..10f0e052 100644 --- a/Sources/Models/Contract.swift +++ b/Sources/Models/Contract.swift @@ -2,7 +2,7 @@ // Contract.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Contract) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Contract) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A formal agreement between parties regarding the conduct of business, exchange of information or other matters. */ public class Contract: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Contract" } } @@ -82,178 +82,178 @@ public class Contract: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["action"] { + if let exist = js["action"] { presentKeys.insert("action") if let val = exist as? [FHIRJSON] { self.action = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "action", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["actionReason"] { + if let exist = js["actionReason"] { presentKeys.insert("actionReason") if let val = exist as? [FHIRJSON] { self.actionReason = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "actionReason", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actionReason", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["actor"] { + if let exist = js["actor"] { presentKeys.insert("actor") if let val = exist as? [FHIRJSON] { self.actor = ContractActor.instantiate(fromArray: val, owner: self) as? [ContractActor] } else { - errors.append(FHIRJSONError(key: "actor", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actor", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["applies"] { + if let exist = js["applies"] { presentKeys.insert("applies") if let val = exist as? FHIRJSON { self.applies = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "applies", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "applies", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["authority"] { + if let exist = js["authority"] { presentKeys.insert("authority") if let val = exist as? [FHIRJSON] { self.authority = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "authority", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "authority", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["bindingAttachment"] { + if let exist = js["bindingAttachment"] { presentKeys.insert("bindingAttachment") if let val = exist as? FHIRJSON { self.bindingAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bindingAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bindingAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["bindingReference"] { + if let exist = js["bindingReference"] { presentKeys.insert("bindingReference") if let val = exist as? FHIRJSON { self.bindingReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bindingReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bindingReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["domain"] { + if let exist = js["domain"] { presentKeys.insert("domain") if let val = exist as? [FHIRJSON] { self.domain = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "domain", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "domain", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["friendly"] { + if let exist = js["friendly"] { presentKeys.insert("friendly") if let val = exist as? [FHIRJSON] { self.friendly = ContractFriendly.instantiate(fromArray: val, owner: self) as? [ContractFriendly] } else { - errors.append(FHIRJSONError(key: "friendly", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "friendly", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["issued"] { + if let exist = js["issued"] { presentKeys.insert("issued") if let val = exist as? String { self.issued = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "issued", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "issued", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["legal"] { + if let exist = js["legal"] { presentKeys.insert("legal") if let val = exist as? [FHIRJSON] { self.legal = ContractLegal.instantiate(fromArray: val, owner: self) as? [ContractLegal] } else { - errors.append(FHIRJSONError(key: "legal", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "legal", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rule"] { + if let exist = js["rule"] { presentKeys.insert("rule") if let val = exist as? [FHIRJSON] { self.rule = ContractRule.instantiate(fromArray: val, owner: self) as? [ContractRule] } else { - errors.append(FHIRJSONError(key: "rule", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rule", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["signer"] { + if let exist = js["signer"] { presentKeys.insert("signer") if let val = exist as? [FHIRJSON] { self.signer = ContractSigner.instantiate(fromArray: val, owner: self) as? [ContractSigner] } else { - errors.append(FHIRJSONError(key: "signer", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "signer", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subType"] { + if let exist = js["subType"] { presentKeys.insert("subType") if let val = exist as? [FHIRJSON] { self.subType = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "subType", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subType", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? [FHIRJSON] { self.subject = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "subject", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["term"] { + if let exist = js["term"] { presentKeys.insert("term") if let val = exist as? [FHIRJSON] { self.term = ContractTerm.instantiate(fromArray: val, owner: self) as? [ContractTerm] } else { - errors.append(FHIRJSONError(key: "term", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "term", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valuedItem"] { + if let exist = js["valuedItem"] { presentKeys.insert("valuedItem") if let val = exist as? [FHIRJSON] { self.valuedItem = ContractValuedItem.instantiate(fromArray: val, owner: self) as? [ContractValuedItem] } else { - errors.append(FHIRJSONError(key: "valuedItem", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valuedItem", wants: Array.self, has: type(of: exist))) } } } @@ -332,7 +332,7 @@ public class Contract: DomainResource { * List of Contract actors. */ public class ContractActor: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ContractActor" } } @@ -354,28 +354,28 @@ public class ContractActor: BackboneElement { self.entity = entity } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["entity"] { + if let exist = js["entity"] { presentKeys.insert("entity") if let val = exist as? FHIRJSON { self.entity = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "entity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entity", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "entity")) } - if let exist: AnyObject = js["role"] { + if let exist = js["role"] { presentKeys.insert("role") if let val = exist as? [FHIRJSON] { self.role = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "role", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "role", wants: Array.self, has: type(of: exist))) } } } @@ -406,7 +406,7 @@ public class ContractActor: BackboneElement { * the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement. */ public class ContractFriendly: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ContractFriendly" } } @@ -429,25 +429,25 @@ public class ContractFriendly: BackboneElement { self.contentReference = contentReference } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contentAttachment"] { + if let exist = js["contentAttachment"] { presentKeys.insert("contentAttachment") if let val = exist as? FHIRJSON { self.contentAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "contentAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contentReference"] { + if let exist = js["contentReference"] { presentKeys.insert("contentReference") if let val = exist as? FHIRJSON { self.contentReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "contentReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentReference", wants: FHIRJSON.self, has: type(of: exist))) } } @@ -480,7 +480,7 @@ public class ContractFriendly: BackboneElement { * List of Legal expressions or representations of this Contract. */ public class ContractLegal: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ContractLegal" } } @@ -503,25 +503,25 @@ public class ContractLegal: BackboneElement { self.contentReference = contentReference } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contentAttachment"] { + if let exist = js["contentAttachment"] { presentKeys.insert("contentAttachment") if let val = exist as? FHIRJSON { self.contentAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "contentAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contentReference"] { + if let exist = js["contentReference"] { presentKeys.insert("contentReference") if let val = exist as? FHIRJSON { self.contentReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "contentReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentReference", wants: FHIRJSON.self, has: type(of: exist))) } } @@ -554,7 +554,7 @@ public class ContractLegal: BackboneElement { * List of Computable Policy Rule Language Representations of this Contract. */ public class ContractRule: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ContractRule" } } @@ -577,25 +577,25 @@ public class ContractRule: BackboneElement { self.contentReference = contentReference } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contentAttachment"] { + if let exist = js["contentAttachment"] { presentKeys.insert("contentAttachment") if let val = exist as? FHIRJSON { self.contentAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "contentAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contentReference"] { + if let exist = js["contentReference"] { presentKeys.insert("contentReference") if let val = exist as? FHIRJSON { self.contentReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "contentReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentReference", wants: FHIRJSON.self, has: type(of: exist))) } } @@ -628,7 +628,7 @@ public class ContractRule: BackboneElement { * Party signing this Contract. */ public class ContractSigner: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ContractSigner" } } @@ -655,40 +655,40 @@ public class ContractSigner: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["party"] { + if let exist = js["party"] { presentKeys.insert("party") if let val = exist as? FHIRJSON { self.party = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "party", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "party", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "party")) } - if let exist: AnyObject = js["signature"] { + if let exist = js["signature"] { presentKeys.insert("signature") if let val = exist as? String { self.signature = val } else { - errors.append(FHIRJSONError(key: "signature", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "signature", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "signature")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -722,7 +722,7 @@ public class ContractSigner: BackboneElement { * One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups. */ public class ContractTerm: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ContractTerm" } } @@ -768,115 +768,115 @@ public class ContractTerm: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["action"] { + if let exist = js["action"] { presentKeys.insert("action") if let val = exist as? [FHIRJSON] { self.action = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "action", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["actionReason"] { + if let exist = js["actionReason"] { presentKeys.insert("actionReason") if let val = exist as? [FHIRJSON] { self.actionReason = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "actionReason", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actionReason", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["actor"] { + if let exist = js["actor"] { presentKeys.insert("actor") if let val = exist as? [FHIRJSON] { self.actor = ContractTermActor.instantiate(fromArray: val, owner: self) as? [ContractTermActor] } else { - errors.append(FHIRJSONError(key: "actor", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actor", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["applies"] { + if let exist = js["applies"] { presentKeys.insert("applies") if let val = exist as? FHIRJSON { self.applies = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "applies", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "applies", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["group"] { + if let exist = js["group"] { presentKeys.insert("group") if let val = exist as? [FHIRJSON] { self.group = ContractTerm.instantiate(fromArray: val, owner: self) as? [ContractTerm] } else { - errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["issued"] { + if let exist = js["issued"] { presentKeys.insert("issued") if let val = exist as? String { self.issued = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "issued", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "issued", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subType"] { + if let exist = js["subType"] { presentKeys.insert("subType") if let val = exist as? FHIRJSON { self.subType = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subType", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subType", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valuedItem"] { + if let exist = js["valuedItem"] { presentKeys.insert("valuedItem") if let val = exist as? [FHIRJSON] { self.valuedItem = ContractTermValuedItem.instantiate(fromArray: val, owner: self) as? [ContractTermValuedItem] } else { - errors.append(FHIRJSONError(key: "valuedItem", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valuedItem", wants: Array.self, has: type(of: exist))) } } } @@ -934,7 +934,7 @@ public class ContractTerm: BackboneElement { * List of actors participating in this Contract Provision. */ public class ContractTermActor: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ContractTermActor" } } @@ -956,28 +956,28 @@ public class ContractTermActor: BackboneElement { self.entity = entity } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["entity"] { + if let exist = js["entity"] { presentKeys.insert("entity") if let val = exist as? FHIRJSON { self.entity = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "entity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entity", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "entity")) } - if let exist: AnyObject = js["role"] { + if let exist = js["role"] { presentKeys.insert("role") if let val = exist as? [FHIRJSON] { self.role = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "role", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "role", wants: Array.self, has: type(of: exist))) } } } @@ -1005,7 +1005,7 @@ public class ContractTermActor: BackboneElement { * Contract Provision Valued Item List. */ public class ContractTermValuedItem: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ContractTermValuedItem" } } @@ -1042,88 +1042,88 @@ public class ContractTermValuedItem: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["effectiveTime"] { + if let exist = js["effectiveTime"] { presentKeys.insert("effectiveTime") if let val = exist as? String { self.effectiveTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "effectiveTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "effectiveTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["entityCodeableConcept"] { + if let exist = js["entityCodeableConcept"] { presentKeys.insert("entityCodeableConcept") if let val = exist as? FHIRJSON { self.entityCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "entityCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entityCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["entityReference"] { + if let exist = js["entityReference"] { presentKeys.insert("entityReference") if let val = exist as? FHIRJSON { self.entityReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "entityReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entityReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["factor"] { + if let exist = js["factor"] { presentKeys.insert("factor") if let val = exist as? NSNumber { self.factor = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["net"] { + if let exist = js["net"] { presentKeys.insert("net") if let val = exist as? FHIRJSON { self.net = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["points"] { + if let exist = js["points"] { presentKeys.insert("points") if let val = exist as? NSNumber { self.points = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["unitPrice"] { + if let exist = js["unitPrice"] { presentKeys.insert("unitPrice") if let val = exist as? FHIRJSON { self.unitPrice = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -1172,7 +1172,7 @@ public class ContractTermValuedItem: BackboneElement { * Contract Valued Item List. */ public class ContractValuedItem: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ContractValuedItem" } } @@ -1209,88 +1209,88 @@ public class ContractValuedItem: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["effectiveTime"] { + if let exist = js["effectiveTime"] { presentKeys.insert("effectiveTime") if let val = exist as? String { self.effectiveTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "effectiveTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "effectiveTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["entityCodeableConcept"] { + if let exist = js["entityCodeableConcept"] { presentKeys.insert("entityCodeableConcept") if let val = exist as? FHIRJSON { self.entityCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "entityCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entityCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["entityReference"] { + if let exist = js["entityReference"] { presentKeys.insert("entityReference") if let val = exist as? FHIRJSON { self.entityReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "entityReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entityReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["factor"] { + if let exist = js["factor"] { presentKeys.insert("factor") if let val = exist as? NSNumber { self.factor = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["net"] { + if let exist = js["net"] { presentKeys.insert("net") if let val = exist as? FHIRJSON { self.net = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "net", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["points"] { + if let exist = js["points"] { presentKeys.insert("points") if let val = exist as? NSNumber { self.points = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "points", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["unitPrice"] { + if let exist = js["unitPrice"] { presentKeys.insert("unitPrice") if let val = exist as? FHIRJSON { self.unitPrice = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "unitPrice", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Count.swift b/Sources/Models/Count.swift index 8d4c5d67..992c9bb0 100644 --- a/Sources/Models/Count.swift +++ b/Sources/Models/Count.swift @@ -2,7 +2,7 @@ // Count.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Count) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Count) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * present, it SHALL be UCUM. If present, the value SHALL a whole number. */ public class Count: Quantity { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Count" } } diff --git a/Sources/Models/Coverage.swift b/Sources/Models/Coverage.swift index b176fb1c..cfdc5f2f 100644 --- a/Sources/Models/Coverage.swift +++ b/Sources/Models/Coverage.swift @@ -2,7 +2,7 @@ // Coverage.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Coverage) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Coverage) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * Financial instrument which may be used to pay for or reimburse health care products and services. */ public class Coverage: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Coverage" } } @@ -67,133 +67,133 @@ public class Coverage: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["bin"] { + if let exist = js["bin"] { presentKeys.insert("bin") if let val = exist as? FHIRJSON { self.bin = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bin", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bin", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contract"] { + if let exist = js["contract"] { presentKeys.insert("contract") if let val = exist as? [FHIRJSON] { self.contract = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "contract", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contract", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dependent"] { + if let exist = js["dependent"] { presentKeys.insert("dependent") if let val = exist as? UInt { self.dependent = val } else { - errors.append(FHIRJSONError(key: "dependent", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dependent", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["group"] { + if let exist = js["group"] { presentKeys.insert("group") if let val = exist as? String { self.group = val } else { - errors.append(FHIRJSONError(key: "group", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["issuer"] { + if let exist = js["issuer"] { presentKeys.insert("issuer") if let val = exist as? FHIRJSON { self.issuer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "issuer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "issuer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["network"] { + if let exist = js["network"] { presentKeys.insert("network") if let val = exist as? FHIRJSON { self.network = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "network", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "network", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["plan"] { + if let exist = js["plan"] { presentKeys.insert("plan") if let val = exist as? String { self.plan = val } else { - errors.append(FHIRJSONError(key: "plan", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "plan", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sequence"] { + if let exist = js["sequence"] { presentKeys.insert("sequence") if let val = exist as? UInt { self.sequence = val } else { - errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequence", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subPlan"] { + if let exist = js["subPlan"] { presentKeys.insert("subPlan") if let val = exist as? String { self.subPlan = val } else { - errors.append(FHIRJSONError(key: "subPlan", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subPlan", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subscriber"] { + if let exist = js["subscriber"] { presentKeys.insert("subscriber") if let val = exist as? FHIRJSON { self.subscriber = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subscriber", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subscriber", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subscriberId"] { + if let exist = js["subscriberId"] { presentKeys.insert("subscriberId") if let val = exist as? FHIRJSON { self.subscriberId = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subscriberId", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subscriberId", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/DataElement.swift b/Sources/Models/DataElement.swift index 8171b91c..cf07bf6d 100644 --- a/Sources/Models/DataElement.swift +++ b/Sources/Models/DataElement.swift @@ -2,7 +2,7 @@ // DataElement.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DataElement) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DataElement) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * The formal description of a single piece of information that can be gathered and reported. */ public class DataElement: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DataElement" } } @@ -74,139 +74,139 @@ public class DataElement: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = DataElementContact.instantiate(fromArray: val, owner: self) as? [DataElementContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["copyright"] { + if let exist = js["copyright"] { presentKeys.insert("copyright") if let val = exist as? String { self.copyright = val } else { - errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["element"] { + if let exist = js["element"] { presentKeys.insert("element") if let val = exist as? [FHIRJSON] { self.element = ElementDefinition.instantiate(fromArray: val, owner: self) as? [ElementDefinition] } else { - errors.append(FHIRJSONError(key: "element", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "element", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "element")) } - if let exist: AnyObject = js["experimental"] { + if let exist = js["experimental"] { presentKeys.insert("experimental") if let val = exist as? Bool { self.experimental = val } else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["mapping"] { + if let exist = js["mapping"] { presentKeys.insert("mapping") if let val = exist as? [FHIRJSON] { self.mapping = DataElementMapping.instantiate(fromArray: val, owner: self) as? [DataElementMapping] } else { - errors.append(FHIRJSONError(key: "mapping", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mapping", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["publisher"] { + if let exist = js["publisher"] { presentKeys.insert("publisher") if let val = exist as? String { self.publisher = val } else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["stringency"] { + if let exist = js["stringency"] { presentKeys.insert("stringency") if let val = exist as? String { self.stringency = val } else { - errors.append(FHIRJSONError(key: "stringency", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "stringency", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["useContext"] { + if let exist = js["useContext"] { presentKeys.insert("useContext") if let val = exist as? [FHIRJSON] { self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } @@ -270,7 +270,7 @@ public class DataElement: DomainResource { * Contacts to assist a user in finding and communicating with the publisher. */ public class DataElementContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DataElementContact" } } @@ -286,25 +286,25 @@ public class DataElementContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -333,7 +333,7 @@ public class DataElementContact: BackboneElement { * correspondence with. */ public class DataElementMapping: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DataElementMapping" } } @@ -361,46 +361,46 @@ public class DataElementMapping: BackboneElement { self.identity = identity } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["comments"] { + if let exist = js["comments"] { presentKeys.insert("comments") if let val = exist as? String { self.comments = val } else { - errors.append(FHIRJSONError(key: "comments", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comments", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identity"] { + if let exist = js["identity"] { presentKeys.insert("identity") if let val = exist as? String { self.identity = val } else { - errors.append(FHIRJSONError(key: "identity", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identity", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "identity")) } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["uri"] { + if let exist = js["uri"] { presentKeys.insert("uri") if let val = exist as? String { self.uri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "uri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "uri", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/DateAndTime.swift b/Sources/Models/DateAndTime.swift index 66444c5a..fa4cf5f4 100644 --- a/Sources/Models/DateAndTime.swift +++ b/Sources/Models/DateAndTime.swift @@ -31,7 +31,7 @@ public struct FHIRDate: DateAndTime { /// The month of the year, maximum of 12. public var month: UInt8? { didSet { - if month > 12 { + if let mth = month, mth > 12 { month = nil } } @@ -40,7 +40,7 @@ public struct FHIRDate: DateAndTime { /// The day of the month; must be valid for the month (not enforced in code!). public var day: UInt8? { didSet { - if day > 31 { + if let d = day, d > 31 { day = nil } } @@ -58,9 +58,11 @@ public struct FHIRDate: DateAndTime { */ public init(year: Int, month: UInt8?, day: UInt8?) { self.year = year - if month <= 12 { - self.month = month - self.day = day > 31 ? nil : day + if let mth = month, mth <= 12 { + self.month = mth + if let d = day, d <= 31 { + self.day = d + } } } @@ -105,24 +107,34 @@ public struct FHIRDate: DateAndTime { } return String(format: "%04d", year) } -} - -extension FHIRDate: Comparable { } -public func <(lhs: FHIRDate, rhs: FHIRDate) -> Bool { - if lhs.year == rhs.year { - if lhs.month == rhs.month { - return lhs.day < rhs.day + + public static func <(lhs: FHIRDate, rhs: FHIRDate) -> Bool { + if lhs.year == rhs.year { + guard let lhm = lhs.month else { + return true + } + guard let rhm = rhs.month else { + return false + } + if lhm == rhm { + guard let lhd = lhs.day else { + return true + } + guard let rhd = rhs.day else { + return false + } + return lhd < rhd + } + return lhm < rhm } - return lhs.month < rhs.month + return lhs.year < rhs.year + } + + public static func ==(lhs: FHIRDate, rhs: FHIRDate) -> Bool { + return lhs.year == rhs.year + && lhs.month == rhs.month + && lhs.day == rhs.day } - return lhs.year < rhs.year -} - -extension FHIRDate: Equatable { } -public func ==(lhs: FHIRDate, rhs: FHIRDate) -> Bool { - return lhs.year == rhs.year - && lhs.month == rhs.month - && lhs.day == rhs.day } @@ -156,7 +168,7 @@ public struct FHIRTime: DateAndTime { /// The second of the minute; must be smaller than 60 public var second: Double? { didSet { - if second >= 60 { + if let sec = second, sec >= 60.0 { second = 59.999999999 } tookSecondsFromString = nil @@ -181,13 +193,15 @@ public struct FHIRTime: DateAndTime { var overflowMinute: UInt = 0 var overflowHour: UInt = 0 - if second >= 60.0 { - self.second = second!.truncatingRemainder(dividingBy: 60) - overflowMinute = UInt((second! - self.second!) / 60) - } - else { - self.second = (second < 0.0) ? nil : second - self.tookSecondsFromString = (second < 0.0) ? nil : secondsFromString + if let sec = second, sec >= 0.0 { + if sec >= 60.0 { + self.second = sec.truncatingRemainder(dividingBy: 60) + overflowMinute = UInt((sec - self.second!) / 60) + } + else { + self.second = sec + self.tookSecondsFromString = secondsFromString + } } let mins = UInt(minute) + overflowMinute @@ -253,27 +267,31 @@ public struct FHIRTime: DateAndTime { } return String(format: "%02d:%02d", hour, minute) } -} - -extension FHIRTime: Comparable { } -public func <(lhs: FHIRTime, rhs: FHIRTime) -> Bool { - if lhs.hour == rhs.hour { - if lhs.minute == rhs.minute { - return lhs.second < rhs.second + + public static func <(lhs: FHIRTime, rhs: FHIRTime) -> Bool { + if lhs.hour == rhs.hour { + if lhs.minute == rhs.minute { + guard let lhsec = lhs.second else { + return true + } + guard let rhsec = rhs.second else { + return false + } + return lhsec < rhsec + } + return lhs.minute < rhs.minute } - return lhs.minute < rhs.minute + return lhs.hour < rhs.hour + } + + public static func ==(lhs: FHIRTime, rhs: FHIRTime) -> Bool { + if nil != lhs.second && nil != rhs.second { + return lhs.description == rhs.description // must respect decimal precision of seconds, which `description` takes care of + } + return lhs.hour == rhs.hour + && lhs.minute == rhs.minute + && lhs.second == rhs.second } - return lhs.hour < rhs.hour -} - -extension FHIRTime: Equatable { } -public func ==(lhs: FHIRTime, rhs: FHIRTime) -> Bool { - if nil != lhs.second && nil != rhs.second { - return lhs.description == rhs.description // must respect decimal precision of seconds, which `description` takes care of - } - return lhs.hour == rhs.hour - && lhs.minute == rhs.minute - && lhs.second == rhs.second } @@ -368,20 +386,18 @@ public struct DateTime: DateAndTime { } return date.description } -} - -extension DateTime: Comparable { } -public func <(lhs: DateTime, rhs: DateTime) -> Bool { - let lhd = lhs.nsDate - let rhd = rhs.nsDate - return (lhd.compare(rhd) == .orderedAscending) -} - -extension DateTime: Equatable { } -public func ==(lhs: DateTime, rhs: DateTime) -> Bool { - let lhd = lhs.nsDate - let rhd = rhs.nsDate - return (lhd.compare(rhd) == .orderedSame) + + public static func <(lhs: DateTime, rhs: DateTime) -> Bool { + let lhd = lhs.nsDate + let rhd = rhs.nsDate + return (lhd.compare(rhd) == .orderedAscending) + } + + public static func ==(lhs: DateTime, rhs: DateTime) -> Bool { + let lhd = lhs.nsDate + let rhd = rhs.nsDate + return (lhd.compare(rhd) == .orderedSame) + } } @@ -479,21 +495,20 @@ public struct Instant: DateAndTime { let tz = timeZoneString ?? timeZone.offset() return String(format: "%@T%@%@", date.description, time.description, tz) } + + public static func <(lhs: Instant, rhs: Instant) -> Bool { + let lhd = lhs.nsDate + let rhd = rhs.nsDate + return (lhd.compare(rhd) == .orderedAscending) + } + + public static func ==(lhs: Instant, rhs: Instant) -> Bool { + let lhd = lhs.nsDate + let rhd = rhs.nsDate + return (lhd.compare(rhd) == .orderedSame) + } } -extension Instant: Comparable { } -public func <(lhs: Instant, rhs: Instant) -> Bool { - let lhd = lhs.nsDate - let rhd = rhs.nsDate - return (lhd.compare(rhd) == .orderedAscending) -} - -extension Instant: Equatable { } -public func ==(lhs: Instant, rhs: Instant) -> Bool { - let lhd = lhs.nsDate - let rhd = rhs.nsDate - return (lhd.compare(rhd) == .orderedSame) -} extension Instant { @@ -668,9 +683,6 @@ class DateAndTimeParser { if scanner.scanInt(&hour) && hour >= 0 && hour < 24 && scanner.scanString(":", into: nil) && scanner.scanInt(&minute) && minute >= 0 && minute < 60 { - /* this crashes in Xcode 8b2, see https://bugs.swift.org/browse/SR-1782 - var decimalSet = CharacterSet.decimalDigits - */ let digitSet = CharacterSet.decimalDigits var decimalSet = NSMutableCharacterSet.decimalDigits decimalSet.insert(".") diff --git a/Sources/Models/DetectedIssue.swift b/Sources/Models/DetectedIssue.swift index 3d699172..3a551338 100644 --- a/Sources/Models/DetectedIssue.swift +++ b/Sources/Models/DetectedIssue.swift @@ -2,7 +2,7 @@ // DetectedIssue.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DetectedIssue) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DetectedIssue) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * a patient; e.g. Drug-drug interaction, Ineffective treatment frequency, Procedure-condition conflict, etc. */ public class DetectedIssue: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DetectedIssue" } } @@ -56,97 +56,97 @@ public class DetectedIssue: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? FHIRJSON { self.author = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? FHIRJSON { self.category = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["detail"] { + if let exist = js["detail"] { presentKeys.insert("detail") if let val = exist as? String { self.detail = val } else { - errors.append(FHIRJSONError(key: "detail", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detail", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["implicated"] { + if let exist = js["implicated"] { presentKeys.insert("implicated") if let val = exist as? [FHIRJSON] { self.implicated = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "implicated", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "implicated", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["mitigation"] { + if let exist = js["mitigation"] { presentKeys.insert("mitigation") if let val = exist as? [FHIRJSON] { self.mitigation = DetectedIssueMitigation.instantiate(fromArray: val, owner: self) as? [DetectedIssueMitigation] } else { - errors.append(FHIRJSONError(key: "mitigation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mitigation", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reference"] { + if let exist = js["reference"] { presentKeys.insert("reference") if let val = exist as? String { self.reference = URL(string: val) } else { - errors.append(FHIRJSONError(key: "reference", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reference", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["severity"] { + if let exist = js["severity"] { presentKeys.insert("severity") if let val = exist as? String { self.severity = val } else { - errors.append(FHIRJSONError(key: "severity", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "severity", wants: String.self, has: type(of: exist))) } } } @@ -200,7 +200,7 @@ public class DetectedIssue: DomainResource { * may reduce/eliminate the need for any action. */ public class DetectedIssueMitigation: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DetectedIssueMitigation" } } @@ -225,37 +225,37 @@ public class DetectedIssueMitigation: BackboneElement { self.action = action } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["action"] { + if let exist = js["action"] { presentKeys.insert("action") if let val = exist as? FHIRJSON { self.action = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "action", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "action", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "action")) } - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? FHIRJSON { self.author = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Device.swift b/Sources/Models/Device.swift index ceae67c9..353b9732 100644 --- a/Sources/Models/Device.swift +++ b/Sources/Models/Device.swift @@ -2,7 +2,7 @@ // Device.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Device) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Device) on 2016-09-16. // 2016, SMART Health IT. // @@ -19,7 +19,7 @@ import Foundation * a machine, cellphone, computer, application, etc. */ public class Device: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Device" } } @@ -83,154 +83,154 @@ public class Device: DomainResource { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["expiry"] { + if let exist = js["expiry"] { presentKeys.insert("expiry") if let val = exist as? String { self.expiry = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "expiry", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "expiry", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? FHIRJSON { self.location = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["lotNumber"] { + if let exist = js["lotNumber"] { presentKeys.insert("lotNumber") if let val = exist as? String { self.lotNumber = val } else { - errors.append(FHIRJSONError(key: "lotNumber", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "lotNumber", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["manufactureDate"] { + if let exist = js["manufactureDate"] { presentKeys.insert("manufactureDate") if let val = exist as? String { self.manufactureDate = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "manufactureDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "manufactureDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["manufacturer"] { + if let exist = js["manufacturer"] { presentKeys.insert("manufacturer") if let val = exist as? String { self.manufacturer = val } else { - errors.append(FHIRJSONError(key: "manufacturer", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "manufacturer", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["model"] { + if let exist = js["model"] { presentKeys.insert("model") if let val = exist as? String { self.model = val } else { - errors.append(FHIRJSONError(key: "model", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "model", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? [FHIRJSON] { self.note = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["owner"] { + if let exist = js["owner"] { presentKeys.insert("owner") if let val = exist as? FHIRJSON { self.owner = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "owner", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "owner", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["udi"] { + if let exist = js["udi"] { presentKeys.insert("udi") if let val = exist as? String { self.udi = val } else { - errors.append(FHIRJSONError(key: "udi", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "udi", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/DeviceComponent.swift b/Sources/Models/DeviceComponent.swift index bb470b2d..3f069f21 100644 --- a/Sources/Models/DeviceComponent.swift +++ b/Sources/Models/DeviceComponent.swift @@ -2,7 +2,7 @@ // DeviceComponent.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceComponent) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceComponent) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * device. */ public class DeviceComponent: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DeviceComponent" } } @@ -64,103 +64,103 @@ public class DeviceComponent: DomainResource { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "identifier")) } - if let exist: AnyObject = js["languageCode"] { + if let exist = js["languageCode"] { presentKeys.insert("languageCode") if let val = exist as? FHIRJSON { self.languageCode = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "languageCode", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "languageCode", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["lastSystemChange"] { + if let exist = js["lastSystemChange"] { presentKeys.insert("lastSystemChange") if let val = exist as? String { self.lastSystemChange = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "lastSystemChange", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "lastSystemChange", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "lastSystemChange")) } - if let exist: AnyObject = js["measurementPrinciple"] { + if let exist = js["measurementPrinciple"] { presentKeys.insert("measurementPrinciple") if let val = exist as? String { self.measurementPrinciple = val } else { - errors.append(FHIRJSONError(key: "measurementPrinciple", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "measurementPrinciple", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["operationalStatus"] { + if let exist = js["operationalStatus"] { presentKeys.insert("operationalStatus") if let val = exist as? [FHIRJSON] { self.operationalStatus = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "operationalStatus", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "operationalStatus", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["parameterGroup"] { + if let exist = js["parameterGroup"] { presentKeys.insert("parameterGroup") if let val = exist as? FHIRJSON { self.parameterGroup = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "parameterGroup", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "parameterGroup", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["parent"] { + if let exist = js["parent"] { presentKeys.insert("parent") if let val = exist as? FHIRJSON { self.parent = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "parent", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "parent", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["productionSpecification"] { + if let exist = js["productionSpecification"] { presentKeys.insert("productionSpecification") if let val = exist as? [FHIRJSON] { self.productionSpecification = DeviceComponentProductionSpecification.instantiate(fromArray: val, owner: self) as? [DeviceComponentProductionSpecification] } else { - errors.append(FHIRJSONError(key: "productionSpecification", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "productionSpecification", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["source"] { + if let exist = js["source"] { presentKeys.insert("source") if let val = exist as? FHIRJSON { self.source = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -215,7 +215,7 @@ public class DeviceComponent: DomainResource { * Describes the production specification such as component revision, serial number, etc. */ public class DeviceComponentProductionSpecification: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DeviceComponentProductionSpecification" } } @@ -234,34 +234,34 @@ public class DeviceComponentProductionSpecification: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["componentId"] { + if let exist = js["componentId"] { presentKeys.insert("componentId") if let val = exist as? FHIRJSON { self.componentId = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "componentId", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "componentId", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["productionSpec"] { + if let exist = js["productionSpec"] { presentKeys.insert("productionSpec") if let val = exist as? String { self.productionSpec = val } else { - errors.append(FHIRJSONError(key: "productionSpec", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "productionSpec", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["specType"] { + if let exist = js["specType"] { presentKeys.insert("specType") if let val = exist as? FHIRJSON { self.specType = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "specType", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "specType", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/DeviceMetric.swift b/Sources/Models/DeviceMetric.swift index 55579fe8..54506872 100644 --- a/Sources/Models/DeviceMetric.swift +++ b/Sources/Models/DeviceMetric.swift @@ -2,7 +2,7 @@ // DeviceMetric.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceMetric) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceMetric) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * Describes a measurement, calculation or setting capability of a medical device. */ public class DeviceMetric: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DeviceMetric" } } @@ -63,106 +63,106 @@ public class DeviceMetric: DomainResource { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["calibration"] { + if let exist = js["calibration"] { presentKeys.insert("calibration") if let val = exist as? [FHIRJSON] { self.calibration = DeviceMetricCalibration.instantiate(fromArray: val, owner: self) as? [DeviceMetricCalibration] } else { - errors.append(FHIRJSONError(key: "calibration", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "calibration", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? String { self.category = val } else { - errors.append(FHIRJSONError(key: "category", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "category")) } - if let exist: AnyObject = js["color"] { + if let exist = js["color"] { presentKeys.insert("color") if let val = exist as? String { self.color = val } else { - errors.append(FHIRJSONError(key: "color", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "color", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "identifier")) } - if let exist: AnyObject = js["measurementPeriod"] { + if let exist = js["measurementPeriod"] { presentKeys.insert("measurementPeriod") if let val = exist as? FHIRJSON { self.measurementPeriod = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "measurementPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "measurementPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["operationalStatus"] { + if let exist = js["operationalStatus"] { presentKeys.insert("operationalStatus") if let val = exist as? String { self.operationalStatus = val } else { - errors.append(FHIRJSONError(key: "operationalStatus", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "operationalStatus", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["parent"] { + if let exist = js["parent"] { presentKeys.insert("parent") if let val = exist as? FHIRJSON { self.parent = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "parent", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "parent", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["source"] { + if let exist = js["source"] { presentKeys.insert("source") if let val = exist as? FHIRJSON { self.source = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["unit"] { + if let exist = js["unit"] { presentKeys.insert("unit") if let val = exist as? FHIRJSON { self.unit = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "unit", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "unit", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -212,7 +212,7 @@ public class DeviceMetric: DomainResource { * Describes the calibrations that have been performed or that are required to be performed. */ public class DeviceMetricCalibration: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DeviceMetricCalibration" } } @@ -231,34 +231,34 @@ public class DeviceMetricCalibration: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["state"] { + if let exist = js["state"] { presentKeys.insert("state") if let val = exist as? String { self.state = val } else { - errors.append(FHIRJSONError(key: "state", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "state", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["time"] { + if let exist = js["time"] { presentKeys.insert("time") if let val = exist as? String { self.time = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "time", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "time", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/DeviceUseRequest.swift b/Sources/Models/DeviceUseRequest.swift index 80d3efc7..d112142b 100644 --- a/Sources/Models/DeviceUseRequest.swift +++ b/Sources/Models/DeviceUseRequest.swift @@ -2,7 +2,7 @@ // DeviceUseRequest.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceUseRequest) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceUseRequest) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * external assistive device, such as a walker. */ public class DeviceUseRequest: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DeviceUseRequest" } } @@ -81,157 +81,157 @@ public class DeviceUseRequest: DomainResource { self.subject = subject } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["bodySiteCodeableConcept"] { + if let exist = js["bodySiteCodeableConcept"] { presentKeys.insert("bodySiteCodeableConcept") if let val = exist as? FHIRJSON { self.bodySiteCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bodySiteCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySiteCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["bodySiteReference"] { + if let exist = js["bodySiteReference"] { presentKeys.insert("bodySiteReference") if let val = exist as? FHIRJSON { self.bodySiteReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bodySiteReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySiteReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["device"] { + if let exist = js["device"] { presentKeys.insert("device") if let val = exist as? FHIRJSON { self.device = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "device", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "device", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "device")) } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["indication"] { + if let exist = js["indication"] { presentKeys.insert("indication") if let val = exist as? [FHIRJSON] { self.indication = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "indication", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "indication", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["notes"] { + if let exist = js["notes"] { presentKeys.insert("notes") if let val = exist as? [String] { self.notes = val } else { - errors.append(FHIRJSONError(key: "notes", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "notes", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["orderedOn"] { + if let exist = js["orderedOn"] { presentKeys.insert("orderedOn") if let val = exist as? String { self.orderedOn = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "orderedOn", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "orderedOn", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["priority"] { + if let exist = js["priority"] { presentKeys.insert("priority") if let val = exist as? String { self.priority = val } else { - errors.append(FHIRJSONError(key: "priority", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priority", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["prnReason"] { + if let exist = js["prnReason"] { presentKeys.insert("prnReason") if let val = exist as? [FHIRJSON] { self.prnReason = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "prnReason", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prnReason", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["recordedOn"] { + if let exist = js["recordedOn"] { presentKeys.insert("recordedOn") if let val = exist as? String { self.recordedOn = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "recordedOn", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "recordedOn", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "subject")) } - if let exist: AnyObject = js["timingDateTime"] { + if let exist = js["timingDateTime"] { presentKeys.insert("timingDateTime") if let val = exist as? String { self.timingDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "timingDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "timingDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["timingPeriod"] { + if let exist = js["timingPeriod"] { presentKeys.insert("timingPeriod") if let val = exist as? FHIRJSON { self.timingPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "timingPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "timingPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["timingTiming"] { + if let exist = js["timingTiming"] { presentKeys.insert("timingTiming") if let val = exist as? FHIRJSON { self.timingTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "timingTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "timingTiming", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -260,7 +260,7 @@ public class DeviceUseRequest: DomainResource { json["indication"] = CodeableConcept.asJSONArray(indication) } if let notes = self.notes { - var arr = [AnyObject]() + var arr = [Any]() for val in notes { arr.append(val.asJSON()) } diff --git a/Sources/Models/DeviceUseStatement.swift b/Sources/Models/DeviceUseStatement.swift index 0025b57d..e439bea1 100644 --- a/Sources/Models/DeviceUseStatement.swift +++ b/Sources/Models/DeviceUseStatement.swift @@ -2,7 +2,7 @@ // DeviceUseStatement.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DeviceUseStatement) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * clinician. */ public class DeviceUseStatement: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DeviceUseStatement" } } @@ -69,121 +69,121 @@ public class DeviceUseStatement: DomainResource { self.subject = subject } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["bodySiteCodeableConcept"] { + if let exist = js["bodySiteCodeableConcept"] { presentKeys.insert("bodySiteCodeableConcept") if let val = exist as? FHIRJSON { self.bodySiteCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bodySiteCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySiteCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["bodySiteReference"] { + if let exist = js["bodySiteReference"] { presentKeys.insert("bodySiteReference") if let val = exist as? FHIRJSON { self.bodySiteReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bodySiteReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySiteReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["device"] { + if let exist = js["device"] { presentKeys.insert("device") if let val = exist as? FHIRJSON { self.device = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "device", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "device", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "device")) } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["indication"] { + if let exist = js["indication"] { presentKeys.insert("indication") if let val = exist as? [FHIRJSON] { self.indication = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "indication", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "indication", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["notes"] { + if let exist = js["notes"] { presentKeys.insert("notes") if let val = exist as? [String] { self.notes = val } else { - errors.append(FHIRJSONError(key: "notes", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "notes", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["recordedOn"] { + if let exist = js["recordedOn"] { presentKeys.insert("recordedOn") if let val = exist as? String { self.recordedOn = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "recordedOn", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "recordedOn", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "subject")) } - if let exist: AnyObject = js["timingDateTime"] { + if let exist = js["timingDateTime"] { presentKeys.insert("timingDateTime") if let val = exist as? String { self.timingDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "timingDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "timingDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["timingPeriod"] { + if let exist = js["timingPeriod"] { presentKeys.insert("timingPeriod") if let val = exist as? FHIRJSON { self.timingPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "timingPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "timingPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["timingTiming"] { + if let exist = js["timingTiming"] { presentKeys.insert("timingTiming") if let val = exist as? FHIRJSON { self.timingTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "timingTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "timingTiming", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["whenUsed"] { + if let exist = js["whenUsed"] { presentKeys.insert("whenUsed") if let val = exist as? FHIRJSON { self.whenUsed = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "whenUsed", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "whenUsed", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -209,7 +209,7 @@ public class DeviceUseStatement: DomainResource { json["indication"] = CodeableConcept.asJSONArray(indication) } if let notes = self.notes { - var arr = [AnyObject]() + var arr = [Any]() for val in notes { arr.append(val.asJSON()) } diff --git a/Sources/Models/DiagnosticOrder.swift b/Sources/Models/DiagnosticOrder.swift index 3a675349..8ea8c4dc 100644 --- a/Sources/Models/DiagnosticOrder.swift +++ b/Sources/Models/DiagnosticOrder.swift @@ -2,7 +2,7 @@ // DiagnosticOrder.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DiagnosticOrder) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DiagnosticOrder) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A record of a request for a diagnostic investigation service to be performed. */ public class DiagnosticOrder: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DiagnosticOrder" } } @@ -67,118 +67,118 @@ public class DiagnosticOrder: DomainResource { self.subject = subject } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["event"] { + if let exist = js["event"] { presentKeys.insert("event") if let val = exist as? [FHIRJSON] { self.event = DiagnosticOrderEvent.instantiate(fromArray: val, owner: self) as? [DiagnosticOrderEvent] } else { - errors.append(FHIRJSONError(key: "event", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "event", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["item"] { + if let exist = js["item"] { presentKeys.insert("item") if let val = exist as? [FHIRJSON] { self.item = DiagnosticOrderItem.instantiate(fromArray: val, owner: self) as? [DiagnosticOrderItem] } else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? [FHIRJSON] { self.note = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["orderer"] { + if let exist = js["orderer"] { presentKeys.insert("orderer") if let val = exist as? FHIRJSON { self.orderer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "orderer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "orderer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["priority"] { + if let exist = js["priority"] { presentKeys.insert("priority") if let val = exist as? String { self.priority = val } else { - errors.append(FHIRJSONError(key: "priority", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priority", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? [FHIRJSON] { self.reason = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["specimen"] { + if let exist = js["specimen"] { presentKeys.insert("specimen") if let val = exist as? [FHIRJSON] { self.specimen = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "specimen", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "specimen", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "subject")) } - if let exist: AnyObject = js["supportingInformation"] { + if let exist = js["supportingInformation"] { presentKeys.insert("supportingInformation") if let val = exist as? [FHIRJSON] { self.supportingInformation = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "supportingInformation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "supportingInformation", wants: Array.self, has: type(of: exist))) } } } @@ -237,7 +237,7 @@ public class DiagnosticOrder: DomainResource { * various processing steps (specimens received), when it was completed. */ public class DiagnosticOrderEvent: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DiagnosticOrderEvent" } } @@ -266,46 +266,46 @@ public class DiagnosticOrderEvent: BackboneElement { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["actor"] { + if let exist = js["actor"] { presentKeys.insert("actor") if let val = exist as? FHIRJSON { self.actor = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dateTime"] { + if let exist = js["dateTime"] { presentKeys.insert("dateTime") if let val = exist as? String { self.dateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "dateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateTime", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "dateTime")) } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? FHIRJSON { self.description_fhir = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "description", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { @@ -343,7 +343,7 @@ public class DiagnosticOrderEvent: BackboneElement { * item per request, but in most contexts, more than one investigation can be requested. */ public class DiagnosticOrderItem: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DiagnosticOrderItem" } } @@ -374,55 +374,55 @@ public class DiagnosticOrderItem: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["bodySite"] { + if let exist = js["bodySite"] { presentKeys.insert("bodySite") if let val = exist as? FHIRJSON { self.bodySite = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bodySite", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySite", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["event"] { + if let exist = js["event"] { presentKeys.insert("event") if let val = exist as? [FHIRJSON] { self.event = DiagnosticOrderEvent.instantiate(fromArray: val, owner: self) as? [DiagnosticOrderEvent] } else { - errors.append(FHIRJSONError(key: "event", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "event", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["specimen"] { + if let exist = js["specimen"] { presentKeys.insert("specimen") if let val = exist as? [FHIRJSON] { self.specimen = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "specimen", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "specimen", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/DiagnosticReport.swift b/Sources/Models/DiagnosticReport.swift index db755824..8d53536c 100644 --- a/Sources/Models/DiagnosticReport.swift +++ b/Sources/Models/DiagnosticReport.swift @@ -2,7 +2,7 @@ // DiagnosticReport.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DiagnosticReport) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DiagnosticReport) on 2016-09-16. // 2016, SMART Health IT. // @@ -19,7 +19,7 @@ import Foundation * of diagnostic reports. */ public class DiagnosticReport: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DiagnosticReport" } } @@ -95,181 +95,181 @@ public class DiagnosticReport: DomainResource { self.subject = subject } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? FHIRJSON { self.category = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["codedDiagnosis"] { + if let exist = js["codedDiagnosis"] { presentKeys.insert("codedDiagnosis") if let val = exist as? [FHIRJSON] { self.codedDiagnosis = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "codedDiagnosis", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "codedDiagnosis", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["conclusion"] { + if let exist = js["conclusion"] { presentKeys.insert("conclusion") if let val = exist as? String { self.conclusion = val } else { - errors.append(FHIRJSONError(key: "conclusion", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "conclusion", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["effectiveDateTime"] { + if let exist = js["effectiveDateTime"] { presentKeys.insert("effectiveDateTime") if let val = exist as? String { self.effectiveDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "effectiveDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "effectiveDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["effectivePeriod"] { + if let exist = js["effectivePeriod"] { presentKeys.insert("effectivePeriod") if let val = exist as? FHIRJSON { self.effectivePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "effectivePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "effectivePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["image"] { + if let exist = js["image"] { presentKeys.insert("image") if let val = exist as? [FHIRJSON] { self.image = DiagnosticReportImage.instantiate(fromArray: val, owner: self) as? [DiagnosticReportImage] } else { - errors.append(FHIRJSONError(key: "image", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "image", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["imagingStudy"] { + if let exist = js["imagingStudy"] { presentKeys.insert("imagingStudy") if let val = exist as? [FHIRJSON] { self.imagingStudy = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "imagingStudy", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "imagingStudy", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["issued"] { + if let exist = js["issued"] { presentKeys.insert("issued") if let val = exist as? String { self.issued = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "issued", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "issued", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "issued")) } - if let exist: AnyObject = js["performer"] { + if let exist = js["performer"] { presentKeys.insert("performer") if let val = exist as? FHIRJSON { self.performer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "performer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "performer", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "performer")) } - if let exist: AnyObject = js["presentedForm"] { + if let exist = js["presentedForm"] { presentKeys.insert("presentedForm") if let val = exist as? [FHIRJSON] { self.presentedForm = Attachment.instantiate(fromArray: val, owner: self) as? [Attachment] } else { - errors.append(FHIRJSONError(key: "presentedForm", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "presentedForm", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? [FHIRJSON] { self.request = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "request", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["result"] { + if let exist = js["result"] { presentKeys.insert("result") if let val = exist as? [FHIRJSON] { self.result = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "result", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "result", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["specimen"] { + if let exist = js["specimen"] { presentKeys.insert("specimen") if let val = exist as? [FHIRJSON] { self.specimen = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "specimen", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "specimen", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -354,7 +354,7 @@ public class DiagnosticReport: DomainResource { * and may be directly of the patient, or of treated specimens (i.e. slides of interest). */ public class DiagnosticReportImage: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DiagnosticReportImage" } } @@ -376,25 +376,25 @@ public class DiagnosticReportImage: BackboneElement { self.link = link } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["comment"] { + if let exist = js["comment"] { presentKeys.insert("comment") if let val = exist as? String { self.comment = val } else { - errors.append(FHIRJSONError(key: "comment", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comment", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["link"] { + if let exist = js["link"] { presentKeys.insert("link") if let val = exist as? FHIRJSON { self.link = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "link", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "link", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Distance.swift b/Sources/Models/Distance.swift index bcf355a6..3dab659a 100644 --- a/Sources/Models/Distance.swift +++ b/Sources/Models/Distance.swift @@ -2,7 +2,7 @@ // Distance.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Distance) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Distance) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * be UCUM. */ public class Distance: Quantity { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Distance" } } diff --git a/Sources/Models/DocumentManifest.swift b/Sources/Models/DocumentManifest.swift index 2c505fd3..8fa0f3c0 100644 --- a/Sources/Models/DocumentManifest.swift +++ b/Sources/Models/DocumentManifest.swift @@ -2,7 +2,7 @@ // DocumentManifest.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DocumentManifest) on 2016-09-16. // 2016, SMART Health IT. // @@ -13,7 +13,7 @@ import Foundation * A manifest that defines a set of documents. */ public class DocumentManifest: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DocumentManifest" } } @@ -66,121 +66,121 @@ public class DocumentManifest: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? [FHIRJSON] { self.author = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "author", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["content"] { + if let exist = js["content"] { presentKeys.insert("content") if let val = exist as? [FHIRJSON] { self.content = DocumentManifestContent.instantiate(fromArray: val, owner: self) as? [DocumentManifestContent] } else { - errors.append(FHIRJSONError(key: "content", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "content", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "content")) } - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["masterIdentifier"] { + if let exist = js["masterIdentifier"] { presentKeys.insert("masterIdentifier") if let val = exist as? FHIRJSON { self.masterIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "masterIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "masterIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["recipient"] { + if let exist = js["recipient"] { presentKeys.insert("recipient") if let val = exist as? [FHIRJSON] { self.recipient = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "recipient", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "recipient", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["related"] { + if let exist = js["related"] { presentKeys.insert("related") if let val = exist as? [FHIRJSON] { self.related = DocumentManifestRelated.instantiate(fromArray: val, owner: self) as? [DocumentManifestRelated] } else { - errors.append(FHIRJSONError(key: "related", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "related", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["source"] { + if let exist = js["source"] { presentKeys.insert("source") if let val = exist as? String { self.source = URL(string: val) } else { - errors.append(FHIRJSONError(key: "source", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "source", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -238,7 +238,7 @@ public class DocumentManifest: DomainResource { * The list of Documents included in the manifest. */ public class DocumentManifestContent: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DocumentManifestContent" } } @@ -261,25 +261,25 @@ public class DocumentManifestContent: BackboneElement { self.pReference = pReference } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["pAttachment"] { + if let exist = js["pAttachment"] { presentKeys.insert("pAttachment") if let val = exist as? FHIRJSON { self.pAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "pAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "pAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["pReference"] { + if let exist = js["pReference"] { presentKeys.insert("pReference") if let val = exist as? FHIRJSON { self.pReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "pReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "pReference", wants: FHIRJSON.self, has: type(of: exist))) } } @@ -312,7 +312,7 @@ public class DocumentManifestContent: BackboneElement { * Related identifiers or resources associated with the DocumentManifest. */ public class DocumentManifestRelated: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DocumentManifestRelated" } } @@ -328,25 +328,25 @@ public class DocumentManifestRelated: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ref"] { + if let exist = js["ref"] { presentKeys.insert("ref") if let val = exist as? FHIRJSON { self.ref = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ref", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ref", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/DocumentReference.swift b/Sources/Models/DocumentReference.swift index c53fd8c4..ebdb958a 100644 --- a/Sources/Models/DocumentReference.swift +++ b/Sources/Models/DocumentReference.swift @@ -2,7 +2,7 @@ // DocumentReference.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DocumentReference) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DocumentReference) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A reference to a document . */ public class DocumentReference: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DocumentReference" } } @@ -85,169 +85,169 @@ public class DocumentReference: DomainResource { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["authenticator"] { + if let exist = js["authenticator"] { presentKeys.insert("authenticator") if let val = exist as? FHIRJSON { self.authenticator = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "authenticator", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "authenticator", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? [FHIRJSON] { self.author = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "author", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["class"] { + if let exist = js["class"] { presentKeys.insert("class") if let val = exist as? FHIRJSON { self.class_fhir = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "class", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "class", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["content"] { + if let exist = js["content"] { presentKeys.insert("content") if let val = exist as? [FHIRJSON] { self.content = DocumentReferenceContent.instantiate(fromArray: val, owner: self) as? [DocumentReferenceContent] } else { - errors.append(FHIRJSONError(key: "content", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "content", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "content")) } - if let exist: AnyObject = js["context"] { + if let exist = js["context"] { presentKeys.insert("context") if let val = exist as? FHIRJSON { self.context = DocumentReferenceContext(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "context", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "context", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["custodian"] { + if let exist = js["custodian"] { presentKeys.insert("custodian") if let val = exist as? FHIRJSON { self.custodian = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "custodian", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "custodian", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["docStatus"] { + if let exist = js["docStatus"] { presentKeys.insert("docStatus") if let val = exist as? FHIRJSON { self.docStatus = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "docStatus", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "docStatus", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["indexed"] { + if let exist = js["indexed"] { presentKeys.insert("indexed") if let val = exist as? String { self.indexed = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "indexed", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "indexed", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "indexed")) } - if let exist: AnyObject = js["masterIdentifier"] { + if let exist = js["masterIdentifier"] { presentKeys.insert("masterIdentifier") if let val = exist as? FHIRJSON { self.masterIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "masterIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "masterIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["relatesTo"] { + if let exist = js["relatesTo"] { presentKeys.insert("relatesTo") if let val = exist as? [FHIRJSON] { self.relatesTo = DocumentReferenceRelatesTo.instantiate(fromArray: val, owner: self) as? [DocumentReferenceRelatesTo] } else { - errors.append(FHIRJSONError(key: "relatesTo", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "relatesTo", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["securityLabel"] { + if let exist = js["securityLabel"] { presentKeys.insert("securityLabel") if let val = exist as? [FHIRJSON] { self.securityLabel = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "securityLabel", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "securityLabel", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -323,7 +323,7 @@ public class DocumentReference: DomainResource { * The document and format referenced. There may be multiple content element repetitions, each with a different format. */ public class DocumentReferenceContent: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DocumentReferenceContent" } } @@ -345,28 +345,28 @@ public class DocumentReferenceContent: BackboneElement { self.attachment = attachment } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["attachment"] { + if let exist = js["attachment"] { presentKeys.insert("attachment") if let val = exist as? FHIRJSON { self.attachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "attachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "attachment", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "attachment")) } - if let exist: AnyObject = js["format"] { + if let exist = js["format"] { presentKeys.insert("format") if let val = exist as? [FHIRJSON] { self.format = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "format", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "format", wants: Array.self, has: type(of: exist))) } } } @@ -394,7 +394,7 @@ public class DocumentReferenceContent: BackboneElement { * The clinical context in which the document was prepared. */ public class DocumentReferenceContext: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DocumentReferenceContext" } } @@ -425,70 +425,70 @@ public class DocumentReferenceContext: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["event"] { + if let exist = js["event"] { presentKeys.insert("event") if let val = exist as? [FHIRJSON] { self.event = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "event", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "event", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["facilityType"] { + if let exist = js["facilityType"] { presentKeys.insert("facilityType") if let val = exist as? FHIRJSON { self.facilityType = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "facilityType", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "facilityType", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["practiceSetting"] { + if let exist = js["practiceSetting"] { presentKeys.insert("practiceSetting") if let val = exist as? FHIRJSON { self.practiceSetting = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "practiceSetting", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "practiceSetting", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["related"] { + if let exist = js["related"] { presentKeys.insert("related") if let val = exist as? [FHIRJSON] { self.related = DocumentReferenceContextRelated.instantiate(fromArray: val, owner: self) as? [DocumentReferenceContextRelated] } else { - errors.append(FHIRJSONError(key: "related", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "related", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sourcePatientInfo"] { + if let exist = js["sourcePatientInfo"] { presentKeys.insert("sourcePatientInfo") if let val = exist as? FHIRJSON { self.sourcePatientInfo = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "sourcePatientInfo", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sourcePatientInfo", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -531,7 +531,7 @@ public class DocumentReferenceContext: BackboneElement { * Related identifiers or resources associated with the DocumentReference. */ public class DocumentReferenceContextRelated: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DocumentReferenceContextRelated" } } @@ -547,25 +547,25 @@ public class DocumentReferenceContextRelated: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ref"] { + if let exist = js["ref"] { presentKeys.insert("ref") if let val = exist as? FHIRJSON { self.ref = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ref", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ref", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -593,7 +593,7 @@ public class DocumentReferenceContextRelated: BackboneElement { * Relationships that this document has with other document references that already exist. */ public class DocumentReferenceRelatesTo: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DocumentReferenceRelatesTo" } } @@ -616,28 +616,28 @@ public class DocumentReferenceRelatesTo: BackboneElement { self.target = target } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? FHIRJSON { self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/DomainResource.swift b/Sources/Models/DomainResource.swift index a41c8d6b..8351d7a8 100644 --- a/Sources/Models/DomainResource.swift +++ b/Sources/Models/DomainResource.swift @@ -2,7 +2,7 @@ // DomainResource.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DomainResource) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/DomainResource) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A resource that includes narrative, extensions, and contained resources. */ public class DomainResource: Resource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "DomainResource" } } @@ -37,43 +37,43 @@ public class DomainResource: Resource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contained"] { + if let exist = js["contained"] { presentKeys.insert("contained") if let val = exist as? [FHIRJSON] { self.contained = Resource.instantiate(fromArray: val, owner: self) as? [Resource] } else { - errors.append(FHIRJSONError(key: "contained", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contained", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["extension"] { + if let exist = js["extension"] { presentKeys.insert("extension") if let val = exist as? [FHIRJSON] { self.extension_fhir = Extension.instantiate(fromArray: val, owner: self) as? [Extension] } else { - errors.append(FHIRJSONError(key: "extension", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "extension", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["modifierExtension"] { + if let exist = js["modifierExtension"] { presentKeys.insert("modifierExtension") if let val = exist as? [FHIRJSON] { self.modifierExtension = Extension.instantiate(fromArray: val, owner: self) as? [Extension] } else { - errors.append(FHIRJSONError(key: "modifierExtension", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "modifierExtension", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? FHIRJSON { self.text = Narrative(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "text", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Duration.swift b/Sources/Models/Duration.swift index 5ce7b09e..70e17008 100644 --- a/Sources/Models/Duration.swift +++ b/Sources/Models/Duration.swift @@ -2,7 +2,7 @@ // Duration.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Duration) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Duration) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * UCUM. */ public class Duration: Quantity { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Duration" } } diff --git a/Sources/Models/Element.swift b/Sources/Models/Element.swift index 4aed6664..c4786d7e 100644 --- a/Sources/Models/Element.swift +++ b/Sources/Models/Element.swift @@ -2,7 +2,7 @@ // Element.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Element) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Element) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * Base definition for all elements in a resource. */ public class Element: FHIRAbstractBase { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Element" } } @@ -31,25 +31,25 @@ public class Element: FHIRAbstractBase { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["extension"] { + if let exist = js["extension"] { presentKeys.insert("extension") if let val = exist as? [FHIRJSON] { self.extension_fhir = Extension.instantiate(fromArray: val, owner: self) as? [Extension] } else { - errors.append(FHIRJSONError(key: "extension", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "extension", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["id"] { + if let exist = js["id"] { presentKeys.insert("id") if let val = exist as? String { self.id = val } else { - errors.append(FHIRJSONError(key: "id", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "id", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/ElementDefinition.swift b/Sources/Models/ElementDefinition.swift index 0db4a6e9..0d5bbf8b 100644 --- a/Sources/Models/ElementDefinition.swift +++ b/Sources/Models/ElementDefinition.swift @@ -2,7 +2,7 @@ // ElementDefinition.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ElementDefinition) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ElementDefinition) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * Captures constraints on each element within the resource, profile, or extension. */ public class ElementDefinition: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ElementDefinition" } } @@ -700,2017 +700,2017 @@ public class ElementDefinition: Element { self.path = path } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["alias"] { + if let exist = js["alias"] { presentKeys.insert("alias") if let val = exist as? [String] { self.alias = val } else { - errors.append(FHIRJSONError(key: "alias", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "alias", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["base"] { + if let exist = js["base"] { presentKeys.insert("base") if let val = exist as? FHIRJSON { self.base = ElementDefinitionBase(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "base", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "base", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["binding"] { + if let exist = js["binding"] { presentKeys.insert("binding") if let val = exist as? FHIRJSON { self.binding = ElementDefinitionBinding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "binding", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "binding", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? [FHIRJSON] { self.code = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "code", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["comments"] { + if let exist = js["comments"] { presentKeys.insert("comments") if let val = exist as? String { self.comments = val } else { - errors.append(FHIRJSONError(key: "comments", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comments", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["condition"] { + if let exist = js["condition"] { presentKeys.insert("condition") if let val = exist as? [String] { self.condition = val } else { - errors.append(FHIRJSONError(key: "condition", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "condition", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["constraint"] { + if let exist = js["constraint"] { presentKeys.insert("constraint") if let val = exist as? [FHIRJSON] { self.constraint = ElementDefinitionConstraint.instantiate(fromArray: val, owner: self) as? [ElementDefinitionConstraint] } else { - errors.append(FHIRJSONError(key: "constraint", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "constraint", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueAddress"] { + if let exist = js["defaultValueAddress"] { presentKeys.insert("defaultValueAddress") if let val = exist as? FHIRJSON { self.defaultValueAddress = Address(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueAddress", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueAddress", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueAnnotation"] { + if let exist = js["defaultValueAnnotation"] { presentKeys.insert("defaultValueAnnotation") if let val = exist as? FHIRJSON { self.defaultValueAnnotation = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueAnnotation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueAnnotation", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueAttachment"] { + if let exist = js["defaultValueAttachment"] { presentKeys.insert("defaultValueAttachment") if let val = exist as? FHIRJSON { self.defaultValueAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueBase64Binary"] { + if let exist = js["defaultValueBase64Binary"] { presentKeys.insert("defaultValueBase64Binary") if let val = exist as? String { self.defaultValueBase64Binary = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "defaultValueBase64Binary", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueBase64Binary", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueBoolean"] { + if let exist = js["defaultValueBoolean"] { presentKeys.insert("defaultValueBoolean") if let val = exist as? Bool { self.defaultValueBoolean = val } else { - errors.append(FHIRJSONError(key: "defaultValueBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueCode"] { + if let exist = js["defaultValueCode"] { presentKeys.insert("defaultValueCode") if let val = exist as? String { self.defaultValueCode = val } else { - errors.append(FHIRJSONError(key: "defaultValueCode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueCode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueCodeableConcept"] { + if let exist = js["defaultValueCodeableConcept"] { presentKeys.insert("defaultValueCodeableConcept") if let val = exist as? FHIRJSON { self.defaultValueCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueCoding"] { + if let exist = js["defaultValueCoding"] { presentKeys.insert("defaultValueCoding") if let val = exist as? FHIRJSON { self.defaultValueCoding = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueCoding", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueCoding", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueContactPoint"] { + if let exist = js["defaultValueContactPoint"] { presentKeys.insert("defaultValueContactPoint") if let val = exist as? FHIRJSON { self.defaultValueContactPoint = ContactPoint(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueContactPoint", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueContactPoint", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueDate"] { + if let exist = js["defaultValueDate"] { presentKeys.insert("defaultValueDate") if let val = exist as? String { self.defaultValueDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "defaultValueDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueDateTime"] { + if let exist = js["defaultValueDateTime"] { presentKeys.insert("defaultValueDateTime") if let val = exist as? String { self.defaultValueDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "defaultValueDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueDecimal"] { + if let exist = js["defaultValueDecimal"] { presentKeys.insert("defaultValueDecimal") if let val = exist as? NSNumber { self.defaultValueDecimal = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "defaultValueDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueDecimal", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueHumanName"] { + if let exist = js["defaultValueHumanName"] { presentKeys.insert("defaultValueHumanName") if let val = exist as? FHIRJSON { self.defaultValueHumanName = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueHumanName", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueHumanName", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueId"] { + if let exist = js["defaultValueId"] { presentKeys.insert("defaultValueId") if let val = exist as? String { self.defaultValueId = val } else { - errors.append(FHIRJSONError(key: "defaultValueId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueIdentifier"] { + if let exist = js["defaultValueIdentifier"] { presentKeys.insert("defaultValueIdentifier") if let val = exist as? FHIRJSON { self.defaultValueIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueInstant"] { + if let exist = js["defaultValueInstant"] { presentKeys.insert("defaultValueInstant") if let val = exist as? String { self.defaultValueInstant = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "defaultValueInstant", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueInstant", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueInteger"] { + if let exist = js["defaultValueInteger"] { presentKeys.insert("defaultValueInteger") if let val = exist as? Int { self.defaultValueInteger = val } else { - errors.append(FHIRJSONError(key: "defaultValueInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueInteger", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueMarkdown"] { + if let exist = js["defaultValueMarkdown"] { presentKeys.insert("defaultValueMarkdown") if let val = exist as? String { self.defaultValueMarkdown = val } else { - errors.append(FHIRJSONError(key: "defaultValueMarkdown", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueMarkdown", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueMeta"] { + if let exist = js["defaultValueMeta"] { presentKeys.insert("defaultValueMeta") if let val = exist as? FHIRJSON { self.defaultValueMeta = Meta(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueMeta", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueMeta", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueOid"] { + if let exist = js["defaultValueOid"] { presentKeys.insert("defaultValueOid") if let val = exist as? String { self.defaultValueOid = val } else { - errors.append(FHIRJSONError(key: "defaultValueOid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueOid", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValuePeriod"] { + if let exist = js["defaultValuePeriod"] { presentKeys.insert("defaultValuePeriod") if let val = exist as? FHIRJSON { self.defaultValuePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValuePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValuePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValuePositiveInt"] { + if let exist = js["defaultValuePositiveInt"] { presentKeys.insert("defaultValuePositiveInt") if let val = exist as? UInt { self.defaultValuePositiveInt = val } else { - errors.append(FHIRJSONError(key: "defaultValuePositiveInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValuePositiveInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueQuantity"] { + if let exist = js["defaultValueQuantity"] { presentKeys.insert("defaultValueQuantity") if let val = exist as? FHIRJSON { self.defaultValueQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueRange"] { + if let exist = js["defaultValueRange"] { presentKeys.insert("defaultValueRange") if let val = exist as? FHIRJSON { self.defaultValueRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueRatio"] { + if let exist = js["defaultValueRatio"] { presentKeys.insert("defaultValueRatio") if let val = exist as? FHIRJSON { self.defaultValueRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueReference"] { + if let exist = js["defaultValueReference"] { presentKeys.insert("defaultValueReference") if let val = exist as? FHIRJSON { self.defaultValueReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueSampledData"] { + if let exist = js["defaultValueSampledData"] { presentKeys.insert("defaultValueSampledData") if let val = exist as? FHIRJSON { self.defaultValueSampledData = SampledData(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueSampledData", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueSignature"] { + if let exist = js["defaultValueSignature"] { presentKeys.insert("defaultValueSignature") if let val = exist as? FHIRJSON { self.defaultValueSignature = Signature(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueSignature", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueSignature", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueString"] { + if let exist = js["defaultValueString"] { presentKeys.insert("defaultValueString") if let val = exist as? String { self.defaultValueString = val } else { - errors.append(FHIRJSONError(key: "defaultValueString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueTime"] { + if let exist = js["defaultValueTime"] { presentKeys.insert("defaultValueTime") if let val = exist as? String { self.defaultValueTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "defaultValueTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueTiming"] { + if let exist = js["defaultValueTiming"] { presentKeys.insert("defaultValueTiming") if let val = exist as? FHIRJSON { self.defaultValueTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "defaultValueTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueTiming", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueUnsignedInt"] { + if let exist = js["defaultValueUnsignedInt"] { presentKeys.insert("defaultValueUnsignedInt") if let val = exist as? UInt { self.defaultValueUnsignedInt = val } else { - errors.append(FHIRJSONError(key: "defaultValueUnsignedInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueUnsignedInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["defaultValueUri"] { + if let exist = js["defaultValueUri"] { presentKeys.insert("defaultValueUri") if let val = exist as? String { self.defaultValueUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "defaultValueUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "defaultValueUri", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["definition"] { + if let exist = js["definition"] { presentKeys.insert("definition") if let val = exist as? String { self.definition = val } else { - errors.append(FHIRJSONError(key: "definition", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "definition", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleAddress"] { + if let exist = js["exampleAddress"] { presentKeys.insert("exampleAddress") if let val = exist as? FHIRJSON { self.exampleAddress = Address(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleAddress", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleAddress", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleAnnotation"] { + if let exist = js["exampleAnnotation"] { presentKeys.insert("exampleAnnotation") if let val = exist as? FHIRJSON { self.exampleAnnotation = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleAnnotation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleAnnotation", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleAttachment"] { + if let exist = js["exampleAttachment"] { presentKeys.insert("exampleAttachment") if let val = exist as? FHIRJSON { self.exampleAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleBase64Binary"] { + if let exist = js["exampleBase64Binary"] { presentKeys.insert("exampleBase64Binary") if let val = exist as? String { self.exampleBase64Binary = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "exampleBase64Binary", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleBase64Binary", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleBoolean"] { + if let exist = js["exampleBoolean"] { presentKeys.insert("exampleBoolean") if let val = exist as? Bool { self.exampleBoolean = val } else { - errors.append(FHIRJSONError(key: "exampleBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleCode"] { + if let exist = js["exampleCode"] { presentKeys.insert("exampleCode") if let val = exist as? String { self.exampleCode = val } else { - errors.append(FHIRJSONError(key: "exampleCode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleCode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleCodeableConcept"] { + if let exist = js["exampleCodeableConcept"] { presentKeys.insert("exampleCodeableConcept") if let val = exist as? FHIRJSON { self.exampleCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleCoding"] { + if let exist = js["exampleCoding"] { presentKeys.insert("exampleCoding") if let val = exist as? FHIRJSON { self.exampleCoding = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleCoding", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleCoding", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleContactPoint"] { + if let exist = js["exampleContactPoint"] { presentKeys.insert("exampleContactPoint") if let val = exist as? FHIRJSON { self.exampleContactPoint = ContactPoint(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleContactPoint", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleContactPoint", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleDate"] { + if let exist = js["exampleDate"] { presentKeys.insert("exampleDate") if let val = exist as? String { self.exampleDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "exampleDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleDateTime"] { + if let exist = js["exampleDateTime"] { presentKeys.insert("exampleDateTime") if let val = exist as? String { self.exampleDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "exampleDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleDecimal"] { + if let exist = js["exampleDecimal"] { presentKeys.insert("exampleDecimal") if let val = exist as? NSNumber { self.exampleDecimal = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "exampleDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleDecimal", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleHumanName"] { + if let exist = js["exampleHumanName"] { presentKeys.insert("exampleHumanName") if let val = exist as? FHIRJSON { self.exampleHumanName = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleHumanName", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleHumanName", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleId"] { + if let exist = js["exampleId"] { presentKeys.insert("exampleId") if let val = exist as? String { self.exampleId = val } else { - errors.append(FHIRJSONError(key: "exampleId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleIdentifier"] { + if let exist = js["exampleIdentifier"] { presentKeys.insert("exampleIdentifier") if let val = exist as? FHIRJSON { self.exampleIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleInstant"] { + if let exist = js["exampleInstant"] { presentKeys.insert("exampleInstant") if let val = exist as? String { self.exampleInstant = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "exampleInstant", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleInstant", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleInteger"] { + if let exist = js["exampleInteger"] { presentKeys.insert("exampleInteger") if let val = exist as? Int { self.exampleInteger = val } else { - errors.append(FHIRJSONError(key: "exampleInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleInteger", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleMarkdown"] { + if let exist = js["exampleMarkdown"] { presentKeys.insert("exampleMarkdown") if let val = exist as? String { self.exampleMarkdown = val } else { - errors.append(FHIRJSONError(key: "exampleMarkdown", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleMarkdown", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleMeta"] { + if let exist = js["exampleMeta"] { presentKeys.insert("exampleMeta") if let val = exist as? FHIRJSON { self.exampleMeta = Meta(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleMeta", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleMeta", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleOid"] { + if let exist = js["exampleOid"] { presentKeys.insert("exampleOid") if let val = exist as? String { self.exampleOid = val } else { - errors.append(FHIRJSONError(key: "exampleOid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleOid", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["examplePeriod"] { + if let exist = js["examplePeriod"] { presentKeys.insert("examplePeriod") if let val = exist as? FHIRJSON { self.examplePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "examplePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "examplePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["examplePositiveInt"] { + if let exist = js["examplePositiveInt"] { presentKeys.insert("examplePositiveInt") if let val = exist as? UInt { self.examplePositiveInt = val } else { - errors.append(FHIRJSONError(key: "examplePositiveInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "examplePositiveInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleQuantity"] { + if let exist = js["exampleQuantity"] { presentKeys.insert("exampleQuantity") if let val = exist as? FHIRJSON { self.exampleQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleRange"] { + if let exist = js["exampleRange"] { presentKeys.insert("exampleRange") if let val = exist as? FHIRJSON { self.exampleRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleRatio"] { + if let exist = js["exampleRatio"] { presentKeys.insert("exampleRatio") if let val = exist as? FHIRJSON { self.exampleRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleReference"] { + if let exist = js["exampleReference"] { presentKeys.insert("exampleReference") if let val = exist as? FHIRJSON { self.exampleReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleSampledData"] { + if let exist = js["exampleSampledData"] { presentKeys.insert("exampleSampledData") if let val = exist as? FHIRJSON { self.exampleSampledData = SampledData(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleSampledData", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleSignature"] { + if let exist = js["exampleSignature"] { presentKeys.insert("exampleSignature") if let val = exist as? FHIRJSON { self.exampleSignature = Signature(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleSignature", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleSignature", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleString"] { + if let exist = js["exampleString"] { presentKeys.insert("exampleString") if let val = exist as? String { self.exampleString = val } else { - errors.append(FHIRJSONError(key: "exampleString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleTime"] { + if let exist = js["exampleTime"] { presentKeys.insert("exampleTime") if let val = exist as? String { self.exampleTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "exampleTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleTiming"] { + if let exist = js["exampleTiming"] { presentKeys.insert("exampleTiming") if let val = exist as? FHIRJSON { self.exampleTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleTiming", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleUnsignedInt"] { + if let exist = js["exampleUnsignedInt"] { presentKeys.insert("exampleUnsignedInt") if let val = exist as? UInt { self.exampleUnsignedInt = val } else { - errors.append(FHIRJSONError(key: "exampleUnsignedInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleUnsignedInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleUri"] { + if let exist = js["exampleUri"] { presentKeys.insert("exampleUri") if let val = exist as? String { self.exampleUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "exampleUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleUri", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedAddress"] { + if let exist = js["fixedAddress"] { presentKeys.insert("fixedAddress") if let val = exist as? FHIRJSON { self.fixedAddress = Address(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedAddress", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedAddress", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedAnnotation"] { + if let exist = js["fixedAnnotation"] { presentKeys.insert("fixedAnnotation") if let val = exist as? FHIRJSON { self.fixedAnnotation = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedAnnotation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedAnnotation", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedAttachment"] { + if let exist = js["fixedAttachment"] { presentKeys.insert("fixedAttachment") if let val = exist as? FHIRJSON { self.fixedAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedBase64Binary"] { + if let exist = js["fixedBase64Binary"] { presentKeys.insert("fixedBase64Binary") if let val = exist as? String { self.fixedBase64Binary = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "fixedBase64Binary", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedBase64Binary", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedBoolean"] { + if let exist = js["fixedBoolean"] { presentKeys.insert("fixedBoolean") if let val = exist as? Bool { self.fixedBoolean = val } else { - errors.append(FHIRJSONError(key: "fixedBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedCode"] { + if let exist = js["fixedCode"] { presentKeys.insert("fixedCode") if let val = exist as? String { self.fixedCode = val } else { - errors.append(FHIRJSONError(key: "fixedCode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedCode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedCodeableConcept"] { + if let exist = js["fixedCodeableConcept"] { presentKeys.insert("fixedCodeableConcept") if let val = exist as? FHIRJSON { self.fixedCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedCoding"] { + if let exist = js["fixedCoding"] { presentKeys.insert("fixedCoding") if let val = exist as? FHIRJSON { self.fixedCoding = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedCoding", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedCoding", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedContactPoint"] { + if let exist = js["fixedContactPoint"] { presentKeys.insert("fixedContactPoint") if let val = exist as? FHIRJSON { self.fixedContactPoint = ContactPoint(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedContactPoint", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedContactPoint", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedDate"] { + if let exist = js["fixedDate"] { presentKeys.insert("fixedDate") if let val = exist as? String { self.fixedDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "fixedDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedDateTime"] { + if let exist = js["fixedDateTime"] { presentKeys.insert("fixedDateTime") if let val = exist as? String { self.fixedDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "fixedDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedDecimal"] { + if let exist = js["fixedDecimal"] { presentKeys.insert("fixedDecimal") if let val = exist as? NSNumber { self.fixedDecimal = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "fixedDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedDecimal", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedHumanName"] { + if let exist = js["fixedHumanName"] { presentKeys.insert("fixedHumanName") if let val = exist as? FHIRJSON { self.fixedHumanName = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedHumanName", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedHumanName", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedId"] { + if let exist = js["fixedId"] { presentKeys.insert("fixedId") if let val = exist as? String { self.fixedId = val } else { - errors.append(FHIRJSONError(key: "fixedId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedIdentifier"] { + if let exist = js["fixedIdentifier"] { presentKeys.insert("fixedIdentifier") if let val = exist as? FHIRJSON { self.fixedIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedInstant"] { + if let exist = js["fixedInstant"] { presentKeys.insert("fixedInstant") if let val = exist as? String { self.fixedInstant = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "fixedInstant", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedInstant", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedInteger"] { + if let exist = js["fixedInteger"] { presentKeys.insert("fixedInteger") if let val = exist as? Int { self.fixedInteger = val } else { - errors.append(FHIRJSONError(key: "fixedInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedInteger", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedMarkdown"] { + if let exist = js["fixedMarkdown"] { presentKeys.insert("fixedMarkdown") if let val = exist as? String { self.fixedMarkdown = val } else { - errors.append(FHIRJSONError(key: "fixedMarkdown", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedMarkdown", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedMeta"] { + if let exist = js["fixedMeta"] { presentKeys.insert("fixedMeta") if let val = exist as? FHIRJSON { self.fixedMeta = Meta(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedMeta", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedMeta", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedOid"] { + if let exist = js["fixedOid"] { presentKeys.insert("fixedOid") if let val = exist as? String { self.fixedOid = val } else { - errors.append(FHIRJSONError(key: "fixedOid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedOid", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedPeriod"] { + if let exist = js["fixedPeriod"] { presentKeys.insert("fixedPeriod") if let val = exist as? FHIRJSON { self.fixedPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedPositiveInt"] { + if let exist = js["fixedPositiveInt"] { presentKeys.insert("fixedPositiveInt") if let val = exist as? UInt { self.fixedPositiveInt = val } else { - errors.append(FHIRJSONError(key: "fixedPositiveInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedPositiveInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedQuantity"] { + if let exist = js["fixedQuantity"] { presentKeys.insert("fixedQuantity") if let val = exist as? FHIRJSON { self.fixedQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedRange"] { + if let exist = js["fixedRange"] { presentKeys.insert("fixedRange") if let val = exist as? FHIRJSON { self.fixedRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedRatio"] { + if let exist = js["fixedRatio"] { presentKeys.insert("fixedRatio") if let val = exist as? FHIRJSON { self.fixedRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedReference"] { + if let exist = js["fixedReference"] { presentKeys.insert("fixedReference") if let val = exist as? FHIRJSON { self.fixedReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedSampledData"] { + if let exist = js["fixedSampledData"] { presentKeys.insert("fixedSampledData") if let val = exist as? FHIRJSON { self.fixedSampledData = SampledData(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedSampledData", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedSignature"] { + if let exist = js["fixedSignature"] { presentKeys.insert("fixedSignature") if let val = exist as? FHIRJSON { self.fixedSignature = Signature(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedSignature", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedSignature", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedString"] { + if let exist = js["fixedString"] { presentKeys.insert("fixedString") if let val = exist as? String { self.fixedString = val } else { - errors.append(FHIRJSONError(key: "fixedString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedTime"] { + if let exist = js["fixedTime"] { presentKeys.insert("fixedTime") if let val = exist as? String { self.fixedTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "fixedTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedTiming"] { + if let exist = js["fixedTiming"] { presentKeys.insert("fixedTiming") if let val = exist as? FHIRJSON { self.fixedTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fixedTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedTiming", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedUnsignedInt"] { + if let exist = js["fixedUnsignedInt"] { presentKeys.insert("fixedUnsignedInt") if let val = exist as? UInt { self.fixedUnsignedInt = val } else { - errors.append(FHIRJSONError(key: "fixedUnsignedInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedUnsignedInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixedUri"] { + if let exist = js["fixedUri"] { presentKeys.insert("fixedUri") if let val = exist as? String { self.fixedUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "fixedUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixedUri", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["isModifier"] { + if let exist = js["isModifier"] { presentKeys.insert("isModifier") if let val = exist as? Bool { self.isModifier = val } else { - errors.append(FHIRJSONError(key: "isModifier", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "isModifier", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["isSummary"] { + if let exist = js["isSummary"] { presentKeys.insert("isSummary") if let val = exist as? Bool { self.isSummary = val } else { - errors.append(FHIRJSONError(key: "isSummary", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "isSummary", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["label"] { + if let exist = js["label"] { presentKeys.insert("label") if let val = exist as? String { self.label = val } else { - errors.append(FHIRJSONError(key: "label", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "label", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["mapping"] { + if let exist = js["mapping"] { presentKeys.insert("mapping") if let val = exist as? [FHIRJSON] { self.mapping = ElementDefinitionMapping.instantiate(fromArray: val, owner: self) as? [ElementDefinitionMapping] } else { - errors.append(FHIRJSONError(key: "mapping", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mapping", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["max"] { + if let exist = js["max"] { presentKeys.insert("max") if let val = exist as? String { self.max = val } else { - errors.append(FHIRJSONError(key: "max", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "max", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxLength"] { + if let exist = js["maxLength"] { presentKeys.insert("maxLength") if let val = exist as? Int { self.maxLength = val } else { - errors.append(FHIRJSONError(key: "maxLength", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxLength", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueAddress"] { + if let exist = js["maxValueAddress"] { presentKeys.insert("maxValueAddress") if let val = exist as? FHIRJSON { self.maxValueAddress = Address(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueAddress", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueAddress", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueAnnotation"] { + if let exist = js["maxValueAnnotation"] { presentKeys.insert("maxValueAnnotation") if let val = exist as? FHIRJSON { self.maxValueAnnotation = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueAnnotation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueAnnotation", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueAttachment"] { + if let exist = js["maxValueAttachment"] { presentKeys.insert("maxValueAttachment") if let val = exist as? FHIRJSON { self.maxValueAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueBase64Binary"] { + if let exist = js["maxValueBase64Binary"] { presentKeys.insert("maxValueBase64Binary") if let val = exist as? String { self.maxValueBase64Binary = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "maxValueBase64Binary", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueBase64Binary", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueBoolean"] { + if let exist = js["maxValueBoolean"] { presentKeys.insert("maxValueBoolean") if let val = exist as? Bool { self.maxValueBoolean = val } else { - errors.append(FHIRJSONError(key: "maxValueBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueCode"] { + if let exist = js["maxValueCode"] { presentKeys.insert("maxValueCode") if let val = exist as? String { self.maxValueCode = val } else { - errors.append(FHIRJSONError(key: "maxValueCode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueCode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueCodeableConcept"] { + if let exist = js["maxValueCodeableConcept"] { presentKeys.insert("maxValueCodeableConcept") if let val = exist as? FHIRJSON { self.maxValueCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueCoding"] { + if let exist = js["maxValueCoding"] { presentKeys.insert("maxValueCoding") if let val = exist as? FHIRJSON { self.maxValueCoding = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueCoding", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueCoding", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueContactPoint"] { + if let exist = js["maxValueContactPoint"] { presentKeys.insert("maxValueContactPoint") if let val = exist as? FHIRJSON { self.maxValueContactPoint = ContactPoint(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueContactPoint", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueContactPoint", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueDate"] { + if let exist = js["maxValueDate"] { presentKeys.insert("maxValueDate") if let val = exist as? String { self.maxValueDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "maxValueDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueDateTime"] { + if let exist = js["maxValueDateTime"] { presentKeys.insert("maxValueDateTime") if let val = exist as? String { self.maxValueDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "maxValueDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueDecimal"] { + if let exist = js["maxValueDecimal"] { presentKeys.insert("maxValueDecimal") if let val = exist as? NSNumber { self.maxValueDecimal = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "maxValueDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueDecimal", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueHumanName"] { + if let exist = js["maxValueHumanName"] { presentKeys.insert("maxValueHumanName") if let val = exist as? FHIRJSON { self.maxValueHumanName = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueHumanName", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueHumanName", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueId"] { + if let exist = js["maxValueId"] { presentKeys.insert("maxValueId") if let val = exist as? String { self.maxValueId = val } else { - errors.append(FHIRJSONError(key: "maxValueId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueIdentifier"] { + if let exist = js["maxValueIdentifier"] { presentKeys.insert("maxValueIdentifier") if let val = exist as? FHIRJSON { self.maxValueIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueInstant"] { + if let exist = js["maxValueInstant"] { presentKeys.insert("maxValueInstant") if let val = exist as? String { self.maxValueInstant = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "maxValueInstant", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueInstant", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueInteger"] { + if let exist = js["maxValueInteger"] { presentKeys.insert("maxValueInteger") if let val = exist as? Int { self.maxValueInteger = val } else { - errors.append(FHIRJSONError(key: "maxValueInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueInteger", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueMarkdown"] { + if let exist = js["maxValueMarkdown"] { presentKeys.insert("maxValueMarkdown") if let val = exist as? String { self.maxValueMarkdown = val } else { - errors.append(FHIRJSONError(key: "maxValueMarkdown", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueMarkdown", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueMeta"] { + if let exist = js["maxValueMeta"] { presentKeys.insert("maxValueMeta") if let val = exist as? FHIRJSON { self.maxValueMeta = Meta(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueMeta", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueMeta", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueOid"] { + if let exist = js["maxValueOid"] { presentKeys.insert("maxValueOid") if let val = exist as? String { self.maxValueOid = val } else { - errors.append(FHIRJSONError(key: "maxValueOid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueOid", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValuePeriod"] { + if let exist = js["maxValuePeriod"] { presentKeys.insert("maxValuePeriod") if let val = exist as? FHIRJSON { self.maxValuePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValuePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValuePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValuePositiveInt"] { + if let exist = js["maxValuePositiveInt"] { presentKeys.insert("maxValuePositiveInt") if let val = exist as? UInt { self.maxValuePositiveInt = val } else { - errors.append(FHIRJSONError(key: "maxValuePositiveInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValuePositiveInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueQuantity"] { + if let exist = js["maxValueQuantity"] { presentKeys.insert("maxValueQuantity") if let val = exist as? FHIRJSON { self.maxValueQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueRange"] { + if let exist = js["maxValueRange"] { presentKeys.insert("maxValueRange") if let val = exist as? FHIRJSON { self.maxValueRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueRatio"] { + if let exist = js["maxValueRatio"] { presentKeys.insert("maxValueRatio") if let val = exist as? FHIRJSON { self.maxValueRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueReference"] { + if let exist = js["maxValueReference"] { presentKeys.insert("maxValueReference") if let val = exist as? FHIRJSON { self.maxValueReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueSampledData"] { + if let exist = js["maxValueSampledData"] { presentKeys.insert("maxValueSampledData") if let val = exist as? FHIRJSON { self.maxValueSampledData = SampledData(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueSampledData", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueSignature"] { + if let exist = js["maxValueSignature"] { presentKeys.insert("maxValueSignature") if let val = exist as? FHIRJSON { self.maxValueSignature = Signature(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueSignature", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueSignature", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueString"] { + if let exist = js["maxValueString"] { presentKeys.insert("maxValueString") if let val = exist as? String { self.maxValueString = val } else { - errors.append(FHIRJSONError(key: "maxValueString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueTime"] { + if let exist = js["maxValueTime"] { presentKeys.insert("maxValueTime") if let val = exist as? String { self.maxValueTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "maxValueTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueTiming"] { + if let exist = js["maxValueTiming"] { presentKeys.insert("maxValueTiming") if let val = exist as? FHIRJSON { self.maxValueTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxValueTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueTiming", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueUnsignedInt"] { + if let exist = js["maxValueUnsignedInt"] { presentKeys.insert("maxValueUnsignedInt") if let val = exist as? UInt { self.maxValueUnsignedInt = val } else { - errors.append(FHIRJSONError(key: "maxValueUnsignedInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueUnsignedInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxValueUri"] { + if let exist = js["maxValueUri"] { presentKeys.insert("maxValueUri") if let val = exist as? String { self.maxValueUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "maxValueUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxValueUri", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["meaningWhenMissing"] { + if let exist = js["meaningWhenMissing"] { presentKeys.insert("meaningWhenMissing") if let val = exist as? String { self.meaningWhenMissing = val } else { - errors.append(FHIRJSONError(key: "meaningWhenMissing", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "meaningWhenMissing", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["min"] { + if let exist = js["min"] { presentKeys.insert("min") if let val = exist as? Int { self.min = val } else { - errors.append(FHIRJSONError(key: "min", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "min", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueAddress"] { + if let exist = js["minValueAddress"] { presentKeys.insert("minValueAddress") if let val = exist as? FHIRJSON { self.minValueAddress = Address(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueAddress", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueAddress", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueAnnotation"] { + if let exist = js["minValueAnnotation"] { presentKeys.insert("minValueAnnotation") if let val = exist as? FHIRJSON { self.minValueAnnotation = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueAnnotation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueAnnotation", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueAttachment"] { + if let exist = js["minValueAttachment"] { presentKeys.insert("minValueAttachment") if let val = exist as? FHIRJSON { self.minValueAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueBase64Binary"] { + if let exist = js["minValueBase64Binary"] { presentKeys.insert("minValueBase64Binary") if let val = exist as? String { self.minValueBase64Binary = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "minValueBase64Binary", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueBase64Binary", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueBoolean"] { + if let exist = js["minValueBoolean"] { presentKeys.insert("minValueBoolean") if let val = exist as? Bool { self.minValueBoolean = val } else { - errors.append(FHIRJSONError(key: "minValueBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueCode"] { + if let exist = js["minValueCode"] { presentKeys.insert("minValueCode") if let val = exist as? String { self.minValueCode = val } else { - errors.append(FHIRJSONError(key: "minValueCode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueCode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueCodeableConcept"] { + if let exist = js["minValueCodeableConcept"] { presentKeys.insert("minValueCodeableConcept") if let val = exist as? FHIRJSON { self.minValueCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueCoding"] { + if let exist = js["minValueCoding"] { presentKeys.insert("minValueCoding") if let val = exist as? FHIRJSON { self.minValueCoding = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueCoding", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueCoding", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueContactPoint"] { + if let exist = js["minValueContactPoint"] { presentKeys.insert("minValueContactPoint") if let val = exist as? FHIRJSON { self.minValueContactPoint = ContactPoint(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueContactPoint", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueContactPoint", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueDate"] { + if let exist = js["minValueDate"] { presentKeys.insert("minValueDate") if let val = exist as? String { self.minValueDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "minValueDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueDateTime"] { + if let exist = js["minValueDateTime"] { presentKeys.insert("minValueDateTime") if let val = exist as? String { self.minValueDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "minValueDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueDecimal"] { + if let exist = js["minValueDecimal"] { presentKeys.insert("minValueDecimal") if let val = exist as? NSNumber { self.minValueDecimal = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "minValueDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueDecimal", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueHumanName"] { + if let exist = js["minValueHumanName"] { presentKeys.insert("minValueHumanName") if let val = exist as? FHIRJSON { self.minValueHumanName = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueHumanName", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueHumanName", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueId"] { + if let exist = js["minValueId"] { presentKeys.insert("minValueId") if let val = exist as? String { self.minValueId = val } else { - errors.append(FHIRJSONError(key: "minValueId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueIdentifier"] { + if let exist = js["minValueIdentifier"] { presentKeys.insert("minValueIdentifier") if let val = exist as? FHIRJSON { self.minValueIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueInstant"] { + if let exist = js["minValueInstant"] { presentKeys.insert("minValueInstant") if let val = exist as? String { self.minValueInstant = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "minValueInstant", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueInstant", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueInteger"] { + if let exist = js["minValueInteger"] { presentKeys.insert("minValueInteger") if let val = exist as? Int { self.minValueInteger = val } else { - errors.append(FHIRJSONError(key: "minValueInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueInteger", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueMarkdown"] { + if let exist = js["minValueMarkdown"] { presentKeys.insert("minValueMarkdown") if let val = exist as? String { self.minValueMarkdown = val } else { - errors.append(FHIRJSONError(key: "minValueMarkdown", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueMarkdown", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueMeta"] { + if let exist = js["minValueMeta"] { presentKeys.insert("minValueMeta") if let val = exist as? FHIRJSON { self.minValueMeta = Meta(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueMeta", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueMeta", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueOid"] { + if let exist = js["minValueOid"] { presentKeys.insert("minValueOid") if let val = exist as? String { self.minValueOid = val } else { - errors.append(FHIRJSONError(key: "minValueOid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueOid", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValuePeriod"] { + if let exist = js["minValuePeriod"] { presentKeys.insert("minValuePeriod") if let val = exist as? FHIRJSON { self.minValuePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValuePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValuePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValuePositiveInt"] { + if let exist = js["minValuePositiveInt"] { presentKeys.insert("minValuePositiveInt") if let val = exist as? UInt { self.minValuePositiveInt = val } else { - errors.append(FHIRJSONError(key: "minValuePositiveInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValuePositiveInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueQuantity"] { + if let exist = js["minValueQuantity"] { presentKeys.insert("minValueQuantity") if let val = exist as? FHIRJSON { self.minValueQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueRange"] { + if let exist = js["minValueRange"] { presentKeys.insert("minValueRange") if let val = exist as? FHIRJSON { self.minValueRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueRatio"] { + if let exist = js["minValueRatio"] { presentKeys.insert("minValueRatio") if let val = exist as? FHIRJSON { self.minValueRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueReference"] { + if let exist = js["minValueReference"] { presentKeys.insert("minValueReference") if let val = exist as? FHIRJSON { self.minValueReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueSampledData"] { + if let exist = js["minValueSampledData"] { presentKeys.insert("minValueSampledData") if let val = exist as? FHIRJSON { self.minValueSampledData = SampledData(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueSampledData", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueSignature"] { + if let exist = js["minValueSignature"] { presentKeys.insert("minValueSignature") if let val = exist as? FHIRJSON { self.minValueSignature = Signature(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueSignature", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueSignature", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueString"] { + if let exist = js["minValueString"] { presentKeys.insert("minValueString") if let val = exist as? String { self.minValueString = val } else { - errors.append(FHIRJSONError(key: "minValueString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueTime"] { + if let exist = js["minValueTime"] { presentKeys.insert("minValueTime") if let val = exist as? String { self.minValueTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "minValueTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueTiming"] { + if let exist = js["minValueTiming"] { presentKeys.insert("minValueTiming") if let val = exist as? FHIRJSON { self.minValueTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "minValueTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueTiming", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueUnsignedInt"] { + if let exist = js["minValueUnsignedInt"] { presentKeys.insert("minValueUnsignedInt") if let val = exist as? UInt { self.minValueUnsignedInt = val } else { - errors.append(FHIRJSONError(key: "minValueUnsignedInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueUnsignedInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minValueUri"] { + if let exist = js["minValueUri"] { presentKeys.insert("minValueUri") if let val = exist as? String { self.minValueUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "minValueUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minValueUri", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["mustSupport"] { + if let exist = js["mustSupport"] { presentKeys.insert("mustSupport") if let val = exist as? Bool { self.mustSupport = val } else { - errors.append(FHIRJSONError(key: "mustSupport", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mustSupport", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["nameReference"] { + if let exist = js["nameReference"] { presentKeys.insert("nameReference") if let val = exist as? String { self.nameReference = val } else { - errors.append(FHIRJSONError(key: "nameReference", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "nameReference", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["path"] { + if let exist = js["path"] { presentKeys.insert("path") if let val = exist as? String { self.path = val } else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "path", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "path")) } - if let exist: AnyObject = js["patternAddress"] { + if let exist = js["patternAddress"] { presentKeys.insert("patternAddress") if let val = exist as? FHIRJSON { self.patternAddress = Address(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternAddress", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternAddress", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternAnnotation"] { + if let exist = js["patternAnnotation"] { presentKeys.insert("patternAnnotation") if let val = exist as? FHIRJSON { self.patternAnnotation = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternAnnotation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternAnnotation", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternAttachment"] { + if let exist = js["patternAttachment"] { presentKeys.insert("patternAttachment") if let val = exist as? FHIRJSON { self.patternAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternBase64Binary"] { + if let exist = js["patternBase64Binary"] { presentKeys.insert("patternBase64Binary") if let val = exist as? String { self.patternBase64Binary = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "patternBase64Binary", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternBase64Binary", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternBoolean"] { + if let exist = js["patternBoolean"] { presentKeys.insert("patternBoolean") if let val = exist as? Bool { self.patternBoolean = val } else { - errors.append(FHIRJSONError(key: "patternBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternCode"] { + if let exist = js["patternCode"] { presentKeys.insert("patternCode") if let val = exist as? String { self.patternCode = val } else { - errors.append(FHIRJSONError(key: "patternCode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternCode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternCodeableConcept"] { + if let exist = js["patternCodeableConcept"] { presentKeys.insert("patternCodeableConcept") if let val = exist as? FHIRJSON { self.patternCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternCoding"] { + if let exist = js["patternCoding"] { presentKeys.insert("patternCoding") if let val = exist as? FHIRJSON { self.patternCoding = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternCoding", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternCoding", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternContactPoint"] { + if let exist = js["patternContactPoint"] { presentKeys.insert("patternContactPoint") if let val = exist as? FHIRJSON { self.patternContactPoint = ContactPoint(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternContactPoint", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternContactPoint", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternDate"] { + if let exist = js["patternDate"] { presentKeys.insert("patternDate") if let val = exist as? String { self.patternDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "patternDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternDateTime"] { + if let exist = js["patternDateTime"] { presentKeys.insert("patternDateTime") if let val = exist as? String { self.patternDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "patternDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternDecimal"] { + if let exist = js["patternDecimal"] { presentKeys.insert("patternDecimal") if let val = exist as? NSNumber { self.patternDecimal = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "patternDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternDecimal", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternHumanName"] { + if let exist = js["patternHumanName"] { presentKeys.insert("patternHumanName") if let val = exist as? FHIRJSON { self.patternHumanName = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternHumanName", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternHumanName", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternId"] { + if let exist = js["patternId"] { presentKeys.insert("patternId") if let val = exist as? String { self.patternId = val } else { - errors.append(FHIRJSONError(key: "patternId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternIdentifier"] { + if let exist = js["patternIdentifier"] { presentKeys.insert("patternIdentifier") if let val = exist as? FHIRJSON { self.patternIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternInstant"] { + if let exist = js["patternInstant"] { presentKeys.insert("patternInstant") if let val = exist as? String { self.patternInstant = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "patternInstant", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternInstant", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternInteger"] { + if let exist = js["patternInteger"] { presentKeys.insert("patternInteger") if let val = exist as? Int { self.patternInteger = val } else { - errors.append(FHIRJSONError(key: "patternInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternInteger", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternMarkdown"] { + if let exist = js["patternMarkdown"] { presentKeys.insert("patternMarkdown") if let val = exist as? String { self.patternMarkdown = val } else { - errors.append(FHIRJSONError(key: "patternMarkdown", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternMarkdown", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternMeta"] { + if let exist = js["patternMeta"] { presentKeys.insert("patternMeta") if let val = exist as? FHIRJSON { self.patternMeta = Meta(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternMeta", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternMeta", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternOid"] { + if let exist = js["patternOid"] { presentKeys.insert("patternOid") if let val = exist as? String { self.patternOid = val } else { - errors.append(FHIRJSONError(key: "patternOid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternOid", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternPeriod"] { + if let exist = js["patternPeriod"] { presentKeys.insert("patternPeriod") if let val = exist as? FHIRJSON { self.patternPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternPositiveInt"] { + if let exist = js["patternPositiveInt"] { presentKeys.insert("patternPositiveInt") if let val = exist as? UInt { self.patternPositiveInt = val } else { - errors.append(FHIRJSONError(key: "patternPositiveInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternPositiveInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternQuantity"] { + if let exist = js["patternQuantity"] { presentKeys.insert("patternQuantity") if let val = exist as? FHIRJSON { self.patternQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternRange"] { + if let exist = js["patternRange"] { presentKeys.insert("patternRange") if let val = exist as? FHIRJSON { self.patternRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternRatio"] { + if let exist = js["patternRatio"] { presentKeys.insert("patternRatio") if let val = exist as? FHIRJSON { self.patternRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternReference"] { + if let exist = js["patternReference"] { presentKeys.insert("patternReference") if let val = exist as? FHIRJSON { self.patternReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternSampledData"] { + if let exist = js["patternSampledData"] { presentKeys.insert("patternSampledData") if let val = exist as? FHIRJSON { self.patternSampledData = SampledData(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternSampledData", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternSignature"] { + if let exist = js["patternSignature"] { presentKeys.insert("patternSignature") if let val = exist as? FHIRJSON { self.patternSignature = Signature(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternSignature", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternSignature", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternString"] { + if let exist = js["patternString"] { presentKeys.insert("patternString") if let val = exist as? String { self.patternString = val } else { - errors.append(FHIRJSONError(key: "patternString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternTime"] { + if let exist = js["patternTime"] { presentKeys.insert("patternTime") if let val = exist as? String { self.patternTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "patternTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternTiming"] { + if let exist = js["patternTiming"] { presentKeys.insert("patternTiming") if let val = exist as? FHIRJSON { self.patternTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patternTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternTiming", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternUnsignedInt"] { + if let exist = js["patternUnsignedInt"] { presentKeys.insert("patternUnsignedInt") if let val = exist as? UInt { self.patternUnsignedInt = val } else { - errors.append(FHIRJSONError(key: "patternUnsignedInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternUnsignedInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patternUri"] { + if let exist = js["patternUri"] { presentKeys.insert("patternUri") if let val = exist as? String { self.patternUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "patternUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patternUri", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["representation"] { + if let exist = js["representation"] { presentKeys.insert("representation") if let val = exist as? [String] { self.representation = val } else { - errors.append(FHIRJSONError(key: "representation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "representation", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requirements"] { + if let exist = js["requirements"] { presentKeys.insert("requirements") if let val = exist as? String { self.requirements = val } else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["short"] { + if let exist = js["short"] { presentKeys.insert("short") if let val = exist as? String { self.short = val } else { - errors.append(FHIRJSONError(key: "short", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "short", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["slicing"] { + if let exist = js["slicing"] { presentKeys.insert("slicing") if let val = exist as? FHIRJSON { self.slicing = ElementDefinitionSlicing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "slicing", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "slicing", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? [FHIRJSON] { self.type = ElementDefinitionType.instantiate(fromArray: val, owner: self) as? [ElementDefinitionType] } else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: type(of: exist))) } } } @@ -2721,7 +2721,7 @@ public class ElementDefinition: Element { var json = super.asJSON() if let alias = self.alias { - var arr = [AnyObject]() + var arr = [Any]() for val in alias { arr.append(val.asJSON()) } @@ -2740,7 +2740,7 @@ public class ElementDefinition: Element { json["comments"] = comments.asJSON() } if let condition = self.condition { - var arr = [AnyObject]() + var arr = [Any]() for val in condition { arr.append(val.asJSON()) } @@ -3383,7 +3383,7 @@ public class ElementDefinition: Element { json["patternUri"] = patternUri.asJSON() } if let representation = self.representation { - var arr = [AnyObject]() + var arr = [Any]() for val in representation { arr.append(val.asJSON()) } @@ -3416,7 +3416,7 @@ public class ElementDefinition: Element { * element definition. */ public class ElementDefinitionBase: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ElementDefinitionBase" } } @@ -3443,40 +3443,40 @@ public class ElementDefinitionBase: Element { self.path = path } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["max"] { + if let exist = js["max"] { presentKeys.insert("max") if let val = exist as? String { self.max = val } else { - errors.append(FHIRJSONError(key: "max", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "max", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "max")) } - if let exist: AnyObject = js["min"] { + if let exist = js["min"] { presentKeys.insert("min") if let val = exist as? Int { self.min = val } else { - errors.append(FHIRJSONError(key: "min", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "min", wants: Int.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "min")) } - if let exist: AnyObject = js["path"] { + if let exist = js["path"] { presentKeys.insert("path") if let val = exist as? String { self.path = val } else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "path", wants: String.self, has: type(of: exist))) } } else { @@ -3510,7 +3510,7 @@ public class ElementDefinitionBase: Element { * Binds to a value set if this element is coded (code, Coding, CodeableConcept). */ public class ElementDefinitionBinding: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ElementDefinitionBinding" } } @@ -3538,46 +3538,46 @@ public class ElementDefinitionBinding: Element { self.strength = strength } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["strength"] { + if let exist = js["strength"] { presentKeys.insert("strength") if let val = exist as? String { self.strength = val } else { - errors.append(FHIRJSONError(key: "strength", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "strength", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "strength")) } - if let exist: AnyObject = js["valueSetReference"] { + if let exist = js["valueSetReference"] { presentKeys.insert("valueSetReference") if let val = exist as? FHIRJSON { self.valueSetReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueSetReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueSetReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueSetUri"] { + if let exist = js["valueSetUri"] { presentKeys.insert("valueSetUri") if let val = exist as? String { self.valueSetUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "valueSetUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueSetUri", wants: String.self, has: type(of: exist))) } } } @@ -3612,7 +3612,7 @@ public class ElementDefinitionBinding: Element { * context of the instance. */ public class ElementDefinitionConstraint: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ElementDefinitionConstraint" } } @@ -3646,61 +3646,61 @@ public class ElementDefinitionConstraint: Element { self.xpath = xpath } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["human"] { + if let exist = js["human"] { presentKeys.insert("human") if let val = exist as? String { self.human = val } else { - errors.append(FHIRJSONError(key: "human", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "human", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "human")) } - if let exist: AnyObject = js["key"] { + if let exist = js["key"] { presentKeys.insert("key") if let val = exist as? String { self.key = val } else { - errors.append(FHIRJSONError(key: "key", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "key", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "key")) } - if let exist: AnyObject = js["requirements"] { + if let exist = js["requirements"] { presentKeys.insert("requirements") if let val = exist as? String { self.requirements = val } else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["severity"] { + if let exist = js["severity"] { presentKeys.insert("severity") if let val = exist as? String { self.severity = val } else { - errors.append(FHIRJSONError(key: "severity", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "severity", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "severity")) } - if let exist: AnyObject = js["xpath"] { + if let exist = js["xpath"] { presentKeys.insert("xpath") if let val = exist as? String { self.xpath = val } else { - errors.append(FHIRJSONError(key: "xpath", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "xpath", wants: String.self, has: type(of: exist))) } } else { @@ -3740,7 +3740,7 @@ public class ElementDefinitionConstraint: Element { * Identifies a concept from an external specification that roughly corresponds to this element. */ public class ElementDefinitionMapping: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ElementDefinitionMapping" } } @@ -3766,37 +3766,37 @@ public class ElementDefinitionMapping: Element { self.map = map } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["identity"] { + if let exist = js["identity"] { presentKeys.insert("identity") if let val = exist as? String { self.identity = val } else { - errors.append(FHIRJSONError(key: "identity", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identity", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "identity")) } - if let exist: AnyObject = js["language"] { + if let exist = js["language"] { presentKeys.insert("language") if let val = exist as? String { self.language = val } else { - errors.append(FHIRJSONError(key: "language", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "language", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["map"] { + if let exist = js["map"] { presentKeys.insert("map") if let val = exist as? String { self.map = val } else { - errors.append(FHIRJSONError(key: "map", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "map", wants: String.self, has: type(of: exist))) } } else { @@ -3834,7 +3834,7 @@ public class ElementDefinitionMapping: Element { * shorter path terminates the set). */ public class ElementDefinitionSlicing: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ElementDefinitionSlicing" } } @@ -3862,43 +3862,43 @@ public class ElementDefinitionSlicing: Element { self.rules = rules } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["discriminator"] { + if let exist = js["discriminator"] { presentKeys.insert("discriminator") if let val = exist as? [String] { self.discriminator = val } else { - errors.append(FHIRJSONError(key: "discriminator", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "discriminator", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ordered"] { + if let exist = js["ordered"] { presentKeys.insert("ordered") if let val = exist as? Bool { self.ordered = val } else { - errors.append(FHIRJSONError(key: "ordered", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ordered", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rules"] { + if let exist = js["rules"] { presentKeys.insert("rules") if let val = exist as? String { self.rules = val } else { - errors.append(FHIRJSONError(key: "rules", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rules", wants: String.self, has: type(of: exist))) } } else { @@ -3915,7 +3915,7 @@ public class ElementDefinitionSlicing: Element { json["description"] = description_fhir.asJSON() } if let discriminator = self.discriminator { - var arr = [AnyObject]() + var arr = [Any]() for val in discriminator { arr.append(val.asJSON()) } @@ -3939,7 +3939,7 @@ public class ElementDefinitionSlicing: Element { * The data type or resource that the value of this element is permitted to be. */ public class ElementDefinitionType: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ElementDefinitionType" } } @@ -3964,37 +3964,37 @@ public class ElementDefinitionType: Element { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["aggregation"] { + if let exist = js["aggregation"] { presentKeys.insert("aggregation") if let val = exist as? [String] { self.aggregation = val } else { - errors.append(FHIRJSONError(key: "aggregation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "aggregation", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["profile"] { + if let exist = js["profile"] { presentKeys.insert("profile") if let val = exist as? [String] { self.profile = URL.instantiate(fromArray: val) } else { - errors.append(FHIRJSONError(key: "profile", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "profile", wants: Array.self, has: type(of: exist))) } } } @@ -4005,7 +4005,7 @@ public class ElementDefinitionType: Element { var json = super.asJSON() if let aggregation = self.aggregation { - var arr = [AnyObject]() + var arr = [Any]() for val in aggregation { arr.append(val.asJSON()) } @@ -4015,7 +4015,7 @@ public class ElementDefinitionType: Element { json["code"] = code.asJSON() } if let profile = self.profile { - var arr = [AnyObject]() + var arr = [Any]() for val in profile { arr.append(val.asJSON()) } diff --git a/Sources/Models/EligibilityRequest.swift b/Sources/Models/EligibilityRequest.swift index ab3953d2..4cc157f4 100644 --- a/Sources/Models/EligibilityRequest.swift +++ b/Sources/Models/EligibilityRequest.swift @@ -2,7 +2,7 @@ // EligibilityRequest.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EligibilityRequest) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EligibilityRequest) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * optionally some class of service. */ public class EligibilityRequest: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "EligibilityRequest" } } @@ -47,70 +47,70 @@ public class EligibilityRequest: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["provider"] { + if let exist = js["provider"] { presentKeys.insert("provider") if let val = exist as? FHIRJSON { self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ruleset"] { + if let exist = js["ruleset"] { presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? FHIRJSON { self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/EligibilityResponse.swift b/Sources/Models/EligibilityResponse.swift index fbc12fe4..460b07b5 100644 --- a/Sources/Models/EligibilityResponse.swift +++ b/Sources/Models/EligibilityResponse.swift @@ -2,7 +2,7 @@ // EligibilityResponse.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EligibilityResponse) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EligibilityResponse) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * This resource provides eligibility and plan details from the processing of an Eligibility resource. */ public class EligibilityResponse: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "EligibilityResponse" } } @@ -55,97 +55,97 @@ public class EligibilityResponse: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["disposition"] { + if let exist = js["disposition"] { presentKeys.insert("disposition") if let val = exist as? String { self.disposition = val } else { - errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["outcome"] { + if let exist = js["outcome"] { presentKeys.insert("outcome") if let val = exist as? String { self.outcome = val } else { - errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestOrganization"] { + if let exist = js["requestOrganization"] { presentKeys.insert("requestOrganization") if let val = exist as? FHIRJSON { self.requestOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestProvider"] { + if let exist = js["requestProvider"] { presentKeys.insert("requestProvider") if let val = exist as? FHIRJSON { self.requestProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ruleset"] { + if let exist = js["ruleset"] { presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Encounter.swift b/Sources/Models/Encounter.swift index cd2798d6..1ef5b7f4 100644 --- a/Sources/Models/Encounter.swift +++ b/Sources/Models/Encounter.swift @@ -2,7 +2,7 @@ // Encounter.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Encounter) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Encounter) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * assessing the health status of a patient. */ public class Encounter: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Encounter" } } @@ -89,181 +89,181 @@ public class Encounter: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["appointment"] { + if let exist = js["appointment"] { presentKeys.insert("appointment") if let val = exist as? FHIRJSON { self.appointment = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "appointment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "appointment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["class"] { + if let exist = js["class"] { presentKeys.insert("class") if let val = exist as? String { self.class_fhir = val } else { - errors.append(FHIRJSONError(key: "class", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "class", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["episodeOfCare"] { + if let exist = js["episodeOfCare"] { presentKeys.insert("episodeOfCare") if let val = exist as? [FHIRJSON] { self.episodeOfCare = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "episodeOfCare", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "episodeOfCare", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["hospitalization"] { + if let exist = js["hospitalization"] { presentKeys.insert("hospitalization") if let val = exist as? FHIRJSON { self.hospitalization = EncounterHospitalization(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "hospitalization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "hospitalization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["incomingReferral"] { + if let exist = js["incomingReferral"] { presentKeys.insert("incomingReferral") if let val = exist as? [FHIRJSON] { self.incomingReferral = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "incomingReferral", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "incomingReferral", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["indication"] { + if let exist = js["indication"] { presentKeys.insert("indication") if let val = exist as? [FHIRJSON] { self.indication = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "indication", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "indication", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["length"] { + if let exist = js["length"] { presentKeys.insert("length") if let val = exist as? FHIRJSON { self.length = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "length", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "length", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? [FHIRJSON] { self.location = EncounterLocation.instantiate(fromArray: val, owner: self) as? [EncounterLocation] } else { - errors.append(FHIRJSONError(key: "location", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["partOf"] { + if let exist = js["partOf"] { presentKeys.insert("partOf") if let val = exist as? FHIRJSON { self.partOf = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "partOf", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "partOf", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["participant"] { + if let exist = js["participant"] { presentKeys.insert("participant") if let val = exist as? [FHIRJSON] { self.participant = EncounterParticipant.instantiate(fromArray: val, owner: self) as? [EncounterParticipant] } else { - errors.append(FHIRJSONError(key: "participant", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "participant", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["priority"] { + if let exist = js["priority"] { presentKeys.insert("priority") if let val = exist as? FHIRJSON { self.priority = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? [FHIRJSON] { self.reason = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["serviceProvider"] { + if let exist = js["serviceProvider"] { presentKeys.insert("serviceProvider") if let val = exist as? FHIRJSON { self.serviceProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "serviceProvider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "serviceProvider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["statusHistory"] { + if let exist = js["statusHistory"] { presentKeys.insert("statusHistory") if let val = exist as? [FHIRJSON] { self.statusHistory = EncounterStatusHistory.instantiate(fromArray: val, owner: self) as? [EncounterStatusHistory] } else { - errors.append(FHIRJSONError(key: "statusHistory", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "statusHistory", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? [FHIRJSON] { self.type = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: type(of: exist))) } } } @@ -340,7 +340,7 @@ public class Encounter: DomainResource { * Details about the admission to a healthcare service. */ public class EncounterHospitalization: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "EncounterHospitalization" } } @@ -383,106 +383,106 @@ public class EncounterHospitalization: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["admitSource"] { + if let exist = js["admitSource"] { presentKeys.insert("admitSource") if let val = exist as? FHIRJSON { self.admitSource = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "admitSource", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "admitSource", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["admittingDiagnosis"] { + if let exist = js["admittingDiagnosis"] { presentKeys.insert("admittingDiagnosis") if let val = exist as? [FHIRJSON] { self.admittingDiagnosis = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "admittingDiagnosis", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "admittingDiagnosis", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["destination"] { + if let exist = js["destination"] { presentKeys.insert("destination") if let val = exist as? FHIRJSON { self.destination = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "destination", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "destination", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dietPreference"] { + if let exist = js["dietPreference"] { presentKeys.insert("dietPreference") if let val = exist as? [FHIRJSON] { self.dietPreference = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "dietPreference", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dietPreference", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dischargeDiagnosis"] { + if let exist = js["dischargeDiagnosis"] { presentKeys.insert("dischargeDiagnosis") if let val = exist as? [FHIRJSON] { self.dischargeDiagnosis = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "dischargeDiagnosis", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dischargeDiagnosis", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dischargeDisposition"] { + if let exist = js["dischargeDisposition"] { presentKeys.insert("dischargeDisposition") if let val = exist as? FHIRJSON { self.dischargeDisposition = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "dischargeDisposition", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dischargeDisposition", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["origin"] { + if let exist = js["origin"] { presentKeys.insert("origin") if let val = exist as? FHIRJSON { self.origin = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "origin", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "origin", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["preAdmissionIdentifier"] { + if let exist = js["preAdmissionIdentifier"] { presentKeys.insert("preAdmissionIdentifier") if let val = exist as? FHIRJSON { self.preAdmissionIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "preAdmissionIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "preAdmissionIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reAdmission"] { + if let exist = js["reAdmission"] { presentKeys.insert("reAdmission") if let val = exist as? FHIRJSON { self.reAdmission = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reAdmission", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reAdmission", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["specialArrangement"] { + if let exist = js["specialArrangement"] { presentKeys.insert("specialArrangement") if let val = exist as? [FHIRJSON] { self.specialArrangement = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "specialArrangement", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "specialArrangement", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["specialCourtesy"] { + if let exist = js["specialCourtesy"] { presentKeys.insert("specialCourtesy") if let val = exist as? [FHIRJSON] { self.specialCourtesy = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "specialCourtesy", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "specialCourtesy", wants: Array.self, has: type(of: exist))) } } } @@ -537,7 +537,7 @@ public class EncounterHospitalization: BackboneElement { * List of locations where the patient has been during this encounter. */ public class EncounterLocation: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "EncounterLocation" } } @@ -562,37 +562,37 @@ public class EncounterLocation: BackboneElement { self.location = location } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? FHIRJSON { self.location = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "location")) } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } } @@ -623,7 +623,7 @@ public class EncounterLocation: BackboneElement { * The list of people responsible for providing the service. */ public class EncounterParticipant: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "EncounterParticipant" } } @@ -642,34 +642,34 @@ public class EncounterParticipant: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["individual"] { + if let exist = js["individual"] { presentKeys.insert("individual") if let val = exist as? FHIRJSON { self.individual = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "individual", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "individual", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? [FHIRJSON] { self.type = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: type(of: exist))) } } } @@ -701,7 +701,7 @@ public class EncounterParticipant: BackboneElement { * historical versions of the resource, or even have the server store them. */ public class EncounterStatusHistory: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "EncounterStatusHistory" } } @@ -724,28 +724,28 @@ public class EncounterStatusHistory: BackboneElement { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "period")) } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/EnrollmentRequest.swift b/Sources/Models/EnrollmentRequest.swift index 60c25737..a59e9d32 100644 --- a/Sources/Models/EnrollmentRequest.swift +++ b/Sources/Models/EnrollmentRequest.swift @@ -2,7 +2,7 @@ // EnrollmentRequest.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EnrollmentRequest) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * This resource provides the insurance enrollment details to the insurer regarding a specified coverage. */ public class EnrollmentRequest: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "EnrollmentRequest" } } @@ -63,106 +63,106 @@ public class EnrollmentRequest: DomainResource { self.subject = subject } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["coverage"] { + if let exist = js["coverage"] { presentKeys.insert("coverage") if let val = exist as? FHIRJSON { self.coverage = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "coverage", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "coverage", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "coverage")) } - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["provider"] { + if let exist = js["provider"] { presentKeys.insert("provider") if let val = exist as? FHIRJSON { self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["relationship"] { + if let exist = js["relationship"] { presentKeys.insert("relationship") if let val = exist as? FHIRJSON { self.relationship = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "relationship")) } - if let exist: AnyObject = js["ruleset"] { + if let exist = js["ruleset"] { presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "subject")) } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? FHIRJSON { self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/EnrollmentResponse.swift b/Sources/Models/EnrollmentResponse.swift index ec0be5e0..e1803ca0 100644 --- a/Sources/Models/EnrollmentResponse.swift +++ b/Sources/Models/EnrollmentResponse.swift @@ -2,7 +2,7 @@ // EnrollmentResponse.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EnrollmentResponse) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * This resource provides enrollment and plan details from the processing of an Enrollment resource. */ public class EnrollmentResponse: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "EnrollmentResponse" } } @@ -55,97 +55,97 @@ public class EnrollmentResponse: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["disposition"] { + if let exist = js["disposition"] { presentKeys.insert("disposition") if let val = exist as? String { self.disposition = val } else { - errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["outcome"] { + if let exist = js["outcome"] { presentKeys.insert("outcome") if let val = exist as? String { self.outcome = val } else { - errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestOrganization"] { + if let exist = js["requestOrganization"] { presentKeys.insert("requestOrganization") if let val = exist as? FHIRJSON { self.requestOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestProvider"] { + if let exist = js["requestProvider"] { presentKeys.insert("requestProvider") if let val = exist as? FHIRJSON { self.requestProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ruleset"] { + if let exist = js["ruleset"] { presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/EpisodeOfCare.swift b/Sources/Models/EpisodeOfCare.swift index baf1d708..82a0fba6 100644 --- a/Sources/Models/EpisodeOfCare.swift +++ b/Sources/Models/EpisodeOfCare.swift @@ -2,7 +2,7 @@ // EpisodeOfCare.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/EpisodeOfCare) on 2016-09-16. // 2016, SMART Health IT. // @@ -17,7 +17,7 @@ import Foundation * occur. The managing organization assumes a level of responsibility for the patient during this time. */ public class EpisodeOfCare: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "EpisodeOfCare" } } @@ -67,112 +67,112 @@ public class EpisodeOfCare: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["careManager"] { + if let exist = js["careManager"] { presentKeys.insert("careManager") if let val = exist as? FHIRJSON { self.careManager = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "careManager", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "careManager", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["careTeam"] { + if let exist = js["careTeam"] { presentKeys.insert("careTeam") if let val = exist as? [FHIRJSON] { self.careTeam = EpisodeOfCareCareTeam.instantiate(fromArray: val, owner: self) as? [EpisodeOfCareCareTeam] } else { - errors.append(FHIRJSONError(key: "careTeam", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "careTeam", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["condition"] { + if let exist = js["condition"] { presentKeys.insert("condition") if let val = exist as? [FHIRJSON] { self.condition = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "condition", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "condition", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["managingOrganization"] { + if let exist = js["managingOrganization"] { presentKeys.insert("managingOrganization") if let val = exist as? FHIRJSON { self.managingOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["referralRequest"] { + if let exist = js["referralRequest"] { presentKeys.insert("referralRequest") if let val = exist as? [FHIRJSON] { self.referralRequest = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "referralRequest", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "referralRequest", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["statusHistory"] { + if let exist = js["statusHistory"] { presentKeys.insert("statusHistory") if let val = exist as? [FHIRJSON] { self.statusHistory = EpisodeOfCareStatusHistory.instantiate(fromArray: val, owner: self) as? [EpisodeOfCareStatusHistory] } else { - errors.append(FHIRJSONError(key: "statusHistory", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "statusHistory", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? [FHIRJSON] { self.type = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: type(of: exist))) } } } @@ -227,7 +227,7 @@ public class EpisodeOfCare: DomainResource { * The list of practitioners that may be facilitating this episode of care for specific purposes. */ public class EpisodeOfCareCareTeam: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "EpisodeOfCareCareTeam" } } @@ -246,34 +246,34 @@ public class EpisodeOfCareCareTeam: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["member"] { + if let exist = js["member"] { presentKeys.insert("member") if let val = exist as? FHIRJSON { self.member = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "member", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "member", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["role"] { + if let exist = js["role"] { presentKeys.insert("role") if let val = exist as? [FHIRJSON] { self.role = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "role", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "role", wants: Array.self, has: type(of: exist))) } } } @@ -305,7 +305,7 @@ public class EpisodeOfCareCareTeam: BackboneElement { * resource). */ public class EpisodeOfCareStatusHistory: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "EpisodeOfCareStatusHistory" } } @@ -328,28 +328,28 @@ public class EpisodeOfCareStatusHistory: BackboneElement { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "period")) } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/ExplanationOfBenefit.swift b/Sources/Models/ExplanationOfBenefit.swift index d20477e7..7bd13ab7 100644 --- a/Sources/Models/ExplanationOfBenefit.swift +++ b/Sources/Models/ExplanationOfBenefit.swift @@ -2,7 +2,7 @@ // ExplanationOfBenefit.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ExplanationOfBenefit) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * account balance information, for informing the subscriber of the benefits provided. */ public class ExplanationOfBenefit: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ExplanationOfBenefit" } } @@ -56,97 +56,97 @@ public class ExplanationOfBenefit: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["disposition"] { + if let exist = js["disposition"] { presentKeys.insert("disposition") if let val = exist as? String { self.disposition = val } else { - errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["outcome"] { + if let exist = js["outcome"] { presentKeys.insert("outcome") if let val = exist as? String { self.outcome = val } else { - errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestOrganization"] { + if let exist = js["requestOrganization"] { presentKeys.insert("requestOrganization") if let val = exist as? FHIRJSON { self.requestOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestProvider"] { + if let exist = js["requestProvider"] { presentKeys.insert("requestProvider") if let val = exist as? FHIRJSON { self.requestProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ruleset"] { + if let exist = js["ruleset"] { presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Extension.swift b/Sources/Models/Extension.swift index 740ef3f8..686da47d 100644 --- a/Sources/Models/Extension.swift +++ b/Sources/Models/Extension.swift @@ -2,7 +2,7 @@ // Extension.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Extension) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Extension) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * Optional Extensions Element - found in all resources. */ public class Extension: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Extension" } } @@ -133,316 +133,316 @@ public class Extension: Element { self.url = url } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "url")) } - if let exist: AnyObject = js["valueAddress"] { + if let exist = js["valueAddress"] { presentKeys.insert("valueAddress") if let val = exist as? FHIRJSON { self.valueAddress = Address(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueAddress", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueAddress", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueAnnotation"] { + if let exist = js["valueAnnotation"] { presentKeys.insert("valueAnnotation") if let val = exist as? FHIRJSON { self.valueAnnotation = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueAnnotation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueAnnotation", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueAttachment"] { + if let exist = js["valueAttachment"] { presentKeys.insert("valueAttachment") if let val = exist as? FHIRJSON { self.valueAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueBase64Binary"] { + if let exist = js["valueBase64Binary"] { presentKeys.insert("valueBase64Binary") if let val = exist as? String { self.valueBase64Binary = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "valueBase64Binary", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueBase64Binary", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueBoolean"] { + if let exist = js["valueBoolean"] { presentKeys.insert("valueBoolean") if let val = exist as? Bool { self.valueBoolean = val } else { - errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueCode"] { + if let exist = js["valueCode"] { presentKeys.insert("valueCode") if let val = exist as? String { self.valueCode = val } else { - errors.append(FHIRJSONError(key: "valueCode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueCode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueCodeableConcept"] { + if let exist = js["valueCodeableConcept"] { presentKeys.insert("valueCodeableConcept") if let val = exist as? FHIRJSON { self.valueCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueCoding"] { + if let exist = js["valueCoding"] { presentKeys.insert("valueCoding") if let val = exist as? FHIRJSON { self.valueCoding = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueCoding", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueCoding", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueContactPoint"] { + if let exist = js["valueContactPoint"] { presentKeys.insert("valueContactPoint") if let val = exist as? FHIRJSON { self.valueContactPoint = ContactPoint(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueContactPoint", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueContactPoint", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDate"] { + if let exist = js["valueDate"] { presentKeys.insert("valueDate") if let val = exist as? String { self.valueDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "valueDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDateTime"] { + if let exist = js["valueDateTime"] { presentKeys.insert("valueDateTime") if let val = exist as? String { self.valueDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDecimal"] { + if let exist = js["valueDecimal"] { presentKeys.insert("valueDecimal") if let val = exist as? NSNumber { self.valueDecimal = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "valueDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDecimal", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueHumanName"] { + if let exist = js["valueHumanName"] { presentKeys.insert("valueHumanName") if let val = exist as? FHIRJSON { self.valueHumanName = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueHumanName", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueHumanName", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueId"] { + if let exist = js["valueId"] { presentKeys.insert("valueId") if let val = exist as? String { self.valueId = val } else { - errors.append(FHIRJSONError(key: "valueId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueIdentifier"] { + if let exist = js["valueIdentifier"] { presentKeys.insert("valueIdentifier") if let val = exist as? FHIRJSON { self.valueIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueInstant"] { + if let exist = js["valueInstant"] { presentKeys.insert("valueInstant") if let val = exist as? String { self.valueInstant = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "valueInstant", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueInstant", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueInteger"] { + if let exist = js["valueInteger"] { presentKeys.insert("valueInteger") if let val = exist as? Int { self.valueInteger = val } else { - errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueMarkdown"] { + if let exist = js["valueMarkdown"] { presentKeys.insert("valueMarkdown") if let val = exist as? String { self.valueMarkdown = val } else { - errors.append(FHIRJSONError(key: "valueMarkdown", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueMarkdown", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueMeta"] { + if let exist = js["valueMeta"] { presentKeys.insert("valueMeta") if let val = exist as? FHIRJSON { self.valueMeta = Meta(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueMeta", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueMeta", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueOid"] { + if let exist = js["valueOid"] { presentKeys.insert("valueOid") if let val = exist as? String { self.valueOid = val } else { - errors.append(FHIRJSONError(key: "valueOid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueOid", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valuePeriod"] { + if let exist = js["valuePeriod"] { presentKeys.insert("valuePeriod") if let val = exist as? FHIRJSON { self.valuePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valuePositiveInt"] { + if let exist = js["valuePositiveInt"] { presentKeys.insert("valuePositiveInt") if let val = exist as? UInt { self.valuePositiveInt = val } else { - errors.append(FHIRJSONError(key: "valuePositiveInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valuePositiveInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueQuantity"] { + if let exist = js["valueQuantity"] { presentKeys.insert("valueQuantity") if let val = exist as? FHIRJSON { self.valueQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueRange"] { + if let exist = js["valueRange"] { presentKeys.insert("valueRange") if let val = exist as? FHIRJSON { self.valueRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueRatio"] { + if let exist = js["valueRatio"] { presentKeys.insert("valueRatio") if let val = exist as? FHIRJSON { self.valueRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueReference"] { + if let exist = js["valueReference"] { presentKeys.insert("valueReference") if let val = exist as? FHIRJSON { self.valueReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueSampledData"] { + if let exist = js["valueSampledData"] { presentKeys.insert("valueSampledData") if let val = exist as? FHIRJSON { self.valueSampledData = SampledData(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueSampledData", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueSignature"] { + if let exist = js["valueSignature"] { presentKeys.insert("valueSignature") if let val = exist as? FHIRJSON { self.valueSignature = Signature(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueSignature", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueSignature", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueString"] { + if let exist = js["valueString"] { presentKeys.insert("valueString") if let val = exist as? String { self.valueString = val } else { - errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueTime"] { + if let exist = js["valueTime"] { presentKeys.insert("valueTime") if let val = exist as? String { self.valueTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueTiming"] { + if let exist = js["valueTiming"] { presentKeys.insert("valueTiming") if let val = exist as? FHIRJSON { self.valueTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueTiming", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueUnsignedInt"] { + if let exist = js["valueUnsignedInt"] { presentKeys.insert("valueUnsignedInt") if let val = exist as? UInt { self.valueUnsignedInt = val } else { - errors.append(FHIRJSONError(key: "valueUnsignedInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueUnsignedInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueUri"] { + if let exist = js["valueUri"] { presentKeys.insert("valueUri") if let val = exist as? String { self.valueUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "valueUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueUri", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/FHIRAbstractBase+Factory.swift b/Sources/Models/FHIRAbstractBase+Factory.swift index 0621d684..635275c3 100644 --- a/Sources/Models/FHIRAbstractBase+Factory.swift +++ b/Sources/Models/FHIRAbstractBase+Factory.swift @@ -2,7 +2,7 @@ // FHIRAbstractBase+Factory.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Sources/Models/FHIRAbstractBase.swift b/Sources/Models/FHIRAbstractBase.swift index 43d0ba4d..e26152ce 100644 --- a/Sources/Models/FHIRAbstractBase.swift +++ b/Sources/Models/FHIRAbstractBase.swift @@ -10,10 +10,10 @@ /** * Abstract superclass for all FHIR data elements. */ -public class FHIRAbstractBase: CustomStringConvertible { +open class FHIRAbstractBase: CustomStringConvertible { /// The name of the resource or element. - public class var resourceName: String { + open class var resourceType: String { get { return "FHIRAbstractBase" } } @@ -27,11 +27,11 @@ public class FHIRAbstractBase: CustomStringConvertible { /** The default initializer. - Forwards to `populate(fromJSON:)` and logs all JSON errors to console, if "DEBUG" is defined and true. + Forwards to `populate(from:)` and logs all JSON errors to console, if "DEBUG" is defined and true. */ public required init(json: FHIRJSON?, owner: FHIRAbstractBase? = nil) { _owner = owner - if let errors = populate(fromJSON: json) { + if let errors = populate(from: json) { for error in errors { fhir_warn(error.description) } @@ -44,21 +44,21 @@ public class FHIRAbstractBase: CustomStringConvertible { /** Will populate instance variables - overriding existing ones - with values found in the supplied JSON. - - parameter fromJSON: The JSON dictionary to pull data from - - returns: An optional array of errors reporting missing (when nonoptional) and superfluous properties and properties of the - wrong type + - parameter json: The JSON dictionary to pull data from + - returns: An optional array of errors reporting missing (when nonoptional) and superfluous properties and properties of the + wrong type */ - public final func populate(fromJSON json: FHIRJSON?) -> [FHIRJSONError]? { + public final func populate(from json: FHIRJSON?) -> [FHIRJSONError]? { var present = Set() present.insert("fhir_comments") - var errors = populate(fromJSON: json, presentKeys: &present) ?? [FHIRJSONError]() + var errors = populate(from: json, presentKeys: &present) ?? [FHIRJSONError]() // superfluous JSON entries? Ignore "fhir_comments" and "_xy". let superfluous = json?.keys.filter() { !present.contains($0) } if let supflu = superfluous, !supflu.isEmpty { for sup in supflu { if let first = sup.characters.first, "_" != first { - errors.append(FHIRJSONError(key: sup, has: json![sup]!.dynamicType)) + errors.append(FHIRJSONError(key: sup, has: type(of: json![sup]!))) } } } @@ -68,11 +68,11 @@ public class FHIRAbstractBase: CustomStringConvertible { /** The main function to perform the actual JSON parsing, to be overridden by subclasses. - - parameter fromJSON: The JSON element to use to populate the receiver + - parameter json: The JSON element to use to populate the receiver - parameter presentKeys: An in-out parameter being filled with key names used. - returns: An optional array of errors reporting missing mandatory keys or keys containing values of the wrong type */ - public func populate(fromJSON: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + open func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { return nil } @@ -81,7 +81,7 @@ public class FHIRAbstractBase: CustomStringConvertible { - returns: The FHIRJSON reperesentation of the receiver */ - public func asJSON() -> FHIRJSON { + open func asJSON() -> FHIRJSON { return FHIRJSON() } @@ -91,7 +91,7 @@ public class FHIRAbstractBase: CustomStringConvertible { - parameter array: The array of elements to map to FHIRJSON - returns: An array of FHIRJSON elements representing the given resources */ - public class func asJSONArray(_ array: [FHIRAbstractBase]) -> [FHIRJSON] { + open class func asJSONArray(_ array: [FHIRAbstractBase]) -> [FHIRJSON] { return array.map() { $0.asJSON() } } @@ -102,11 +102,11 @@ public class FHIRAbstractBase: CustomStringConvertible { Tries to find `resourceType` by inspecting the JSON dictionary, then instantiates the appropriate class for the specified resource type, or instantiates the receiver's class otherwise. - - parameter fromJSON: A FHIRJSON decoded from a JSON response - - parameter owner: The FHIRAbstractBase owning the new instance, if appropriate - - returns: If possible the appropriate FHIRAbstractBase subclass, instantiated from the given JSON dictionary, Self otherwise + - parameter json: A FHIRJSON decoded from a JSON response + - parameter owner: The FHIRAbstractBase owning the new instance, if appropriate + - returns: If possible the appropriate FHIRAbstractBase subclass, instantiated from the given JSON dictionary, Self otherwise */ - public final class func instantiate(fromJSON json: FHIRJSON?, owner: FHIRAbstractBase?) -> FHIRAbstractBase { + public final class func instantiate(from json: FHIRJSON?, owner: FHIRAbstractBase?) -> FHIRAbstractBase { if let type = json?["resourceType"] as? String { return factory(type, json: json!, owner: owner) } @@ -123,14 +123,14 @@ public class FHIRAbstractBase: CustomStringConvertible { - returns: An array of the appropriate FHIRAbstractBase subclass, if possible, Self otherwise */ public final class func instantiate(fromArray: [FHIRJSON], owner: FHIRAbstractBase? = nil) -> [FHIRAbstractBase] { - return fromArray.map() { instantiate(fromJSON: $0, owner: owner) } + return fromArray.map() { instantiate(from: $0, owner: owner) } } // MARK: - Resolving References /** Returns the resolved reference with the given id, if it has been resolved already. */ - public func resolvedReference(_ refid: String) -> Resource? { + open func resolvedReference(_ refid: String) -> Resource? { if let resolved = _resolved?[refid] { return resolved } @@ -146,7 +146,7 @@ public class FHIRAbstractBase: CustomStringConvertible { - parameter refid: The reference identifier as String - parameter resolved: The resource that was resolved */ - public func didResolveReference(_ refid: String, resolved: Resource) { + open func didResolveReference(_ refid: String, resolved: Resource) { if nil != _resolved { _resolved![refid] = resolved } @@ -160,7 +160,7 @@ public class FHIRAbstractBase: CustomStringConvertible { - returns: The owning `DomainResource` instance or nil */ - public var owningResource: DomainResource? { + open var owningResource: DomainResource? { var owner = _owner while nil != owner { if let owner = owner as? DomainResource { @@ -176,7 +176,7 @@ public class FHIRAbstractBase: CustomStringConvertible { - returns: The owning `Bundle` instance or nil */ - public var owningBundle: Bundle? { + open var owningBundle: Bundle? { var owner = _owner while nil != owner { if let owner = owner as? Bundle { @@ -190,8 +190,8 @@ public class FHIRAbstractBase: CustomStringConvertible { // MARK: - Printable - public var description: String { - return "<\(self.dynamicType.resourceName)>" + open var description: String { + return "<\(type(of: self).resourceType)>" } } diff --git a/Sources/Models/FHIRAbstractResource.swift b/Sources/Models/FHIRAbstractResource.swift index c20a67c7..698fef4e 100644 --- a/Sources/Models/FHIRAbstractResource.swift +++ b/Sources/Models/FHIRAbstractResource.swift @@ -12,13 +12,13 @@ import Foundation /** * Abstract superclass for all FHIR resource models. */ -public class FHIRAbstractResource: FHIRAbstractBase { +open class FHIRAbstractResource: FHIRAbstractBase { /// A specific version id, if the instance was created using `vread`. - public var _versionId: String? + open var _versionId: String? /// If this instance lives on a server, this property represents that server. - public var _server: FHIRServer? { + open var _server: FHIRServer? { get { return __server ?? owningResource?._server } set { __server = newValue } } @@ -33,24 +33,24 @@ public class FHIRAbstractResource: FHIRAbstractBase { The Resource, in contrast to the base element, definitely wants "resourceType" to be present. Will return an error complaining about it missing if it's not present. */ - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + open override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { guard let json = json else { return nil } if let type = json["resourceType"] as? String { presentKeys.insert("resourceType") - if type != self.dynamicType.resourceName { - return [FHIRJSONError.init(key: "resourceType", problem: "should be “\(self.dynamicType.resourceName)” but is “\(type)”")] + if type != type(of: self).resourceType { + return [FHIRJSONError.init(key: "resourceType", problem: "should be “\(type(of: self).resourceType)” but is “\(type)”")] } - return super.populate(fromJSON: json, presentKeys: &presentKeys) + return super.populate(from: json, presentKeys: &presentKeys) } return [FHIRJSONError(key: "resourceType")] } /** Serialize the receiver to JSON. */ - public override func asJSON() -> FHIRJSON { + open override func asJSON() -> FHIRJSON { var json = super.asJSON() - json["resourceType"] = self.dynamicType.resourceName + json["resourceType"] = type(of: self).resourceType return json } @@ -58,8 +58,8 @@ public class FHIRAbstractResource: FHIRAbstractBase { // MARK: - Printable - override public var description: String { - return "<\(self.dynamicType.resourceName)> \(__server?.baseURL.absoluteString ?? "nil")" + override open var description: String { + return "<\(type(of: self).resourceType)> \(__server?.baseURL.absoluteString ?? "nil")" } } diff --git a/Sources/Models/FHIRServer.swift b/Sources/Models/FHIRServer.swift index 24c13878..fc8663c7 100644 --- a/Sources/Models/FHIRServer.swift +++ b/Sources/Models/FHIRServer.swift @@ -104,7 +104,7 @@ public protocol FHIRServer { /** Designated initializer. Should make sure that the base URL ends with a "/"! */ - init(baseURL base: URL, auth: [String: AnyObject]?) + init(baseURL base: URL, auth: [String: Any]?) // MARK: - HTTP Request @@ -118,6 +118,6 @@ public protocol FHIRServer { - parameter additonalHeaders: The headers to set on the request - parameter callback: A callback, likely called asynchronously, returning a response instance */ - func performRequest(ofType: FHIRRequestType, path: String, resource: Resource?, additionalHeaders: FHIRRequestHeaders?, callback: ((response: FHIRServerResponse) -> Void)) + func performRequest(ofType: FHIRRequestType, path: String, resource: Resource?, additionalHeaders: FHIRRequestHeaders?, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) } diff --git a/Sources/Models/FHIRServerResponse.swift b/Sources/Models/FHIRServerResponse.swift index 351f857c..5f56657d 100644 --- a/Sources/Models/FHIRServerResponse.swift +++ b/Sources/Models/FHIRServerResponse.swift @@ -32,9 +32,9 @@ public protocol FHIRServerResponse { /** - Instantiate a FHIRServerResponse from an NS(HTTP)URLResponse, NSData and an NSError. + Instantiate a FHIRServerResponse from an (HTTP)URLResponse, Data and an Error. */ - init(response: URLResponse, data: Data?, urlError: NSError?) + init(response: URLResponse, data: Data?, error: Error?) init(error: Error) @@ -51,7 +51,7 @@ public protocol FHIRServerResponse { - throws: The method should only throw on severe cases, like if Location headers were returned that don't match the resource type - parameter resource: The resource to apply response data to */ - func applyHeadersTo(resource: Resource) throws + func applyHeaders(to resource: Resource) throws /** The response should apply response body data to the given resource. It should throw `FHIRError.ResponseNoResourceReceived` if there was @@ -63,7 +63,7 @@ public protocol FHIRServerResponse { response data at all (`FHIRError.ResponseNoResourceReceived` in that case) - parameter resource: The resource to apply response data to */ - func applyBodyTo(resource: Resource) throws + func applyBody(to resource: Resource) throws static func noneReceived() -> Self } diff --git a/Sources/Models/FHIRTypes.swift b/Sources/Models/FHIRTypes.swift index c94b6014..2382d3f2 100644 --- a/Sources/Models/FHIRTypes.swift +++ b/Sources/Models/FHIRTypes.swift @@ -10,9 +10,9 @@ import Foundation /** -A JSON dictionary, with `String` keys and `AnyObject` values. +A JSON dictionary, with `String` keys and `Any` values. */ -public typealias FHIRJSON = [String: AnyObject] +public typealias FHIRJSON = [String: Any] /** @@ -29,7 +29,7 @@ public struct Base64Binary: ExpressibleByStringLiteral, CustomStringConvertible, } - // MARK: - String Literal Convertible + // MARK: - ExpressibleByStringLiteral public init(stringLiteral value: StringLiteralType) { self.value = value @@ -43,28 +43,26 @@ public struct Base64Binary: ExpressibleByStringLiteral, CustomStringConvertible, self.value = value } - public static func convertFromExtendedGraphemeClusterLiteral(value: String) -> Base64Binary { - return self.init(stringLiteral: value) - } - - public static func convertFromStringLiteral(value: String) -> Base64Binary { - return self.init(stringLiteral: value) - } - - // MARK: - Printable + // MARK: - Printable, Equatable and Comparable public var description: String { return "" } -} - -public func <(lhs: Base64Binary, rhs: Base64Binary) -> Bool { - return lhs.value < rhs.value -} - -public func ==(lhs: Base64Binary, rhs: Base64Binary) -> Bool { - return lhs.value == rhs.value + + public static func <(lh: Base64Binary, rh: Base64Binary) -> Bool { + guard let lhs = lh.value else { + return true + } + guard let rhs = rh.value else { + return false + } + return lhs < rhs + } + + public static func ==(lhs: Base64Binary, rhs: Base64Binary) -> Bool { + return lhs.value == rhs.value + } } @@ -82,7 +80,7 @@ extension String { /** Execute a `print()`, prepending filename, line and function/method name, if `DEBUG` is defined. */ -public func fhir_logIfDebug(_ message: @autoclosure () -> String, function: String = #function, file: NSString = #file, line: Int = #line) { +public func fhir_logIfDebug(_ message: @autoclosure () -> String, function: String = #function, file: String = #file, line: Int = #line) { #if DEBUG print("SwiftFHIR [\(file.lastPathComponent):\(line)] \(function) \(message())") #endif @@ -91,7 +89,7 @@ public func fhir_logIfDebug(_ message: @autoclosure () -> String, function: Stri /** Execute a `print()`, prepending filename, line and function/method name and "WARNING" prepended. */ -public func fhir_warn(_ message: @autoclosure () -> String, function: String = #function, file: NSString = #file, line: Int = #line) { - print("SwiftFHIR [\(file.lastPathComponent):\(line)] \(function) WARNING: \(message())") +public func fhir_warn(_ message: @autoclosure () -> String, function: String = #function, file: String = #file, line: Int = #line) { + print("SwiftFHIR [\((file as NSString).lastPathComponent):\(line)] \(function) WARNING: \(message())") } diff --git a/Sources/Models/FamilyMemberHistory.swift b/Sources/Models/FamilyMemberHistory.swift index b5abbc61..7906f097 100644 --- a/Sources/Models/FamilyMemberHistory.swift +++ b/Sources/Models/FamilyMemberHistory.swift @@ -2,7 +2,7 @@ // FamilyMemberHistory.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/FamilyMemberHistory) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * patient. */ public class FamilyMemberHistory: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "FamilyMemberHistory" } } @@ -94,193 +94,193 @@ public class FamilyMemberHistory: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["ageQuantity"] { + if let exist = js["ageQuantity"] { presentKeys.insert("ageQuantity") if let val = exist as? FHIRJSON { self.ageQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ageQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ageQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ageRange"] { + if let exist = js["ageRange"] { presentKeys.insert("ageRange") if let val = exist as? FHIRJSON { self.ageRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ageRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ageRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ageString"] { + if let exist = js["ageString"] { presentKeys.insert("ageString") if let val = exist as? String { self.ageString = val } else { - errors.append(FHIRJSONError(key: "ageString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ageString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["bornDate"] { + if let exist = js["bornDate"] { presentKeys.insert("bornDate") if let val = exist as? String { self.bornDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "bornDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bornDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["bornPeriod"] { + if let exist = js["bornPeriod"] { presentKeys.insert("bornPeriod") if let val = exist as? FHIRJSON { self.bornPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bornPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bornPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["bornString"] { + if let exist = js["bornString"] { presentKeys.insert("bornString") if let val = exist as? String { self.bornString = val } else { - errors.append(FHIRJSONError(key: "bornString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bornString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["condition"] { + if let exist = js["condition"] { presentKeys.insert("condition") if let val = exist as? [FHIRJSON] { self.condition = FamilyMemberHistoryCondition.instantiate(fromArray: val, owner: self) as? [FamilyMemberHistoryCondition] } else { - errors.append(FHIRJSONError(key: "condition", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "condition", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["deceasedBoolean"] { + if let exist = js["deceasedBoolean"] { presentKeys.insert("deceasedBoolean") if let val = exist as? Bool { self.deceasedBoolean = val } else { - errors.append(FHIRJSONError(key: "deceasedBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "deceasedBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["deceasedDate"] { + if let exist = js["deceasedDate"] { presentKeys.insert("deceasedDate") if let val = exist as? String { self.deceasedDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "deceasedDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "deceasedDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["deceasedQuantity"] { + if let exist = js["deceasedQuantity"] { presentKeys.insert("deceasedQuantity") if let val = exist as? FHIRJSON { self.deceasedQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "deceasedQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "deceasedQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["deceasedRange"] { + if let exist = js["deceasedRange"] { presentKeys.insert("deceasedRange") if let val = exist as? FHIRJSON { self.deceasedRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "deceasedRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "deceasedRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["deceasedString"] { + if let exist = js["deceasedString"] { presentKeys.insert("deceasedString") if let val = exist as? String { self.deceasedString = val } else { - errors.append(FHIRJSONError(key: "deceasedString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "deceasedString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["gender"] { + if let exist = js["gender"] { presentKeys.insert("gender") if let val = exist as? String { self.gender = val } else { - errors.append(FHIRJSONError(key: "gender", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "gender", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? FHIRJSON { self.note = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["relationship"] { + if let exist = js["relationship"] { presentKeys.insert("relationship") if let val = exist as? FHIRJSON { self.relationship = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "relationship")) } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { @@ -367,7 +367,7 @@ public class FamilyMemberHistory: DomainResource { * condition. */ public class FamilyMemberHistoryCondition: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "FamilyMemberHistoryCondition" } } @@ -404,73 +404,73 @@ public class FamilyMemberHistoryCondition: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? FHIRJSON { self.note = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["onsetPeriod"] { + if let exist = js["onsetPeriod"] { presentKeys.insert("onsetPeriod") if let val = exist as? FHIRJSON { self.onsetPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "onsetPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "onsetPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["onsetQuantity"] { + if let exist = js["onsetQuantity"] { presentKeys.insert("onsetQuantity") if let val = exist as? FHIRJSON { self.onsetQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "onsetQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "onsetQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["onsetRange"] { + if let exist = js["onsetRange"] { presentKeys.insert("onsetRange") if let val = exist as? FHIRJSON { self.onsetRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "onsetRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "onsetRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["onsetString"] { + if let exist = js["onsetString"] { presentKeys.insert("onsetString") if let val = exist as? String { self.onsetString = val } else { - errors.append(FHIRJSONError(key: "onsetString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "onsetString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["outcome"] { + if let exist = js["outcome"] { presentKeys.insert("outcome") if let val = exist as? FHIRJSON { self.outcome = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "outcome", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Flag.swift b/Sources/Models/Flag.swift index 5b670cd4..34e17af5 100644 --- a/Sources/Models/Flag.swift +++ b/Sources/Models/Flag.swift @@ -2,7 +2,7 @@ // Flag.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Flag) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Flag) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * Prospective warnings of potential issues when providing care to the patient. */ public class Flag: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Flag" } } @@ -57,85 +57,85 @@ public class Flag: DomainResource { self.subject = subject } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? FHIRJSON { self.author = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? FHIRJSON { self.category = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Goal.swift b/Sources/Models/Goal.swift index e06bc84b..efe13b81 100644 --- a/Sources/Models/Goal.swift +++ b/Sources/Models/Goal.swift @@ -2,7 +2,7 @@ // Goal.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Goal) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Goal) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * an activity of daily living, obtaining herd immunity via immunization, meeting a process improvement objective, etc. */ public class Goal: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Goal" } } @@ -81,157 +81,157 @@ public class Goal: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["addresses"] { + if let exist = js["addresses"] { presentKeys.insert("addresses") if let val = exist as? [FHIRJSON] { self.addresses = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "addresses", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "addresses", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? FHIRJSON { self.author = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? [FHIRJSON] { self.category = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "category", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "description")) } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? [FHIRJSON] { self.note = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["outcome"] { + if let exist = js["outcome"] { presentKeys.insert("outcome") if let val = exist as? [FHIRJSON] { self.outcome = GoalOutcome.instantiate(fromArray: val, owner: self) as? [GoalOutcome] } else { - errors.append(FHIRJSONError(key: "outcome", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["priority"] { + if let exist = js["priority"] { presentKeys.insert("priority") if let val = exist as? FHIRJSON { self.priority = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["startCodeableConcept"] { + if let exist = js["startCodeableConcept"] { presentKeys.insert("startCodeableConcept") if let val = exist as? FHIRJSON { self.startCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "startCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "startCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["startDate"] { + if let exist = js["startDate"] { presentKeys.insert("startDate") if let val = exist as? String { self.startDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "startDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "startDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["statusDate"] { + if let exist = js["statusDate"] { presentKeys.insert("statusDate") if let val = exist as? String { self.statusDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "statusDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "statusDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["statusReason"] { + if let exist = js["statusReason"] { presentKeys.insert("statusReason") if let val = exist as? FHIRJSON { self.statusReason = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "statusReason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "statusReason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["targetDate"] { + if let exist = js["targetDate"] { presentKeys.insert("targetDate") if let val = exist as? String { self.targetDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "targetDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "targetDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["targetQuantity"] { + if let exist = js["targetQuantity"] { presentKeys.insert("targetQuantity") if let val = exist as? FHIRJSON { self.targetQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "targetQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "targetQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -301,7 +301,7 @@ public class Goal: DomainResource { * Identifies the change (or lack of change) at the point where the goal was deepmed to be cancelled or achieved. */ public class GoalOutcome: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "GoalOutcome" } } @@ -317,25 +317,25 @@ public class GoalOutcome: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["resultCodeableConcept"] { + if let exist = js["resultCodeableConcept"] { presentKeys.insert("resultCodeableConcept") if let val = exist as? FHIRJSON { self.resultCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "resultCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "resultCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["resultReference"] { + if let exist = js["resultReference"] { presentKeys.insert("resultReference") if let val = exist as? FHIRJSON { self.resultReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "resultReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "resultReference", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Group.swift b/Sources/Models/Group.swift index 421663a3..f1631149 100644 --- a/Sources/Models/Group.swift +++ b/Sources/Models/Group.swift @@ -2,7 +2,7 @@ // Group.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Group) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Group) on 2016-09-16. // 2016, SMART Health IT. // @@ -17,7 +17,7 @@ import Foundation * Organization. */ public class Group: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Group" } } @@ -58,82 +58,82 @@ public class Group: DomainResource { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["actual"] { + if let exist = js["actual"] { presentKeys.insert("actual") if let val = exist as? Bool { self.actual = val } else { - errors.append(FHIRJSONError(key: "actual", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actual", wants: Bool.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "actual")) } - if let exist: AnyObject = js["characteristic"] { + if let exist = js["characteristic"] { presentKeys.insert("characteristic") if let val = exist as? [FHIRJSON] { self.characteristic = GroupCharacteristic.instantiate(fromArray: val, owner: self) as? [GroupCharacteristic] } else { - errors.append(FHIRJSONError(key: "characteristic", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "characteristic", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["member"] { + if let exist = js["member"] { presentKeys.insert("member") if let val = exist as? [FHIRJSON] { self.member = GroupMember.instantiate(fromArray: val, owner: self) as? [GroupMember] } else { - errors.append(FHIRJSONError(key: "member", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "member", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? UInt { self.quantity = val } else { - errors.append(FHIRJSONError(key: "quantity", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { @@ -182,7 +182,7 @@ public class Group: DomainResource { * Identifies the traits shared by members of the group. */ public class GroupCharacteristic: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "GroupCharacteristic" } } @@ -224,76 +224,76 @@ public class GroupCharacteristic: BackboneElement { self.valueRange = valueRange } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["exclude"] { + if let exist = js["exclude"] { presentKeys.insert("exclude") if let val = exist as? Bool { self.exclude = val } else { - errors.append(FHIRJSONError(key: "exclude", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exclude", wants: Bool.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "exclude")) } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueBoolean"] { + if let exist = js["valueBoolean"] { presentKeys.insert("valueBoolean") if let val = exist as? Bool { self.valueBoolean = val } else { - errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueCodeableConcept"] { + if let exist = js["valueCodeableConcept"] { presentKeys.insert("valueCodeableConcept") if let val = exist as? FHIRJSON { self.valueCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueQuantity"] { + if let exist = js["valueQuantity"] { presentKeys.insert("valueQuantity") if let val = exist as? FHIRJSON { self.valueQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueRange"] { + if let exist = js["valueRange"] { presentKeys.insert("valueRange") if let val = exist as? FHIRJSON { self.valueRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: type(of: exist))) } } @@ -341,7 +341,7 @@ public class GroupCharacteristic: BackboneElement { * Identifies the resource instances that are members of the group. */ public class GroupMember: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "GroupMember" } } @@ -366,37 +366,37 @@ public class GroupMember: BackboneElement { self.entity = entity } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["entity"] { + if let exist = js["entity"] { presentKeys.insert("entity") if let val = exist as? FHIRJSON { self.entity = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "entity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entity", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "entity")) } - if let exist: AnyObject = js["inactive"] { + if let exist = js["inactive"] { presentKeys.insert("inactive") if let val = exist as? Bool { self.inactive = val } else { - errors.append(FHIRJSONError(key: "inactive", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "inactive", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/HealthcareService.swift b/Sources/Models/HealthcareService.swift index 55737be6..f07b6885 100644 --- a/Sources/Models/HealthcareService.swift +++ b/Sources/Models/HealthcareService.swift @@ -2,7 +2,7 @@ // HealthcareService.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/HealthcareService) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/HealthcareService) on 2016-09-16. // 2016, SMART Health IT. // @@ -13,7 +13,7 @@ import Foundation * The details of a healthcare service available at a location. */ public class HealthcareService: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "HealthcareService" } } @@ -95,208 +95,208 @@ public class HealthcareService: DomainResource { self.location = location } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["appointmentRequired"] { + if let exist = js["appointmentRequired"] { presentKeys.insert("appointmentRequired") if let val = exist as? Bool { self.appointmentRequired = val } else { - errors.append(FHIRJSONError(key: "appointmentRequired", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "appointmentRequired", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["availabilityExceptions"] { + if let exist = js["availabilityExceptions"] { presentKeys.insert("availabilityExceptions") if let val = exist as? String { self.availabilityExceptions = val } else { - errors.append(FHIRJSONError(key: "availabilityExceptions", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "availabilityExceptions", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["availableTime"] { + if let exist = js["availableTime"] { presentKeys.insert("availableTime") if let val = exist as? [FHIRJSON] { self.availableTime = HealthcareServiceAvailableTime.instantiate(fromArray: val, owner: self) as? [HealthcareServiceAvailableTime] } else { - errors.append(FHIRJSONError(key: "availableTime", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "availableTime", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["characteristic"] { + if let exist = js["characteristic"] { presentKeys.insert("characteristic") if let val = exist as? [FHIRJSON] { self.characteristic = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "characteristic", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "characteristic", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["comment"] { + if let exist = js["comment"] { presentKeys.insert("comment") if let val = exist as? String { self.comment = val } else { - errors.append(FHIRJSONError(key: "comment", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comment", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["coverageArea"] { + if let exist = js["coverageArea"] { presentKeys.insert("coverageArea") if let val = exist as? [FHIRJSON] { self.coverageArea = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "coverageArea", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "coverageArea", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["eligibility"] { + if let exist = js["eligibility"] { presentKeys.insert("eligibility") if let val = exist as? FHIRJSON { self.eligibility = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "eligibility", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "eligibility", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["eligibilityNote"] { + if let exist = js["eligibilityNote"] { presentKeys.insert("eligibilityNote") if let val = exist as? String { self.eligibilityNote = val } else { - errors.append(FHIRJSONError(key: "eligibilityNote", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "eligibilityNote", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["extraDetails"] { + if let exist = js["extraDetails"] { presentKeys.insert("extraDetails") if let val = exist as? String { self.extraDetails = val } else { - errors.append(FHIRJSONError(key: "extraDetails", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "extraDetails", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? FHIRJSON { self.location = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "location")) } - if let exist: AnyObject = js["notAvailable"] { + if let exist = js["notAvailable"] { presentKeys.insert("notAvailable") if let val = exist as? [FHIRJSON] { self.notAvailable = HealthcareServiceNotAvailable.instantiate(fromArray: val, owner: self) as? [HealthcareServiceNotAvailable] } else { - errors.append(FHIRJSONError(key: "notAvailable", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "notAvailable", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["photo"] { + if let exist = js["photo"] { presentKeys.insert("photo") if let val = exist as? FHIRJSON { self.photo = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "photo", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "photo", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["programName"] { + if let exist = js["programName"] { presentKeys.insert("programName") if let val = exist as? [String] { self.programName = val } else { - errors.append(FHIRJSONError(key: "programName", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "programName", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["providedBy"] { + if let exist = js["providedBy"] { presentKeys.insert("providedBy") if let val = exist as? FHIRJSON { self.providedBy = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "providedBy", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "providedBy", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["publicKey"] { + if let exist = js["publicKey"] { presentKeys.insert("publicKey") if let val = exist as? String { self.publicKey = val } else { - errors.append(FHIRJSONError(key: "publicKey", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publicKey", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["referralMethod"] { + if let exist = js["referralMethod"] { presentKeys.insert("referralMethod") if let val = exist as? [FHIRJSON] { self.referralMethod = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "referralMethod", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "referralMethod", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["serviceCategory"] { + if let exist = js["serviceCategory"] { presentKeys.insert("serviceCategory") if let val = exist as? FHIRJSON { self.serviceCategory = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "serviceCategory", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "serviceCategory", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["serviceName"] { + if let exist = js["serviceName"] { presentKeys.insert("serviceName") if let val = exist as? String { self.serviceName = val } else { - errors.append(FHIRJSONError(key: "serviceName", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "serviceName", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["serviceProvisionCode"] { + if let exist = js["serviceProvisionCode"] { presentKeys.insert("serviceProvisionCode") if let val = exist as? [FHIRJSON] { self.serviceProvisionCode = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "serviceProvisionCode", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "serviceProvisionCode", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["serviceType"] { + if let exist = js["serviceType"] { presentKeys.insert("serviceType") if let val = exist as? [FHIRJSON] { self.serviceType = HealthcareServiceServiceType.instantiate(fromArray: val, owner: self) as? [HealthcareServiceServiceType] } else { - errors.append(FHIRJSONError(key: "serviceType", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "serviceType", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -346,7 +346,7 @@ public class HealthcareService: DomainResource { json["photo"] = photo.asJSON() } if let programName = self.programName { - var arr = [AnyObject]() + var arr = [Any]() for val in programName { arr.append(val.asJSON()) } @@ -388,7 +388,7 @@ public class HealthcareService: DomainResource { * A collection of times that the Service Site is available. */ public class HealthcareServiceAvailableTime: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "HealthcareServiceAvailableTime" } } @@ -410,43 +410,43 @@ public class HealthcareServiceAvailableTime: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["allDay"] { + if let exist = js["allDay"] { presentKeys.insert("allDay") if let val = exist as? Bool { self.allDay = val } else { - errors.append(FHIRJSONError(key: "allDay", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "allDay", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["availableEndTime"] { + if let exist = js["availableEndTime"] { presentKeys.insert("availableEndTime") if let val = exist as? String { self.availableEndTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "availableEndTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "availableEndTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["availableStartTime"] { + if let exist = js["availableStartTime"] { presentKeys.insert("availableStartTime") if let val = exist as? String { self.availableStartTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "availableStartTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "availableStartTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["daysOfWeek"] { + if let exist = js["daysOfWeek"] { presentKeys.insert("daysOfWeek") if let val = exist as? [String] { self.daysOfWeek = val } else { - errors.append(FHIRJSONError(key: "daysOfWeek", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "daysOfWeek", wants: Array.self, has: type(of: exist))) } } } @@ -466,7 +466,7 @@ public class HealthcareServiceAvailableTime: BackboneElement { json["availableStartTime"] = availableStartTime.asJSON() } if let daysOfWeek = self.daysOfWeek { - var arr = [AnyObject]() + var arr = [Any]() for val in daysOfWeek { arr.append(val.asJSON()) } @@ -484,7 +484,7 @@ public class HealthcareServiceAvailableTime: BackboneElement { * The HealthcareService is not available during this period of time due to the provided reason. */ public class HealthcareServiceNotAvailable: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "HealthcareServiceNotAvailable" } } @@ -506,28 +506,28 @@ public class HealthcareServiceNotAvailable: BackboneElement { self.description_fhir = description_fhir } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "description")) } - if let exist: AnyObject = js["during"] { + if let exist = js["during"] { presentKeys.insert("during") if let val = exist as? FHIRJSON { self.during = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "during", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "during", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -555,7 +555,7 @@ public class HealthcareServiceNotAvailable: BackboneElement { * A specific type of service that may be delivered or performed. */ public class HealthcareServiceServiceType: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "HealthcareServiceServiceType" } } @@ -577,25 +577,25 @@ public class HealthcareServiceServiceType: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["specialty"] { + if let exist = js["specialty"] { presentKeys.insert("specialty") if let val = exist as? [FHIRJSON] { self.specialty = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "specialty", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "specialty", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/HumanName.swift b/Sources/Models/HumanName.swift index 301173d0..5c989ef5 100644 --- a/Sources/Models/HumanName.swift +++ b/Sources/Models/HumanName.swift @@ -2,7 +2,7 @@ // HumanName.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/HumanName) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/HumanName) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A human's name with the ability to identify parts and usage. */ public class HumanName: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "HumanName" } } @@ -46,70 +46,70 @@ public class HumanName: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["family"] { + if let exist = js["family"] { presentKeys.insert("family") if let val = exist as? [String] { self.family = val } else { - errors.append(FHIRJSONError(key: "family", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "family", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["given"] { + if let exist = js["given"] { presentKeys.insert("given") if let val = exist as? [String] { self.given = val } else { - errors.append(FHIRJSONError(key: "given", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "given", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["prefix"] { + if let exist = js["prefix"] { presentKeys.insert("prefix") if let val = exist as? [String] { self.prefix = val } else { - errors.append(FHIRJSONError(key: "prefix", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prefix", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["suffix"] { + if let exist = js["suffix"] { presentKeys.insert("suffix") if let val = exist as? [String] { self.suffix = val } else { - errors.append(FHIRJSONError(key: "suffix", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "suffix", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["use"] { + if let exist = js["use"] { presentKeys.insert("use") if let val = exist as? String { self.use = val } else { - errors.append(FHIRJSONError(key: "use", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "use", wants: String.self, has: type(of: exist))) } } } @@ -120,14 +120,14 @@ public class HumanName: Element { var json = super.asJSON() if let family = self.family { - var arr = [AnyObject]() + var arr = [Any]() for val in family { arr.append(val.asJSON()) } json["family"] = arr } if let given = self.given { - var arr = [AnyObject]() + var arr = [Any]() for val in given { arr.append(val.asJSON()) } @@ -137,14 +137,14 @@ public class HumanName: Element { json["period"] = period.asJSON() } if let prefix = self.prefix { - var arr = [AnyObject]() + var arr = [Any]() for val in prefix { arr.append(val.asJSON()) } json["prefix"] = arr } if let suffix = self.suffix { - var arr = [AnyObject]() + var arr = [Any]() for val in suffix { arr.append(val.asJSON()) } diff --git a/Sources/Models/Identifier.swift b/Sources/Models/Identifier.swift index c39080c1..22938544 100644 --- a/Sources/Models/Identifier.swift +++ b/Sources/Models/Identifier.swift @@ -2,7 +2,7 @@ // Identifier.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Identifier) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Identifier) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A technical identifier - identifies some entity uniquely and unambiguously. */ public class Identifier: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Identifier" } } @@ -43,61 +43,61 @@ public class Identifier: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["assigner"] { + if let exist = js["assigner"] { presentKeys.insert("assigner") if let val = exist as? FHIRJSON { self.assigner = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "assigner", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "assigner", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["system"] { + if let exist = js["system"] { presentKeys.insert("system") if let val = exist as? String { self.system = URL(string: val) } else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "system", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["use"] { + if let exist = js["use"] { presentKeys.insert("use") if let val = exist as? String { self.use = val } else { - errors.append(FHIRJSONError(key: "use", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "use", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? String { self.value = val } else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/ImagingObjectSelection.swift b/Sources/Models/ImagingObjectSelection.swift index 9c0663a7..b6a32366 100644 --- a/Sources/Models/ImagingObjectSelection.swift +++ b/Sources/Models/ImagingObjectSelection.swift @@ -2,7 +2,7 @@ // ImagingObjectSelection.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImagingObjectSelection) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImagingObjectSelection) on 2016-09-16. // 2016, SMART Health IT. // @@ -21,7 +21,7 @@ import Foundation * inclusion in a teaching file); and so on. */ public class ImagingObjectSelection: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImagingObjectSelection" } } @@ -61,79 +61,79 @@ public class ImagingObjectSelection: DomainResource { self.uid = uid } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? FHIRJSON { self.author = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["authoringTime"] { + if let exist = js["authoringTime"] { presentKeys.insert("authoringTime") if let val = exist as? String { self.authoringTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "authoringTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "authoringTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["study"] { + if let exist = js["study"] { presentKeys.insert("study") if let val = exist as? [FHIRJSON] { self.study = ImagingObjectSelectionStudy.instantiate(fromArray: val, owner: self) as? [ImagingObjectSelectionStudy] } else { - errors.append(FHIRJSONError(key: "study", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "study", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "study")) } - if let exist: AnyObject = js["title"] { + if let exist = js["title"] { presentKeys.insert("title") if let val = exist as? FHIRJSON { self.title = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "title", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "title", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "title")) } - if let exist: AnyObject = js["uid"] { + if let exist = js["uid"] { presentKeys.insert("uid") if let val = exist as? String { self.uid = val } else { - errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "uid", wants: String.self, has: type(of: exist))) } } else { @@ -179,7 +179,7 @@ public class ImagingObjectSelection: DomainResource { * Study identity and locating information of the DICOM SOP instances in the selection. */ public class ImagingObjectSelectionStudy: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImagingObjectSelectionStudy" } } @@ -208,49 +208,49 @@ public class ImagingObjectSelectionStudy: BackboneElement { self.uid = uid } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["imagingStudy"] { + if let exist = js["imagingStudy"] { presentKeys.insert("imagingStudy") if let val = exist as? FHIRJSON { self.imagingStudy = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "imagingStudy", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "imagingStudy", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["series"] { + if let exist = js["series"] { presentKeys.insert("series") if let val = exist as? [FHIRJSON] { self.series = ImagingObjectSelectionStudySeries.instantiate(fromArray: val, owner: self) as? [ImagingObjectSelectionStudySeries] } else { - errors.append(FHIRJSONError(key: "series", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "series", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "series")) } - if let exist: AnyObject = js["uid"] { + if let exist = js["uid"] { presentKeys.insert("uid") if let val = exist as? String { self.uid = val } else { - errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "uid", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "uid")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } } @@ -284,7 +284,7 @@ public class ImagingObjectSelectionStudy: BackboneElement { * Series identity and locating information of the DICOM SOP instances in the selection. */ public class ImagingObjectSelectionStudySeries: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImagingObjectSelectionStudySeries" } } @@ -309,37 +309,37 @@ public class ImagingObjectSelectionStudySeries: BackboneElement { self.instance = instance } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["instance"] { + if let exist = js["instance"] { presentKeys.insert("instance") if let val = exist as? [FHIRJSON] { self.instance = ImagingObjectSelectionStudySeriesInstance.instantiate(fromArray: val, owner: self) as? [ImagingObjectSelectionStudySeriesInstance] } else { - errors.append(FHIRJSONError(key: "instance", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "instance", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "instance")) } - if let exist: AnyObject = js["uid"] { + if let exist = js["uid"] { presentKeys.insert("uid") if let val = exist as? String { self.uid = val } else { - errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "uid", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } } @@ -370,7 +370,7 @@ public class ImagingObjectSelectionStudySeries: BackboneElement { * Identity and locating information of the selected DICOM SOP instances. */ public class ImagingObjectSelectionStudySeriesInstance: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImagingObjectSelectionStudySeriesInstance" } } @@ -400,49 +400,49 @@ public class ImagingObjectSelectionStudySeriesInstance: BackboneElement { self.url = url } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["frames"] { + if let exist = js["frames"] { presentKeys.insert("frames") if let val = exist as? [FHIRJSON] { self.frames = ImagingObjectSelectionStudySeriesInstanceFrames.instantiate(fromArray: val, owner: self) as? [ImagingObjectSelectionStudySeriesInstanceFrames] } else { - errors.append(FHIRJSONError(key: "frames", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "frames", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sopClass"] { + if let exist = js["sopClass"] { presentKeys.insert("sopClass") if let val = exist as? String { self.sopClass = val } else { - errors.append(FHIRJSONError(key: "sopClass", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sopClass", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "sopClass")) } - if let exist: AnyObject = js["uid"] { + if let exist = js["uid"] { presentKeys.insert("uid") if let val = exist as? String { self.uid = val } else { - errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "uid", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "uid")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } else { @@ -479,7 +479,7 @@ public class ImagingObjectSelectionStudySeriesInstance: BackboneElement { * Identity and location information of the frames in the selected instance. */ public class ImagingObjectSelectionStudySeriesInstanceFrames: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImagingObjectSelectionStudySeriesInstanceFrames" } } @@ -502,28 +502,28 @@ public class ImagingObjectSelectionStudySeriesInstanceFrames: BackboneElement { self.url = url } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["frameNumbers"] { + if let exist = js["frameNumbers"] { presentKeys.insert("frameNumbers") if let val = exist as? [UInt] { self.frameNumbers = val } else { - errors.append(FHIRJSONError(key: "frameNumbers", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "frameNumbers", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "frameNumbers")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } else { @@ -537,7 +537,7 @@ public class ImagingObjectSelectionStudySeriesInstanceFrames: BackboneElement { var json = super.asJSON() if let frameNumbers = self.frameNumbers { - var arr = [AnyObject]() + var arr = [Any]() for val in frameNumbers { arr.append(val.asJSON()) } diff --git a/Sources/Models/ImagingStudy.swift b/Sources/Models/ImagingStudy.swift index 1be1dce2..a8e5f23f 100644 --- a/Sources/Models/ImagingStudy.swift +++ b/Sources/Models/ImagingStudy.swift @@ -2,7 +2,7 @@ // ImagingStudy.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImagingStudy) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImagingStudy) on 2016-09-16. // 2016, SMART Health IT. // @@ -18,7 +18,7 @@ import Foundation * series of different modalities. */ public class ImagingStudy: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImagingStudy" } } @@ -85,163 +85,163 @@ public class ImagingStudy: DomainResource { self.uid = uid } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["accession"] { + if let exist = js["accession"] { presentKeys.insert("accession") if let val = exist as? FHIRJSON { self.accession = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "accession", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "accession", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["availability"] { + if let exist = js["availability"] { presentKeys.insert("availability") if let val = exist as? String { self.availability = val } else { - errors.append(FHIRJSONError(key: "availability", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "availability", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["interpreter"] { + if let exist = js["interpreter"] { presentKeys.insert("interpreter") if let val = exist as? FHIRJSON { self.interpreter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "interpreter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "interpreter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["modalityList"] { + if let exist = js["modalityList"] { presentKeys.insert("modalityList") if let val = exist as? [FHIRJSON] { self.modalityList = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "modalityList", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "modalityList", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["numberOfInstances"] { + if let exist = js["numberOfInstances"] { presentKeys.insert("numberOfInstances") if let val = exist as? UInt { self.numberOfInstances = val } else { - errors.append(FHIRJSONError(key: "numberOfInstances", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "numberOfInstances", wants: UInt.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "numberOfInstances")) } - if let exist: AnyObject = js["numberOfSeries"] { + if let exist = js["numberOfSeries"] { presentKeys.insert("numberOfSeries") if let val = exist as? UInt { self.numberOfSeries = val } else { - errors.append(FHIRJSONError(key: "numberOfSeries", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "numberOfSeries", wants: UInt.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "numberOfSeries")) } - if let exist: AnyObject = js["order"] { + if let exist = js["order"] { presentKeys.insert("order") if let val = exist as? [FHIRJSON] { self.order = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "order", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "order", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["procedure"] { + if let exist = js["procedure"] { presentKeys.insert("procedure") if let val = exist as? [FHIRJSON] { self.procedure = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "procedure", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "procedure", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["referrer"] { + if let exist = js["referrer"] { presentKeys.insert("referrer") if let val = exist as? FHIRJSON { self.referrer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "referrer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "referrer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["series"] { + if let exist = js["series"] { presentKeys.insert("series") if let val = exist as? [FHIRJSON] { self.series = ImagingStudySeries.instantiate(fromArray: val, owner: self) as? [ImagingStudySeries] } else { - errors.append(FHIRJSONError(key: "series", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "series", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["started"] { + if let exist = js["started"] { presentKeys.insert("started") if let val = exist as? String { self.started = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "started", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "started", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["uid"] { + if let exist = js["uid"] { presentKeys.insert("uid") if let val = exist as? String { self.uid = val } else { - errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "uid", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "uid")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } } @@ -311,7 +311,7 @@ public class ImagingStudy: DomainResource { * Each study has one or more series of images or other content. */ public class ImagingStudySeries: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImagingStudySeries" } } @@ -362,115 +362,115 @@ public class ImagingStudySeries: BackboneElement { self.uid = uid } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["availability"] { + if let exist = js["availability"] { presentKeys.insert("availability") if let val = exist as? String { self.availability = val } else { - errors.append(FHIRJSONError(key: "availability", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "availability", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["bodySite"] { + if let exist = js["bodySite"] { presentKeys.insert("bodySite") if let val = exist as? FHIRJSON { self.bodySite = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bodySite", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySite", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["instance"] { + if let exist = js["instance"] { presentKeys.insert("instance") if let val = exist as? [FHIRJSON] { self.instance = ImagingStudySeriesInstance.instantiate(fromArray: val, owner: self) as? [ImagingStudySeriesInstance] } else { - errors.append(FHIRJSONError(key: "instance", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "instance", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["laterality"] { + if let exist = js["laterality"] { presentKeys.insert("laterality") if let val = exist as? FHIRJSON { self.laterality = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "laterality", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "laterality", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["modality"] { + if let exist = js["modality"] { presentKeys.insert("modality") if let val = exist as? FHIRJSON { self.modality = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "modality", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "modality", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "modality")) } - if let exist: AnyObject = js["number"] { + if let exist = js["number"] { presentKeys.insert("number") if let val = exist as? UInt { self.number = val } else { - errors.append(FHIRJSONError(key: "number", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "number", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["numberOfInstances"] { + if let exist = js["numberOfInstances"] { presentKeys.insert("numberOfInstances") if let val = exist as? UInt { self.numberOfInstances = val } else { - errors.append(FHIRJSONError(key: "numberOfInstances", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "numberOfInstances", wants: UInt.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "numberOfInstances")) } - if let exist: AnyObject = js["started"] { + if let exist = js["started"] { presentKeys.insert("started") if let val = exist as? String { self.started = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "started", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "started", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["uid"] { + if let exist = js["uid"] { presentKeys.insert("uid") if let val = exist as? String { self.uid = val } else { - errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "uid", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "uid")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } } @@ -525,7 +525,7 @@ public class ImagingStudySeries: BackboneElement { * A single SOP Instance within the series, e.g. an image, or presentation state. */ public class ImagingStudySeriesInstance: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImagingStudySeriesInstance" } } @@ -560,64 +560,64 @@ public class ImagingStudySeriesInstance: BackboneElement { self.uid = uid } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["content"] { + if let exist = js["content"] { presentKeys.insert("content") if let val = exist as? [FHIRJSON] { self.content = Attachment.instantiate(fromArray: val, owner: self) as? [Attachment] } else { - errors.append(FHIRJSONError(key: "content", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "content", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["number"] { + if let exist = js["number"] { presentKeys.insert("number") if let val = exist as? UInt { self.number = val } else { - errors.append(FHIRJSONError(key: "number", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "number", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sopClass"] { + if let exist = js["sopClass"] { presentKeys.insert("sopClass") if let val = exist as? String { self.sopClass = val } else { - errors.append(FHIRJSONError(key: "sopClass", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sopClass", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "sopClass")) } - if let exist: AnyObject = js["title"] { + if let exist = js["title"] { presentKeys.insert("title") if let val = exist as? String { self.title = val } else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "title", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["uid"] { + if let exist = js["uid"] { presentKeys.insert("uid") if let val = exist as? String { self.uid = val } else { - errors.append(FHIRJSONError(key: "uid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "uid", wants: String.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Immunization.swift b/Sources/Models/Immunization.swift index 59315f18..acda57d1 100644 --- a/Sources/Models/Immunization.swift +++ b/Sources/Models/Immunization.swift @@ -2,7 +2,7 @@ // Immunization.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Immunization) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Immunization) on 2016-09-16. // 2016, SMART Health IT. // @@ -17,7 +17,7 @@ import Foundation * followed. */ public class Immunization: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Immunization" } } @@ -100,208 +100,208 @@ public class Immunization: DomainResource { self.wasNotGiven = wasNotGiven } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["doseQuantity"] { + if let exist = js["doseQuantity"] { presentKeys.insert("doseQuantity") if let val = exist as? FHIRJSON { self.doseQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "doseQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "doseQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["expirationDate"] { + if let exist = js["expirationDate"] { presentKeys.insert("expirationDate") if let val = exist as? String { self.expirationDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "expirationDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "expirationDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["explanation"] { + if let exist = js["explanation"] { presentKeys.insert("explanation") if let val = exist as? FHIRJSON { self.explanation = ImmunizationExplanation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "explanation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "explanation", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? FHIRJSON { self.location = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["lotNumber"] { + if let exist = js["lotNumber"] { presentKeys.insert("lotNumber") if let val = exist as? String { self.lotNumber = val } else { - errors.append(FHIRJSONError(key: "lotNumber", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "lotNumber", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["manufacturer"] { + if let exist = js["manufacturer"] { presentKeys.insert("manufacturer") if let val = exist as? FHIRJSON { self.manufacturer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "manufacturer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "manufacturer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? [FHIRJSON] { self.note = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["performer"] { + if let exist = js["performer"] { presentKeys.insert("performer") if let val = exist as? FHIRJSON { self.performer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "performer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "performer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reaction"] { + if let exist = js["reaction"] { presentKeys.insert("reaction") if let val = exist as? [FHIRJSON] { self.reaction = ImmunizationReaction.instantiate(fromArray: val, owner: self) as? [ImmunizationReaction] } else { - errors.append(FHIRJSONError(key: "reaction", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reaction", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reported"] { + if let exist = js["reported"] { presentKeys.insert("reported") if let val = exist as? Bool { self.reported = val } else { - errors.append(FHIRJSONError(key: "reported", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reported", wants: Bool.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "reported")) } - if let exist: AnyObject = js["requester"] { + if let exist = js["requester"] { presentKeys.insert("requester") if let val = exist as? FHIRJSON { self.requester = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requester", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requester", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["route"] { + if let exist = js["route"] { presentKeys.insert("route") if let val = exist as? FHIRJSON { self.route = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "route", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "route", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["site"] { + if let exist = js["site"] { presentKeys.insert("site") if let val = exist as? FHIRJSON { self.site = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "site", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "site", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["vaccinationProtocol"] { + if let exist = js["vaccinationProtocol"] { presentKeys.insert("vaccinationProtocol") if let val = exist as? [FHIRJSON] { self.vaccinationProtocol = ImmunizationVaccinationProtocol.instantiate(fromArray: val, owner: self) as? [ImmunizationVaccinationProtocol] } else { - errors.append(FHIRJSONError(key: "vaccinationProtocol", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "vaccinationProtocol", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["vaccineCode"] { + if let exist = js["vaccineCode"] { presentKeys.insert("vaccineCode") if let val = exist as? FHIRJSON { self.vaccineCode = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "vaccineCode", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "vaccineCode", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "vaccineCode")) } - if let exist: AnyObject = js["wasNotGiven"] { + if let exist = js["wasNotGiven"] { presentKeys.insert("wasNotGiven") if let val = exist as? Bool { self.wasNotGiven = val } else { - errors.append(FHIRJSONError(key: "wasNotGiven", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "wasNotGiven", wants: Bool.self, has: type(of: exist))) } } else { @@ -389,7 +389,7 @@ public class Immunization: DomainResource { * Reasons why a vaccine was or was not administered. */ public class ImmunizationExplanation: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImmunizationExplanation" } } @@ -405,25 +405,25 @@ public class ImmunizationExplanation: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? [FHIRJSON] { self.reason = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonNotGiven"] { + if let exist = js["reasonNotGiven"] { presentKeys.insert("reasonNotGiven") if let val = exist as? [FHIRJSON] { self.reasonNotGiven = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reasonNotGiven", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonNotGiven", wants: Array.self, has: type(of: exist))) } } } @@ -451,7 +451,7 @@ public class ImmunizationExplanation: BackboneElement { * Categorical data indicating that an adverse event is associated in time to an immunization. */ public class ImmunizationReaction: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImmunizationReaction" } } @@ -470,34 +470,34 @@ public class ImmunizationReaction: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["detail"] { + if let exist = js["detail"] { presentKeys.insert("detail") if let val = exist as? FHIRJSON { self.detail = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "detail", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detail", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reported"] { + if let exist = js["reported"] { presentKeys.insert("reported") if let val = exist as? Bool { self.reported = val } else { - errors.append(FHIRJSONError(key: "reported", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reported", wants: Bool.self, has: type(of: exist))) } } } @@ -528,7 +528,7 @@ public class ImmunizationReaction: BackboneElement { * Contains information about the protocol(s) under which the vaccine was administered. */ public class ImmunizationVaccinationProtocol: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImmunizationVaccinationProtocol" } } @@ -570,85 +570,85 @@ public class ImmunizationVaccinationProtocol: BackboneElement { self.targetDisease = targetDisease } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["authority"] { + if let exist = js["authority"] { presentKeys.insert("authority") if let val = exist as? FHIRJSON { self.authority = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "authority", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "authority", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["doseSequence"] { + if let exist = js["doseSequence"] { presentKeys.insert("doseSequence") if let val = exist as? UInt { self.doseSequence = val } else { - errors.append(FHIRJSONError(key: "doseSequence", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "doseSequence", wants: UInt.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "doseSequence")) } - if let exist: AnyObject = js["doseStatus"] { + if let exist = js["doseStatus"] { presentKeys.insert("doseStatus") if let val = exist as? FHIRJSON { self.doseStatus = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "doseStatus", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "doseStatus", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "doseStatus")) } - if let exist: AnyObject = js["doseStatusReason"] { + if let exist = js["doseStatusReason"] { presentKeys.insert("doseStatusReason") if let val = exist as? FHIRJSON { self.doseStatusReason = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "doseStatusReason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "doseStatusReason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["series"] { + if let exist = js["series"] { presentKeys.insert("series") if let val = exist as? String { self.series = val } else { - errors.append(FHIRJSONError(key: "series", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "series", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["seriesDoses"] { + if let exist = js["seriesDoses"] { presentKeys.insert("seriesDoses") if let val = exist as? UInt { self.seriesDoses = val } else { - errors.append(FHIRJSONError(key: "seriesDoses", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "seriesDoses", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["targetDisease"] { + if let exist = js["targetDisease"] { presentKeys.insert("targetDisease") if let val = exist as? [FHIRJSON] { self.targetDisease = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "targetDisease", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "targetDisease", wants: Array.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/ImmunizationRecommendation.swift b/Sources/Models/ImmunizationRecommendation.swift index 85c5d86c..66fbb2ef 100644 --- a/Sources/Models/ImmunizationRecommendation.swift +++ b/Sources/Models/ImmunizationRecommendation.swift @@ -2,7 +2,7 @@ // ImmunizationRecommendation.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * according to a published schedule) with optional supporting justification. */ public class ImmunizationRecommendation: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImmunizationRecommendation" } } @@ -42,37 +42,37 @@ public class ImmunizationRecommendation: DomainResource { self.recommendation = recommendation } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["recommendation"] { + if let exist = js["recommendation"] { presentKeys.insert("recommendation") if let val = exist as? [FHIRJSON] { self.recommendation = ImmunizationRecommendationRecommendation.instantiate(fromArray: val, owner: self) as? [ImmunizationRecommendationRecommendation] } else { - errors.append(FHIRJSONError(key: "recommendation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "recommendation", wants: Array.self, has: type(of: exist))) } } else { @@ -104,7 +104,7 @@ public class ImmunizationRecommendation: DomainResource { * Vaccine administration recommendations. */ public class ImmunizationRecommendationRecommendation: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImmunizationRecommendationRecommendation" } } @@ -146,85 +146,85 @@ public class ImmunizationRecommendationRecommendation: BackboneElement { self.vaccineCode = vaccineCode } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "date")) } - if let exist: AnyObject = js["dateCriterion"] { + if let exist = js["dateCriterion"] { presentKeys.insert("dateCriterion") if let val = exist as? [FHIRJSON] { self.dateCriterion = ImmunizationRecommendationRecommendationDateCriterion.instantiate(fromArray: val, owner: self) as? [ImmunizationRecommendationRecommendationDateCriterion] } else { - errors.append(FHIRJSONError(key: "dateCriterion", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateCriterion", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["doseNumber"] { + if let exist = js["doseNumber"] { presentKeys.insert("doseNumber") if let val = exist as? UInt { self.doseNumber = val } else { - errors.append(FHIRJSONError(key: "doseNumber", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "doseNumber", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["forecastStatus"] { + if let exist = js["forecastStatus"] { presentKeys.insert("forecastStatus") if let val = exist as? FHIRJSON { self.forecastStatus = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "forecastStatus", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "forecastStatus", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "forecastStatus")) } - if let exist: AnyObject = js["protocol"] { + if let exist = js["protocol"] { presentKeys.insert("protocol") if let val = exist as? FHIRJSON { self.protocol_fhir = ImmunizationRecommendationRecommendationProtocol(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "protocol", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "protocol", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["supportingImmunization"] { + if let exist = js["supportingImmunization"] { presentKeys.insert("supportingImmunization") if let val = exist as? [FHIRJSON] { self.supportingImmunization = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "supportingImmunization", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "supportingImmunization", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["supportingPatientInformation"] { + if let exist = js["supportingPatientInformation"] { presentKeys.insert("supportingPatientInformation") if let val = exist as? [FHIRJSON] { self.supportingPatientInformation = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "supportingPatientInformation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "supportingPatientInformation", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["vaccineCode"] { + if let exist = js["vaccineCode"] { presentKeys.insert("vaccineCode") if let val = exist as? FHIRJSON { self.vaccineCode = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "vaccineCode", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "vaccineCode", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -273,7 +273,7 @@ public class ImmunizationRecommendationRecommendation: BackboneElement { * Vaccine date recommendations. For example, earliest date to administer, latest date to administer, etc. */ public class ImmunizationRecommendationRecommendationDateCriterion: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImmunizationRecommendationRecommendationDateCriterion" } } @@ -296,28 +296,28 @@ public class ImmunizationRecommendationRecommendationDateCriterion: BackboneElem self.value = value } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? String { self.value = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: String.self, has: type(of: exist))) } } else { @@ -348,7 +348,7 @@ public class ImmunizationRecommendationRecommendationDateCriterion: BackboneElem * Contains information about the protocol under which the vaccine was administered. */ public class ImmunizationRecommendationRecommendationProtocol: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImmunizationRecommendationRecommendationProtocol" } } @@ -370,43 +370,43 @@ public class ImmunizationRecommendationRecommendationProtocol: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["authority"] { + if let exist = js["authority"] { presentKeys.insert("authority") if let val = exist as? FHIRJSON { self.authority = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "authority", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "authority", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["doseSequence"] { + if let exist = js["doseSequence"] { presentKeys.insert("doseSequence") if let val = exist as? Int { self.doseSequence = val } else { - errors.append(FHIRJSONError(key: "doseSequence", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "doseSequence", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["series"] { + if let exist = js["series"] { presentKeys.insert("series") if let val = exist as? String { self.series = val } else { - errors.append(FHIRJSONError(key: "series", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "series", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/ImplementationGuide.swift b/Sources/Models/ImplementationGuide.swift index 67904517..233bec1a 100644 --- a/Sources/Models/ImplementationGuide.swift +++ b/Sources/Models/ImplementationGuide.swift @@ -2,7 +2,7 @@ // ImplementationGuide.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImplementationGuide) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ImplementationGuide) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * an implementation guide into a logical whole, and to publish a computable definition of all the parts. */ public class ImplementationGuide: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImplementationGuide" } } @@ -87,175 +87,175 @@ public class ImplementationGuide: DomainResource { self.url = url } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["binary"] { + if let exist = js["binary"] { presentKeys.insert("binary") if let val = exist as? [String] { self.binary = URL.instantiate(fromArray: val) } else { - errors.append(FHIRJSONError(key: "binary", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "binary", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = ImplementationGuideContact.instantiate(fromArray: val, owner: self) as? [ImplementationGuideContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["copyright"] { + if let exist = js["copyright"] { presentKeys.insert("copyright") if let val = exist as? String { self.copyright = val } else { - errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dependency"] { + if let exist = js["dependency"] { presentKeys.insert("dependency") if let val = exist as? [FHIRJSON] { self.dependency = ImplementationGuideDependency.instantiate(fromArray: val, owner: self) as? [ImplementationGuideDependency] } else { - errors.append(FHIRJSONError(key: "dependency", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dependency", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["experimental"] { + if let exist = js["experimental"] { presentKeys.insert("experimental") if let val = exist as? Bool { self.experimental = val } else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fhirVersion"] { + if let exist = js["fhirVersion"] { presentKeys.insert("fhirVersion") if let val = exist as? String { self.fhirVersion = val } else { - errors.append(FHIRJSONError(key: "fhirVersion", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fhirVersion", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["global"] { + if let exist = js["global"] { presentKeys.insert("global") if let val = exist as? [FHIRJSON] { self.global = ImplementationGuideGlobal.instantiate(fromArray: val, owner: self) as? [ImplementationGuideGlobal] } else { - errors.append(FHIRJSONError(key: "global", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "global", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["package"] { + if let exist = js["package"] { presentKeys.insert("package") if let val = exist as? [FHIRJSON] { self.package = ImplementationGuidePackage.instantiate(fromArray: val, owner: self) as? [ImplementationGuidePackage] } else { - errors.append(FHIRJSONError(key: "package", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "package", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "package")) } - if let exist: AnyObject = js["page"] { + if let exist = js["page"] { presentKeys.insert("page") if let val = exist as? FHIRJSON { self.page = ImplementationGuidePage(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "page", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "page", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "page")) } - if let exist: AnyObject = js["publisher"] { + if let exist = js["publisher"] { presentKeys.insert("publisher") if let val = exist as? String { self.publisher = val } else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "url")) } - if let exist: AnyObject = js["useContext"] { + if let exist = js["useContext"] { presentKeys.insert("useContext") if let val = exist as? [FHIRJSON] { self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } @@ -266,7 +266,7 @@ public class ImplementationGuide: DomainResource { var json = super.asJSON() if let binary = self.binary { - var arr = [AnyObject]() + var arr = [Any]() for val in binary { arr.append(val.asJSON()) } @@ -332,7 +332,7 @@ public class ImplementationGuide: DomainResource { * Contacts to assist a user in finding and communicating with the publisher. */ public class ImplementationGuideContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImplementationGuideContact" } } @@ -348,25 +348,25 @@ public class ImplementationGuideContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -395,7 +395,7 @@ public class ImplementationGuideContact: BackboneElement { * sets, profiles etc.defined in other implementation guides. */ public class ImplementationGuideDependency: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImplementationGuideDependency" } } @@ -418,28 +418,28 @@ public class ImplementationGuideDependency: BackboneElement { self.uri = uri } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["uri"] { + if let exist = js["uri"] { presentKeys.insert("uri") if let val = exist as? String { self.uri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "uri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "uri", wants: String.self, has: type(of: exist))) } } else { @@ -470,7 +470,7 @@ public class ImplementationGuideDependency: BackboneElement { * A set of profiles that all resources covered by this implementation guide must conform to. */ public class ImplementationGuideGlobal: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImplementationGuideGlobal" } } @@ -493,28 +493,28 @@ public class ImplementationGuideGlobal: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["profile"] { + if let exist = js["profile"] { presentKeys.insert("profile") if let val = exist as? FHIRJSON { self.profile = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "profile")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { @@ -545,7 +545,7 @@ public class ImplementationGuideGlobal: BackboneElement { * A logical group of resources. Logical groups can be used when building pages. */ public class ImplementationGuidePackage: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImplementationGuidePackage" } } @@ -571,37 +571,37 @@ public class ImplementationGuidePackage: BackboneElement { self.resource = resource } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["resource"] { + if let exist = js["resource"] { presentKeys.insert("resource") if let val = exist as? [FHIRJSON] { self.resource = ImplementationGuidePackageResource.instantiate(fromArray: val, owner: self) as? [ImplementationGuidePackageResource] } else { - errors.append(FHIRJSONError(key: "resource", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "resource", wants: Array.self, has: type(of: exist))) } } else { @@ -637,7 +637,7 @@ public class ImplementationGuidePackage: BackboneElement { * example resource. */ public class ImplementationGuidePackageResource: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImplementationGuidePackageResource" } } @@ -676,73 +676,73 @@ public class ImplementationGuidePackageResource: BackboneElement { self.sourceUri = sourceUri } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["acronym"] { + if let exist = js["acronym"] { presentKeys.insert("acronym") if let val = exist as? String { self.acronym = val } else { - errors.append(FHIRJSONError(key: "acronym", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "acronym", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exampleFor"] { + if let exist = js["exampleFor"] { presentKeys.insert("exampleFor") if let val = exist as? FHIRJSON { self.exampleFor = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "exampleFor", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exampleFor", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["purpose"] { + if let exist = js["purpose"] { presentKeys.insert("purpose") if let val = exist as? String { self.purpose = val } else { - errors.append(FHIRJSONError(key: "purpose", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "purpose", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "purpose")) } - if let exist: AnyObject = js["sourceReference"] { + if let exist = js["sourceReference"] { presentKeys.insert("sourceReference") if let val = exist as? FHIRJSON { self.sourceReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "sourceReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sourceReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sourceUri"] { + if let exist = js["sourceUri"] { presentKeys.insert("sourceUri") if let val = exist as? String { self.sourceUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "sourceUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sourceUri", wants: String.self, has: type(of: exist))) } } @@ -790,7 +790,7 @@ public class ImplementationGuidePackageResource: BackboneElement { * A page / section in the implementation guide. The root page is the implementation guide home page. */ public class ImplementationGuidePage: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ImplementationGuidePage" } } @@ -829,79 +829,79 @@ public class ImplementationGuidePage: BackboneElement { self.source = source } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["format"] { + if let exist = js["format"] { presentKeys.insert("format") if let val = exist as? String { self.format = val } else { - errors.append(FHIRJSONError(key: "format", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "format", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["kind"] { + if let exist = js["kind"] { presentKeys.insert("kind") if let val = exist as? String { self.kind = val } else { - errors.append(FHIRJSONError(key: "kind", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "kind", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "kind")) } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["package"] { + if let exist = js["package"] { presentKeys.insert("package") if let val = exist as? [String] { self.package = val } else { - errors.append(FHIRJSONError(key: "package", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "package", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["page"] { + if let exist = js["page"] { presentKeys.insert("page") if let val = exist as? [FHIRJSON] { self.page = ImplementationGuidePage.instantiate(fromArray: val, owner: self) as? [ImplementationGuidePage] } else { - errors.append(FHIRJSONError(key: "page", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "page", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["source"] { + if let exist = js["source"] { presentKeys.insert("source") if let val = exist as? String { self.source = URL(string: val) } else { - errors.append(FHIRJSONError(key: "source", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "source", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "source")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? [String] { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: type(of: exist))) } } } @@ -921,7 +921,7 @@ public class ImplementationGuidePage: BackboneElement { json["name"] = name.asJSON() } if let package = self.package { - var arr = [AnyObject]() + var arr = [Any]() for val in package { arr.append(val.asJSON()) } @@ -934,7 +934,7 @@ public class ImplementationGuidePage: BackboneElement { json["source"] = source.asJSON() } if let type = self.type { - var arr = [AnyObject]() + var arr = [Any]() for val in type { arr.append(val.asJSON()) } diff --git a/Sources/Models/List.swift b/Sources/Models/List.swift index cd13a38f..7868b439 100644 --- a/Sources/Models/List.swift +++ b/Sources/Models/List.swift @@ -2,7 +2,7 @@ // List.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/List) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/List) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A set of information summarized from a list of other resources. */ public class List: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "List" } } @@ -71,130 +71,130 @@ public class List: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["emptyReason"] { + if let exist = js["emptyReason"] { presentKeys.insert("emptyReason") if let val = exist as? FHIRJSON { self.emptyReason = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "emptyReason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "emptyReason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["entry"] { + if let exist = js["entry"] { presentKeys.insert("entry") if let val = exist as? [FHIRJSON] { self.entry = ListEntry.instantiate(fromArray: val, owner: self) as? [ListEntry] } else { - errors.append(FHIRJSONError(key: "entry", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entry", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["mode"] { + if let exist = js["mode"] { presentKeys.insert("mode") if let val = exist as? String { self.mode = val } else { - errors.append(FHIRJSONError(key: "mode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mode", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "mode")) } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? String { self.note = val } else { - errors.append(FHIRJSONError(key: "note", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["orderedBy"] { + if let exist = js["orderedBy"] { presentKeys.insert("orderedBy") if let val = exist as? FHIRJSON { self.orderedBy = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "orderedBy", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "orderedBy", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["source"] { + if let exist = js["source"] { presentKeys.insert("source") if let val = exist as? FHIRJSON { self.source = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["title"] { + if let exist = js["title"] { presentKeys.insert("title") if let val = exist as? String { self.title = val } else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "title", wants: String.self, has: type(of: exist))) } } } @@ -255,7 +255,7 @@ public class List: DomainResource { * Entries in this list. */ public class ListEntry: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ListEntry" } } @@ -283,43 +283,43 @@ public class ListEntry: BackboneElement { self.item = item } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["deleted"] { + if let exist = js["deleted"] { presentKeys.insert("deleted") if let val = exist as? Bool { self.deleted = val } else { - errors.append(FHIRJSONError(key: "deleted", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "deleted", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["flag"] { + if let exist = js["flag"] { presentKeys.insert("flag") if let val = exist as? FHIRJSON { self.flag = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "flag", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "flag", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["item"] { + if let exist = js["item"] { presentKeys.insert("item") if let val = exist as? FHIRJSON { self.item = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Location.swift b/Sources/Models/Location.swift index 65c8d67a..e7a485cc 100644 --- a/Sources/Models/Location.swift +++ b/Sources/Models/Location.swift @@ -2,7 +2,7 @@ // Location.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Location) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Location) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * may be stored, found, contained or accommodated. */ public class Location: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Location" } } @@ -62,115 +62,115 @@ public class Location: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["address"] { + if let exist = js["address"] { presentKeys.insert("address") if let val = exist as? FHIRJSON { self.address = Address(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "address", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "address", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["managingOrganization"] { + if let exist = js["managingOrganization"] { presentKeys.insert("managingOrganization") if let val = exist as? FHIRJSON { self.managingOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["mode"] { + if let exist = js["mode"] { presentKeys.insert("mode") if let val = exist as? String { self.mode = val } else { - errors.append(FHIRJSONError(key: "mode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["partOf"] { + if let exist = js["partOf"] { presentKeys.insert("partOf") if let val = exist as? FHIRJSON { self.partOf = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "partOf", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "partOf", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["physicalType"] { + if let exist = js["physicalType"] { presentKeys.insert("physicalType") if let val = exist as? FHIRJSON { self.physicalType = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "physicalType", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "physicalType", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["position"] { + if let exist = js["position"] { presentKeys.insert("position") if let val = exist as? FHIRJSON { self.position = LocationPosition(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "position", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "position", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -229,7 +229,7 @@ public class Location: DomainResource { * system used in KML). */ public class LocationPosition: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "LocationPosition" } } @@ -255,37 +255,37 @@ public class LocationPosition: BackboneElement { self.longitude = longitude } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["altitude"] { + if let exist = js["altitude"] { presentKeys.insert("altitude") if let val = exist as? NSNumber { self.altitude = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "altitude", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "altitude", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["latitude"] { + if let exist = js["latitude"] { presentKeys.insert("latitude") if let val = exist as? NSNumber { self.latitude = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "latitude", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "latitude", wants: NSNumber.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "latitude")) } - if let exist: AnyObject = js["longitude"] { + if let exist = js["longitude"] { presentKeys.insert("longitude") if let val = exist as? NSNumber { self.longitude = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "longitude", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "longitude", wants: NSNumber.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Media.swift b/Sources/Models/Media.swift index a2c4becd..c12b0e92 100644 --- a/Sources/Models/Media.swift +++ b/Sources/Models/Media.swift @@ -2,7 +2,7 @@ // Media.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Media) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Media) on 2016-09-16. // 2016, SMART Health IT. // @@ -14,7 +14,7 @@ import Foundation * direct reference. */ public class Media: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Media" } } @@ -67,121 +67,121 @@ public class Media: DomainResource { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["content"] { + if let exist = js["content"] { presentKeys.insert("content") if let val = exist as? FHIRJSON { self.content = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "content", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "content", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "content")) } - if let exist: AnyObject = js["deviceName"] { + if let exist = js["deviceName"] { presentKeys.insert("deviceName") if let val = exist as? String { self.deviceName = val } else { - errors.append(FHIRJSONError(key: "deviceName", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "deviceName", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["duration"] { + if let exist = js["duration"] { presentKeys.insert("duration") if let val = exist as? UInt { self.duration = val } else { - errors.append(FHIRJSONError(key: "duration", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "duration", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["frames"] { + if let exist = js["frames"] { presentKeys.insert("frames") if let val = exist as? UInt { self.frames = val } else { - errors.append(FHIRJSONError(key: "frames", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "frames", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["height"] { + if let exist = js["height"] { presentKeys.insert("height") if let val = exist as? UInt { self.height = val } else { - errors.append(FHIRJSONError(key: "height", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "height", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["operator"] { + if let exist = js["operator"] { presentKeys.insert("operator") if let val = exist as? FHIRJSON { self.operator_fhir = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "operator", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "operator", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subtype"] { + if let exist = js["subtype"] { presentKeys.insert("subtype") if let val = exist as? FHIRJSON { self.subtype = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subtype", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subtype", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["view"] { + if let exist = js["view"] { presentKeys.insert("view") if let val = exist as? FHIRJSON { self.view = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "view", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "view", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["width"] { + if let exist = js["width"] { presentKeys.insert("width") if let val = exist as? UInt { self.width = val } else { - errors.append(FHIRJSONError(key: "width", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "width", wants: UInt.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Medication.swift b/Sources/Models/Medication.swift index 163f0aef..3e39f1a7 100644 --- a/Sources/Models/Medication.swift +++ b/Sources/Models/Medication.swift @@ -2,7 +2,7 @@ // Medication.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Medication) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Medication) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * the packaging for a medication. */ public class Medication: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Medication" } } @@ -41,52 +41,52 @@ public class Medication: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["isBrand"] { + if let exist = js["isBrand"] { presentKeys.insert("isBrand") if let val = exist as? Bool { self.isBrand = val } else { - errors.append(FHIRJSONError(key: "isBrand", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "isBrand", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["manufacturer"] { + if let exist = js["manufacturer"] { presentKeys.insert("manufacturer") if let val = exist as? FHIRJSON { self.manufacturer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "manufacturer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "manufacturer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["package"] { + if let exist = js["package"] { presentKeys.insert("package") if let val = exist as? FHIRJSON { self.package = MedicationPackage(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "package", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "package", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["product"] { + if let exist = js["product"] { presentKeys.insert("product") if let val = exist as? FHIRJSON { self.product = MedicationProduct(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "product", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "product", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -123,7 +123,7 @@ public class Medication: DomainResource { * Information that only applies to packages (not products). */ public class MedicationPackage: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationPackage" } } @@ -139,25 +139,25 @@ public class MedicationPackage: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["container"] { + if let exist = js["container"] { presentKeys.insert("container") if let val = exist as? FHIRJSON { self.container = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "container", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "container", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["content"] { + if let exist = js["content"] { presentKeys.insert("content") if let val = exist as? [FHIRJSON] { self.content = MedicationPackageContent.instantiate(fromArray: val, owner: self) as? [MedicationPackageContent] } else { - errors.append(FHIRJSONError(key: "content", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "content", wants: Array.self, has: type(of: exist))) } } } @@ -185,7 +185,7 @@ public class MedicationPackage: BackboneElement { * A set of components that go to make up the described item. */ public class MedicationPackageContent: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationPackageContent" } } @@ -207,25 +207,25 @@ public class MedicationPackageContent: BackboneElement { self.item = item } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["amount"] { + if let exist = js["amount"] { presentKeys.insert("amount") if let val = exist as? FHIRJSON { self.amount = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["item"] { + if let exist = js["item"] { presentKeys.insert("item") if let val = exist as? FHIRJSON { self.item = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -256,7 +256,7 @@ public class MedicationPackageContent: BackboneElement { * Information that only applies to products (not packages). */ public class MedicationProduct: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationProduct" } } @@ -275,34 +275,34 @@ public class MedicationProduct: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["batch"] { + if let exist = js["batch"] { presentKeys.insert("batch") if let val = exist as? [FHIRJSON] { self.batch = MedicationProductBatch.instantiate(fromArray: val, owner: self) as? [MedicationProductBatch] } else { - errors.append(FHIRJSONError(key: "batch", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "batch", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["form"] { + if let exist = js["form"] { presentKeys.insert("form") if let val = exist as? FHIRJSON { self.form = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "form", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "form", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ingredient"] { + if let exist = js["ingredient"] { presentKeys.insert("ingredient") if let val = exist as? [FHIRJSON] { self.ingredient = MedicationProductIngredient.instantiate(fromArray: val, owner: self) as? [MedicationProductIngredient] } else { - errors.append(FHIRJSONError(key: "ingredient", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ingredient", wants: Array.self, has: type(of: exist))) } } } @@ -333,7 +333,7 @@ public class MedicationProduct: BackboneElement { * Information about a group of medication produced or packaged from one production run. */ public class MedicationProductBatch: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationProductBatch" } } @@ -349,25 +349,25 @@ public class MedicationProductBatch: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["expirationDate"] { + if let exist = js["expirationDate"] { presentKeys.insert("expirationDate") if let val = exist as? String { self.expirationDate = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "expirationDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "expirationDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["lotNumber"] { + if let exist = js["lotNumber"] { presentKeys.insert("lotNumber") if let val = exist as? String { self.lotNumber = val } else { - errors.append(FHIRJSONError(key: "lotNumber", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "lotNumber", wants: String.self, has: type(of: exist))) } } } @@ -395,7 +395,7 @@ public class MedicationProductBatch: BackboneElement { * Identifies a particular constituent of interest in the product. */ public class MedicationProductIngredient: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationProductIngredient" } } @@ -417,25 +417,25 @@ public class MedicationProductIngredient: BackboneElement { self.item = item } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["amount"] { + if let exist = js["amount"] { presentKeys.insert("amount") if let val = exist as? FHIRJSON { self.amount = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["item"] { + if let exist = js["item"] { presentKeys.insert("item") if let val = exist as? FHIRJSON { self.item = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/MedicationAdministration.swift b/Sources/Models/MedicationAdministration.swift index 7a50ada4..55c28bec 100644 --- a/Sources/Models/MedicationAdministration.swift +++ b/Sources/Models/MedicationAdministration.swift @@ -2,7 +2,7 @@ // MedicationAdministration.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationAdministration) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationAdministration) on 2016-09-16. // 2016, SMART Health IT. // @@ -17,7 +17,7 @@ import Foundation * prescription, and the specific encounter between patient and health care practitioner. */ public class MedicationAdministration: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationAdministration" } } @@ -86,157 +86,157 @@ public class MedicationAdministration: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["device"] { + if let exist = js["device"] { presentKeys.insert("device") if let val = exist as? [FHIRJSON] { self.device = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "device", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "device", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dosage"] { + if let exist = js["dosage"] { presentKeys.insert("dosage") if let val = exist as? FHIRJSON { self.dosage = MedicationAdministrationDosage(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "dosage", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dosage", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["effectiveTimeDateTime"] { + if let exist = js["effectiveTimeDateTime"] { presentKeys.insert("effectiveTimeDateTime") if let val = exist as? String { self.effectiveTimeDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "effectiveTimeDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "effectiveTimeDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["effectiveTimePeriod"] { + if let exist = js["effectiveTimePeriod"] { presentKeys.insert("effectiveTimePeriod") if let val = exist as? FHIRJSON { self.effectiveTimePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "effectiveTimePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "effectiveTimePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medicationCodeableConcept"] { + if let exist = js["medicationCodeableConcept"] { presentKeys.insert("medicationCodeableConcept") if let val = exist as? FHIRJSON { self.medicationCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "medicationCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medicationCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medicationReference"] { + if let exist = js["medicationReference"] { presentKeys.insert("medicationReference") if let val = exist as? FHIRJSON { self.medicationReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "medicationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medicationReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? String { self.note = val } else { - errors.append(FHIRJSONError(key: "note", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["practitioner"] { + if let exist = js["practitioner"] { presentKeys.insert("practitioner") if let val = exist as? FHIRJSON { self.practitioner = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "practitioner", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "practitioner", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["prescription"] { + if let exist = js["prescription"] { presentKeys.insert("prescription") if let val = exist as? FHIRJSON { self.prescription = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "prescription", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prescription", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonGiven"] { + if let exist = js["reasonGiven"] { presentKeys.insert("reasonGiven") if let val = exist as? [FHIRJSON] { self.reasonGiven = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reasonGiven", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonGiven", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonNotGiven"] { + if let exist = js["reasonNotGiven"] { presentKeys.insert("reasonNotGiven") if let val = exist as? [FHIRJSON] { self.reasonNotGiven = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reasonNotGiven", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonNotGiven", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["wasNotGiven"] { + if let exist = js["wasNotGiven"] { presentKeys.insert("wasNotGiven") if let val = exist as? Bool { self.wasNotGiven = val } else { - errors.append(FHIRJSONError(key: "wasNotGiven", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "wasNotGiven", wants: Bool.self, has: type(of: exist))) } } @@ -314,7 +314,7 @@ public class MedicationAdministration: DomainResource { * Describes the medication dosage information details e.g. dose, rate, site, route, etc. */ public class MedicationAdministrationDosage: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationAdministrationDosage" } } @@ -348,79 +348,79 @@ public class MedicationAdministrationDosage: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["method"] { + if let exist = js["method"] { presentKeys.insert("method") if let val = exist as? FHIRJSON { self.method = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rateRange"] { + if let exist = js["rateRange"] { presentKeys.insert("rateRange") if let val = exist as? FHIRJSON { self.rateRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "rateRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rateRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rateRatio"] { + if let exist = js["rateRatio"] { presentKeys.insert("rateRatio") if let val = exist as? FHIRJSON { self.rateRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "rateRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rateRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["route"] { + if let exist = js["route"] { presentKeys.insert("route") if let val = exist as? FHIRJSON { self.route = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "route", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "route", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["siteCodeableConcept"] { + if let exist = js["siteCodeableConcept"] { presentKeys.insert("siteCodeableConcept") if let val = exist as? FHIRJSON { self.siteCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "siteCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "siteCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["siteReference"] { + if let exist = js["siteReference"] { presentKeys.insert("siteReference") if let val = exist as? FHIRJSON { self.siteReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "siteReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "siteReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/MedicationDispense.swift b/Sources/Models/MedicationDispense.swift index 9db613ba..d37bc56d 100644 --- a/Sources/Models/MedicationDispense.swift +++ b/Sources/Models/MedicationDispense.swift @@ -2,7 +2,7 @@ // MedicationDispense.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationDispense) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationDispense) on 2016-09-16. // 2016, SMART Health IT. // @@ -17,7 +17,7 @@ import Foundation * medication dispense is the result of a pharmacy system responding to a medication order. */ public class MedicationDispense: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationDispense" } } @@ -85,160 +85,160 @@ public class MedicationDispense: DomainResource { self.medicationReference = medicationReference } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["authorizingPrescription"] { + if let exist = js["authorizingPrescription"] { presentKeys.insert("authorizingPrescription") if let val = exist as? [FHIRJSON] { self.authorizingPrescription = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "authorizingPrescription", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "authorizingPrescription", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["daysSupply"] { + if let exist = js["daysSupply"] { presentKeys.insert("daysSupply") if let val = exist as? FHIRJSON { self.daysSupply = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "daysSupply", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "daysSupply", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["destination"] { + if let exist = js["destination"] { presentKeys.insert("destination") if let val = exist as? FHIRJSON { self.destination = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "destination", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "destination", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dispenser"] { + if let exist = js["dispenser"] { presentKeys.insert("dispenser") if let val = exist as? FHIRJSON { self.dispenser = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "dispenser", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dispenser", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dosageInstruction"] { + if let exist = js["dosageInstruction"] { presentKeys.insert("dosageInstruction") if let val = exist as? [FHIRJSON] { self.dosageInstruction = MedicationDispenseDosageInstruction.instantiate(fromArray: val, owner: self) as? [MedicationDispenseDosageInstruction] } else { - errors.append(FHIRJSONError(key: "dosageInstruction", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dosageInstruction", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medicationCodeableConcept"] { + if let exist = js["medicationCodeableConcept"] { presentKeys.insert("medicationCodeableConcept") if let val = exist as? FHIRJSON { self.medicationCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "medicationCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medicationCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medicationReference"] { + if let exist = js["medicationReference"] { presentKeys.insert("medicationReference") if let val = exist as? FHIRJSON { self.medicationReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "medicationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medicationReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? String { self.note = val } else { - errors.append(FHIRJSONError(key: "note", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["receiver"] { + if let exist = js["receiver"] { presentKeys.insert("receiver") if let val = exist as? [FHIRJSON] { self.receiver = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "receiver", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "receiver", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["substitution"] { + if let exist = js["substitution"] { presentKeys.insert("substitution") if let val = exist as? FHIRJSON { self.substitution = MedicationDispenseSubstitution(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "substitution", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "substitution", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["whenHandedOver"] { + if let exist = js["whenHandedOver"] { presentKeys.insert("whenHandedOver") if let val = exist as? String { self.whenHandedOver = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "whenHandedOver", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "whenHandedOver", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["whenPrepared"] { + if let exist = js["whenPrepared"] { presentKeys.insert("whenPrepared") if let val = exist as? String { self.whenPrepared = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "whenPrepared", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "whenPrepared", wants: String.self, has: type(of: exist))) } } @@ -316,7 +316,7 @@ public class MedicationDispense: DomainResource { * Indicates how the medication is to be used by the patient. */ public class MedicationDispenseDosageInstruction: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationDispenseDosageInstruction" } } @@ -368,133 +368,133 @@ public class MedicationDispenseDosageInstruction: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["additionalInstructions"] { + if let exist = js["additionalInstructions"] { presentKeys.insert("additionalInstructions") if let val = exist as? FHIRJSON { self.additionalInstructions = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "additionalInstructions", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "additionalInstructions", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["asNeededBoolean"] { + if let exist = js["asNeededBoolean"] { presentKeys.insert("asNeededBoolean") if let val = exist as? Bool { self.asNeededBoolean = val } else { - errors.append(FHIRJSONError(key: "asNeededBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "asNeededBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["asNeededCodeableConcept"] { + if let exist = js["asNeededCodeableConcept"] { presentKeys.insert("asNeededCodeableConcept") if let val = exist as? FHIRJSON { self.asNeededCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "asNeededCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "asNeededCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["doseQuantity"] { + if let exist = js["doseQuantity"] { presentKeys.insert("doseQuantity") if let val = exist as? FHIRJSON { self.doseQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "doseQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "doseQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["doseRange"] { + if let exist = js["doseRange"] { presentKeys.insert("doseRange") if let val = exist as? FHIRJSON { self.doseRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "doseRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "doseRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxDosePerPeriod"] { + if let exist = js["maxDosePerPeriod"] { presentKeys.insert("maxDosePerPeriod") if let val = exist as? FHIRJSON { self.maxDosePerPeriod = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxDosePerPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxDosePerPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["method"] { + if let exist = js["method"] { presentKeys.insert("method") if let val = exist as? FHIRJSON { self.method = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rateRange"] { + if let exist = js["rateRange"] { presentKeys.insert("rateRange") if let val = exist as? FHIRJSON { self.rateRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "rateRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rateRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rateRatio"] { + if let exist = js["rateRatio"] { presentKeys.insert("rateRatio") if let val = exist as? FHIRJSON { self.rateRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "rateRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rateRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["route"] { + if let exist = js["route"] { presentKeys.insert("route") if let val = exist as? FHIRJSON { self.route = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "route", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "route", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["siteCodeableConcept"] { + if let exist = js["siteCodeableConcept"] { presentKeys.insert("siteCodeableConcept") if let val = exist as? FHIRJSON { self.siteCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "siteCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "siteCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["siteReference"] { + if let exist = js["siteReference"] { presentKeys.insert("siteReference") if let val = exist as? FHIRJSON { self.siteReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "siteReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "siteReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["timing"] { + if let exist = js["timing"] { presentKeys.insert("timing") if let val = exist as? FHIRJSON { self.timing = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "timing", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "timing", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -560,7 +560,7 @@ public class MedicationDispenseDosageInstruction: BackboneElement { * substitution did or did not happen and why. */ public class MedicationDispenseSubstitution: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationDispenseSubstitution" } } @@ -585,34 +585,34 @@ public class MedicationDispenseSubstitution: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? [FHIRJSON] { self.reason = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["responsibleParty"] { + if let exist = js["responsibleParty"] { presentKeys.insert("responsibleParty") if let val = exist as? [FHIRJSON] { self.responsibleParty = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "responsibleParty", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "responsibleParty", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/MedicationOrder.swift b/Sources/Models/MedicationOrder.swift index 665b298e..09e4df58 100644 --- a/Sources/Models/MedicationOrder.swift +++ b/Sources/Models/MedicationOrder.swift @@ -2,7 +2,7 @@ // MedicationOrder.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationOrder) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationOrder) on 2016-09-16. // 2016, SMART Health IT. // @@ -17,7 +17,7 @@ import Foundation * and outpatient settings as well as for care plans, etc. */ public class MedicationOrder: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationOrder" } } @@ -85,160 +85,160 @@ public class MedicationOrder: DomainResource { self.medicationReference = medicationReference } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["dateEnded"] { + if let exist = js["dateEnded"] { presentKeys.insert("dateEnded") if let val = exist as? String { self.dateEnded = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "dateEnded", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateEnded", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dateWritten"] { + if let exist = js["dateWritten"] { presentKeys.insert("dateWritten") if let val = exist as? String { self.dateWritten = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "dateWritten", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateWritten", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dispenseRequest"] { + if let exist = js["dispenseRequest"] { presentKeys.insert("dispenseRequest") if let val = exist as? FHIRJSON { self.dispenseRequest = MedicationOrderDispenseRequest(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "dispenseRequest", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dispenseRequest", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dosageInstruction"] { + if let exist = js["dosageInstruction"] { presentKeys.insert("dosageInstruction") if let val = exist as? [FHIRJSON] { self.dosageInstruction = MedicationOrderDosageInstruction.instantiate(fromArray: val, owner: self) as? [MedicationOrderDosageInstruction] } else { - errors.append(FHIRJSONError(key: "dosageInstruction", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dosageInstruction", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medicationCodeableConcept"] { + if let exist = js["medicationCodeableConcept"] { presentKeys.insert("medicationCodeableConcept") if let val = exist as? FHIRJSON { self.medicationCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "medicationCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medicationCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medicationReference"] { + if let exist = js["medicationReference"] { presentKeys.insert("medicationReference") if let val = exist as? FHIRJSON { self.medicationReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "medicationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medicationReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? String { self.note = val } else { - errors.append(FHIRJSONError(key: "note", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["prescriber"] { + if let exist = js["prescriber"] { presentKeys.insert("prescriber") if let val = exist as? FHIRJSON { self.prescriber = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "prescriber", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prescriber", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["priorPrescription"] { + if let exist = js["priorPrescription"] { presentKeys.insert("priorPrescription") if let val = exist as? FHIRJSON { self.priorPrescription = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "priorPrescription", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priorPrescription", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonCodeableConcept"] { + if let exist = js["reasonCodeableConcept"] { presentKeys.insert("reasonCodeableConcept") if let val = exist as? FHIRJSON { self.reasonCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonEnded"] { + if let exist = js["reasonEnded"] { presentKeys.insert("reasonEnded") if let val = exist as? FHIRJSON { self.reasonEnded = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonEnded", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonEnded", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonReference"] { + if let exist = js["reasonReference"] { presentKeys.insert("reasonReference") if let val = exist as? FHIRJSON { self.reasonReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["substitution"] { + if let exist = js["substitution"] { presentKeys.insert("substitution") if let val = exist as? FHIRJSON { self.substitution = MedicationOrderSubstitution(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "substitution", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "substitution", wants: FHIRJSON.self, has: type(of: exist))) } } @@ -319,7 +319,7 @@ public class MedicationOrder: DomainResource { * department. */ public class MedicationOrderDispenseRequest: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationOrderDispenseRequest" } } @@ -347,61 +347,61 @@ public class MedicationOrderDispenseRequest: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["expectedSupplyDuration"] { + if let exist = js["expectedSupplyDuration"] { presentKeys.insert("expectedSupplyDuration") if let val = exist as? FHIRJSON { self.expectedSupplyDuration = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "expectedSupplyDuration", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "expectedSupplyDuration", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medicationCodeableConcept"] { + if let exist = js["medicationCodeableConcept"] { presentKeys.insert("medicationCodeableConcept") if let val = exist as? FHIRJSON { self.medicationCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "medicationCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medicationCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medicationReference"] { + if let exist = js["medicationReference"] { presentKeys.insert("medicationReference") if let val = exist as? FHIRJSON { self.medicationReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "medicationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medicationReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["numberOfRepeatsAllowed"] { + if let exist = js["numberOfRepeatsAllowed"] { presentKeys.insert("numberOfRepeatsAllowed") if let val = exist as? UInt { self.numberOfRepeatsAllowed = val } else { - errors.append(FHIRJSONError(key: "numberOfRepeatsAllowed", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "numberOfRepeatsAllowed", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["validityPeriod"] { + if let exist = js["validityPeriod"] { presentKeys.insert("validityPeriod") if let val = exist as? FHIRJSON { self.validityPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "validityPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "validityPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -441,7 +441,7 @@ public class MedicationOrderDispenseRequest: BackboneElement { * Indicates how the medication is to be used by the patient. */ public class MedicationOrderDosageInstruction: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationOrderDosageInstruction" } } @@ -493,133 +493,133 @@ public class MedicationOrderDosageInstruction: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["additionalInstructions"] { + if let exist = js["additionalInstructions"] { presentKeys.insert("additionalInstructions") if let val = exist as? FHIRJSON { self.additionalInstructions = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "additionalInstructions", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "additionalInstructions", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["asNeededBoolean"] { + if let exist = js["asNeededBoolean"] { presentKeys.insert("asNeededBoolean") if let val = exist as? Bool { self.asNeededBoolean = val } else { - errors.append(FHIRJSONError(key: "asNeededBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "asNeededBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["asNeededCodeableConcept"] { + if let exist = js["asNeededCodeableConcept"] { presentKeys.insert("asNeededCodeableConcept") if let val = exist as? FHIRJSON { self.asNeededCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "asNeededCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "asNeededCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["doseQuantity"] { + if let exist = js["doseQuantity"] { presentKeys.insert("doseQuantity") if let val = exist as? FHIRJSON { self.doseQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "doseQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "doseQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["doseRange"] { + if let exist = js["doseRange"] { presentKeys.insert("doseRange") if let val = exist as? FHIRJSON { self.doseRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "doseRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "doseRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxDosePerPeriod"] { + if let exist = js["maxDosePerPeriod"] { presentKeys.insert("maxDosePerPeriod") if let val = exist as? FHIRJSON { self.maxDosePerPeriod = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxDosePerPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxDosePerPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["method"] { + if let exist = js["method"] { presentKeys.insert("method") if let val = exist as? FHIRJSON { self.method = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rateRange"] { + if let exist = js["rateRange"] { presentKeys.insert("rateRange") if let val = exist as? FHIRJSON { self.rateRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "rateRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rateRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rateRatio"] { + if let exist = js["rateRatio"] { presentKeys.insert("rateRatio") if let val = exist as? FHIRJSON { self.rateRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "rateRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rateRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["route"] { + if let exist = js["route"] { presentKeys.insert("route") if let val = exist as? FHIRJSON { self.route = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "route", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "route", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["siteCodeableConcept"] { + if let exist = js["siteCodeableConcept"] { presentKeys.insert("siteCodeableConcept") if let val = exist as? FHIRJSON { self.siteCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "siteCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "siteCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["siteReference"] { + if let exist = js["siteReference"] { presentKeys.insert("siteReference") if let val = exist as? FHIRJSON { self.siteReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "siteReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "siteReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["timing"] { + if let exist = js["timing"] { presentKeys.insert("timing") if let val = exist as? FHIRJSON { self.timing = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "timing", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "timing", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -685,7 +685,7 @@ public class MedicationOrderDosageInstruction: BackboneElement { * intent. If nothing is specified substitution may be done. */ public class MedicationOrderSubstitution: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationOrderSubstitution" } } @@ -707,25 +707,25 @@ public class MedicationOrderSubstitution: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? FHIRJSON { self.reason = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/MedicationStatement.swift b/Sources/Models/MedicationStatement.swift index 3b3a4055..5d85c5e6 100644 --- a/Sources/Models/MedicationStatement.swift +++ b/Sources/Models/MedicationStatement.swift @@ -2,7 +2,7 @@ // MedicationStatement.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationStatement) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MedicationStatement) on 2016-09-16. // 2016, SMART Health IT. // @@ -28,7 +28,7 @@ import Foundation * administration is more formal and is not missing detailed information. */ public class MedicationStatement: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationStatement" } } @@ -95,157 +95,157 @@ public class MedicationStatement: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["dateAsserted"] { + if let exist = js["dateAsserted"] { presentKeys.insert("dateAsserted") if let val = exist as? String { self.dateAsserted = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "dateAsserted", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateAsserted", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dosage"] { + if let exist = js["dosage"] { presentKeys.insert("dosage") if let val = exist as? [FHIRJSON] { self.dosage = MedicationStatementDosage.instantiate(fromArray: val, owner: self) as? [MedicationStatementDosage] } else { - errors.append(FHIRJSONError(key: "dosage", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dosage", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["effectiveDateTime"] { + if let exist = js["effectiveDateTime"] { presentKeys.insert("effectiveDateTime") if let val = exist as? String { self.effectiveDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "effectiveDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "effectiveDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["effectivePeriod"] { + if let exist = js["effectivePeriod"] { presentKeys.insert("effectivePeriod") if let val = exist as? FHIRJSON { self.effectivePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "effectivePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "effectivePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["informationSource"] { + if let exist = js["informationSource"] { presentKeys.insert("informationSource") if let val = exist as? FHIRJSON { self.informationSource = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "informationSource", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "informationSource", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medicationCodeableConcept"] { + if let exist = js["medicationCodeableConcept"] { presentKeys.insert("medicationCodeableConcept") if let val = exist as? FHIRJSON { self.medicationCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "medicationCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medicationCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["medicationReference"] { + if let exist = js["medicationReference"] { presentKeys.insert("medicationReference") if let val = exist as? FHIRJSON { self.medicationReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "medicationReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "medicationReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? String { self.note = val } else { - errors.append(FHIRJSONError(key: "note", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["reasonForUseCodeableConcept"] { + if let exist = js["reasonForUseCodeableConcept"] { presentKeys.insert("reasonForUseCodeableConcept") if let val = exist as? FHIRJSON { self.reasonForUseCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonForUseCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonForUseCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonForUseReference"] { + if let exist = js["reasonForUseReference"] { presentKeys.insert("reasonForUseReference") if let val = exist as? FHIRJSON { self.reasonForUseReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonForUseReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonForUseReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonNotTaken"] { + if let exist = js["reasonNotTaken"] { presentKeys.insert("reasonNotTaken") if let val = exist as? [FHIRJSON] { self.reasonNotTaken = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reasonNotTaken", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonNotTaken", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["supportingInformation"] { + if let exist = js["supportingInformation"] { presentKeys.insert("supportingInformation") if let val = exist as? [FHIRJSON] { self.supportingInformation = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "supportingInformation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "supportingInformation", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["wasNotTaken"] { + if let exist = js["wasNotTaken"] { presentKeys.insert("wasNotTaken") if let val = exist as? Bool { self.wasNotTaken = val } else { - errors.append(FHIRJSONError(key: "wasNotTaken", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "wasNotTaken", wants: Bool.self, has: type(of: exist))) } } @@ -320,7 +320,7 @@ public class MedicationStatement: DomainResource { * Indicates how the medication is/was used by the patient. */ public class MedicationStatementDosage: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MedicationStatementDosage" } } @@ -369,124 +369,124 @@ public class MedicationStatementDosage: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["asNeededBoolean"] { + if let exist = js["asNeededBoolean"] { presentKeys.insert("asNeededBoolean") if let val = exist as? Bool { self.asNeededBoolean = val } else { - errors.append(FHIRJSONError(key: "asNeededBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "asNeededBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["asNeededCodeableConcept"] { + if let exist = js["asNeededCodeableConcept"] { presentKeys.insert("asNeededCodeableConcept") if let val = exist as? FHIRJSON { self.asNeededCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "asNeededCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "asNeededCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxDosePerPeriod"] { + if let exist = js["maxDosePerPeriod"] { presentKeys.insert("maxDosePerPeriod") if let val = exist as? FHIRJSON { self.maxDosePerPeriod = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxDosePerPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxDosePerPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["method"] { + if let exist = js["method"] { presentKeys.insert("method") if let val = exist as? FHIRJSON { self.method = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantityQuantity"] { + if let exist = js["quantityQuantity"] { presentKeys.insert("quantityQuantity") if let val = exist as? FHIRJSON { self.quantityQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantityQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantityQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantityRange"] { + if let exist = js["quantityRange"] { presentKeys.insert("quantityRange") if let val = exist as? FHIRJSON { self.quantityRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantityRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantityRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rateRange"] { + if let exist = js["rateRange"] { presentKeys.insert("rateRange") if let val = exist as? FHIRJSON { self.rateRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "rateRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rateRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rateRatio"] { + if let exist = js["rateRatio"] { presentKeys.insert("rateRatio") if let val = exist as? FHIRJSON { self.rateRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "rateRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rateRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["route"] { + if let exist = js["route"] { presentKeys.insert("route") if let val = exist as? FHIRJSON { self.route = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "route", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "route", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["siteCodeableConcept"] { + if let exist = js["siteCodeableConcept"] { presentKeys.insert("siteCodeableConcept") if let val = exist as? FHIRJSON { self.siteCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "siteCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "siteCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["siteReference"] { + if let exist = js["siteReference"] { presentKeys.insert("siteReference") if let val = exist as? FHIRJSON { self.siteReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "siteReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "siteReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["timing"] { + if let exist = js["timing"] { presentKeys.insert("timing") if let val = exist as? FHIRJSON { self.timing = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "timing", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "timing", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/MessageHeader.swift b/Sources/Models/MessageHeader.swift index a4f8ffeb..6d81e42e 100644 --- a/Sources/Models/MessageHeader.swift +++ b/Sources/Models/MessageHeader.swift @@ -2,7 +2,7 @@ // MessageHeader.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MessageHeader) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/MessageHeader) on 2016-09-16. // 2016, SMART Health IT. // @@ -17,7 +17,7 @@ import Foundation * in which the MessageHeader resource instance is the first resource in the bundle. */ public class MessageHeader: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MessageHeader" } } @@ -68,112 +68,112 @@ public class MessageHeader: DomainResource { self.timestamp = timestamp } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? FHIRJSON { self.author = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["data"] { + if let exist = js["data"] { presentKeys.insert("data") if let val = exist as? [FHIRJSON] { self.data = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "data", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "data", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["destination"] { + if let exist = js["destination"] { presentKeys.insert("destination") if let val = exist as? [FHIRJSON] { self.destination = MessageHeaderDestination.instantiate(fromArray: val, owner: self) as? [MessageHeaderDestination] } else { - errors.append(FHIRJSONError(key: "destination", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "destination", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["enterer"] { + if let exist = js["enterer"] { presentKeys.insert("enterer") if let val = exist as? FHIRJSON { self.enterer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "enterer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "enterer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["event"] { + if let exist = js["event"] { presentKeys.insert("event") if let val = exist as? FHIRJSON { self.event = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "event", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "event", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "event")) } - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? FHIRJSON { self.reason = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["receiver"] { + if let exist = js["receiver"] { presentKeys.insert("receiver") if let val = exist as? FHIRJSON { self.receiver = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "receiver", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "receiver", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["response"] { + if let exist = js["response"] { presentKeys.insert("response") if let val = exist as? FHIRJSON { self.response = MessageHeaderResponse(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["responsible"] { + if let exist = js["responsible"] { presentKeys.insert("responsible") if let val = exist as? FHIRJSON { self.responsible = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "responsible", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "responsible", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["source"] { + if let exist = js["source"] { presentKeys.insert("source") if let val = exist as? FHIRJSON { self.source = MessageHeaderSource(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "source")) } - if let exist: AnyObject = js["timestamp"] { + if let exist = js["timestamp"] { presentKeys.insert("timestamp") if let val = exist as? String { self.timestamp = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "timestamp", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "timestamp", wants: String.self, has: type(of: exist))) } } else { @@ -231,7 +231,7 @@ public class MessageHeader: DomainResource { * The destination application which the message is intended for. */ public class MessageHeaderDestination: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MessageHeaderDestination" } } @@ -256,37 +256,37 @@ public class MessageHeaderDestination: BackboneElement { self.endpoint = endpoint } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["endpoint"] { + if let exist = js["endpoint"] { presentKeys.insert("endpoint") if let val = exist as? String { self.endpoint = URL(string: val) } else { - errors.append(FHIRJSONError(key: "endpoint", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "endpoint", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "endpoint")) } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? FHIRJSON { self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -317,7 +317,7 @@ public class MessageHeaderDestination: BackboneElement { * Information about the message that this message is a response to. Only present if this message is a response. */ public class MessageHeaderResponse: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MessageHeaderResponse" } } @@ -343,37 +343,37 @@ public class MessageHeaderResponse: BackboneElement { self.identifier = identifier } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["details"] { + if let exist = js["details"] { presentKeys.insert("details") if let val = exist as? FHIRJSON { self.details = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "details", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "details", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? String { self.identifier = val } else { - errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: type(of: exist))) } } else { @@ -407,7 +407,7 @@ public class MessageHeaderResponse: BackboneElement { * The source application from which this message originated. */ public class MessageHeaderSource: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "MessageHeaderSource" } } @@ -438,55 +438,55 @@ public class MessageHeaderSource: BackboneElement { self.endpoint = endpoint } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? FHIRJSON { self.contact = ContactPoint(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "contact", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["endpoint"] { + if let exist = js["endpoint"] { presentKeys.insert("endpoint") if let val = exist as? String { self.endpoint = URL(string: val) } else { - errors.append(FHIRJSONError(key: "endpoint", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "endpoint", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "endpoint")) } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["software"] { + if let exist = js["software"] { presentKeys.insert("software") if let val = exist as? String { self.software = val } else { - errors.append(FHIRJSONError(key: "software", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "software", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Meta.swift b/Sources/Models/Meta.swift index 37d6645d..7fa2aa7b 100644 --- a/Sources/Models/Meta.swift +++ b/Sources/Models/Meta.swift @@ -2,7 +2,7 @@ // Meta.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Meta) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Meta) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * the content may not always be associated with version changes to the resource. */ public class Meta: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Meta" } } @@ -41,52 +41,52 @@ public class Meta: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["lastUpdated"] { + if let exist = js["lastUpdated"] { presentKeys.insert("lastUpdated") if let val = exist as? String { self.lastUpdated = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "lastUpdated", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "lastUpdated", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["profile"] { + if let exist = js["profile"] { presentKeys.insert("profile") if let val = exist as? [String] { self.profile = URL.instantiate(fromArray: val) } else { - errors.append(FHIRJSONError(key: "profile", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "profile", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["security"] { + if let exist = js["security"] { presentKeys.insert("security") if let val = exist as? [FHIRJSON] { self.security = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "security", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "security", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["tag"] { + if let exist = js["tag"] { presentKeys.insert("tag") if let val = exist as? [FHIRJSON] { self.tag = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "tag", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "tag", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["versionId"] { + if let exist = js["versionId"] { presentKeys.insert("versionId") if let val = exist as? String { self.versionId = val } else { - errors.append(FHIRJSONError(key: "versionId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "versionId", wants: String.self, has: type(of: exist))) } } } @@ -100,7 +100,7 @@ public class Meta: Element { json["lastUpdated"] = lastUpdated.asJSON() } if let profile = self.profile { - var arr = [AnyObject]() + var arr = [Any]() for val in profile { arr.append(val.asJSON()) } diff --git a/Sources/Models/Money.swift b/Sources/Models/Money.swift index 6bbe14b5..89141fa8 100644 --- a/Sources/Models/Money.swift +++ b/Sources/Models/Money.swift @@ -2,7 +2,7 @@ // Money.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Money) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Money) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * be ISO 4217 (system = "urn:iso:std:iso:4217" - currency). */ public class Money: Quantity { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Money" } } diff --git a/Sources/Models/NamingSystem.swift b/Sources/Models/NamingSystem.swift index aee73ab8..f8a10b2b 100644 --- a/Sources/Models/NamingSystem.swift +++ b/Sources/Models/NamingSystem.swift @@ -2,7 +2,7 @@ // NamingSystem.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/NamingSystem) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/NamingSystem) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * devices, etc. Represents a "System" used within the Identifier and Coding data types. */ public class NamingSystem: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "NamingSystem" } } @@ -75,139 +75,139 @@ public class NamingSystem: DomainResource { self.uniqueId = uniqueId } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = NamingSystemContact.instantiate(fromArray: val, owner: self) as? [NamingSystemContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "date")) } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["kind"] { + if let exist = js["kind"] { presentKeys.insert("kind") if let val = exist as? String { self.kind = val } else { - errors.append(FHIRJSONError(key: "kind", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "kind", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "kind")) } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["publisher"] { + if let exist = js["publisher"] { presentKeys.insert("publisher") if let val = exist as? String { self.publisher = val } else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["replacedBy"] { + if let exist = js["replacedBy"] { presentKeys.insert("replacedBy") if let val = exist as? FHIRJSON { self.replacedBy = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "replacedBy", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "replacedBy", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["responsible"] { + if let exist = js["responsible"] { presentKeys.insert("responsible") if let val = exist as? String { self.responsible = val } else { - errors.append(FHIRJSONError(key: "responsible", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "responsible", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["uniqueId"] { + if let exist = js["uniqueId"] { presentKeys.insert("uniqueId") if let val = exist as? [FHIRJSON] { self.uniqueId = NamingSystemUniqueId.instantiate(fromArray: val, owner: self) as? [NamingSystemUniqueId] } else { - errors.append(FHIRJSONError(key: "uniqueId", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "uniqueId", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "uniqueId")) } - if let exist: AnyObject = js["usage"] { + if let exist = js["usage"] { presentKeys.insert("usage") if let val = exist as? String { self.usage = val } else { - errors.append(FHIRJSONError(key: "usage", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "usage", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["useContext"] { + if let exist = js["useContext"] { presentKeys.insert("useContext") if let val = exist as? [FHIRJSON] { self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: type(of: exist))) } } } @@ -268,7 +268,7 @@ public class NamingSystem: DomainResource { * Contacts to assist a user in finding and communicating with the publisher. */ public class NamingSystemContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "NamingSystemContact" } } @@ -284,25 +284,25 @@ public class NamingSystemContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -330,7 +330,7 @@ public class NamingSystemContact: BackboneElement { * Indicates how the system may be identified when referenced in electronic exchange. */ public class NamingSystemUniqueId: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "NamingSystemUniqueId" } } @@ -359,46 +359,46 @@ public class NamingSystemUniqueId: BackboneElement { self.value = value } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["preferred"] { + if let exist = js["preferred"] { presentKeys.insert("preferred") if let val = exist as? Bool { self.preferred = val } else { - errors.append(FHIRJSONError(key: "preferred", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "preferred", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? String { self.value = val } else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: String.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Narrative.swift b/Sources/Models/Narrative.swift index 5bd26bbd..7c69946a 100644 --- a/Sources/Models/Narrative.swift +++ b/Sources/Models/Narrative.swift @@ -2,7 +2,7 @@ // Narrative.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Narrative) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Narrative) on 2016-09-16. // 2016, SMART Health IT. // @@ -13,7 +13,7 @@ import Foundation * A human-readable formatted text, including images. */ public class Narrative: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Narrative" } } @@ -36,28 +36,28 @@ public class Narrative: Element { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["div"] { + if let exist = js["div"] { presentKeys.insert("div") if let val = exist as? String { self.div = val } else { - errors.append(FHIRJSONError(key: "div", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "div", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "div")) } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/NutritionOrder.swift b/Sources/Models/NutritionOrder.swift index e9cbcc09..e084ee13 100644 --- a/Sources/Models/NutritionOrder.swift +++ b/Sources/Models/NutritionOrder.swift @@ -2,7 +2,7 @@ // NutritionOrder.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/NutritionOrder) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/NutritionOrder) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A request to supply a diet, formula feeding (enteral) or oral nutritional supplement to a patient/resident. */ public class NutritionOrder: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "NutritionOrder" } } @@ -68,121 +68,121 @@ public class NutritionOrder: DomainResource { self.patient = patient } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["allergyIntolerance"] { + if let exist = js["allergyIntolerance"] { presentKeys.insert("allergyIntolerance") if let val = exist as? [FHIRJSON] { self.allergyIntolerance = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "allergyIntolerance", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "allergyIntolerance", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dateTime"] { + if let exist = js["dateTime"] { presentKeys.insert("dateTime") if let val = exist as? String { self.dateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "dateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateTime", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "dateTime")) } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["enteralFormula"] { + if let exist = js["enteralFormula"] { presentKeys.insert("enteralFormula") if let val = exist as? FHIRJSON { self.enteralFormula = NutritionOrderEnteralFormula(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "enteralFormula", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "enteralFormula", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["excludeFoodModifier"] { + if let exist = js["excludeFoodModifier"] { presentKeys.insert("excludeFoodModifier") if let val = exist as? [FHIRJSON] { self.excludeFoodModifier = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "excludeFoodModifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "excludeFoodModifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["foodPreferenceModifier"] { + if let exist = js["foodPreferenceModifier"] { presentKeys.insert("foodPreferenceModifier") if let val = exist as? [FHIRJSON] { self.foodPreferenceModifier = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "foodPreferenceModifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "foodPreferenceModifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["oralDiet"] { + if let exist = js["oralDiet"] { presentKeys.insert("oralDiet") if let val = exist as? FHIRJSON { self.oralDiet = NutritionOrderOralDiet(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "oralDiet", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "oralDiet", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["orderer"] { + if let exist = js["orderer"] { presentKeys.insert("orderer") if let val = exist as? FHIRJSON { self.orderer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "orderer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "orderer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["supplement"] { + if let exist = js["supplement"] { presentKeys.insert("supplement") if let val = exist as? [FHIRJSON] { self.supplement = NutritionOrderSupplement.instantiate(fromArray: val, owner: self) as? [NutritionOrderSupplement] } else { - errors.append(FHIRJSONError(key: "supplement", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "supplement", wants: Array.self, has: type(of: exist))) } } } @@ -241,7 +241,7 @@ public class NutritionOrder: DomainResource { * the oral cavity. */ public class NutritionOrderEnteralFormula: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "NutritionOrderEnteralFormula" } } @@ -278,88 +278,88 @@ public class NutritionOrderEnteralFormula: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["additiveProductName"] { + if let exist = js["additiveProductName"] { presentKeys.insert("additiveProductName") if let val = exist as? String { self.additiveProductName = val } else { - errors.append(FHIRJSONError(key: "additiveProductName", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "additiveProductName", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["additiveType"] { + if let exist = js["additiveType"] { presentKeys.insert("additiveType") if let val = exist as? FHIRJSON { self.additiveType = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "additiveType", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "additiveType", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["administration"] { + if let exist = js["administration"] { presentKeys.insert("administration") if let val = exist as? [FHIRJSON] { self.administration = NutritionOrderEnteralFormulaAdministration.instantiate(fromArray: val, owner: self) as? [NutritionOrderEnteralFormulaAdministration] } else { - errors.append(FHIRJSONError(key: "administration", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "administration", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["administrationInstruction"] { + if let exist = js["administrationInstruction"] { presentKeys.insert("administrationInstruction") if let val = exist as? String { self.administrationInstruction = val } else { - errors.append(FHIRJSONError(key: "administrationInstruction", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "administrationInstruction", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["baseFormulaProductName"] { + if let exist = js["baseFormulaProductName"] { presentKeys.insert("baseFormulaProductName") if let val = exist as? String { self.baseFormulaProductName = val } else { - errors.append(FHIRJSONError(key: "baseFormulaProductName", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "baseFormulaProductName", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["baseFormulaType"] { + if let exist = js["baseFormulaType"] { presentKeys.insert("baseFormulaType") if let val = exist as? FHIRJSON { self.baseFormulaType = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "baseFormulaType", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "baseFormulaType", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["caloricDensity"] { + if let exist = js["caloricDensity"] { presentKeys.insert("caloricDensity") if let val = exist as? FHIRJSON { self.caloricDensity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "caloricDensity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "caloricDensity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maxVolumeToDeliver"] { + if let exist = js["maxVolumeToDeliver"] { presentKeys.insert("maxVolumeToDeliver") if let val = exist as? FHIRJSON { self.maxVolumeToDeliver = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maxVolumeToDeliver", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maxVolumeToDeliver", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["routeofAdministration"] { + if let exist = js["routeofAdministration"] { presentKeys.insert("routeofAdministration") if let val = exist as? FHIRJSON { self.routeofAdministration = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "routeofAdministration", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "routeofAdministration", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -410,7 +410,7 @@ public class NutritionOrderEnteralFormula: BackboneElement { * instruction to increase the rate of continuous feeding every 2 hours. */ public class NutritionOrderEnteralFormulaAdministration: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "NutritionOrderEnteralFormulaAdministration" } } @@ -432,43 +432,43 @@ public class NutritionOrderEnteralFormulaAdministration: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rateQuantity"] { + if let exist = js["rateQuantity"] { presentKeys.insert("rateQuantity") if let val = exist as? FHIRJSON { self.rateQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "rateQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rateQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rateRatio"] { + if let exist = js["rateRatio"] { presentKeys.insert("rateRatio") if let val = exist as? FHIRJSON { self.rateRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "rateRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rateRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["schedule"] { + if let exist = js["schedule"] { presentKeys.insert("schedule") if let val = exist as? FHIRJSON { self.schedule = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "schedule", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "schedule", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -502,7 +502,7 @@ public class NutritionOrderEnteralFormulaAdministration: BackboneElement { * Diet given orally in contrast to enteral (tube) feeding. */ public class NutritionOrderOralDiet: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "NutritionOrderOralDiet" } } @@ -530,61 +530,61 @@ public class NutritionOrderOralDiet: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["fluidConsistencyType"] { + if let exist = js["fluidConsistencyType"] { presentKeys.insert("fluidConsistencyType") if let val = exist as? [FHIRJSON] { self.fluidConsistencyType = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "fluidConsistencyType", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fluidConsistencyType", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["instruction"] { + if let exist = js["instruction"] { presentKeys.insert("instruction") if let val = exist as? String { self.instruction = val } else { - errors.append(FHIRJSONError(key: "instruction", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "instruction", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["nutrient"] { + if let exist = js["nutrient"] { presentKeys.insert("nutrient") if let val = exist as? [FHIRJSON] { self.nutrient = NutritionOrderOralDietNutrient.instantiate(fromArray: val, owner: self) as? [NutritionOrderOralDietNutrient] } else { - errors.append(FHIRJSONError(key: "nutrient", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "nutrient", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["schedule"] { + if let exist = js["schedule"] { presentKeys.insert("schedule") if let val = exist as? [FHIRJSON] { self.schedule = Timing.instantiate(fromArray: val, owner: self) as? [Timing] } else { - errors.append(FHIRJSONError(key: "schedule", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "schedule", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["texture"] { + if let exist = js["texture"] { presentKeys.insert("texture") if let val = exist as? [FHIRJSON] { self.texture = NutritionOrderOralDietTexture.instantiate(fromArray: val, owner: self) as? [NutritionOrderOralDietTexture] } else { - errors.append(FHIRJSONError(key: "texture", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "texture", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? [FHIRJSON] { self.type = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: type(of: exist))) } } } @@ -624,7 +624,7 @@ public class NutritionOrderOralDiet: BackboneElement { * Class that defines the quantity and type of nutrient modifications required for the oral diet. */ public class NutritionOrderOralDietNutrient: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "NutritionOrderOralDietNutrient" } } @@ -640,25 +640,25 @@ public class NutritionOrderOralDietNutrient: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["amount"] { + if let exist = js["amount"] { presentKeys.insert("amount") if let val = exist as? FHIRJSON { self.amount = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["modifier"] { + if let exist = js["modifier"] { presentKeys.insert("modifier") if let val = exist as? FHIRJSON { self.modifier = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "modifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "modifier", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -687,7 +687,7 @@ public class NutritionOrderOralDietNutrient: BackboneElement { * foods. */ public class NutritionOrderOralDietTexture: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "NutritionOrderOralDietTexture" } } @@ -703,25 +703,25 @@ public class NutritionOrderOralDietTexture: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["foodType"] { + if let exist = js["foodType"] { presentKeys.insert("foodType") if let val = exist as? FHIRJSON { self.foodType = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "foodType", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "foodType", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["modifier"] { + if let exist = js["modifier"] { presentKeys.insert("modifier") if let val = exist as? FHIRJSON { self.modifier = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "modifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "modifier", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -749,7 +749,7 @@ public class NutritionOrderOralDietTexture: BackboneElement { * Oral nutritional products given in order to add further nutritional value to the patient's diet. */ public class NutritionOrderSupplement: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "NutritionOrderSupplement" } } @@ -774,52 +774,52 @@ public class NutritionOrderSupplement: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["instruction"] { + if let exist = js["instruction"] { presentKeys.insert("instruction") if let val = exist as? String { self.instruction = val } else { - errors.append(FHIRJSONError(key: "instruction", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "instruction", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["productName"] { + if let exist = js["productName"] { presentKeys.insert("productName") if let val = exist as? String { self.productName = val } else { - errors.append(FHIRJSONError(key: "productName", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "productName", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["schedule"] { + if let exist = js["schedule"] { presentKeys.insert("schedule") if let val = exist as? [FHIRJSON] { self.schedule = Timing.instantiate(fromArray: val, owner: self) as? [Timing] } else { - errors.append(FHIRJSONError(key: "schedule", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "schedule", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Observation.swift b/Sources/Models/Observation.swift index 19dc1032..5264aa23 100644 --- a/Sources/Models/Observation.swift +++ b/Sources/Models/Observation.swift @@ -2,7 +2,7 @@ // Observation.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Observation) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Observation) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * Measurements and simple assertions made about a patient, device or other subject. */ public class Observation: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Observation" } } @@ -122,283 +122,283 @@ public class Observation: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["bodySite"] { + if let exist = js["bodySite"] { presentKeys.insert("bodySite") if let val = exist as? FHIRJSON { self.bodySite = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bodySite", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySite", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? FHIRJSON { self.category = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["comments"] { + if let exist = js["comments"] { presentKeys.insert("comments") if let val = exist as? String { self.comments = val } else { - errors.append(FHIRJSONError(key: "comments", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comments", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["component"] { + if let exist = js["component"] { presentKeys.insert("component") if let val = exist as? [FHIRJSON] { self.component = ObservationComponent.instantiate(fromArray: val, owner: self) as? [ObservationComponent] } else { - errors.append(FHIRJSONError(key: "component", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "component", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dataAbsentReason"] { + if let exist = js["dataAbsentReason"] { presentKeys.insert("dataAbsentReason") if let val = exist as? FHIRJSON { self.dataAbsentReason = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "dataAbsentReason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dataAbsentReason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["device"] { + if let exist = js["device"] { presentKeys.insert("device") if let val = exist as? FHIRJSON { self.device = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "device", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "device", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["effectiveDateTime"] { + if let exist = js["effectiveDateTime"] { presentKeys.insert("effectiveDateTime") if let val = exist as? String { self.effectiveDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "effectiveDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "effectiveDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["effectivePeriod"] { + if let exist = js["effectivePeriod"] { presentKeys.insert("effectivePeriod") if let val = exist as? FHIRJSON { self.effectivePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "effectivePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "effectivePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["interpretation"] { + if let exist = js["interpretation"] { presentKeys.insert("interpretation") if let val = exist as? FHIRJSON { self.interpretation = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "interpretation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "interpretation", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["issued"] { + if let exist = js["issued"] { presentKeys.insert("issued") if let val = exist as? String { self.issued = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "issued", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "issued", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["method"] { + if let exist = js["method"] { presentKeys.insert("method") if let val = exist as? FHIRJSON { self.method = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["performer"] { + if let exist = js["performer"] { presentKeys.insert("performer") if let val = exist as? [FHIRJSON] { self.performer = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "performer", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "performer", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["referenceRange"] { + if let exist = js["referenceRange"] { presentKeys.insert("referenceRange") if let val = exist as? [FHIRJSON] { self.referenceRange = ObservationReferenceRange.instantiate(fromArray: val, owner: self) as? [ObservationReferenceRange] } else { - errors.append(FHIRJSONError(key: "referenceRange", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "referenceRange", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["related"] { + if let exist = js["related"] { presentKeys.insert("related") if let val = exist as? [FHIRJSON] { self.related = ObservationRelated.instantiate(fromArray: val, owner: self) as? [ObservationRelated] } else { - errors.append(FHIRJSONError(key: "related", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "related", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["specimen"] { + if let exist = js["specimen"] { presentKeys.insert("specimen") if let val = exist as? FHIRJSON { self.specimen = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "specimen", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "specimen", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueAttachment"] { + if let exist = js["valueAttachment"] { presentKeys.insert("valueAttachment") if let val = exist as? FHIRJSON { self.valueAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueCodeableConcept"] { + if let exist = js["valueCodeableConcept"] { presentKeys.insert("valueCodeableConcept") if let val = exist as? FHIRJSON { self.valueCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDateTime"] { + if let exist = js["valueDateTime"] { presentKeys.insert("valueDateTime") if let val = exist as? String { self.valueDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valuePeriod"] { + if let exist = js["valuePeriod"] { presentKeys.insert("valuePeriod") if let val = exist as? FHIRJSON { self.valuePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueQuantity"] { + if let exist = js["valueQuantity"] { presentKeys.insert("valueQuantity") if let val = exist as? FHIRJSON { self.valueQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueRange"] { + if let exist = js["valueRange"] { presentKeys.insert("valueRange") if let val = exist as? FHIRJSON { self.valueRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueRatio"] { + if let exist = js["valueRatio"] { presentKeys.insert("valueRatio") if let val = exist as? FHIRJSON { self.valueRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueSampledData"] { + if let exist = js["valueSampledData"] { presentKeys.insert("valueSampledData") if let val = exist as? FHIRJSON { self.valueSampledData = SampledData(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueSampledData", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueString"] { + if let exist = js["valueString"] { presentKeys.insert("valueString") if let val = exist as? String { self.valueString = val } else { - errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueTime"] { + if let exist = js["valueTime"] { presentKeys.insert("valueTime") if let val = exist as? String { self.valueTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: type(of: exist))) } } } @@ -512,7 +512,7 @@ public class Observation: DomainResource { * blood pressure measurement and multiple component observations for genetics observations. */ public class ObservationComponent: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ObservationComponent" } } @@ -567,127 +567,127 @@ public class ObservationComponent: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["dataAbsentReason"] { + if let exist = js["dataAbsentReason"] { presentKeys.insert("dataAbsentReason") if let val = exist as? FHIRJSON { self.dataAbsentReason = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "dataAbsentReason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dataAbsentReason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["referenceRange"] { + if let exist = js["referenceRange"] { presentKeys.insert("referenceRange") if let val = exist as? [FHIRJSON] { self.referenceRange = ObservationReferenceRange.instantiate(fromArray: val, owner: self) as? [ObservationReferenceRange] } else { - errors.append(FHIRJSONError(key: "referenceRange", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "referenceRange", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueAttachment"] { + if let exist = js["valueAttachment"] { presentKeys.insert("valueAttachment") if let val = exist as? FHIRJSON { self.valueAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueCodeableConcept"] { + if let exist = js["valueCodeableConcept"] { presentKeys.insert("valueCodeableConcept") if let val = exist as? FHIRJSON { self.valueCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDateTime"] { + if let exist = js["valueDateTime"] { presentKeys.insert("valueDateTime") if let val = exist as? String { self.valueDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valuePeriod"] { + if let exist = js["valuePeriod"] { presentKeys.insert("valuePeriod") if let val = exist as? FHIRJSON { self.valuePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueQuantity"] { + if let exist = js["valueQuantity"] { presentKeys.insert("valueQuantity") if let val = exist as? FHIRJSON { self.valueQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueRange"] { + if let exist = js["valueRange"] { presentKeys.insert("valueRange") if let val = exist as? FHIRJSON { self.valueRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueRatio"] { + if let exist = js["valueRatio"] { presentKeys.insert("valueRatio") if let val = exist as? FHIRJSON { self.valueRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueSampledData"] { + if let exist = js["valueSampledData"] { presentKeys.insert("valueSampledData") if let val = exist as? FHIRJSON { self.valueSampledData = SampledData(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueSampledData", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueString"] { + if let exist = js["valueString"] { presentKeys.insert("valueString") if let val = exist as? String { self.valueString = val } else { - errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueTime"] { + if let exist = js["valueTime"] { presentKeys.insert("valueTime") if let val = exist as? String { self.valueTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: type(of: exist))) } } } @@ -748,7 +748,7 @@ public class ObservationComponent: BackboneElement { * Guidance on how to interpret the value by comparison to a normal or recommended range. */ public class ObservationReferenceRange: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ObservationReferenceRange" } } @@ -773,52 +773,52 @@ public class ObservationReferenceRange: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["age"] { + if let exist = js["age"] { presentKeys.insert("age") if let val = exist as? FHIRJSON { self.age = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "age", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "age", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["high"] { + if let exist = js["high"] { presentKeys.insert("high") if let val = exist as? FHIRJSON { self.high = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "high", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "high", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["low"] { + if let exist = js["low"] { presentKeys.insert("low") if let val = exist as? FHIRJSON { self.low = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "low", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "low", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["meaning"] { + if let exist = js["meaning"] { presentKeys.insert("meaning") if let val = exist as? FHIRJSON { self.meaning = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "meaning", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "meaning", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } } @@ -856,7 +856,7 @@ public class ObservationReferenceRange: BackboneElement { * relationship is defined by the relationship type code. */ public class ObservationRelated: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ObservationRelated" } } @@ -878,28 +878,28 @@ public class ObservationRelated: BackboneElement { self.target = target } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? FHIRJSON { self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "target")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/OperationDefinition.swift b/Sources/Models/OperationDefinition.swift index 7b25a491..fee274c5 100644 --- a/Sources/Models/OperationDefinition.swift +++ b/Sources/Models/OperationDefinition.swift @@ -2,7 +2,7 @@ // OperationDefinition.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OperationDefinition) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OperationDefinition) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * interaction). */ public class OperationDefinition: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "OperationDefinition" } } @@ -94,196 +94,196 @@ public class OperationDefinition: DomainResource { self.system = system } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["base"] { + if let exist = js["base"] { presentKeys.insert("base") if let val = exist as? FHIRJSON { self.base = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "base", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "base", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = OperationDefinitionContact.instantiate(fromArray: val, owner: self) as? [OperationDefinitionContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["experimental"] { + if let exist = js["experimental"] { presentKeys.insert("experimental") if let val = exist as? Bool { self.experimental = val } else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["idempotent"] { + if let exist = js["idempotent"] { presentKeys.insert("idempotent") if let val = exist as? Bool { self.idempotent = val } else { - errors.append(FHIRJSONError(key: "idempotent", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "idempotent", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["instance"] { + if let exist = js["instance"] { presentKeys.insert("instance") if let val = exist as? Bool { self.instance = val } else { - errors.append(FHIRJSONError(key: "instance", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "instance", wants: Bool.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "instance")) } - if let exist: AnyObject = js["kind"] { + if let exist = js["kind"] { presentKeys.insert("kind") if let val = exist as? String { self.kind = val } else { - errors.append(FHIRJSONError(key: "kind", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "kind", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "kind")) } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["notes"] { + if let exist = js["notes"] { presentKeys.insert("notes") if let val = exist as? String { self.notes = val } else { - errors.append(FHIRJSONError(key: "notes", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "notes", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["parameter"] { + if let exist = js["parameter"] { presentKeys.insert("parameter") if let val = exist as? [FHIRJSON] { self.parameter = OperationDefinitionParameter.instantiate(fromArray: val, owner: self) as? [OperationDefinitionParameter] } else { - errors.append(FHIRJSONError(key: "parameter", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "parameter", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["publisher"] { + if let exist = js["publisher"] { presentKeys.insert("publisher") if let val = exist as? String { self.publisher = val } else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requirements"] { + if let exist = js["requirements"] { presentKeys.insert("requirements") if let val = exist as? String { self.requirements = val } else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["system"] { + if let exist = js["system"] { presentKeys.insert("system") if let val = exist as? Bool { self.system = val } else { - errors.append(FHIRJSONError(key: "system", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "system", wants: Bool.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "system")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? [String] { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } @@ -342,7 +342,7 @@ public class OperationDefinition: DomainResource { json["system"] = system.asJSON() } if let type = self.type { - var arr = [AnyObject]() + var arr = [Any]() for val in type { arr.append(val.asJSON()) } @@ -366,7 +366,7 @@ public class OperationDefinition: DomainResource { * Contacts to assist a user in finding and communicating with the publisher. */ public class OperationDefinitionContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "OperationDefinitionContact" } } @@ -382,25 +382,25 @@ public class OperationDefinitionContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -428,7 +428,7 @@ public class OperationDefinitionContact: BackboneElement { * The parameters for the operation/query. */ public class OperationDefinitionParameter: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "OperationDefinitionParameter" } } @@ -474,97 +474,97 @@ public class OperationDefinitionParameter: BackboneElement { self.use = use } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["binding"] { + if let exist = js["binding"] { presentKeys.insert("binding") if let val = exist as? FHIRJSON { self.binding = OperationDefinitionParameterBinding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "binding", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "binding", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["documentation"] { + if let exist = js["documentation"] { presentKeys.insert("documentation") if let val = exist as? String { self.documentation = val } else { - errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "documentation", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["max"] { + if let exist = js["max"] { presentKeys.insert("max") if let val = exist as? String { self.max = val } else { - errors.append(FHIRJSONError(key: "max", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "max", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "max")) } - if let exist: AnyObject = js["min"] { + if let exist = js["min"] { presentKeys.insert("min") if let val = exist as? Int { self.min = val } else { - errors.append(FHIRJSONError(key: "min", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "min", wants: Int.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "min")) } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["part"] { + if let exist = js["part"] { presentKeys.insert("part") if let val = exist as? [FHIRJSON] { self.part = OperationDefinitionParameter.instantiate(fromArray: val, owner: self) as? [OperationDefinitionParameter] } else { - errors.append(FHIRJSONError(key: "part", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "part", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["profile"] { + if let exist = js["profile"] { presentKeys.insert("profile") if let val = exist as? FHIRJSON { self.profile = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "profile", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["use"] { + if let exist = js["use"] { presentKeys.insert("use") if let val = exist as? String { self.use = val } else { - errors.append(FHIRJSONError(key: "use", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "use", wants: String.self, has: type(of: exist))) } } else { @@ -616,7 +616,7 @@ public class OperationDefinitionParameter: BackboneElement { * Binds to a value set if this parameter is coded (code, Coding, CodeableConcept). */ public class OperationDefinitionParameterBinding: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "OperationDefinitionParameterBinding" } } @@ -643,37 +643,37 @@ public class OperationDefinitionParameterBinding: BackboneElement { self.valueSetUri = valueSetUri } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["strength"] { + if let exist = js["strength"] { presentKeys.insert("strength") if let val = exist as? String { self.strength = val } else { - errors.append(FHIRJSONError(key: "strength", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "strength", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "strength")) } - if let exist: AnyObject = js["valueSetReference"] { + if let exist = js["valueSetReference"] { presentKeys.insert("valueSetReference") if let val = exist as? FHIRJSON { self.valueSetReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueSetReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueSetReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueSetUri"] { + if let exist = js["valueSetUri"] { presentKeys.insert("valueSetUri") if let val = exist as? String { self.valueSetUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "valueSetUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueSetUri", wants: String.self, has: type(of: exist))) } } diff --git a/Sources/Models/OperationOutcome.swift b/Sources/Models/OperationOutcome.swift index 6f88e2bd..75f6e9c6 100644 --- a/Sources/Models/OperationOutcome.swift +++ b/Sources/Models/OperationOutcome.swift @@ -2,7 +2,7 @@ // OperationOutcome.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OperationOutcome) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OperationOutcome) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A collection of error, warning or information messages that result from a system action. */ public class OperationOutcome: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "OperationOutcome" } } @@ -34,16 +34,16 @@ public class OperationOutcome: DomainResource { self.issue = issue } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["issue"] { + if let exist = js["issue"] { presentKeys.insert("issue") if let val = exist as? [FHIRJSON] { self.issue = OperationOutcomeIssue.instantiate(fromArray: val, owner: self) as? [OperationOutcomeIssue] } else { - errors.append(FHIRJSONError(key: "issue", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "issue", wants: Array.self, has: type(of: exist))) } } else { @@ -71,7 +71,7 @@ public class OperationOutcome: DomainResource { * An error, warning or information message that results from a system action. */ public class OperationOutcomeIssue: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "OperationOutcomeIssue" } } @@ -103,55 +103,55 @@ public class OperationOutcomeIssue: BackboneElement { self.severity = severity } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["details"] { + if let exist = js["details"] { presentKeys.insert("details") if let val = exist as? FHIRJSON { self.details = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "details", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "details", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["diagnostics"] { + if let exist = js["diagnostics"] { presentKeys.insert("diagnostics") if let val = exist as? String { self.diagnostics = val } else { - errors.append(FHIRJSONError(key: "diagnostics", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "diagnostics", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? [String] { self.location = val } else { - errors.append(FHIRJSONError(key: "location", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["severity"] { + if let exist = js["severity"] { presentKeys.insert("severity") if let val = exist as? String { self.severity = val } else { - errors.append(FHIRJSONError(key: "severity", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "severity", wants: String.self, has: type(of: exist))) } } else { @@ -174,7 +174,7 @@ public class OperationOutcomeIssue: BackboneElement { json["diagnostics"] = diagnostics.asJSON() } if let location = self.location { - var arr = [AnyObject]() + var arr = [Any]() for val in location { arr.append(val.asJSON()) } diff --git a/Sources/Models/Order.swift b/Sources/Models/Order.swift index d1afc588..31568a76 100644 --- a/Sources/Models/Order.swift +++ b/Sources/Models/Order.swift @@ -2,7 +2,7 @@ // Order.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Order) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Order) on 2016-09-16. // 2016, SMART Health IT. // @@ -13,7 +13,7 @@ import Foundation * A request to perform an action. */ public class Order: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Order" } } @@ -56,91 +56,91 @@ public class Order: DomainResource { self.detail = detail } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["detail"] { + if let exist = js["detail"] { presentKeys.insert("detail") if let val = exist as? [FHIRJSON] { self.detail = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "detail")) } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonCodeableConcept"] { + if let exist = js["reasonCodeableConcept"] { presentKeys.insert("reasonCodeableConcept") if let val = exist as? FHIRJSON { self.reasonCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonReference"] { + if let exist = js["reasonReference"] { presentKeys.insert("reasonReference") if let val = exist as? FHIRJSON { self.reasonReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["source"] { + if let exist = js["source"] { presentKeys.insert("source") if let val = exist as? FHIRJSON { self.source = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? FHIRJSON { self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["when"] { + if let exist = js["when"] { presentKeys.insert("when") if let val = exist as? FHIRJSON { self.when = OrderWhen(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "when", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "when", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -187,7 +187,7 @@ public class Order: DomainResource { * When order should be fulfilled. */ public class OrderWhen: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "OrderWhen" } } @@ -203,25 +203,25 @@ public class OrderWhen: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["schedule"] { + if let exist = js["schedule"] { presentKeys.insert("schedule") if let val = exist as? FHIRJSON { self.schedule = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "schedule", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "schedule", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/OrderResponse.swift b/Sources/Models/OrderResponse.swift index 5ed51a74..0f812c82 100644 --- a/Sources/Models/OrderResponse.swift +++ b/Sources/Models/OrderResponse.swift @@ -2,7 +2,7 @@ // OrderResponse.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OrderResponse) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/OrderResponse) on 2016-09-16. // 2016, SMART Health IT. // @@ -13,7 +13,7 @@ import Foundation * A response to an order. */ public class OrderResponse: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "OrderResponse" } } @@ -51,76 +51,76 @@ public class OrderResponse: DomainResource { self.request = request } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fulfillment"] { + if let exist = js["fulfillment"] { presentKeys.insert("fulfillment") if let val = exist as? [FHIRJSON] { self.fulfillment = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "fulfillment", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fulfillment", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["orderStatus"] { + if let exist = js["orderStatus"] { presentKeys.insert("orderStatus") if let val = exist as? String { self.orderStatus = val } else { - errors.append(FHIRJSONError(key: "orderStatus", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "orderStatus", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "orderStatus")) } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "request")) } - if let exist: AnyObject = js["who"] { + if let exist = js["who"] { presentKeys.insert("who") if let val = exist as? FHIRJSON { self.who = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "who", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "who", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Organization.swift b/Sources/Models/Organization.swift index 225c6cf1..dad07e3f 100644 --- a/Sources/Models/Organization.swift +++ b/Sources/Models/Organization.swift @@ -2,7 +2,7 @@ // Organization.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Organization) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Organization) on 2016-09-16. // 2016, SMART Health IT. // @@ -17,7 +17,7 @@ import Foundation * healthcare practice groups, etc. */ public class Organization: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Organization" } } @@ -51,79 +51,79 @@ public class Organization: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["active"] { + if let exist = js["active"] { presentKeys.insert("active") if let val = exist as? Bool { self.active = val } else { - errors.append(FHIRJSONError(key: "active", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "active", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["address"] { + if let exist = js["address"] { presentKeys.insert("address") if let val = exist as? [FHIRJSON] { self.address = Address.instantiate(fromArray: val, owner: self) as? [Address] } else { - errors.append(FHIRJSONError(key: "address", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "address", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = OrganizationContact.instantiate(fromArray: val, owner: self) as? [OrganizationContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["partOf"] { + if let exist = js["partOf"] { presentKeys.insert("partOf") if let val = exist as? FHIRJSON { self.partOf = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "partOf", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "partOf", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -167,7 +167,7 @@ public class Organization: DomainResource { * Contact for the organization for a certain purpose. */ public class OrganizationContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "OrganizationContact" } } @@ -189,43 +189,43 @@ public class OrganizationContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["address"] { + if let exist = js["address"] { presentKeys.insert("address") if let val = exist as? FHIRJSON { self.address = Address(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "address", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "address", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? FHIRJSON { self.name = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "name", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["purpose"] { + if let exist = js["purpose"] { presentKeys.insert("purpose") if let val = exist as? FHIRJSON { self.purpose = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "purpose", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "purpose", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Parameters.swift b/Sources/Models/Parameters.swift index 1946dbee..8ea2627c 100644 --- a/Sources/Models/Parameters.swift +++ b/Sources/Models/Parameters.swift @@ -2,7 +2,7 @@ // Parameters.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Parameters) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Parameters) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * use, and there is no RESTful endpoint associated with it. */ public class Parameters: Resource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Parameters" } } @@ -29,16 +29,16 @@ public class Parameters: Resource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["parameter"] { + if let exist = js["parameter"] { presentKeys.insert("parameter") if let val = exist as? [FHIRJSON] { self.parameter = ParametersParameter.instantiate(fromArray: val, owner: self) as? [ParametersParameter] } else { - errors.append(FHIRJSONError(key: "parameter", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "parameter", wants: Array.self, has: type(of: exist))) } } } @@ -63,7 +63,7 @@ public class Parameters: Resource { * A parameter passed to or received from the operation. */ public class ParametersParameter: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ParametersParameter" } } @@ -187,334 +187,334 @@ public class ParametersParameter: BackboneElement { self.name = name } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["part"] { + if let exist = js["part"] { presentKeys.insert("part") if let val = exist as? [FHIRJSON] { self.part = ParametersParameter.instantiate(fromArray: val, owner: self) as? [ParametersParameter] } else { - errors.append(FHIRJSONError(key: "part", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "part", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["resource"] { + if let exist = js["resource"] { presentKeys.insert("resource") if let val = exist as? FHIRJSON { - self.resource = Resource.instantiate(fromJSON: val, owner: self) as? Resource + self.resource = Resource.instantiate(from: val, owner: self) as? Resource } else { - errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueAddress"] { + if let exist = js["valueAddress"] { presentKeys.insert("valueAddress") if let val = exist as? FHIRJSON { self.valueAddress = Address(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueAddress", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueAddress", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueAnnotation"] { + if let exist = js["valueAnnotation"] { presentKeys.insert("valueAnnotation") if let val = exist as? FHIRJSON { self.valueAnnotation = Annotation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueAnnotation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueAnnotation", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueAttachment"] { + if let exist = js["valueAttachment"] { presentKeys.insert("valueAttachment") if let val = exist as? FHIRJSON { self.valueAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueBase64Binary"] { + if let exist = js["valueBase64Binary"] { presentKeys.insert("valueBase64Binary") if let val = exist as? String { self.valueBase64Binary = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "valueBase64Binary", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueBase64Binary", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueBoolean"] { + if let exist = js["valueBoolean"] { presentKeys.insert("valueBoolean") if let val = exist as? Bool { self.valueBoolean = val } else { - errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueCode"] { + if let exist = js["valueCode"] { presentKeys.insert("valueCode") if let val = exist as? String { self.valueCode = val } else { - errors.append(FHIRJSONError(key: "valueCode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueCode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueCodeableConcept"] { + if let exist = js["valueCodeableConcept"] { presentKeys.insert("valueCodeableConcept") if let val = exist as? FHIRJSON { self.valueCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueCoding"] { + if let exist = js["valueCoding"] { presentKeys.insert("valueCoding") if let val = exist as? FHIRJSON { self.valueCoding = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueCoding", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueCoding", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueContactPoint"] { + if let exist = js["valueContactPoint"] { presentKeys.insert("valueContactPoint") if let val = exist as? FHIRJSON { self.valueContactPoint = ContactPoint(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueContactPoint", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueContactPoint", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDate"] { + if let exist = js["valueDate"] { presentKeys.insert("valueDate") if let val = exist as? String { self.valueDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "valueDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDateTime"] { + if let exist = js["valueDateTime"] { presentKeys.insert("valueDateTime") if let val = exist as? String { self.valueDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDecimal"] { + if let exist = js["valueDecimal"] { presentKeys.insert("valueDecimal") if let val = exist as? NSNumber { self.valueDecimal = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "valueDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDecimal", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueHumanName"] { + if let exist = js["valueHumanName"] { presentKeys.insert("valueHumanName") if let val = exist as? FHIRJSON { self.valueHumanName = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueHumanName", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueHumanName", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueId"] { + if let exist = js["valueId"] { presentKeys.insert("valueId") if let val = exist as? String { self.valueId = val } else { - errors.append(FHIRJSONError(key: "valueId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueIdentifier"] { + if let exist = js["valueIdentifier"] { presentKeys.insert("valueIdentifier") if let val = exist as? FHIRJSON { self.valueIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueInstant"] { + if let exist = js["valueInstant"] { presentKeys.insert("valueInstant") if let val = exist as? String { self.valueInstant = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "valueInstant", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueInstant", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueInteger"] { + if let exist = js["valueInteger"] { presentKeys.insert("valueInteger") if let val = exist as? Int { self.valueInteger = val } else { - errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueMarkdown"] { + if let exist = js["valueMarkdown"] { presentKeys.insert("valueMarkdown") if let val = exist as? String { self.valueMarkdown = val } else { - errors.append(FHIRJSONError(key: "valueMarkdown", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueMarkdown", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueMeta"] { + if let exist = js["valueMeta"] { presentKeys.insert("valueMeta") if let val = exist as? FHIRJSON { self.valueMeta = Meta(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueMeta", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueMeta", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueOid"] { + if let exist = js["valueOid"] { presentKeys.insert("valueOid") if let val = exist as? String { self.valueOid = val } else { - errors.append(FHIRJSONError(key: "valueOid", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueOid", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valuePeriod"] { + if let exist = js["valuePeriod"] { presentKeys.insert("valuePeriod") if let val = exist as? FHIRJSON { self.valuePeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valuePeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valuePositiveInt"] { + if let exist = js["valuePositiveInt"] { presentKeys.insert("valuePositiveInt") if let val = exist as? UInt { self.valuePositiveInt = val } else { - errors.append(FHIRJSONError(key: "valuePositiveInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valuePositiveInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueQuantity"] { + if let exist = js["valueQuantity"] { presentKeys.insert("valueQuantity") if let val = exist as? FHIRJSON { self.valueQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueRange"] { + if let exist = js["valueRange"] { presentKeys.insert("valueRange") if let val = exist as? FHIRJSON { self.valueRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueRatio"] { + if let exist = js["valueRatio"] { presentKeys.insert("valueRatio") if let val = exist as? FHIRJSON { self.valueRatio = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueRatio", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueRatio", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueReference"] { + if let exist = js["valueReference"] { presentKeys.insert("valueReference") if let val = exist as? FHIRJSON { self.valueReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueSampledData"] { + if let exist = js["valueSampledData"] { presentKeys.insert("valueSampledData") if let val = exist as? FHIRJSON { self.valueSampledData = SampledData(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueSampledData", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueSampledData", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueSignature"] { + if let exist = js["valueSignature"] { presentKeys.insert("valueSignature") if let val = exist as? FHIRJSON { self.valueSignature = Signature(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueSignature", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueSignature", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueString"] { + if let exist = js["valueString"] { presentKeys.insert("valueString") if let val = exist as? String { self.valueString = val } else { - errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueTime"] { + if let exist = js["valueTime"] { presentKeys.insert("valueTime") if let val = exist as? String { self.valueTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueTiming"] { + if let exist = js["valueTiming"] { presentKeys.insert("valueTiming") if let val = exist as? FHIRJSON { self.valueTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueTiming", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueUnsignedInt"] { + if let exist = js["valueUnsignedInt"] { presentKeys.insert("valueUnsignedInt") if let val = exist as? UInt { self.valueUnsignedInt = val } else { - errors.append(FHIRJSONError(key: "valueUnsignedInt", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueUnsignedInt", wants: UInt.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueUri"] { + if let exist = js["valueUri"] { presentKeys.insert("valueUri") if let val = exist as? String { self.valueUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "valueUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueUri", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Patient.swift b/Sources/Models/Patient.swift index 56efd9de..cb672ed7 100644 --- a/Sources/Models/Patient.swift +++ b/Sources/Models/Patient.swift @@ -2,7 +2,7 @@ // Patient.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Patient) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Patient) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * related services. */ public class Patient: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Patient" } } @@ -83,178 +83,178 @@ public class Patient: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["active"] { + if let exist = js["active"] { presentKeys.insert("active") if let val = exist as? Bool { self.active = val } else { - errors.append(FHIRJSONError(key: "active", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "active", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["address"] { + if let exist = js["address"] { presentKeys.insert("address") if let val = exist as? [FHIRJSON] { self.address = Address.instantiate(fromArray: val, owner: self) as? [Address] } else { - errors.append(FHIRJSONError(key: "address", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "address", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["animal"] { + if let exist = js["animal"] { presentKeys.insert("animal") if let val = exist as? FHIRJSON { self.animal = PatientAnimal(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "animal", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "animal", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["birthDate"] { + if let exist = js["birthDate"] { presentKeys.insert("birthDate") if let val = exist as? String { self.birthDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "birthDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "birthDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["careProvider"] { + if let exist = js["careProvider"] { presentKeys.insert("careProvider") if let val = exist as? [FHIRJSON] { self.careProvider = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "careProvider", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "careProvider", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["communication"] { + if let exist = js["communication"] { presentKeys.insert("communication") if let val = exist as? [FHIRJSON] { self.communication = PatientCommunication.instantiate(fromArray: val, owner: self) as? [PatientCommunication] } else { - errors.append(FHIRJSONError(key: "communication", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "communication", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = PatientContact.instantiate(fromArray: val, owner: self) as? [PatientContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["deceasedBoolean"] { + if let exist = js["deceasedBoolean"] { presentKeys.insert("deceasedBoolean") if let val = exist as? Bool { self.deceasedBoolean = val } else { - errors.append(FHIRJSONError(key: "deceasedBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "deceasedBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["deceasedDateTime"] { + if let exist = js["deceasedDateTime"] { presentKeys.insert("deceasedDateTime") if let val = exist as? String { self.deceasedDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "deceasedDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "deceasedDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["gender"] { + if let exist = js["gender"] { presentKeys.insert("gender") if let val = exist as? String { self.gender = val } else { - errors.append(FHIRJSONError(key: "gender", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "gender", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["link"] { + if let exist = js["link"] { presentKeys.insert("link") if let val = exist as? [FHIRJSON] { self.link = PatientLink.instantiate(fromArray: val, owner: self) as? [PatientLink] } else { - errors.append(FHIRJSONError(key: "link", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "link", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["managingOrganization"] { + if let exist = js["managingOrganization"] { presentKeys.insert("managingOrganization") if let val = exist as? FHIRJSON { self.managingOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["maritalStatus"] { + if let exist = js["maritalStatus"] { presentKeys.insert("maritalStatus") if let val = exist as? FHIRJSON { self.maritalStatus = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "maritalStatus", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "maritalStatus", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["multipleBirthBoolean"] { + if let exist = js["multipleBirthBoolean"] { presentKeys.insert("multipleBirthBoolean") if let val = exist as? Bool { self.multipleBirthBoolean = val } else { - errors.append(FHIRJSONError(key: "multipleBirthBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "multipleBirthBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["multipleBirthInteger"] { + if let exist = js["multipleBirthInteger"] { presentKeys.insert("multipleBirthInteger") if let val = exist as? Int { self.multipleBirthInteger = val } else { - errors.append(FHIRJSONError(key: "multipleBirthInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "multipleBirthInteger", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? [FHIRJSON] { self.name = HumanName.instantiate(fromArray: val, owner: self) as? [HumanName] } else { - errors.append(FHIRJSONError(key: "name", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["photo"] { + if let exist = js["photo"] { presentKeys.insert("photo") if let val = exist as? [FHIRJSON] { self.photo = Attachment.instantiate(fromArray: val, owner: self) as? [Attachment] } else { - errors.append(FHIRJSONError(key: "photo", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "photo", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -333,7 +333,7 @@ public class Patient: DomainResource { * This patient is known to be an animal. */ public class PatientAnimal: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "PatientAnimal" } } @@ -358,34 +358,34 @@ public class PatientAnimal: BackboneElement { self.species = species } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["breed"] { + if let exist = js["breed"] { presentKeys.insert("breed") if let val = exist as? FHIRJSON { self.breed = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "breed", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "breed", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["genderStatus"] { + if let exist = js["genderStatus"] { presentKeys.insert("genderStatus") if let val = exist as? FHIRJSON { self.genderStatus = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "genderStatus", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "genderStatus", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["species"] { + if let exist = js["species"] { presentKeys.insert("species") if let val = exist as? FHIRJSON { self.species = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "species", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "species", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -419,7 +419,7 @@ public class PatientAnimal: BackboneElement { * Languages which may be used to communicate with the patient about his or her health. */ public class PatientCommunication: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "PatientCommunication" } } @@ -441,28 +441,28 @@ public class PatientCommunication: BackboneElement { self.language = language } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["language"] { + if let exist = js["language"] { presentKeys.insert("language") if let val = exist as? FHIRJSON { self.language = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "language", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "language", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "language")) } - if let exist: AnyObject = js["preferred"] { + if let exist = js["preferred"] { presentKeys.insert("preferred") if let val = exist as? Bool { self.preferred = val } else { - errors.append(FHIRJSONError(key: "preferred", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "preferred", wants: Bool.self, has: type(of: exist))) } } } @@ -488,7 +488,7 @@ public class PatientCommunication: BackboneElement { * A contact party (e.g. guardian, partner, friend) for the patient. */ public class PatientContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "PatientContact" } } @@ -519,70 +519,70 @@ public class PatientContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["address"] { + if let exist = js["address"] { presentKeys.insert("address") if let val = exist as? FHIRJSON { self.address = Address(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "address", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "address", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["gender"] { + if let exist = js["gender"] { presentKeys.insert("gender") if let val = exist as? String { self.gender = val } else { - errors.append(FHIRJSONError(key: "gender", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "gender", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? FHIRJSON { self.name = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "name", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["relationship"] { + if let exist = js["relationship"] { presentKeys.insert("relationship") if let val = exist as? [FHIRJSON] { self.relationship = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "relationship", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "relationship", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -625,7 +625,7 @@ public class PatientContact: BackboneElement { * Link to another patient resource that concerns the same actual patient. */ public class PatientLink: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "PatientLink" } } @@ -648,28 +648,28 @@ public class PatientLink: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["other"] { + if let exist = js["other"] { presentKeys.insert("other") if let val = exist as? FHIRJSON { self.other = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "other", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "other", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "other")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/PaymentNotice.swift b/Sources/Models/PaymentNotice.swift index 012e1ca5..36bca6c0 100644 --- a/Sources/Models/PaymentNotice.swift +++ b/Sources/Models/PaymentNotice.swift @@ -2,7 +2,7 @@ // PaymentNotice.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/PaymentNotice) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/PaymentNotice) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * resource references. */ public class PaymentNotice: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "PaymentNotice" } } @@ -62,100 +62,100 @@ public class PaymentNotice: DomainResource { self.paymentStatus = paymentStatus } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["paymentStatus"] { + if let exist = js["paymentStatus"] { presentKeys.insert("paymentStatus") if let val = exist as? FHIRJSON { self.paymentStatus = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "paymentStatus", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "paymentStatus", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "paymentStatus")) } - if let exist: AnyObject = js["provider"] { + if let exist = js["provider"] { presentKeys.insert("provider") if let val = exist as? FHIRJSON { self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["response"] { + if let exist = js["response"] { presentKeys.insert("response") if let val = exist as? FHIRJSON { self.response = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ruleset"] { + if let exist = js["ruleset"] { presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? FHIRJSON { self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/PaymentReconciliation.swift b/Sources/Models/PaymentReconciliation.swift index 2e301c50..01c43718 100644 --- a/Sources/Models/PaymentReconciliation.swift +++ b/Sources/Models/PaymentReconciliation.swift @@ -2,7 +2,7 @@ // PaymentReconciliation.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/PaymentReconciliation) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * This resource provides payment details and claim references supporting a bulk payment. */ public class PaymentReconciliation: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "PaymentReconciliation" } } @@ -76,142 +76,142 @@ public class PaymentReconciliation: DomainResource { self.total = total } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["detail"] { + if let exist = js["detail"] { presentKeys.insert("detail") if let val = exist as? [FHIRJSON] { self.detail = PaymentReconciliationDetail.instantiate(fromArray: val, owner: self) as? [PaymentReconciliationDetail] } else { - errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "detail", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["disposition"] { + if let exist = js["disposition"] { presentKeys.insert("disposition") if let val = exist as? String { self.disposition = val } else { - errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["form"] { + if let exist = js["form"] { presentKeys.insert("form") if let val = exist as? FHIRJSON { self.form = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "form", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "form", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["note"] { + if let exist = js["note"] { presentKeys.insert("note") if let val = exist as? [FHIRJSON] { self.note = PaymentReconciliationNote.instantiate(fromArray: val, owner: self) as? [PaymentReconciliationNote] } else { - errors.append(FHIRJSONError(key: "note", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "note", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["outcome"] { + if let exist = js["outcome"] { presentKeys.insert("outcome") if let val = exist as? String { self.outcome = val } else { - errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestOrganization"] { + if let exist = js["requestOrganization"] { presentKeys.insert("requestOrganization") if let val = exist as? FHIRJSON { self.requestOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestProvider"] { + if let exist = js["requestProvider"] { presentKeys.insert("requestProvider") if let val = exist as? FHIRJSON { self.requestProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ruleset"] { + if let exist = js["ruleset"] { presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["total"] { + if let exist = js["total"] { presentKeys.insert("total") if let val = exist as? FHIRJSON { self.total = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "total", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "total", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -281,7 +281,7 @@ public class PaymentReconciliation: DomainResource { * List of individual settlement amounts and the corresponding transaction. */ public class PaymentReconciliationDetail: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "PaymentReconciliationDetail" } } @@ -318,70 +318,70 @@ public class PaymentReconciliationDetail: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["amount"] { + if let exist = js["amount"] { presentKeys.insert("amount") if let val = exist as? FHIRJSON { self.amount = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "amount", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["payee"] { + if let exist = js["payee"] { presentKeys.insert("payee") if let val = exist as? FHIRJSON { self.payee = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "payee", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "payee", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["responce"] { + if let exist = js["responce"] { presentKeys.insert("responce") if let val = exist as? FHIRJSON { self.responce = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "responce", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "responce", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["submitter"] { + if let exist = js["submitter"] { presentKeys.insert("submitter") if let val = exist as? FHIRJSON { self.submitter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "submitter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "submitter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -427,7 +427,7 @@ public class PaymentReconciliationDetail: BackboneElement { * Suite of notes. */ public class PaymentReconciliationNote: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "PaymentReconciliationNote" } } @@ -443,25 +443,25 @@ public class PaymentReconciliationNote: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Period.swift b/Sources/Models/Period.swift index 711cefc6..061ea391 100644 --- a/Sources/Models/Period.swift +++ b/Sources/Models/Period.swift @@ -2,7 +2,7 @@ // Period.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Period) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Period) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A time period defined by a start and end date and optionally time. */ public class Period: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Period" } } @@ -31,25 +31,25 @@ public class Period: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["end"] { + if let exist = js["end"] { presentKeys.insert("end") if let val = exist as? String { self.end = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "end", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "end", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["start"] { + if let exist = js["start"] { presentKeys.insert("start") if let val = exist as? String { self.start = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "start", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "start", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Person.swift b/Sources/Models/Person.swift index d21a4cd3..4fa02a72 100644 --- a/Sources/Models/Person.swift +++ b/Sources/Models/Person.swift @@ -2,7 +2,7 @@ // Person.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Person) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Person) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * Demographics and administrative information about a person independent of a specific health-related context. */ public class Person: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Person" } } @@ -55,97 +55,97 @@ public class Person: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["active"] { + if let exist = js["active"] { presentKeys.insert("active") if let val = exist as? Bool { self.active = val } else { - errors.append(FHIRJSONError(key: "active", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "active", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["address"] { + if let exist = js["address"] { presentKeys.insert("address") if let val = exist as? [FHIRJSON] { self.address = Address.instantiate(fromArray: val, owner: self) as? [Address] } else { - errors.append(FHIRJSONError(key: "address", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "address", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["birthDate"] { + if let exist = js["birthDate"] { presentKeys.insert("birthDate") if let val = exist as? String { self.birthDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "birthDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "birthDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["gender"] { + if let exist = js["gender"] { presentKeys.insert("gender") if let val = exist as? String { self.gender = val } else { - errors.append(FHIRJSONError(key: "gender", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "gender", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["link"] { + if let exist = js["link"] { presentKeys.insert("link") if let val = exist as? [FHIRJSON] { self.link = PersonLink.instantiate(fromArray: val, owner: self) as? [PersonLink] } else { - errors.append(FHIRJSONError(key: "link", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "link", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["managingOrganization"] { + if let exist = js["managingOrganization"] { presentKeys.insert("managingOrganization") if let val = exist as? FHIRJSON { self.managingOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? [FHIRJSON] { self.name = HumanName.instantiate(fromArray: val, owner: self) as? [HumanName] } else { - errors.append(FHIRJSONError(key: "name", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["photo"] { + if let exist = js["photo"] { presentKeys.insert("photo") if let val = exist as? FHIRJSON { self.photo = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "photo", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "photo", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -195,7 +195,7 @@ public class Person: DomainResource { * Link to a resource that concerns the same actual person. */ public class PersonLink: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "PersonLink" } } @@ -217,25 +217,25 @@ public class PersonLink: BackboneElement { self.target = target } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["assurance"] { + if let exist = js["assurance"] { presentKeys.insert("assurance") if let val = exist as? String { self.assurance = val } else { - errors.append(FHIRJSONError(key: "assurance", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "assurance", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? FHIRJSON { self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Practitioner.swift b/Sources/Models/Practitioner.swift index b0ac95c7..20ff7a4d 100644 --- a/Sources/Models/Practitioner.swift +++ b/Sources/Models/Practitioner.swift @@ -2,7 +2,7 @@ // Practitioner.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Practitioner) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Practitioner) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A person who is directly or indirectly involved in the provisioning of healthcare. */ public class Practitioner: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Practitioner" } } @@ -58,106 +58,106 @@ public class Practitioner: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["active"] { + if let exist = js["active"] { presentKeys.insert("active") if let val = exist as? Bool { self.active = val } else { - errors.append(FHIRJSONError(key: "active", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "active", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["address"] { + if let exist = js["address"] { presentKeys.insert("address") if let val = exist as? [FHIRJSON] { self.address = Address.instantiate(fromArray: val, owner: self) as? [Address] } else { - errors.append(FHIRJSONError(key: "address", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "address", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["birthDate"] { + if let exist = js["birthDate"] { presentKeys.insert("birthDate") if let val = exist as? String { self.birthDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "birthDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "birthDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["communication"] { + if let exist = js["communication"] { presentKeys.insert("communication") if let val = exist as? [FHIRJSON] { self.communication = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "communication", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "communication", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["gender"] { + if let exist = js["gender"] { presentKeys.insert("gender") if let val = exist as? String { self.gender = val } else { - errors.append(FHIRJSONError(key: "gender", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "gender", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? FHIRJSON { self.name = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "name", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["photo"] { + if let exist = js["photo"] { presentKeys.insert("photo") if let val = exist as? [FHIRJSON] { self.photo = Attachment.instantiate(fromArray: val, owner: self) as? [Attachment] } else { - errors.append(FHIRJSONError(key: "photo", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "photo", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["practitionerRole"] { + if let exist = js["practitionerRole"] { presentKeys.insert("practitionerRole") if let val = exist as? [FHIRJSON] { self.practitionerRole = PractitionerPractitionerRole.instantiate(fromArray: val, owner: self) as? [PractitionerPractitionerRole] } else { - errors.append(FHIRJSONError(key: "practitionerRole", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "practitionerRole", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["qualification"] { + if let exist = js["qualification"] { presentKeys.insert("qualification") if let val = exist as? [FHIRJSON] { self.qualification = PractitionerQualification.instantiate(fromArray: val, owner: self) as? [PractitionerQualification] } else { - errors.append(FHIRJSONError(key: "qualification", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "qualification", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -212,7 +212,7 @@ public class Practitioner: DomainResource { * The list of roles/organizations that the practitioner is associated with. */ public class PractitionerPractitionerRole: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "PractitionerPractitionerRole" } } @@ -240,61 +240,61 @@ public class PractitionerPractitionerRole: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["healthcareService"] { + if let exist = js["healthcareService"] { presentKeys.insert("healthcareService") if let val = exist as? [FHIRJSON] { self.healthcareService = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "healthcareService", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "healthcareService", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? [FHIRJSON] { self.location = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "location", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["managingOrganization"] { + if let exist = js["managingOrganization"] { presentKeys.insert("managingOrganization") if let val = exist as? FHIRJSON { self.managingOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "managingOrganization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["role"] { + if let exist = js["role"] { presentKeys.insert("role") if let val = exist as? FHIRJSON { self.role = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["specialty"] { + if let exist = js["specialty"] { presentKeys.insert("specialty") if let val = exist as? [FHIRJSON] { self.specialty = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "specialty", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "specialty", wants: Array.self, has: type(of: exist))) } } } @@ -332,7 +332,7 @@ public class PractitionerPractitionerRole: BackboneElement { * Qualifications obtained by training and certification. */ public class PractitionerQualification: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "PractitionerQualification" } } @@ -360,46 +360,46 @@ public class PractitionerQualification: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["issuer"] { + if let exist = js["issuer"] { presentKeys.insert("issuer") if let val = exist as? FHIRJSON { self.issuer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "issuer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "issuer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Procedure.swift b/Sources/Models/Procedure.swift index 43c19332..2ee54a0d 100644 --- a/Sources/Models/Procedure.swift +++ b/Sources/Models/Procedure.swift @@ -2,7 +2,7 @@ // Procedure.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Procedure) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Procedure) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * invasive like counseling or hypnotherapy. */ public class Procedure: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Procedure" } } @@ -103,223 +103,223 @@ public class Procedure: DomainResource { self.subject = subject } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["bodySite"] { + if let exist = js["bodySite"] { presentKeys.insert("bodySite") if let val = exist as? [FHIRJSON] { self.bodySite = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "bodySite", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySite", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? FHIRJSON { self.category = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["complication"] { + if let exist = js["complication"] { presentKeys.insert("complication") if let val = exist as? [FHIRJSON] { self.complication = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "complication", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "complication", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["focalDevice"] { + if let exist = js["focalDevice"] { presentKeys.insert("focalDevice") if let val = exist as? [FHIRJSON] { self.focalDevice = ProcedureFocalDevice.instantiate(fromArray: val, owner: self) as? [ProcedureFocalDevice] } else { - errors.append(FHIRJSONError(key: "focalDevice", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "focalDevice", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["followUp"] { + if let exist = js["followUp"] { presentKeys.insert("followUp") if let val = exist as? [FHIRJSON] { self.followUp = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "followUp", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "followUp", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? FHIRJSON { self.location = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["notPerformed"] { + if let exist = js["notPerformed"] { presentKeys.insert("notPerformed") if let val = exist as? Bool { self.notPerformed = val } else { - errors.append(FHIRJSONError(key: "notPerformed", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "notPerformed", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["notes"] { + if let exist = js["notes"] { presentKeys.insert("notes") if let val = exist as? [FHIRJSON] { self.notes = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] } else { - errors.append(FHIRJSONError(key: "notes", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "notes", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["outcome"] { + if let exist = js["outcome"] { presentKeys.insert("outcome") if let val = exist as? FHIRJSON { self.outcome = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "outcome", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["performedDateTime"] { + if let exist = js["performedDateTime"] { presentKeys.insert("performedDateTime") if let val = exist as? String { self.performedDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "performedDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "performedDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["performedPeriod"] { + if let exist = js["performedPeriod"] { presentKeys.insert("performedPeriod") if let val = exist as? FHIRJSON { self.performedPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "performedPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "performedPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["performer"] { + if let exist = js["performer"] { presentKeys.insert("performer") if let val = exist as? [FHIRJSON] { self.performer = ProcedurePerformer.instantiate(fromArray: val, owner: self) as? [ProcedurePerformer] } else { - errors.append(FHIRJSONError(key: "performer", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "performer", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonCodeableConcept"] { + if let exist = js["reasonCodeableConcept"] { presentKeys.insert("reasonCodeableConcept") if let val = exist as? FHIRJSON { self.reasonCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonNotPerformed"] { + if let exist = js["reasonNotPerformed"] { presentKeys.insert("reasonNotPerformed") if let val = exist as? [FHIRJSON] { self.reasonNotPerformed = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reasonNotPerformed", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonNotPerformed", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonReference"] { + if let exist = js["reasonReference"] { presentKeys.insert("reasonReference") if let val = exist as? FHIRJSON { self.reasonReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["report"] { + if let exist = js["report"] { presentKeys.insert("report") if let val = exist as? [FHIRJSON] { self.report = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "report", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "report", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "subject")) } - if let exist: AnyObject = js["used"] { + if let exist = js["used"] { presentKeys.insert("used") if let val = exist as? [FHIRJSON] { self.used = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "used", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "used", wants: Array.self, has: type(of: exist))) } } } @@ -411,7 +411,7 @@ public class Procedure: DomainResource { * prosthesis, attaching a wound-vac, etc.) as a focal portion of the Procedure. */ public class ProcedureFocalDevice: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ProcedureFocalDevice" } } @@ -433,25 +433,25 @@ public class ProcedureFocalDevice: BackboneElement { self.manipulated = manipulated } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["action"] { + if let exist = js["action"] { presentKeys.insert("action") if let val = exist as? FHIRJSON { self.action = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "action", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "action", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["manipulated"] { + if let exist = js["manipulated"] { presentKeys.insert("manipulated") if let val = exist as? FHIRJSON { self.manipulated = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "manipulated", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "manipulated", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -482,7 +482,7 @@ public class ProcedureFocalDevice: BackboneElement { * Limited to 'real' people rather than equipment. */ public class ProcedurePerformer: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ProcedurePerformer" } } @@ -498,25 +498,25 @@ public class ProcedurePerformer: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["actor"] { + if let exist = js["actor"] { presentKeys.insert("actor") if let val = exist as? FHIRJSON { self.actor = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["role"] { + if let exist = js["role"] { presentKeys.insert("role") if let val = exist as? FHIRJSON { self.role = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/ProcedureRequest.swift b/Sources/Models/ProcedureRequest.swift index 1267626f..e4dfbc75 100644 --- a/Sources/Models/ProcedureRequest.swift +++ b/Sources/Models/ProcedureRequest.swift @@ -2,7 +2,7 @@ // ProcedureRequest.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcedureRequest) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcedureRequest) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A request for a procedure to be performed. May be a proposal or an order. */ public class ProcedureRequest: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ProcedureRequest" } } @@ -86,172 +86,172 @@ public class ProcedureRequest: DomainResource { self.subject = subject } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["asNeededBoolean"] { + if let exist = js["asNeededBoolean"] { presentKeys.insert("asNeededBoolean") if let val = exist as? Bool { self.asNeededBoolean = val } else { - errors.append(FHIRJSONError(key: "asNeededBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "asNeededBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["asNeededCodeableConcept"] { + if let exist = js["asNeededCodeableConcept"] { presentKeys.insert("asNeededCodeableConcept") if let val = exist as? FHIRJSON { self.asNeededCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "asNeededCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "asNeededCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["bodySite"] { + if let exist = js["bodySite"] { presentKeys.insert("bodySite") if let val = exist as? [FHIRJSON] { self.bodySite = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "bodySite", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySite", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["notes"] { + if let exist = js["notes"] { presentKeys.insert("notes") if let val = exist as? [FHIRJSON] { self.notes = Annotation.instantiate(fromArray: val, owner: self) as? [Annotation] } else { - errors.append(FHIRJSONError(key: "notes", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "notes", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["orderedOn"] { + if let exist = js["orderedOn"] { presentKeys.insert("orderedOn") if let val = exist as? String { self.orderedOn = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "orderedOn", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "orderedOn", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["orderer"] { + if let exist = js["orderer"] { presentKeys.insert("orderer") if let val = exist as? FHIRJSON { self.orderer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "orderer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "orderer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["performer"] { + if let exist = js["performer"] { presentKeys.insert("performer") if let val = exist as? FHIRJSON { self.performer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "performer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "performer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["priority"] { + if let exist = js["priority"] { presentKeys.insert("priority") if let val = exist as? String { self.priority = val } else { - errors.append(FHIRJSONError(key: "priority", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priority", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonCodeableConcept"] { + if let exist = js["reasonCodeableConcept"] { presentKeys.insert("reasonCodeableConcept") if let val = exist as? FHIRJSON { self.reasonCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonReference"] { + if let exist = js["reasonReference"] { presentKeys.insert("reasonReference") if let val = exist as? FHIRJSON { self.reasonReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["scheduledDateTime"] { + if let exist = js["scheduledDateTime"] { presentKeys.insert("scheduledDateTime") if let val = exist as? String { self.scheduledDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "scheduledDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "scheduledDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["scheduledPeriod"] { + if let exist = js["scheduledPeriod"] { presentKeys.insert("scheduledPeriod") if let val = exist as? FHIRJSON { self.scheduledPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "scheduledPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "scheduledPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["scheduledTiming"] { + if let exist = js["scheduledTiming"] { presentKeys.insert("scheduledTiming") if let val = exist as? FHIRJSON { self.scheduledTiming = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "scheduledTiming", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "scheduledTiming", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/ProcessRequest.swift b/Sources/Models/ProcessRequest.swift index 6835f924..f82f317b 100644 --- a/Sources/Models/ProcessRequest.swift +++ b/Sources/Models/ProcessRequest.swift @@ -2,7 +2,7 @@ // ProcessRequest.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcessRequest) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcessRequest) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * target on or about existing resources. */ public class ProcessRequest: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ProcessRequest" } } @@ -80,154 +80,154 @@ public class ProcessRequest: DomainResource { self.action = action } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["action"] { + if let exist = js["action"] { presentKeys.insert("action") if let val = exist as? String { self.action = val } else { - errors.append(FHIRJSONError(key: "action", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "action", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "action")) } - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["exclude"] { + if let exist = js["exclude"] { presentKeys.insert("exclude") if let val = exist as? [String] { self.exclude = val } else { - errors.append(FHIRJSONError(key: "exclude", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exclude", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["include"] { + if let exist = js["include"] { presentKeys.insert("include") if let val = exist as? [String] { self.include = val } else { - errors.append(FHIRJSONError(key: "include", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "include", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["item"] { + if let exist = js["item"] { presentKeys.insert("item") if let val = exist as? [FHIRJSON] { self.item = ProcessRequestItem.instantiate(fromArray: val, owner: self) as? [ProcessRequestItem] } else { - errors.append(FHIRJSONError(key: "item", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "item", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["nullify"] { + if let exist = js["nullify"] { presentKeys.insert("nullify") if let val = exist as? Bool { self.nullify = val } else { - errors.append(FHIRJSONError(key: "nullify", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "nullify", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["provider"] { + if let exist = js["provider"] { presentKeys.insert("provider") if let val = exist as? FHIRJSON { self.provider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "provider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reference"] { + if let exist = js["reference"] { presentKeys.insert("reference") if let val = exist as? String { self.reference = val } else { - errors.append(FHIRJSONError(key: "reference", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reference", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["response"] { + if let exist = js["response"] { presentKeys.insert("response") if let val = exist as? FHIRJSON { self.response = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "response", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ruleset"] { + if let exist = js["ruleset"] { presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? FHIRJSON { self.target = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -244,7 +244,7 @@ public class ProcessRequest: DomainResource { json["created"] = created.asJSON() } if let exclude = self.exclude { - var arr = [AnyObject]() + var arr = [Any]() for val in exclude { arr.append(val.asJSON()) } @@ -254,7 +254,7 @@ public class ProcessRequest: DomainResource { json["identifier"] = Identifier.asJSONArray(identifier) } if let include = self.include { - var arr = [AnyObject]() + var arr = [Any]() for val in include { arr.append(val.asJSON()) } @@ -305,7 +305,7 @@ public class ProcessRequest: DomainResource { * List of top level items to be re-adjudicated, if none specified then the entire submission is re-adjudicated. */ public class ProcessRequestItem: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ProcessRequestItem" } } @@ -324,16 +324,16 @@ public class ProcessRequestItem: BackboneElement { self.sequenceLinkId = sequenceLinkId } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["sequenceLinkId"] { + if let exist = js["sequenceLinkId"] { presentKeys.insert("sequenceLinkId") if let val = exist as? Int { self.sequenceLinkId = val } else { - errors.append(FHIRJSONError(key: "sequenceLinkId", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sequenceLinkId", wants: Int.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/ProcessResponse.swift b/Sources/Models/ProcessResponse.swift index cd2e680e..5b6d58cd 100644 --- a/Sources/Models/ProcessResponse.swift +++ b/Sources/Models/ProcessResponse.swift @@ -2,7 +2,7 @@ // ProcessResponse.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcessResponse) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ProcessResponse) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * This resource provides processing status, errors and notes from the processing of a resource. */ public class ProcessResponse: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ProcessResponse" } } @@ -64,124 +64,124 @@ public class ProcessResponse: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["created"] { + if let exist = js["created"] { presentKeys.insert("created") if let val = exist as? String { self.created = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "created", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "created", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["disposition"] { + if let exist = js["disposition"] { presentKeys.insert("disposition") if let val = exist as? String { self.disposition = val } else { - errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "disposition", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["error"] { + if let exist = js["error"] { presentKeys.insert("error") if let val = exist as? [FHIRJSON] { self.error = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "error", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "error", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["form"] { + if let exist = js["form"] { presentKeys.insert("form") if let val = exist as? FHIRJSON { self.form = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "form", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "form", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["notes"] { + if let exist = js["notes"] { presentKeys.insert("notes") if let val = exist as? [FHIRJSON] { self.notes = ProcessResponseNotes.instantiate(fromArray: val, owner: self) as? [ProcessResponseNotes] } else { - errors.append(FHIRJSONError(key: "notes", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "notes", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["organization"] { + if let exist = js["organization"] { presentKeys.insert("organization") if let val = exist as? FHIRJSON { self.organization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "organization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["originalRuleset"] { + if let exist = js["originalRuleset"] { presentKeys.insert("originalRuleset") if let val = exist as? FHIRJSON { self.originalRuleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "originalRuleset", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["outcome"] { + if let exist = js["outcome"] { presentKeys.insert("outcome") if let val = exist as? FHIRJSON { self.outcome = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "outcome", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["request"] { + if let exist = js["request"] { presentKeys.insert("request") if let val = exist as? FHIRJSON { self.request = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "request", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestOrganization"] { + if let exist = js["requestOrganization"] { presentKeys.insert("requestOrganization") if let val = exist as? FHIRJSON { self.requestOrganization = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestOrganization", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestProvider"] { + if let exist = js["requestProvider"] { presentKeys.insert("requestProvider") if let val = exist as? FHIRJSON { self.requestProvider = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestProvider", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ruleset"] { + if let exist = js["ruleset"] { presentKeys.insert("ruleset") if let val = exist as? FHIRJSON { self.ruleset = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ruleset", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -242,7 +242,7 @@ public class ProcessResponse: DomainResource { * Suite of processing note or additional requirements is the processing has been held. */ public class ProcessResponseNotes: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ProcessResponseNotes" } } @@ -258,25 +258,25 @@ public class ProcessResponseNotes: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Provenance.swift b/Sources/Models/Provenance.swift index 1e90d8df..2b6f556b 100644 --- a/Sources/Models/Provenance.swift +++ b/Sources/Models/Provenance.swift @@ -2,7 +2,7 @@ // Provenance.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Provenance) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Provenance) on 2016-09-16. // 2016, SMART Health IT. // @@ -21,7 +21,7 @@ import Foundation * policies. */ public class Provenance: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Provenance" } } @@ -68,100 +68,100 @@ public class Provenance: DomainResource { self.target = target } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["activity"] { + if let exist = js["activity"] { presentKeys.insert("activity") if let val = exist as? FHIRJSON { self.activity = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "activity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "activity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["agent"] { + if let exist = js["agent"] { presentKeys.insert("agent") if let val = exist as? [FHIRJSON] { self.agent = ProvenanceAgent.instantiate(fromArray: val, owner: self) as? [ProvenanceAgent] } else { - errors.append(FHIRJSONError(key: "agent", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "agent", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["entity"] { + if let exist = js["entity"] { presentKeys.insert("entity") if let val = exist as? [FHIRJSON] { self.entity = ProvenanceEntity.instantiate(fromArray: val, owner: self) as? [ProvenanceEntity] } else { - errors.append(FHIRJSONError(key: "entity", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "entity", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["location"] { + if let exist = js["location"] { presentKeys.insert("location") if let val = exist as? FHIRJSON { self.location = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "location", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["policy"] { + if let exist = js["policy"] { presentKeys.insert("policy") if let val = exist as? [String] { self.policy = URL.instantiate(fromArray: val) } else { - errors.append(FHIRJSONError(key: "policy", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "policy", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? [FHIRJSON] { self.reason = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["recorded"] { + if let exist = js["recorded"] { presentKeys.insert("recorded") if let val = exist as? String { self.recorded = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "recorded", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "recorded", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "recorded")) } - if let exist: AnyObject = js["signature"] { + if let exist = js["signature"] { presentKeys.insert("signature") if let val = exist as? [FHIRJSON] { self.signature = Signature.instantiate(fromArray: val, owner: self) as? [Signature] } else { - errors.append(FHIRJSONError(key: "signature", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "signature", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? [FHIRJSON] { self.target = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "target", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: Array.self, has: type(of: exist))) } } else { @@ -190,7 +190,7 @@ public class Provenance: DomainResource { json["period"] = period.asJSON() } if let policy = self.policy { - var arr = [AnyObject]() + var arr = [Any]() for val in policy { arr.append(val.asJSON()) } @@ -222,7 +222,7 @@ public class Provenance: DomainResource { * responsibility. */ public class ProvenanceAgent: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ProvenanceAgent" } } @@ -250,46 +250,46 @@ public class ProvenanceAgent: BackboneElement { self.role = role } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["actor"] { + if let exist = js["actor"] { presentKeys.insert("actor") if let val = exist as? FHIRJSON { self.actor = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["relatedAgent"] { + if let exist = js["relatedAgent"] { presentKeys.insert("relatedAgent") if let val = exist as? [FHIRJSON] { self.relatedAgent = ProvenanceAgentRelatedAgent.instantiate(fromArray: val, owner: self) as? [ProvenanceAgentRelatedAgent] } else { - errors.append(FHIRJSONError(key: "relatedAgent", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "relatedAgent", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["role"] { + if let exist = js["role"] { presentKeys.insert("role") if let val = exist as? FHIRJSON { self.role = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "role", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "role")) } - if let exist: AnyObject = js["userId"] { + if let exist = js["userId"] { presentKeys.insert("userId") if let val = exist as? FHIRJSON { self.userId = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "userId", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "userId", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -325,7 +325,7 @@ public class ProvenanceAgent: BackboneElement { * behest. */ public class ProvenanceAgentRelatedAgent: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ProvenanceAgentRelatedAgent" } } @@ -348,28 +348,28 @@ public class ProvenanceAgentRelatedAgent: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? String { self.target = URL(string: val) } else { - errors.append(FHIRJSONError(key: "target", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "target")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -398,7 +398,7 @@ public class ProvenanceAgentRelatedAgent: BackboneElement { * An entity used in this activity. */ public class ProvenanceEntity: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ProvenanceEntity" } } @@ -431,58 +431,58 @@ public class ProvenanceEntity: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["agent"] { + if let exist = js["agent"] { presentKeys.insert("agent") if let val = exist as? FHIRJSON { self.agent = ProvenanceAgent(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "agent", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "agent", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["display"] { + if let exist = js["display"] { presentKeys.insert("display") if let val = exist as? String { self.display = val } else { - errors.append(FHIRJSONError(key: "display", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "display", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reference"] { + if let exist = js["reference"] { presentKeys.insert("reference") if let val = exist as? String { self.reference = URL(string: val) } else { - errors.append(FHIRJSONError(key: "reference", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reference", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "reference")) } - if let exist: AnyObject = js["role"] { + if let exist = js["role"] { presentKeys.insert("role") if let val = exist as? String { self.role = val } else { - errors.append(FHIRJSONError(key: "role", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "role", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "role")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Quantity.swift b/Sources/Models/Quantity.swift index eb8a6c9b..dba264bc 100644 --- a/Sources/Models/Quantity.swift +++ b/Sources/Models/Quantity.swift @@ -2,7 +2,7 @@ // Quantity.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Quantity) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Quantity) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * are not precisely quantified, including amounts involving arbitrary units and floating currencies. */ public class Quantity: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Quantity" } } @@ -41,52 +41,52 @@ public class Quantity: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["comparator"] { + if let exist = js["comparator"] { presentKeys.insert("comparator") if let val = exist as? String { self.comparator = val } else { - errors.append(FHIRJSONError(key: "comparator", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comparator", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["system"] { + if let exist = js["system"] { presentKeys.insert("system") if let val = exist as? String { self.system = URL(string: val) } else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "system", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["unit"] { + if let exist = js["unit"] { presentKeys.insert("unit") if let val = exist as? String { self.unit = val } else { - errors.append(FHIRJSONError(key: "unit", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "unit", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? NSNumber { self.value = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: NSNumber.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Questionnaire.swift b/Sources/Models/Questionnaire.swift index 863632a9..cf7f31ee 100644 --- a/Sources/Models/Questionnaire.swift +++ b/Sources/Models/Questionnaire.swift @@ -2,7 +2,7 @@ // Questionnaire.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Questionnaire) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Questionnaire) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * into coherent subsets, corresponding to the structure of the grouping of the underlying questions. */ public class Questionnaire: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Questionnaire" } } @@ -57,85 +57,85 @@ public class Questionnaire: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["group"] { + if let exist = js["group"] { presentKeys.insert("group") if let val = exist as? FHIRJSON { self.group = QuestionnaireGroup(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "group", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "group")) } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["publisher"] { + if let exist = js["publisher"] { presentKeys.insert("publisher") if let val = exist as? String { self.publisher = val } else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["subjectType"] { + if let exist = js["subjectType"] { presentKeys.insert("subjectType") if let val = exist as? [String] { self.subjectType = val } else { - errors.append(FHIRJSONError(key: "subjectType", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subjectType", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } @@ -161,7 +161,7 @@ public class Questionnaire: DomainResource { json["status"] = status.asJSON() } if let subjectType = self.subjectType { - var arr = [AnyObject]() + var arr = [Any]() for val in subjectType { arr.append(val.asJSON()) } @@ -185,7 +185,7 @@ public class Questionnaire: DomainResource { * A collection of related questions (or further groupings of questions). */ public class QuestionnaireGroup: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "QuestionnaireGroup" } } @@ -219,79 +219,79 @@ public class QuestionnaireGroup: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["concept"] { + if let exist = js["concept"] { presentKeys.insert("concept") if let val = exist as? [FHIRJSON] { self.concept = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["group"] { + if let exist = js["group"] { presentKeys.insert("group") if let val = exist as? [FHIRJSON] { self.group = QuestionnaireGroup.instantiate(fromArray: val, owner: self) as? [QuestionnaireGroup] } else { - errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["linkId"] { + if let exist = js["linkId"] { presentKeys.insert("linkId") if let val = exist as? String { self.linkId = val } else { - errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["question"] { + if let exist = js["question"] { presentKeys.insert("question") if let val = exist as? [FHIRJSON] { self.question = QuestionnaireGroupQuestion.instantiate(fromArray: val, owner: self) as? [QuestionnaireGroupQuestion] } else { - errors.append(FHIRJSONError(key: "question", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "question", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["repeats"] { + if let exist = js["repeats"] { presentKeys.insert("repeats") if let val = exist as? Bool { self.repeats = val } else { - errors.append(FHIRJSONError(key: "repeats", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "repeats", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["required"] { + if let exist = js["required"] { presentKeys.insert("required") if let val = exist as? Bool { self.required = val } else { - errors.append(FHIRJSONError(key: "required", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "required", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["title"] { + if let exist = js["title"] { presentKeys.insert("title") if let val = exist as? String { self.title = val } else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "title", wants: String.self, has: type(of: exist))) } } } @@ -337,7 +337,7 @@ public class QuestionnaireGroup: BackboneElement { * Set of questions within this group. The order of questions within the group is relevant. */ public class QuestionnaireGroupQuestion: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "QuestionnaireGroupQuestion" } } @@ -374,88 +374,88 @@ public class QuestionnaireGroupQuestion: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["concept"] { + if let exist = js["concept"] { presentKeys.insert("concept") if let val = exist as? [FHIRJSON] { self.concept = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["group"] { + if let exist = js["group"] { presentKeys.insert("group") if let val = exist as? [FHIRJSON] { self.group = QuestionnaireGroup.instantiate(fromArray: val, owner: self) as? [QuestionnaireGroup] } else { - errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["linkId"] { + if let exist = js["linkId"] { presentKeys.insert("linkId") if let val = exist as? String { self.linkId = val } else { - errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["option"] { + if let exist = js["option"] { presentKeys.insert("option") if let val = exist as? [FHIRJSON] { self.option = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "option", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "option", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["options"] { + if let exist = js["options"] { presentKeys.insert("options") if let val = exist as? FHIRJSON { self.options = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "options", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "options", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["repeats"] { + if let exist = js["repeats"] { presentKeys.insert("repeats") if let val = exist as? Bool { self.repeats = val } else { - errors.append(FHIRJSONError(key: "repeats", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "repeats", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["required"] { + if let exist = js["required"] { presentKeys.insert("required") if let val = exist as? Bool { self.required = val } else { - errors.append(FHIRJSONError(key: "required", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "required", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/QuestionnaireResponse.swift b/Sources/Models/QuestionnaireResponse.swift index f96f4ad1..d1b728bc 100644 --- a/Sources/Models/QuestionnaireResponse.swift +++ b/Sources/Models/QuestionnaireResponse.swift @@ -2,7 +2,7 @@ // QuestionnaireResponse.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * corresponding to the structure of the grouping of the underlying questions. */ public class QuestionnaireResponse: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "QuestionnaireResponse" } } @@ -59,91 +59,91 @@ public class QuestionnaireResponse: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["author"] { + if let exist = js["author"] { presentKeys.insert("author") if let val = exist as? FHIRJSON { self.author = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "author", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["authored"] { + if let exist = js["authored"] { presentKeys.insert("authored") if let val = exist as? String { self.authored = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "authored", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "authored", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["group"] { + if let exist = js["group"] { presentKeys.insert("group") if let val = exist as? FHIRJSON { self.group = QuestionnaireResponseGroup(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "group", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["questionnaire"] { + if let exist = js["questionnaire"] { presentKeys.insert("questionnaire") if let val = exist as? FHIRJSON { self.questionnaire = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "questionnaire", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "questionnaire", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["source"] { + if let exist = js["source"] { presentKeys.insert("source") if let val = exist as? FHIRJSON { self.source = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -192,7 +192,7 @@ public class QuestionnaireResponse: DomainResource { * A group of questions to a possibly similarly grouped set of questions in the questionnaire response. */ public class QuestionnaireResponseGroup: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "QuestionnaireResponseGroup" } } @@ -220,61 +220,61 @@ public class QuestionnaireResponseGroup: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["group"] { + if let exist = js["group"] { presentKeys.insert("group") if let val = exist as? [FHIRJSON] { self.group = QuestionnaireResponseGroup.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseGroup] } else { - errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["linkId"] { + if let exist = js["linkId"] { presentKeys.insert("linkId") if let val = exist as? String { self.linkId = val } else { - errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["question"] { + if let exist = js["question"] { presentKeys.insert("question") if let val = exist as? [FHIRJSON] { self.question = QuestionnaireResponseGroupQuestion.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseGroupQuestion] } else { - errors.append(FHIRJSONError(key: "question", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "question", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["title"] { + if let exist = js["title"] { presentKeys.insert("title") if let val = exist as? String { self.title = val } else { - errors.append(FHIRJSONError(key: "title", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "title", wants: String.self, has: type(of: exist))) } } } @@ -314,7 +314,7 @@ public class QuestionnaireResponseGroup: BackboneElement { * Set of questions within this group. The order of questions within the group is relevant. */ public class QuestionnaireResponseGroupQuestion: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "QuestionnaireResponseGroupQuestion" } } @@ -333,34 +333,34 @@ public class QuestionnaireResponseGroupQuestion: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["answer"] { + if let exist = js["answer"] { presentKeys.insert("answer") if let val = exist as? [FHIRJSON] { self.answer = QuestionnaireResponseGroupQuestionAnswer.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseGroupQuestionAnswer] } else { - errors.append(FHIRJSONError(key: "answer", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "answer", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["linkId"] { + if let exist = js["linkId"] { presentKeys.insert("linkId") if let val = exist as? String { self.linkId = val } else { - errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "linkId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["text"] { + if let exist = js["text"] { presentKeys.insert("text") if let val = exist as? String { self.text = val } else { - errors.append(FHIRJSONError(key: "text", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "text", wants: String.self, has: type(of: exist))) } } } @@ -391,7 +391,7 @@ public class QuestionnaireResponseGroupQuestion: BackboneElement { * The respondent's answer(s) to the question. */ public class QuestionnaireResponseGroupQuestionAnswer: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "QuestionnaireResponseGroupQuestionAnswer" } } @@ -443,133 +443,133 @@ public class QuestionnaireResponseGroupQuestionAnswer: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["group"] { + if let exist = js["group"] { presentKeys.insert("group") if let val = exist as? [FHIRJSON] { self.group = QuestionnaireResponseGroup.instantiate(fromArray: val, owner: self) as? [QuestionnaireResponseGroup] } else { - errors.append(FHIRJSONError(key: "group", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "group", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueAttachment"] { + if let exist = js["valueAttachment"] { presentKeys.insert("valueAttachment") if let val = exist as? FHIRJSON { self.valueAttachment = Attachment(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueAttachment", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueBoolean"] { + if let exist = js["valueBoolean"] { presentKeys.insert("valueBoolean") if let val = exist as? Bool { self.valueBoolean = val } else { - errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueCoding"] { + if let exist = js["valueCoding"] { presentKeys.insert("valueCoding") if let val = exist as? FHIRJSON { self.valueCoding = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueCoding", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueCoding", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDate"] { + if let exist = js["valueDate"] { presentKeys.insert("valueDate") if let val = exist as? String { self.valueDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "valueDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDateTime"] { + if let exist = js["valueDateTime"] { presentKeys.insert("valueDateTime") if let val = exist as? String { self.valueDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDecimal"] { + if let exist = js["valueDecimal"] { presentKeys.insert("valueDecimal") if let val = exist as? NSNumber { self.valueDecimal = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "valueDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDecimal", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueInstant"] { + if let exist = js["valueInstant"] { presentKeys.insert("valueInstant") if let val = exist as? String { self.valueInstant = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "valueInstant", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueInstant", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueInteger"] { + if let exist = js["valueInteger"] { presentKeys.insert("valueInteger") if let val = exist as? Int { self.valueInteger = val } else { - errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueQuantity"] { + if let exist = js["valueQuantity"] { presentKeys.insert("valueQuantity") if let val = exist as? FHIRJSON { self.valueQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueReference"] { + if let exist = js["valueReference"] { presentKeys.insert("valueReference") if let val = exist as? FHIRJSON { self.valueReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "valueReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueString"] { + if let exist = js["valueString"] { presentKeys.insert("valueString") if let val = exist as? String { self.valueString = val } else { - errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueTime"] { + if let exist = js["valueTime"] { presentKeys.insert("valueTime") if let val = exist as? String { self.valueTime = FHIRTime(string: val) } else { - errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueUri"] { + if let exist = js["valueUri"] { presentKeys.insert("valueUri") if let val = exist as? String { self.valueUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "valueUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueUri", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Range.swift b/Sources/Models/Range.swift index e6073095..fbc8794e 100644 --- a/Sources/Models/Range.swift +++ b/Sources/Models/Range.swift @@ -2,7 +2,7 @@ // Range.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Range) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Range) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A set of ordered Quantities defined by a low and high limit. */ public class Range: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Range" } } @@ -31,25 +31,25 @@ public class Range: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["high"] { + if let exist = js["high"] { presentKeys.insert("high") if let val = exist as? FHIRJSON { self.high = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "high", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "high", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["low"] { + if let exist = js["low"] { presentKeys.insert("low") if let val = exist as? FHIRJSON { self.low = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "low", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "low", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Ratio.swift b/Sources/Models/Ratio.swift index 7b3846dd..0c71c08a 100644 --- a/Sources/Models/Ratio.swift +++ b/Sources/Models/Ratio.swift @@ -2,7 +2,7 @@ // Ratio.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Ratio) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Ratio) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A relationship of two Quantity values - expressed as a numerator and a denominator. */ public class Ratio: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Ratio" } } @@ -31,25 +31,25 @@ public class Ratio: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["denominator"] { + if let exist = js["denominator"] { presentKeys.insert("denominator") if let val = exist as? FHIRJSON { self.denominator = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "denominator", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "denominator", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["numerator"] { + if let exist = js["numerator"] { presentKeys.insert("numerator") if let val = exist as? FHIRJSON { self.numerator = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "numerator", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "numerator", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Reference.swift b/Sources/Models/Reference.swift index 52d33782..2ec675c7 100644 --- a/Sources/Models/Reference.swift +++ b/Sources/Models/Reference.swift @@ -2,7 +2,7 @@ // Reference.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Reference) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Reference) on 2016-09-16. // 2016, SMART Health IT. // @@ -13,7 +13,7 @@ import Foundation * A reference from one resource to another. */ public class Reference: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Reference" } } @@ -29,25 +29,25 @@ public class Reference: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["display"] { + if let exist = js["display"] { presentKeys.insert("display") if let val = exist as? String { self.display = val } else { - errors.append(FHIRJSONError(key: "display", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "display", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reference"] { + if let exist = js["reference"] { presentKeys.insert("reference") if let val = exist as? String { self.reference = val } else { - errors.append(FHIRJSONError(key: "reference", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reference", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/ReferralRequest.swift b/Sources/Models/ReferralRequest.swift index e6b7ee81..2c71e903 100644 --- a/Sources/Models/ReferralRequest.swift +++ b/Sources/Models/ReferralRequest.swift @@ -2,7 +2,7 @@ // ReferralRequest.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ReferralRequest) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ReferralRequest) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * provider or provider organization. */ public class ReferralRequest: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ReferralRequest" } } @@ -80,154 +80,154 @@ public class ReferralRequest: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dateSent"] { + if let exist = js["dateSent"] { presentKeys.insert("dateSent") if let val = exist as? String { self.dateSent = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "dateSent", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateSent", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fulfillmentTime"] { + if let exist = js["fulfillmentTime"] { presentKeys.insert("fulfillmentTime") if let val = exist as? FHIRJSON { self.fulfillmentTime = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "fulfillmentTime", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fulfillmentTime", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["priority"] { + if let exist = js["priority"] { presentKeys.insert("priority") if let val = exist as? FHIRJSON { self.priority = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "priority", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? FHIRJSON { self.reason = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["recipient"] { + if let exist = js["recipient"] { presentKeys.insert("recipient") if let val = exist as? [FHIRJSON] { self.recipient = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "recipient", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "recipient", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requester"] { + if let exist = js["requester"] { presentKeys.insert("requester") if let val = exist as? FHIRJSON { self.requester = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "requester", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requester", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["serviceRequested"] { + if let exist = js["serviceRequested"] { presentKeys.insert("serviceRequested") if let val = exist as? [FHIRJSON] { self.serviceRequested = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "serviceRequested", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "serviceRequested", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["specialty"] { + if let exist = js["specialty"] { presentKeys.insert("specialty") if let val = exist as? FHIRJSON { self.specialty = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "specialty", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "specialty", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["supportingInformation"] { + if let exist = js["supportingInformation"] { presentKeys.insert("supportingInformation") if let val = exist as? [FHIRJSON] { self.supportingInformation = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "supportingInformation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "supportingInformation", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/RelatedPerson.swift b/Sources/Models/RelatedPerson.swift index d6d85ced..e2f2a92a 100644 --- a/Sources/Models/RelatedPerson.swift +++ b/Sources/Models/RelatedPerson.swift @@ -2,7 +2,7 @@ // RelatedPerson.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/RelatedPerson) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/RelatedPerson) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * has a formal responsibility in the care process. */ public class RelatedPerson: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "RelatedPerson" } } @@ -62,100 +62,100 @@ public class RelatedPerson: DomainResource { self.patient = patient } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["address"] { + if let exist = js["address"] { presentKeys.insert("address") if let val = exist as? [FHIRJSON] { self.address = Address.instantiate(fromArray: val, owner: self) as? [Address] } else { - errors.append(FHIRJSONError(key: "address", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "address", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["birthDate"] { + if let exist = js["birthDate"] { presentKeys.insert("birthDate") if let val = exist as? String { self.birthDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "birthDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "birthDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["gender"] { + if let exist = js["gender"] { presentKeys.insert("gender") if let val = exist as? String { self.gender = val } else { - errors.append(FHIRJSONError(key: "gender", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "gender", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? FHIRJSON { self.name = HumanName(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "name", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "patient")) } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? FHIRJSON { self.period = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["photo"] { + if let exist = js["photo"] { presentKeys.insert("photo") if let val = exist as? [FHIRJSON] { self.photo = Attachment.instantiate(fromArray: val, owner: self) as? [Attachment] } else { - errors.append(FHIRJSONError(key: "photo", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "photo", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["relationship"] { + if let exist = js["relationship"] { presentKeys.insert("relationship") if let val = exist as? FHIRJSON { self.relationship = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "relationship", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Resource.swift b/Sources/Models/Resource.swift index 8b61e959..641e276d 100644 --- a/Sources/Models/Resource.swift +++ b/Sources/Models/Resource.swift @@ -2,7 +2,7 @@ // Resource.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Resource) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Resource) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * This is the base resource type for everything. */ public class Resource: FHIRAbstractResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Resource" } } @@ -37,43 +37,43 @@ public class Resource: FHIRAbstractResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["id"] { + if let exist = js["id"] { presentKeys.insert("id") if let val = exist as? String { self.id = val } else { - errors.append(FHIRJSONError(key: "id", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "id", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["implicitRules"] { + if let exist = js["implicitRules"] { presentKeys.insert("implicitRules") if let val = exist as? String { self.implicitRules = URL(string: val) } else { - errors.append(FHIRJSONError(key: "implicitRules", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "implicitRules", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["language"] { + if let exist = js["language"] { presentKeys.insert("language") if let val = exist as? String { self.language = val } else { - errors.append(FHIRJSONError(key: "language", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "language", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["meta"] { + if let exist = js["meta"] { presentKeys.insert("meta") if let val = exist as? FHIRJSON { self.meta = Meta(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "meta", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "meta", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/RiskAssessment.swift b/Sources/Models/RiskAssessment.swift index 816cc50d..fd8aaf6f 100644 --- a/Sources/Models/RiskAssessment.swift +++ b/Sources/Models/RiskAssessment.swift @@ -2,7 +2,7 @@ // RiskAssessment.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/RiskAssessment) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/RiskAssessment) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * An assessment of the likely outcome(s) for a patient or other subject as well as the likelihood of each outcome. */ public class RiskAssessment: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "RiskAssessment" } } @@ -55,97 +55,97 @@ public class RiskAssessment: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["basis"] { + if let exist = js["basis"] { presentKeys.insert("basis") if let val = exist as? [FHIRJSON] { self.basis = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "basis", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "basis", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["condition"] { + if let exist = js["condition"] { presentKeys.insert("condition") if let val = exist as? FHIRJSON { self.condition = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "condition", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "condition", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["method"] { + if let exist = js["method"] { presentKeys.insert("method") if let val = exist as? FHIRJSON { self.method = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["mitigation"] { + if let exist = js["mitigation"] { presentKeys.insert("mitigation") if let val = exist as? String { self.mitigation = val } else { - errors.append(FHIRJSONError(key: "mitigation", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mitigation", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["performer"] { + if let exist = js["performer"] { presentKeys.insert("performer") if let val = exist as? FHIRJSON { self.performer = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "performer", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "performer", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["prediction"] { + if let exist = js["prediction"] { presentKeys.insert("prediction") if let val = exist as? [FHIRJSON] { self.prediction = RiskAssessmentPrediction.instantiate(fromArray: val, owner: self) as? [RiskAssessmentPrediction] } else { - errors.append(FHIRJSONError(key: "prediction", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prediction", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -197,7 +197,7 @@ public class RiskAssessment: DomainResource { * Describes the expected outcome for the subject. */ public class RiskAssessmentPrediction: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "RiskAssessmentPrediction" } } @@ -237,82 +237,82 @@ public class RiskAssessmentPrediction: BackboneElement { self.outcome = outcome } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["outcome"] { + if let exist = js["outcome"] { presentKeys.insert("outcome") if let val = exist as? FHIRJSON { self.outcome = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "outcome", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "outcome", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "outcome")) } - if let exist: AnyObject = js["probabilityCodeableConcept"] { + if let exist = js["probabilityCodeableConcept"] { presentKeys.insert("probabilityCodeableConcept") if let val = exist as? FHIRJSON { self.probabilityCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "probabilityCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "probabilityCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["probabilityDecimal"] { + if let exist = js["probabilityDecimal"] { presentKeys.insert("probabilityDecimal") if let val = exist as? NSNumber { self.probabilityDecimal = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "probabilityDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "probabilityDecimal", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["probabilityRange"] { + if let exist = js["probabilityRange"] { presentKeys.insert("probabilityRange") if let val = exist as? FHIRJSON { self.probabilityRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "probabilityRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "probabilityRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["rationale"] { + if let exist = js["rationale"] { presentKeys.insert("rationale") if let val = exist as? String { self.rationale = val } else { - errors.append(FHIRJSONError(key: "rationale", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "rationale", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["relativeRisk"] { + if let exist = js["relativeRisk"] { presentKeys.insert("relativeRisk") if let val = exist as? NSNumber { self.relativeRisk = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "relativeRisk", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "relativeRisk", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["whenPeriod"] { + if let exist = js["whenPeriod"] { presentKeys.insert("whenPeriod") if let val = exist as? FHIRJSON { self.whenPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "whenPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "whenPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["whenRange"] { + if let exist = js["whenRange"] { presentKeys.insert("whenRange") if let val = exist as? FHIRJSON { self.whenRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "whenRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "whenRange", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/SampledData.swift b/Sources/Models/SampledData.swift index 2fc5ffae..3416141b 100644 --- a/Sources/Models/SampledData.swift +++ b/Sources/Models/SampledData.swift @@ -2,7 +2,7 @@ // SampledData.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SampledData) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SampledData) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * data. */ public class SampledData: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SampledData" } } @@ -56,82 +56,82 @@ public class SampledData: Element { self.period = period } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["data"] { + if let exist = js["data"] { presentKeys.insert("data") if let val = exist as? String { self.data = val } else { - errors.append(FHIRJSONError(key: "data", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "data", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "data")) } - if let exist: AnyObject = js["dimensions"] { + if let exist = js["dimensions"] { presentKeys.insert("dimensions") if let val = exist as? UInt { self.dimensions = val } else { - errors.append(FHIRJSONError(key: "dimensions", wants: UInt.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dimensions", wants: UInt.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "dimensions")) } - if let exist: AnyObject = js["factor"] { + if let exist = js["factor"] { presentKeys.insert("factor") if let val = exist as? NSNumber { self.factor = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "factor", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["lowerLimit"] { + if let exist = js["lowerLimit"] { presentKeys.insert("lowerLimit") if let val = exist as? NSNumber { self.lowerLimit = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "lowerLimit", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "lowerLimit", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["origin"] { + if let exist = js["origin"] { presentKeys.insert("origin") if let val = exist as? FHIRJSON { self.origin = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "origin", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "origin", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "origin")) } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? NSNumber { self.period = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "period", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: NSNumber.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "period")) } - if let exist: AnyObject = js["upperLimit"] { + if let exist = js["upperLimit"] { presentKeys.insert("upperLimit") if let val = exist as? NSNumber { self.upperLimit = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "upperLimit", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "upperLimit", wants: NSNumber.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Schedule.swift b/Sources/Models/Schedule.swift index 0d250bfc..5177188f 100644 --- a/Sources/Models/Schedule.swift +++ b/Sources/Models/Schedule.swift @@ -2,7 +2,7 @@ // Schedule.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Schedule) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Schedule) on 2016-09-16. // 2016, SMART Health IT. // @@ -13,7 +13,7 @@ import Foundation * A container for slot(s) of time that may be available for booking appointments. */ public class Schedule: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Schedule" } } @@ -44,55 +44,55 @@ public class Schedule: DomainResource { self.actor = actor } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["actor"] { + if let exist = js["actor"] { presentKeys.insert("actor") if let val = exist as? FHIRJSON { self.actor = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "actor", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "actor")) } - if let exist: AnyObject = js["comment"] { + if let exist = js["comment"] { presentKeys.insert("comment") if let val = exist as? String { self.comment = val } else { - errors.append(FHIRJSONError(key: "comment", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comment", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["planningHorizon"] { + if let exist = js["planningHorizon"] { presentKeys.insert("planningHorizon") if let val = exist as? FHIRJSON { self.planningHorizon = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "planningHorizon", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "planningHorizon", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? [FHIRJSON] { self.type = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: type(of: exist))) } } } diff --git a/Sources/Models/SearchParameter.swift b/Sources/Models/SearchParameter.swift index 72cc8873..f6a24342 100644 --- a/Sources/Models/SearchParameter.swift +++ b/Sources/Models/SearchParameter.swift @@ -2,7 +2,7 @@ // SearchParameter.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SearchParameter) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SearchParameter) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A search parameter that defines a named search item that can be used to search/filter on a resource. */ public class SearchParameter: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SearchParameter" } } @@ -81,160 +81,160 @@ public class SearchParameter: DomainResource { self.url = url } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["base"] { + if let exist = js["base"] { presentKeys.insert("base") if let val = exist as? String { self.base = val } else { - errors.append(FHIRJSONError(key: "base", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "base", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "base")) } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = SearchParameterContact.instantiate(fromArray: val, owner: self) as? [SearchParameterContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "description")) } - if let exist: AnyObject = js["experimental"] { + if let exist = js["experimental"] { presentKeys.insert("experimental") if let val = exist as? Bool { self.experimental = val } else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["publisher"] { + if let exist = js["publisher"] { presentKeys.insert("publisher") if let val = exist as? String { self.publisher = val } else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requirements"] { + if let exist = js["requirements"] { presentKeys.insert("requirements") if let val = exist as? String { self.requirements = val } else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["target"] { + if let exist = js["target"] { presentKeys.insert("target") if let val = exist as? [String] { self.target = val } else { - errors.append(FHIRJSONError(key: "target", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "target", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "url")) } - if let exist: AnyObject = js["xpath"] { + if let exist = js["xpath"] { presentKeys.insert("xpath") if let val = exist as? String { self.xpath = val } else { - errors.append(FHIRJSONError(key: "xpath", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "xpath", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["xpathUsage"] { + if let exist = js["xpathUsage"] { presentKeys.insert("xpathUsage") if let val = exist as? String { self.xpathUsage = val } else { - errors.append(FHIRJSONError(key: "xpathUsage", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "xpathUsage", wants: String.self, has: type(of: exist))) } } } @@ -275,7 +275,7 @@ public class SearchParameter: DomainResource { json["status"] = status.asJSON() } if let target = self.target { - var arr = [AnyObject]() + var arr = [Any]() for val in target { arr.append(val.asJSON()) } @@ -305,7 +305,7 @@ public class SearchParameter: DomainResource { * Contacts to assist a user in finding and communicating with the publisher. */ public class SearchParameterContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SearchParameterContact" } } @@ -321,25 +321,25 @@ public class SearchParameterContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Signature.swift b/Sources/Models/Signature.swift index 32c483f3..6f40c4be 100644 --- a/Sources/Models/Signature.swift +++ b/Sources/Models/Signature.swift @@ -2,7 +2,7 @@ // Signature.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Signature) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Signature) on 2016-09-16. // 2016, SMART Health IT. // @@ -17,7 +17,7 @@ import Foundation * different utilities. */ public class Signature: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Signature" } } @@ -56,73 +56,73 @@ public class Signature: Element { self.whoUri = whoUri } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["blob"] { + if let exist = js["blob"] { presentKeys.insert("blob") if let val = exist as? String { self.blob = Base64Binary(string: val) } else { - errors.append(FHIRJSONError(key: "blob", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "blob", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "blob")) } - if let exist: AnyObject = js["contentType"] { + if let exist = js["contentType"] { presentKeys.insert("contentType") if let val = exist as? String { self.contentType = val } else { - errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "contentType")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? [FHIRJSON] { self.type = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "type", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "type")) } - if let exist: AnyObject = js["when"] { + if let exist = js["when"] { presentKeys.insert("when") if let val = exist as? String { self.when = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "when", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "when", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "when")) } - if let exist: AnyObject = js["whoReference"] { + if let exist = js["whoReference"] { presentKeys.insert("whoReference") if let val = exist as? FHIRJSON { self.whoReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "whoReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "whoReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["whoUri"] { + if let exist = js["whoUri"] { presentKeys.insert("whoUri") if let val = exist as? String { self.whoUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "whoUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "whoUri", wants: String.self, has: type(of: exist))) } } diff --git a/Sources/Models/Slot.swift b/Sources/Models/Slot.swift index 6c4d87cb..39d69643 100644 --- a/Sources/Models/Slot.swift +++ b/Sources/Models/Slot.swift @@ -2,7 +2,7 @@ // Slot.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Slot) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Slot) on 2016-09-16. // 2016, SMART Health IT. // @@ -13,7 +13,7 @@ import Foundation * A slot of time on a schedule that may be available for booking appointments. */ public class Slot: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Slot" } } @@ -56,91 +56,91 @@ public class Slot: DomainResource { self.start = start } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["comment"] { + if let exist = js["comment"] { presentKeys.insert("comment") if let val = exist as? String { self.comment = val } else { - errors.append(FHIRJSONError(key: "comment", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comment", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["end"] { + if let exist = js["end"] { presentKeys.insert("end") if let val = exist as? String { self.end = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "end", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "end", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "end")) } - if let exist: AnyObject = js["freeBusyType"] { + if let exist = js["freeBusyType"] { presentKeys.insert("freeBusyType") if let val = exist as? String { self.freeBusyType = val } else { - errors.append(FHIRJSONError(key: "freeBusyType", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "freeBusyType", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "freeBusyType")) } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["overbooked"] { + if let exist = js["overbooked"] { presentKeys.insert("overbooked") if let val = exist as? Bool { self.overbooked = val } else { - errors.append(FHIRJSONError(key: "overbooked", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "overbooked", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["schedule"] { + if let exist = js["schedule"] { presentKeys.insert("schedule") if let val = exist as? FHIRJSON { self.schedule = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "schedule", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "schedule", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "schedule")) } - if let exist: AnyObject = js["start"] { + if let exist = js["start"] { presentKeys.insert("start") if let val = exist as? String { self.start = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "start", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "start", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "start")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Specimen.swift b/Sources/Models/Specimen.swift index 83894548..edef2697 100644 --- a/Sources/Models/Specimen.swift +++ b/Sources/Models/Specimen.swift @@ -2,7 +2,7 @@ // Specimen.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Specimen) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Specimen) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A sample to be used for analysis. */ public class Specimen: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Specimen" } } @@ -61,100 +61,100 @@ public class Specimen: DomainResource { self.subject = subject } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["accessionIdentifier"] { + if let exist = js["accessionIdentifier"] { presentKeys.insert("accessionIdentifier") if let val = exist as? FHIRJSON { self.accessionIdentifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "accessionIdentifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "accessionIdentifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["collection"] { + if let exist = js["collection"] { presentKeys.insert("collection") if let val = exist as? FHIRJSON { self.collection = SpecimenCollection(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "collection", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "collection", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["container"] { + if let exist = js["container"] { presentKeys.insert("container") if let val = exist as? [FHIRJSON] { self.container = SpecimenContainer.instantiate(fromArray: val, owner: self) as? [SpecimenContainer] } else { - errors.append(FHIRJSONError(key: "container", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "container", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["parent"] { + if let exist = js["parent"] { presentKeys.insert("parent") if let val = exist as? [FHIRJSON] { self.parent = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "parent", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "parent", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["receivedTime"] { + if let exist = js["receivedTime"] { presentKeys.insert("receivedTime") if let val = exist as? String { self.receivedTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "receivedTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "receivedTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["subject"] { + if let exist = js["subject"] { presentKeys.insert("subject") if let val = exist as? FHIRJSON { self.subject = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "subject", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "subject")) } - if let exist: AnyObject = js["treatment"] { + if let exist = js["treatment"] { presentKeys.insert("treatment") if let val = exist as? [FHIRJSON] { self.treatment = SpecimenTreatment.instantiate(fromArray: val, owner: self) as? [SpecimenTreatment] } else { - errors.append(FHIRJSONError(key: "treatment", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "treatment", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -206,7 +206,7 @@ public class Specimen: DomainResource { * Details concerning the specimen collection. */ public class SpecimenCollection: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SpecimenCollection" } } @@ -237,70 +237,70 @@ public class SpecimenCollection: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["bodySite"] { + if let exist = js["bodySite"] { presentKeys.insert("bodySite") if let val = exist as? FHIRJSON { self.bodySite = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "bodySite", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "bodySite", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["collectedDateTime"] { + if let exist = js["collectedDateTime"] { presentKeys.insert("collectedDateTime") if let val = exist as? String { self.collectedDateTime = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "collectedDateTime", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "collectedDateTime", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["collectedPeriod"] { + if let exist = js["collectedPeriod"] { presentKeys.insert("collectedPeriod") if let val = exist as? FHIRJSON { self.collectedPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "collectedPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "collectedPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["collector"] { + if let exist = js["collector"] { presentKeys.insert("collector") if let val = exist as? FHIRJSON { self.collector = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "collector", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "collector", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["comment"] { + if let exist = js["comment"] { presentKeys.insert("comment") if let val = exist as? [String] { self.comment = val } else { - errors.append(FHIRJSONError(key: "comment", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comment", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["method"] { + if let exist = js["method"] { presentKeys.insert("method") if let val = exist as? FHIRJSON { self.method = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "method", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -323,7 +323,7 @@ public class SpecimenCollection: BackboneElement { json["collector"] = collector.asJSON() } if let comment = self.comment { - var arr = [AnyObject]() + var arr = [Any]() for val in comment { arr.append(val.asJSON()) } @@ -348,7 +348,7 @@ public class SpecimenCollection: BackboneElement { * addressed here. */ public class SpecimenContainer: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SpecimenContainer" } } @@ -379,70 +379,70 @@ public class SpecimenContainer: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["additiveCodeableConcept"] { + if let exist = js["additiveCodeableConcept"] { presentKeys.insert("additiveCodeableConcept") if let val = exist as? FHIRJSON { self.additiveCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "additiveCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "additiveCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["additiveReference"] { + if let exist = js["additiveReference"] { presentKeys.insert("additiveReference") if let val = exist as? FHIRJSON { self.additiveReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "additiveReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "additiveReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["capacity"] { + if let exist = js["capacity"] { presentKeys.insert("capacity") if let val = exist as? FHIRJSON { self.capacity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "capacity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "capacity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["specimenQuantity"] { + if let exist = js["specimenQuantity"] { presentKeys.insert("specimenQuantity") if let val = exist as? FHIRJSON { self.specimenQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "specimenQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "specimenQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -485,7 +485,7 @@ public class SpecimenContainer: BackboneElement { * Details concerning treatment and processing steps for the specimen. */ public class SpecimenTreatment: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SpecimenTreatment" } } @@ -504,34 +504,34 @@ public class SpecimenTreatment: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["additive"] { + if let exist = js["additive"] { presentKeys.insert("additive") if let val = exist as? [FHIRJSON] { self.additive = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "additive", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "additive", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["procedure"] { + if let exist = js["procedure"] { presentKeys.insert("procedure") if let val = exist as? FHIRJSON { self.procedure = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "procedure", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "procedure", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/StructureDefinition.swift b/Sources/Models/StructureDefinition.swift index c7cf0070..7a6d218b 100644 --- a/Sources/Models/StructureDefinition.swift +++ b/Sources/Models/StructureDefinition.swift @@ -2,7 +2,7 @@ // StructureDefinition.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/StructureDefinition) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/StructureDefinition) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * FHIR, and also for describing extensions, and constraints on resources and data types. */ public class StructureDefinition: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "StructureDefinition" } } @@ -111,247 +111,247 @@ public class StructureDefinition: DomainResource { self.url = url } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["abstract"] { + if let exist = js["abstract"] { presentKeys.insert("abstract") if let val = exist as? Bool { self.abstract = val } else { - errors.append(FHIRJSONError(key: "abstract", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "abstract", wants: Bool.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "abstract")) } - if let exist: AnyObject = js["base"] { + if let exist = js["base"] { presentKeys.insert("base") if let val = exist as? String { self.base = URL(string: val) } else { - errors.append(FHIRJSONError(key: "base", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "base", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? [FHIRJSON] { self.code = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "code", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["constrainedType"] { + if let exist = js["constrainedType"] { presentKeys.insert("constrainedType") if let val = exist as? String { self.constrainedType = val } else { - errors.append(FHIRJSONError(key: "constrainedType", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "constrainedType", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = StructureDefinitionContact.instantiate(fromArray: val, owner: self) as? [StructureDefinitionContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["context"] { + if let exist = js["context"] { presentKeys.insert("context") if let val = exist as? [String] { self.context = val } else { - errors.append(FHIRJSONError(key: "context", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "context", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contextType"] { + if let exist = js["contextType"] { presentKeys.insert("contextType") if let val = exist as? String { self.contextType = val } else { - errors.append(FHIRJSONError(key: "contextType", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contextType", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["copyright"] { + if let exist = js["copyright"] { presentKeys.insert("copyright") if let val = exist as? String { self.copyright = val } else { - errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["differential"] { + if let exist = js["differential"] { presentKeys.insert("differential") if let val = exist as? FHIRJSON { self.differential = StructureDefinitionDifferential(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "differential", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "differential", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["display"] { + if let exist = js["display"] { presentKeys.insert("display") if let val = exist as? String { self.display = val } else { - errors.append(FHIRJSONError(key: "display", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "display", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["experimental"] { + if let exist = js["experimental"] { presentKeys.insert("experimental") if let val = exist as? Bool { self.experimental = val } else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fhirVersion"] { + if let exist = js["fhirVersion"] { presentKeys.insert("fhirVersion") if let val = exist as? String { self.fhirVersion = val } else { - errors.append(FHIRJSONError(key: "fhirVersion", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fhirVersion", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["kind"] { + if let exist = js["kind"] { presentKeys.insert("kind") if let val = exist as? String { self.kind = val } else { - errors.append(FHIRJSONError(key: "kind", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "kind", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "kind")) } - if let exist: AnyObject = js["mapping"] { + if let exist = js["mapping"] { presentKeys.insert("mapping") if let val = exist as? [FHIRJSON] { self.mapping = StructureDefinitionMapping.instantiate(fromArray: val, owner: self) as? [StructureDefinitionMapping] } else { - errors.append(FHIRJSONError(key: "mapping", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "mapping", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["publisher"] { + if let exist = js["publisher"] { presentKeys.insert("publisher") if let val = exist as? String { self.publisher = val } else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requirements"] { + if let exist = js["requirements"] { presentKeys.insert("requirements") if let val = exist as? String { self.requirements = val } else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["snapshot"] { + if let exist = js["snapshot"] { presentKeys.insert("snapshot") if let val = exist as? FHIRJSON { self.snapshot = StructureDefinitionSnapshot(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "snapshot", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "snapshot", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "url")) } - if let exist: AnyObject = js["useContext"] { + if let exist = js["useContext"] { presentKeys.insert("useContext") if let val = exist as? [FHIRJSON] { self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } @@ -377,7 +377,7 @@ public class StructureDefinition: DomainResource { json["contact"] = StructureDefinitionContact.asJSONArray(contact) } if let context = self.context { - var arr = [AnyObject]() + var arr = [Any]() for val in context { arr.append(val.asJSON()) } @@ -452,7 +452,7 @@ public class StructureDefinition: DomainResource { * Contacts to assist a user in finding and communicating with the publisher. */ public class StructureDefinitionContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "StructureDefinitionContact" } } @@ -468,25 +468,25 @@ public class StructureDefinitionContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -515,7 +515,7 @@ public class StructureDefinitionContact: BackboneElement { * applies. */ public class StructureDefinitionDifferential: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "StructureDefinitionDifferential" } } @@ -534,16 +534,16 @@ public class StructureDefinitionDifferential: BackboneElement { self.element = element } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["element"] { + if let exist = js["element"] { presentKeys.insert("element") if let val = exist as? [FHIRJSON] { self.element = ElementDefinition.instantiate(fromArray: val, owner: self) as? [ElementDefinition] } else { - errors.append(FHIRJSONError(key: "element", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "element", wants: Array.self, has: type(of: exist))) } } else { @@ -571,7 +571,7 @@ public class StructureDefinitionDifferential: BackboneElement { * An external specification that the content is mapped to. */ public class StructureDefinitionMapping: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "StructureDefinitionMapping" } } @@ -599,46 +599,46 @@ public class StructureDefinitionMapping: BackboneElement { self.identity = identity } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["comments"] { + if let exist = js["comments"] { presentKeys.insert("comments") if let val = exist as? String { self.comments = val } else { - errors.append(FHIRJSONError(key: "comments", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "comments", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identity"] { + if let exist = js["identity"] { presentKeys.insert("identity") if let val = exist as? String { self.identity = val } else { - errors.append(FHIRJSONError(key: "identity", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identity", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "identity")) } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["uri"] { + if let exist = js["uri"] { presentKeys.insert("uri") if let val = exist as? String { self.uri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "uri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "uri", wants: String.self, has: type(of: exist))) } } } @@ -673,7 +673,7 @@ public class StructureDefinitionMapping: BackboneElement { * StructureDefinition. */ public class StructureDefinitionSnapshot: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "StructureDefinitionSnapshot" } } @@ -692,16 +692,16 @@ public class StructureDefinitionSnapshot: BackboneElement { self.element = element } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["element"] { + if let exist = js["element"] { presentKeys.insert("element") if let val = exist as? [FHIRJSON] { self.element = ElementDefinition.instantiate(fromArray: val, owner: self) as? [ElementDefinition] } else { - errors.append(FHIRJSONError(key: "element", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "element", wants: Array.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Subscription.swift b/Sources/Models/Subscription.swift index 2a71c837..d0f11828 100644 --- a/Sources/Models/Subscription.swift +++ b/Sources/Models/Subscription.swift @@ -2,7 +2,7 @@ // Subscription.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Subscription) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Subscription) on 2016-09-16. // 2016, SMART Health IT. // @@ -18,7 +18,7 @@ import Foundation * take an appropriate action. */ public class Subscription: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Subscription" } } @@ -61,91 +61,91 @@ public class Subscription: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["channel"] { + if let exist = js["channel"] { presentKeys.insert("channel") if let val = exist as? FHIRJSON { self.channel = SubscriptionChannel(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "channel", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "channel", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "channel")) } - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["criteria"] { + if let exist = js["criteria"] { presentKeys.insert("criteria") if let val = exist as? String { self.criteria = val } else { - errors.append(FHIRJSONError(key: "criteria", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "criteria", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "criteria")) } - if let exist: AnyObject = js["end"] { + if let exist = js["end"] { presentKeys.insert("end") if let val = exist as? String { self.end = Instant(string: val) } else { - errors.append(FHIRJSONError(key: "end", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "end", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["error"] { + if let exist = js["error"] { presentKeys.insert("error") if let val = exist as? String { self.error = val } else { - errors.append(FHIRJSONError(key: "error", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "error", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reason"] { + if let exist = js["reason"] { presentKeys.insert("reason") if let val = exist as? String { self.reason = val } else { - errors.append(FHIRJSONError(key: "reason", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reason", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "reason")) } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["tag"] { + if let exist = js["tag"] { presentKeys.insert("tag") if let val = exist as? [FHIRJSON] { self.tag = Coding.instantiate(fromArray: val, owner: self) as? [Coding] } else { - errors.append(FHIRJSONError(key: "tag", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "tag", wants: Array.self, has: type(of: exist))) } } } @@ -191,7 +191,7 @@ public class Subscription: DomainResource { * Details where to send notifications when resources are received that meet the criteria. */ public class SubscriptionChannel: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SubscriptionChannel" } } @@ -220,46 +220,46 @@ public class SubscriptionChannel: BackboneElement { self.type = type } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["endpoint"] { + if let exist = js["endpoint"] { presentKeys.insert("endpoint") if let val = exist as? String { self.endpoint = URL(string: val) } else { - errors.append(FHIRJSONError(key: "endpoint", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "endpoint", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["header"] { + if let exist = js["header"] { presentKeys.insert("header") if let val = exist as? String { self.header = val } else { - errors.append(FHIRJSONError(key: "header", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "header", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["payload"] { + if let exist = js["payload"] { presentKeys.insert("payload") if let val = exist as? String { self.payload = val } else { - errors.append(FHIRJSONError(key: "payload", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "payload", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "payload")) } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? String { self.type = val } else { - errors.append(FHIRJSONError(key: "type", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: String.self, has: type(of: exist))) } } else { diff --git a/Sources/Models/Substance.swift b/Sources/Models/Substance.swift index ca81ab92..50756c6a 100644 --- a/Sources/Models/Substance.swift +++ b/Sources/Models/Substance.swift @@ -2,7 +2,7 @@ // Substance.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Substance) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Substance) on 2016-09-16. // 2016, SMART Health IT. // @@ -13,7 +13,7 @@ import Foundation * A homogeneous material with a definite composition. */ public class Substance: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Substance" } } @@ -47,64 +47,64 @@ public class Substance: DomainResource { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["category"] { + if let exist = js["category"] { presentKeys.insert("category") if let val = exist as? [FHIRJSON] { self.category = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "category", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "category", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["ingredient"] { + if let exist = js["ingredient"] { presentKeys.insert("ingredient") if let val = exist as? [FHIRJSON] { self.ingredient = SubstanceIngredient.instantiate(fromArray: val, owner: self) as? [SubstanceIngredient] } else { - errors.append(FHIRJSONError(key: "ingredient", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "ingredient", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["instance"] { + if let exist = js["instance"] { presentKeys.insert("instance") if let val = exist as? [FHIRJSON] { self.instance = SubstanceInstance.instantiate(fromArray: val, owner: self) as? [SubstanceInstance] } else { - errors.append(FHIRJSONError(key: "instance", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "instance", wants: Array.self, has: type(of: exist))) } } } @@ -144,7 +144,7 @@ public class Substance: DomainResource { * A substance can be composed of other substances. */ public class SubstanceIngredient: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SubstanceIngredient" } } @@ -166,25 +166,25 @@ public class SubstanceIngredient: BackboneElement { self.substance = substance } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Ratio(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["substance"] { + if let exist = js["substance"] { presentKeys.insert("substance") if let val = exist as? FHIRJSON { self.substance = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "substance", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "substance", wants: FHIRJSON.self, has: type(of: exist))) } } else { @@ -216,7 +216,7 @@ public class SubstanceIngredient: BackboneElement { * instance. */ public class SubstanceInstance: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SubstanceInstance" } } @@ -235,34 +235,34 @@ public class SubstanceInstance: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["expiry"] { + if let exist = js["expiry"] { presentKeys.insert("expiry") if let val = exist as? String { self.expiry = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "expiry", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "expiry", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/SupplyDelivery.swift b/Sources/Models/SupplyDelivery.swift index ae4bee6e..7d81cd44 100644 --- a/Sources/Models/SupplyDelivery.swift +++ b/Sources/Models/SupplyDelivery.swift @@ -2,7 +2,7 @@ // SupplyDelivery.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SupplyDelivery) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SupplyDelivery) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * Record of delivery of what is supplied. */ public class SupplyDelivery: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SupplyDelivery" } } @@ -58,106 +58,106 @@ public class SupplyDelivery: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["destination"] { + if let exist = js["destination"] { presentKeys.insert("destination") if let val = exist as? FHIRJSON { self.destination = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "destination", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "destination", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["quantity"] { + if let exist = js["quantity"] { presentKeys.insert("quantity") if let val = exist as? FHIRJSON { self.quantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "quantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["receiver"] { + if let exist = js["receiver"] { presentKeys.insert("receiver") if let val = exist as? [FHIRJSON] { self.receiver = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "receiver", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "receiver", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["suppliedItem"] { + if let exist = js["suppliedItem"] { presentKeys.insert("suppliedItem") if let val = exist as? FHIRJSON { self.suppliedItem = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "suppliedItem", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "suppliedItem", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["supplier"] { + if let exist = js["supplier"] { presentKeys.insert("supplier") if let val = exist as? FHIRJSON { self.supplier = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "supplier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "supplier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["time"] { + if let exist = js["time"] { presentKeys.insert("time") if let val = exist as? String { self.time = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "time", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "time", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["whenPrepared"] { + if let exist = js["whenPrepared"] { presentKeys.insert("whenPrepared") if let val = exist as? FHIRJSON { self.whenPrepared = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "whenPrepared", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "whenPrepared", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/SupplyRequest.swift b/Sources/Models/SupplyRequest.swift index 053223ad..dccfa1ce 100644 --- a/Sources/Models/SupplyRequest.swift +++ b/Sources/Models/SupplyRequest.swift @@ -2,7 +2,7 @@ // SupplyRequest.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SupplyRequest) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/SupplyRequest) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A record of a request for a medication, substance or device used in the healthcare setting. */ public class SupplyRequest: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SupplyRequest" } } @@ -58,106 +58,106 @@ public class SupplyRequest: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["kind"] { + if let exist = js["kind"] { presentKeys.insert("kind") if let val = exist as? FHIRJSON { self.kind = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "kind", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "kind", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["orderedItem"] { + if let exist = js["orderedItem"] { presentKeys.insert("orderedItem") if let val = exist as? FHIRJSON { self.orderedItem = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "orderedItem", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "orderedItem", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonCodeableConcept"] { + if let exist = js["reasonCodeableConcept"] { presentKeys.insert("reasonCodeableConcept") if let val = exist as? FHIRJSON { self.reasonCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonReference"] { + if let exist = js["reasonReference"] { presentKeys.insert("reasonReference") if let val = exist as? FHIRJSON { self.reasonReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["source"] { + if let exist = js["source"] { presentKeys.insert("source") if let val = exist as? FHIRJSON { self.source = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "source", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["supplier"] { + if let exist = js["supplier"] { presentKeys.insert("supplier") if let val = exist as? [FHIRJSON] { self.supplier = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "supplier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "supplier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["when"] { + if let exist = js["when"] { presentKeys.insert("when") if let val = exist as? FHIRJSON { self.when = SupplyRequestWhen(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "when", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "when", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -210,7 +210,7 @@ public class SupplyRequest: DomainResource { * When the request should be fulfilled. */ public class SupplyRequestWhen: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "SupplyRequestWhen" } } @@ -226,25 +226,25 @@ public class SupplyRequestWhen: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["schedule"] { + if let exist = js["schedule"] { presentKeys.insert("schedule") if let val = exist as? FHIRJSON { self.schedule = Timing(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "schedule", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "schedule", wants: FHIRJSON.self, has: type(of: exist))) } } } diff --git a/Sources/Models/TestScript.swift b/Sources/Models/TestScript.swift index 11ca2708..fc3dafce 100644 --- a/Sources/Models/TestScript.swift +++ b/Sources/Models/TestScript.swift @@ -2,7 +2,7 @@ // TestScript.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/TestScript) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/TestScript) on 2016-09-16. // 2016, SMART Health IT. // @@ -16,7 +16,7 @@ import Foundation * compliance against the FHIR specification. */ public class TestScript: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScript" } } @@ -97,205 +97,205 @@ public class TestScript: DomainResource { self.url = url } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = TestScriptContact.instantiate(fromArray: val, owner: self) as? [TestScriptContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["copyright"] { + if let exist = js["copyright"] { presentKeys.insert("copyright") if let val = exist as? String { self.copyright = val } else { - errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["experimental"] { + if let exist = js["experimental"] { presentKeys.insert("experimental") if let val = exist as? Bool { self.experimental = val } else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["fixture"] { + if let exist = js["fixture"] { presentKeys.insert("fixture") if let val = exist as? [FHIRJSON] { self.fixture = TestScriptFixture.instantiate(fromArray: val, owner: self) as? [TestScriptFixture] } else { - errors.append(FHIRJSONError(key: "fixture", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "fixture", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["metadata"] { + if let exist = js["metadata"] { presentKeys.insert("metadata") if let val = exist as? FHIRJSON { self.metadata = TestScriptMetadata(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "metadata", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "metadata", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["multiserver"] { + if let exist = js["multiserver"] { presentKeys.insert("multiserver") if let val = exist as? Bool { self.multiserver = val } else { - errors.append(FHIRJSONError(key: "multiserver", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "multiserver", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["profile"] { + if let exist = js["profile"] { presentKeys.insert("profile") if let val = exist as? [FHIRJSON] { self.profile = Reference.instantiate(fromArray: val, owner: self) as? [Reference] } else { - errors.append(FHIRJSONError(key: "profile", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "profile", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["publisher"] { + if let exist = js["publisher"] { presentKeys.insert("publisher") if let val = exist as? String { self.publisher = val } else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requirements"] { + if let exist = js["requirements"] { presentKeys.insert("requirements") if let val = exist as? String { self.requirements = val } else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["setup"] { + if let exist = js["setup"] { presentKeys.insert("setup") if let val = exist as? FHIRJSON { self.setup = TestScriptSetup(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "setup", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "setup", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["teardown"] { + if let exist = js["teardown"] { presentKeys.insert("teardown") if let val = exist as? FHIRJSON { self.teardown = TestScriptTeardown(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "teardown", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "teardown", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["test"] { + if let exist = js["test"] { presentKeys.insert("test") if let val = exist as? [FHIRJSON] { self.test = TestScriptTest.instantiate(fromArray: val, owner: self) as? [TestScriptTest] } else { - errors.append(FHIRJSONError(key: "test", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "test", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "url")) } - if let exist: AnyObject = js["useContext"] { + if let exist = js["useContext"] { presentKeys.insert("useContext") if let val = exist as? [FHIRJSON] { self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["variable"] { + if let exist = js["variable"] { presentKeys.insert("variable") if let val = exist as? [FHIRJSON] { self.variable = TestScriptVariable.instantiate(fromArray: val, owner: self) as? [TestScriptVariable] } else { - errors.append(FHIRJSONError(key: "variable", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "variable", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } @@ -380,7 +380,7 @@ public class TestScript: DomainResource { * Contacts to assist a user in finding and communicating with the publisher. */ public class TestScriptContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptContact" } } @@ -396,25 +396,25 @@ public class TestScriptContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -442,7 +442,7 @@ public class TestScriptContact: BackboneElement { * Fixture in the test script - by reference (uri). All fixtures are required for the test script to execute. */ public class TestScriptFixture: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptFixture" } } @@ -461,34 +461,34 @@ public class TestScriptFixture: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["autocreate"] { + if let exist = js["autocreate"] { presentKeys.insert("autocreate") if let val = exist as? Bool { self.autocreate = val } else { - errors.append(FHIRJSONError(key: "autocreate", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "autocreate", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["autodelete"] { + if let exist = js["autodelete"] { presentKeys.insert("autodelete") if let val = exist as? Bool { self.autodelete = val } else { - errors.append(FHIRJSONError(key: "autodelete", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "autodelete", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["resource"] { + if let exist = js["resource"] { presentKeys.insert("resource") if let val = exist as? FHIRJSON { self.resource = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "resource", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -519,7 +519,7 @@ public class TestScriptFixture: BackboneElement { * The required capability must exist and are assumed to function correctly on the FHIR server being tested. */ public class TestScriptMetadata: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptMetadata" } } @@ -541,28 +541,28 @@ public class TestScriptMetadata: BackboneElement { self.capability = capability } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["capability"] { + if let exist = js["capability"] { presentKeys.insert("capability") if let val = exist as? [FHIRJSON] { self.capability = TestScriptMetadataCapability.instantiate(fromArray: val, owner: self) as? [TestScriptMetadataCapability] } else { - errors.append(FHIRJSONError(key: "capability", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "capability", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "capability")) } - if let exist: AnyObject = js["link"] { + if let exist = js["link"] { presentKeys.insert("link") if let val = exist as? [FHIRJSON] { self.link = TestScriptMetadataLink.instantiate(fromArray: val, owner: self) as? [TestScriptMetadataLink] } else { - errors.append(FHIRJSONError(key: "link", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "link", wants: Array.self, has: type(of: exist))) } } } @@ -590,7 +590,7 @@ public class TestScriptMetadata: BackboneElement { * Capabilities that must exist and are assumed to function correctly on the FHIR server being tested. */ public class TestScriptMetadataCapability: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptMetadataCapability" } } @@ -624,64 +624,64 @@ public class TestScriptMetadataCapability: BackboneElement { self.conformance = conformance } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["conformance"] { + if let exist = js["conformance"] { presentKeys.insert("conformance") if let val = exist as? FHIRJSON { self.conformance = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "conformance", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "conformance", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "conformance")) } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["destination"] { + if let exist = js["destination"] { presentKeys.insert("destination") if let val = exist as? Int { self.destination = val } else { - errors.append(FHIRJSONError(key: "destination", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "destination", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["link"] { + if let exist = js["link"] { presentKeys.insert("link") if let val = exist as? [String] { self.link = URL.instantiate(fromArray: val) } else { - errors.append(FHIRJSONError(key: "link", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "link", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["required"] { + if let exist = js["required"] { presentKeys.insert("required") if let val = exist as? Bool { self.required = val } else { - errors.append(FHIRJSONError(key: "required", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "required", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["validated"] { + if let exist = js["validated"] { presentKeys.insert("validated") if let val = exist as? Bool { self.validated = val } else { - errors.append(FHIRJSONError(key: "validated", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "validated", wants: Bool.self, has: type(of: exist))) } } } @@ -701,7 +701,7 @@ public class TestScriptMetadataCapability: BackboneElement { json["destination"] = destination.asJSON() } if let link = self.link { - var arr = [AnyObject]() + var arr = [Any]() for val in link { arr.append(val.asJSON()) } @@ -725,7 +725,7 @@ public class TestScriptMetadataCapability: BackboneElement { * A link to the FHIR specification that this test is covering. */ public class TestScriptMetadataLink: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptMetadataLink" } } @@ -747,25 +747,25 @@ public class TestScriptMetadataLink: BackboneElement { self.url = url } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } else { @@ -794,7 +794,7 @@ public class TestScriptMetadataLink: BackboneElement { * A series of required setup operations before tests are executed. */ public class TestScriptSetup: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptSetup" } } @@ -816,28 +816,28 @@ public class TestScriptSetup: BackboneElement { self.action = action } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["action"] { + if let exist = js["action"] { presentKeys.insert("action") if let val = exist as? [FHIRJSON] { self.action = TestScriptSetupAction.instantiate(fromArray: val, owner: self) as? [TestScriptSetupAction] } else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "action", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "action")) } - if let exist: AnyObject = js["metadata"] { + if let exist = js["metadata"] { presentKeys.insert("metadata") if let val = exist as? FHIRJSON { self.metadata = TestScriptMetadata(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "metadata", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "metadata", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -865,7 +865,7 @@ public class TestScriptSetup: BackboneElement { * Action would contain either an operation or an assertion. */ public class TestScriptSetupAction: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptSetupAction" } } @@ -881,25 +881,25 @@ public class TestScriptSetupAction: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["assert"] { + if let exist = js["assert"] { presentKeys.insert("assert") if let val = exist as? FHIRJSON { self.assert = TestScriptSetupActionAssert(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "assert", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "assert", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["operation"] { + if let exist = js["operation"] { presentKeys.insert("operation") if let val = exist as? FHIRJSON { self.operation = TestScriptSetupActionOperation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "operation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "operation", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -927,7 +927,7 @@ public class TestScriptSetupAction: BackboneElement { * Evaluates the results of previous operations to determine if the server under test behaves appropriately. */ public class TestScriptSetupActionAssert: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptSetupActionAssert" } } @@ -991,169 +991,169 @@ public class TestScriptSetupActionAssert: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["compareToSourceId"] { + if let exist = js["compareToSourceId"] { presentKeys.insert("compareToSourceId") if let val = exist as? String { self.compareToSourceId = val } else { - errors.append(FHIRJSONError(key: "compareToSourceId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "compareToSourceId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["compareToSourcePath"] { + if let exist = js["compareToSourcePath"] { presentKeys.insert("compareToSourcePath") if let val = exist as? String { self.compareToSourcePath = val } else { - errors.append(FHIRJSONError(key: "compareToSourcePath", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "compareToSourcePath", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contentType"] { + if let exist = js["contentType"] { presentKeys.insert("contentType") if let val = exist as? String { self.contentType = val } else { - errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["direction"] { + if let exist = js["direction"] { presentKeys.insert("direction") if let val = exist as? String { self.direction = val } else { - errors.append(FHIRJSONError(key: "direction", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "direction", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["headerField"] { + if let exist = js["headerField"] { presentKeys.insert("headerField") if let val = exist as? String { self.headerField = val } else { - errors.append(FHIRJSONError(key: "headerField", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "headerField", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["label"] { + if let exist = js["label"] { presentKeys.insert("label") if let val = exist as? String { self.label = val } else { - errors.append(FHIRJSONError(key: "label", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "label", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["minimumId"] { + if let exist = js["minimumId"] { presentKeys.insert("minimumId") if let val = exist as? String { self.minimumId = val } else { - errors.append(FHIRJSONError(key: "minimumId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "minimumId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["navigationLinks"] { + if let exist = js["navigationLinks"] { presentKeys.insert("navigationLinks") if let val = exist as? Bool { self.navigationLinks = val } else { - errors.append(FHIRJSONError(key: "navigationLinks", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "navigationLinks", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["operator"] { + if let exist = js["operator"] { presentKeys.insert("operator") if let val = exist as? String { self.operator_fhir = val } else { - errors.append(FHIRJSONError(key: "operator", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "operator", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["path"] { + if let exist = js["path"] { presentKeys.insert("path") if let val = exist as? String { self.path = val } else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "path", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["resource"] { + if let exist = js["resource"] { presentKeys.insert("resource") if let val = exist as? String { self.resource = val } else { - errors.append(FHIRJSONError(key: "resource", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "resource", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["response"] { + if let exist = js["response"] { presentKeys.insert("response") if let val = exist as? String { self.response = val } else { - errors.append(FHIRJSONError(key: "response", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "response", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["responseCode"] { + if let exist = js["responseCode"] { presentKeys.insert("responseCode") if let val = exist as? String { self.responseCode = val } else { - errors.append(FHIRJSONError(key: "responseCode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "responseCode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sourceId"] { + if let exist = js["sourceId"] { presentKeys.insert("sourceId") if let val = exist as? String { self.sourceId = val } else { - errors.append(FHIRJSONError(key: "sourceId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sourceId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["validateProfileId"] { + if let exist = js["validateProfileId"] { presentKeys.insert("validateProfileId") if let val = exist as? String { self.validateProfileId = val } else { - errors.append(FHIRJSONError(key: "validateProfileId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "validateProfileId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? String { self.value = val } else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["warningOnly"] { + if let exist = js["warningOnly"] { presentKeys.insert("warningOnly") if let val = exist as? Bool { self.warningOnly = val } else { - errors.append(FHIRJSONError(key: "warningOnly", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "warningOnly", wants: Bool.self, has: type(of: exist))) } } } @@ -1229,7 +1229,7 @@ public class TestScriptSetupActionAssert: BackboneElement { * The operation to perform. */ public class TestScriptSetupActionOperation: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptSetupActionOperation" } } @@ -1281,133 +1281,133 @@ public class TestScriptSetupActionOperation: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["accept"] { + if let exist = js["accept"] { presentKeys.insert("accept") if let val = exist as? String { self.accept = val } else { - errors.append(FHIRJSONError(key: "accept", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "accept", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contentType"] { + if let exist = js["contentType"] { presentKeys.insert("contentType") if let val = exist as? String { self.contentType = val } else { - errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contentType", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["destination"] { + if let exist = js["destination"] { presentKeys.insert("destination") if let val = exist as? Int { self.destination = val } else { - errors.append(FHIRJSONError(key: "destination", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "destination", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encodeRequestUrl"] { + if let exist = js["encodeRequestUrl"] { presentKeys.insert("encodeRequestUrl") if let val = exist as? Bool { self.encodeRequestUrl = val } else { - errors.append(FHIRJSONError(key: "encodeRequestUrl", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encodeRequestUrl", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["label"] { + if let exist = js["label"] { presentKeys.insert("label") if let val = exist as? String { self.label = val } else { - errors.append(FHIRJSONError(key: "label", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "label", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["params"] { + if let exist = js["params"] { presentKeys.insert("params") if let val = exist as? String { self.params = val } else { - errors.append(FHIRJSONError(key: "params", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "params", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requestHeader"] { + if let exist = js["requestHeader"] { presentKeys.insert("requestHeader") if let val = exist as? [FHIRJSON] { self.requestHeader = TestScriptSetupActionOperationRequestHeader.instantiate(fromArray: val, owner: self) as? [TestScriptSetupActionOperationRequestHeader] } else { - errors.append(FHIRJSONError(key: "requestHeader", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requestHeader", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["resource"] { + if let exist = js["resource"] { presentKeys.insert("resource") if let val = exist as? String { self.resource = val } else { - errors.append(FHIRJSONError(key: "resource", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "resource", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["responseId"] { + if let exist = js["responseId"] { presentKeys.insert("responseId") if let val = exist as? String { self.responseId = val } else { - errors.append(FHIRJSONError(key: "responseId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "responseId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sourceId"] { + if let exist = js["sourceId"] { presentKeys.insert("sourceId") if let val = exist as? String { self.sourceId = val } else { - errors.append(FHIRJSONError(key: "sourceId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sourceId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["targetId"] { + if let exist = js["targetId"] { presentKeys.insert("targetId") if let val = exist as? String { self.targetId = val } else { - errors.append(FHIRJSONError(key: "targetId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "targetId", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["type"] { + if let exist = js["type"] { presentKeys.insert("type") if let val = exist as? FHIRJSON { self.type = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "type", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = val } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } } @@ -1471,7 +1471,7 @@ public class TestScriptSetupActionOperation: BackboneElement { * Header elements would be used to set HTTP headers. */ public class TestScriptSetupActionOperationRequestHeader: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptSetupActionOperationRequestHeader" } } @@ -1494,28 +1494,28 @@ public class TestScriptSetupActionOperationRequestHeader: BackboneElement { self.value = value } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["field"] { + if let exist = js["field"] { presentKeys.insert("field") if let val = exist as? String { self.field = val } else { - errors.append(FHIRJSONError(key: "field", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "field", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "field")) } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? String { self.value = val } else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: String.self, has: type(of: exist))) } } else { @@ -1546,7 +1546,7 @@ public class TestScriptSetupActionOperationRequestHeader: BackboneElement { * A series of operations required to clean up after the all the tests are executed (successfully or otherwise). */ public class TestScriptTeardown: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptTeardown" } } @@ -1565,16 +1565,16 @@ public class TestScriptTeardown: BackboneElement { self.action = action } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["action"] { + if let exist = js["action"] { presentKeys.insert("action") if let val = exist as? [FHIRJSON] { self.action = TestScriptTeardownAction.instantiate(fromArray: val, owner: self) as? [TestScriptTeardownAction] } else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "action", wants: Array.self, has: type(of: exist))) } } else { @@ -1602,7 +1602,7 @@ public class TestScriptTeardown: BackboneElement { * The teardown action will only contain an operation. */ public class TestScriptTeardownAction: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptTeardownAction" } } @@ -1615,16 +1615,16 @@ public class TestScriptTeardownAction: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["operation"] { + if let exist = js["operation"] { presentKeys.insert("operation") if let val = exist as? FHIRJSON { self.operation = TestScriptSetupActionOperation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "operation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "operation", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -1647,7 +1647,7 @@ public class TestScriptTeardownAction: BackboneElement { * A test in this script. */ public class TestScriptTest: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptTest" } } @@ -1675,46 +1675,46 @@ public class TestScriptTest: BackboneElement { self.action = action } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["action"] { + if let exist = js["action"] { presentKeys.insert("action") if let val = exist as? [FHIRJSON] { self.action = TestScriptTestAction.instantiate(fromArray: val, owner: self) as? [TestScriptTestAction] } else { - errors.append(FHIRJSONError(key: "action", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "action", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "action")) } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["metadata"] { + if let exist = js["metadata"] { presentKeys.insert("metadata") if let val = exist as? FHIRJSON { self.metadata = TestScriptMetadata(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "metadata", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "metadata", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } } @@ -1748,7 +1748,7 @@ public class TestScriptTest: BackboneElement { * Action would contain either an operation or an assertion. */ public class TestScriptTestAction: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptTestAction" } } @@ -1764,25 +1764,25 @@ public class TestScriptTestAction: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["assert"] { + if let exist = js["assert"] { presentKeys.insert("assert") if let val = exist as? FHIRJSON { self.assert = TestScriptSetupActionAssert(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "assert", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "assert", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["operation"] { + if let exist = js["operation"] { presentKeys.insert("operation") if let val = exist as? FHIRJSON { self.operation = TestScriptSetupActionOperation(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "operation", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "operation", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -1810,7 +1810,7 @@ public class TestScriptTestAction: BackboneElement { * Variable is set based either on element value in response body or on header field value in the response headers. */ public class TestScriptVariable: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TestScriptVariable" } } @@ -1838,46 +1838,46 @@ public class TestScriptVariable: BackboneElement { self.name = name } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["headerField"] { + if let exist = js["headerField"] { presentKeys.insert("headerField") if let val = exist as? String { self.headerField = val } else { - errors.append(FHIRJSONError(key: "headerField", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "headerField", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["path"] { + if let exist = js["path"] { presentKeys.insert("path") if let val = exist as? String { self.path = val } else { - errors.append(FHIRJSONError(key: "path", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "path", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["sourceId"] { + if let exist = js["sourceId"] { presentKeys.insert("sourceId") if let val = exist as? String { self.sourceId = val } else { - errors.append(FHIRJSONError(key: "sourceId", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sourceId", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/Timing.swift b/Sources/Models/Timing.swift index 81c49f0d..9e1a0c2b 100644 --- a/Sources/Models/Timing.swift +++ b/Sources/Models/Timing.swift @@ -2,7 +2,7 @@ // Timing.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Timing) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/Timing) on 2016-09-16. // 2016, SMART Health IT. // @@ -17,7 +17,7 @@ import Foundation * planning care of various kinds. */ public class Timing: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "Timing" } } @@ -36,34 +36,34 @@ public class Timing: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? FHIRJSON { self.code = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["event"] { + if let exist = js["event"] { presentKeys.insert("event") if let val = exist as? [String] { self.event = DateTime.instantiate(fromArray: val) } else { - errors.append(FHIRJSONError(key: "event", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "event", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["repeat"] { + if let exist = js["repeat"] { presentKeys.insert("repeat") if let val = exist as? FHIRJSON { self.repeat_fhir = TimingRepeat(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "repeat", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "repeat", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -77,7 +77,7 @@ public class Timing: Element { json["code"] = code.asJSON() } if let event = self.event { - var arr = [AnyObject]() + var arr = [Any]() for val in event { arr.append(val.asJSON()) } @@ -98,7 +98,7 @@ public class Timing: Element { * A set of rules that describe when the event should occur. */ public class TimingRepeat: Element { - override public class var resourceName: String { + override public class var resourceType: String { get { return "TimingRepeat" } } @@ -147,124 +147,124 @@ public class TimingRepeat: Element { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["boundsPeriod"] { + if let exist = js["boundsPeriod"] { presentKeys.insert("boundsPeriod") if let val = exist as? FHIRJSON { self.boundsPeriod = Period(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "boundsPeriod", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "boundsPeriod", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["boundsQuantity"] { + if let exist = js["boundsQuantity"] { presentKeys.insert("boundsQuantity") if let val = exist as? FHIRJSON { self.boundsQuantity = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "boundsQuantity", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "boundsQuantity", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["boundsRange"] { + if let exist = js["boundsRange"] { presentKeys.insert("boundsRange") if let val = exist as? FHIRJSON { self.boundsRange = Range(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "boundsRange", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "boundsRange", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["count"] { + if let exist = js["count"] { presentKeys.insert("count") if let val = exist as? Int { self.count = val } else { - errors.append(FHIRJSONError(key: "count", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "count", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["duration"] { + if let exist = js["duration"] { presentKeys.insert("duration") if let val = exist as? NSNumber { self.duration = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "duration", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "duration", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["durationMax"] { + if let exist = js["durationMax"] { presentKeys.insert("durationMax") if let val = exist as? NSNumber { self.durationMax = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "durationMax", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "durationMax", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["durationUnits"] { + if let exist = js["durationUnits"] { presentKeys.insert("durationUnits") if let val = exist as? String { self.durationUnits = val } else { - errors.append(FHIRJSONError(key: "durationUnits", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "durationUnits", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["frequency"] { + if let exist = js["frequency"] { presentKeys.insert("frequency") if let val = exist as? Int { self.frequency = val } else { - errors.append(FHIRJSONError(key: "frequency", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "frequency", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["frequencyMax"] { + if let exist = js["frequencyMax"] { presentKeys.insert("frequencyMax") if let val = exist as? Int { self.frequencyMax = val } else { - errors.append(FHIRJSONError(key: "frequencyMax", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "frequencyMax", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["period"] { + if let exist = js["period"] { presentKeys.insert("period") if let val = exist as? NSNumber { self.period = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "period", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "period", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["periodMax"] { + if let exist = js["periodMax"] { presentKeys.insert("periodMax") if let val = exist as? NSNumber { self.periodMax = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "periodMax", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "periodMax", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["periodUnits"] { + if let exist = js["periodUnits"] { presentKeys.insert("periodUnits") if let val = exist as? String { self.periodUnits = val } else { - errors.append(FHIRJSONError(key: "periodUnits", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "periodUnits", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["when"] { + if let exist = js["when"] { presentKeys.insert("when") if let val = exist as? String { self.when = val } else { - errors.append(FHIRJSONError(key: "when", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "when", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/ValueSet.swift b/Sources/Models/ValueSet.swift index 8b79ddf1..ec1efd04 100644 --- a/Sources/Models/ValueSet.swift +++ b/Sources/Models/ValueSet.swift @@ -2,7 +2,7 @@ // ValueSet.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/ValueSet) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * A value set specifies a set of codes drawn from one or more code systems. */ public class ValueSet: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSet" } } @@ -88,181 +88,181 @@ public class ValueSet: DomainResource { self.status = status } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["codeSystem"] { + if let exist = js["codeSystem"] { presentKeys.insert("codeSystem") if let val = exist as? FHIRJSON { self.codeSystem = ValueSetCodeSystem(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "codeSystem", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "codeSystem", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["compose"] { + if let exist = js["compose"] { presentKeys.insert("compose") if let val = exist as? FHIRJSON { self.compose = ValueSetCompose(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "compose", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "compose", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contact"] { + if let exist = js["contact"] { presentKeys.insert("contact") if let val = exist as? [FHIRJSON] { self.contact = ValueSetContact.instantiate(fromArray: val, owner: self) as? [ValueSetContact] } else { - errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contact", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["copyright"] { + if let exist = js["copyright"] { presentKeys.insert("copyright") if let val = exist as? String { self.copyright = val } else { - errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "copyright", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["date"] { + if let exist = js["date"] { presentKeys.insert("date") if let val = exist as? String { self.date = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "date", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "date", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["description"] { + if let exist = js["description"] { presentKeys.insert("description") if let val = exist as? String { self.description_fhir = val } else { - errors.append(FHIRJSONError(key: "description", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "description", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["expansion"] { + if let exist = js["expansion"] { presentKeys.insert("expansion") if let val = exist as? FHIRJSON { self.expansion = ValueSetExpansion(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "expansion", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "expansion", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["experimental"] { + if let exist = js["experimental"] { presentKeys.insert("experimental") if let val = exist as? Bool { self.experimental = val } else { - errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "experimental", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["extensible"] { + if let exist = js["extensible"] { presentKeys.insert("extensible") if let val = exist as? Bool { self.extensible = val } else { - errors.append(FHIRJSONError(key: "extensible", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "extensible", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? FHIRJSON { self.identifier = Identifier(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["immutable"] { + if let exist = js["immutable"] { presentKeys.insert("immutable") if let val = exist as? Bool { self.immutable = val } else { - errors.append(FHIRJSONError(key: "immutable", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "immutable", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["lockedDate"] { + if let exist = js["lockedDate"] { presentKeys.insert("lockedDate") if let val = exist as? String { self.lockedDate = FHIRDate(string: val) } else { - errors.append(FHIRJSONError(key: "lockedDate", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "lockedDate", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["publisher"] { + if let exist = js["publisher"] { presentKeys.insert("publisher") if let val = exist as? String { self.publisher = val } else { - errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "publisher", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["requirements"] { + if let exist = js["requirements"] { presentKeys.insert("requirements") if let val = exist as? String { self.requirements = val } else { - errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "requirements", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["status"] { + if let exist = js["status"] { presentKeys.insert("status") if let val = exist as? String { self.status = val } else { - errors.append(FHIRJSONError(key: "status", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "status", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "status")) } - if let exist: AnyObject = js["url"] { + if let exist = js["url"] { presentKeys.insert("url") if let val = exist as? String { self.url = URL(string: val) } else { - errors.append(FHIRJSONError(key: "url", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "url", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["useContext"] { + if let exist = js["useContext"] { presentKeys.insert("useContext") if let val = exist as? [FHIRJSON] { self.useContext = CodeableConcept.instantiate(fromArray: val, owner: self) as? [CodeableConcept] } else { - errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "useContext", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } @@ -342,7 +342,7 @@ public class ValueSet: DomainResource { * system may be used from other value sets by referring to its (codeSystem.system) directly. */ public class ValueSetCodeSystem: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSetCodeSystem" } } @@ -371,49 +371,49 @@ public class ValueSetCodeSystem: BackboneElement { self.system = system } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["caseSensitive"] { + if let exist = js["caseSensitive"] { presentKeys.insert("caseSensitive") if let val = exist as? Bool { self.caseSensitive = val } else { - errors.append(FHIRJSONError(key: "caseSensitive", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "caseSensitive", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["concept"] { + if let exist = js["concept"] { presentKeys.insert("concept") if let val = exist as? [FHIRJSON] { self.concept = ValueSetCodeSystemConcept.instantiate(fromArray: val, owner: self) as? [ValueSetCodeSystemConcept] } else { - errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "concept")) } - if let exist: AnyObject = js["system"] { + if let exist = js["system"] { presentKeys.insert("system") if let val = exist as? String { self.system = URL(string: val) } else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "system", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "system")) } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } @@ -448,7 +448,7 @@ public class ValueSetCodeSystem: BackboneElement { * be consulted to determine what the meaning of the hierarchical relationships are. */ public class ValueSetCodeSystemConcept: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSetCodeSystemConcept" } } @@ -482,64 +482,64 @@ public class ValueSetCodeSystemConcept: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["abstract"] { + if let exist = js["abstract"] { presentKeys.insert("abstract") if let val = exist as? Bool { self.abstract = val } else { - errors.append(FHIRJSONError(key: "abstract", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "abstract", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["concept"] { + if let exist = js["concept"] { presentKeys.insert("concept") if let val = exist as? [FHIRJSON] { self.concept = ValueSetCodeSystemConcept.instantiate(fromArray: val, owner: self) as? [ValueSetCodeSystemConcept] } else { - errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["definition"] { + if let exist = js["definition"] { presentKeys.insert("definition") if let val = exist as? String { self.definition = val } else { - errors.append(FHIRJSONError(key: "definition", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "definition", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["designation"] { + if let exist = js["designation"] { presentKeys.insert("designation") if let val = exist as? [FHIRJSON] { self.designation = ValueSetCodeSystemConceptDesignation.instantiate(fromArray: val, owner: self) as? [ValueSetCodeSystemConceptDesignation] } else { - errors.append(FHIRJSONError(key: "designation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "designation", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["display"] { + if let exist = js["display"] { presentKeys.insert("display") if let val = exist as? String { self.display = val } else { - errors.append(FHIRJSONError(key: "display", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "display", wants: String.self, has: type(of: exist))) } } } @@ -580,7 +580,7 @@ public class ValueSetCodeSystemConcept: BackboneElement { * purposes, etc. */ public class ValueSetCodeSystemConceptDesignation: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSetCodeSystemConceptDesignation" } } @@ -605,34 +605,34 @@ public class ValueSetCodeSystemConceptDesignation: BackboneElement { self.value = value } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["language"] { + if let exist = js["language"] { presentKeys.insert("language") if let val = exist as? String { self.language = val } else { - errors.append(FHIRJSONError(key: "language", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "language", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["use"] { + if let exist = js["use"] { presentKeys.insert("use") if let val = exist as? FHIRJSON { self.use = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "use", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "use", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? String { self.value = val } else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: String.self, has: type(of: exist))) } } else { @@ -667,7 +667,7 @@ public class ValueSetCodeSystemConceptDesignation: BackboneElement { * outside this value set. */ public class ValueSetCompose: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSetCompose" } } @@ -686,34 +686,34 @@ public class ValueSetCompose: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["exclude"] { + if let exist = js["exclude"] { presentKeys.insert("exclude") if let val = exist as? [FHIRJSON] { self.exclude = ValueSetComposeInclude.instantiate(fromArray: val, owner: self) as? [ValueSetComposeInclude] } else { - errors.append(FHIRJSONError(key: "exclude", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "exclude", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["import"] { + if let exist = js["import"] { presentKeys.insert("import") if let val = exist as? [String] { self.import_fhir = URL.instantiate(fromArray: val) } else { - errors.append(FHIRJSONError(key: "import", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "import", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["include"] { + if let exist = js["include"] { presentKeys.insert("include") if let val = exist as? [FHIRJSON] { self.include = ValueSetComposeInclude.instantiate(fromArray: val, owner: self) as? [ValueSetComposeInclude] } else { - errors.append(FHIRJSONError(key: "include", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "include", wants: Array.self, has: type(of: exist))) } } } @@ -727,7 +727,7 @@ public class ValueSetCompose: BackboneElement { json["exclude"] = ValueSetComposeInclude.asJSONArray(exclude) } if let import_fhir = self.import_fhir { - var arr = [AnyObject]() + var arr = [Any]() for val in import_fhir { arr.append(val.asJSON()) } @@ -746,7 +746,7 @@ public class ValueSetCompose: BackboneElement { * Include one or more codes from a code system. */ public class ValueSetComposeInclude: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSetComposeInclude" } } @@ -774,46 +774,46 @@ public class ValueSetComposeInclude: BackboneElement { self.system = system } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["concept"] { + if let exist = js["concept"] { presentKeys.insert("concept") if let val = exist as? [FHIRJSON] { self.concept = ValueSetComposeIncludeConcept.instantiate(fromArray: val, owner: self) as? [ValueSetComposeIncludeConcept] } else { - errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "concept", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["filter"] { + if let exist = js["filter"] { presentKeys.insert("filter") if let val = exist as? [FHIRJSON] { self.filter = ValueSetComposeIncludeFilter.instantiate(fromArray: val, owner: self) as? [ValueSetComposeIncludeFilter] } else { - errors.append(FHIRJSONError(key: "filter", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "filter", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["system"] { + if let exist = js["system"] { presentKeys.insert("system") if let val = exist as? String { self.system = URL(string: val) } else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "system", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "system")) } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } @@ -847,7 +847,7 @@ public class ValueSetComposeInclude: BackboneElement { * Specifies a concept to be included or excluded. */ public class ValueSetComposeIncludeConcept: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSetComposeIncludeConcept" } } @@ -872,37 +872,37 @@ public class ValueSetComposeIncludeConcept: BackboneElement { self.code = code } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "code")) } - if let exist: AnyObject = js["designation"] { + if let exist = js["designation"] { presentKeys.insert("designation") if let val = exist as? [FHIRJSON] { self.designation = ValueSetCodeSystemConceptDesignation.instantiate(fromArray: val, owner: self) as? [ValueSetCodeSystemConceptDesignation] } else { - errors.append(FHIRJSONError(key: "designation", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "designation", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["display"] { + if let exist = js["display"] { presentKeys.insert("display") if let val = exist as? String { self.display = val } else { - errors.append(FHIRJSONError(key: "display", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "display", wants: String.self, has: type(of: exist))) } } } @@ -934,7 +934,7 @@ public class ValueSetComposeIncludeConcept: BackboneElement { * system. If multiple filters are specified, they SHALL all be true. */ public class ValueSetComposeIncludeFilter: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSetComposeIncludeFilter" } } @@ -961,40 +961,40 @@ public class ValueSetComposeIncludeFilter: BackboneElement { self.value = value } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["op"] { + if let exist = js["op"] { presentKeys.insert("op") if let val = exist as? String { self.op = val } else { - errors.append(FHIRJSONError(key: "op", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "op", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "op")) } - if let exist: AnyObject = js["property"] { + if let exist = js["property"] { presentKeys.insert("property") if let val = exist as? String { self.property = val } else { - errors.append(FHIRJSONError(key: "property", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "property", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "property")) } - if let exist: AnyObject = js["value"] { + if let exist = js["value"] { presentKeys.insert("value") if let val = exist as? String { self.value = val } else { - errors.append(FHIRJSONError(key: "value", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "value", wants: String.self, has: type(of: exist))) } } else { @@ -1028,7 +1028,7 @@ public class ValueSetComposeIncludeFilter: BackboneElement { * Contacts to assist a user in finding and communicating with the publisher. */ public class ValueSetContact: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSetContact" } } @@ -1044,25 +1044,25 @@ public class ValueSetContact: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["telecom"] { + if let exist = js["telecom"] { presentKeys.insert("telecom") if let val = exist as? [FHIRJSON] { self.telecom = ContactPoint.instantiate(fromArray: val, owner: self) as? [ContactPoint] } else { - errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "telecom", wants: Array.self, has: type(of: exist))) } } } @@ -1091,7 +1091,7 @@ public class ValueSetContact: BackboneElement { * element holds the expansion, if it has been performed. */ public class ValueSetExpansion: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSetExpansion" } } @@ -1126,67 +1126,67 @@ public class ValueSetExpansion: BackboneElement { self.timestamp = timestamp } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["contains"] { + if let exist = js["contains"] { presentKeys.insert("contains") if let val = exist as? [FHIRJSON] { self.contains = ValueSetExpansionContains.instantiate(fromArray: val, owner: self) as? [ValueSetExpansionContains] } else { - errors.append(FHIRJSONError(key: "contains", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contains", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? String { self.identifier = URL(string: val) } else { - errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "identifier")) } - if let exist: AnyObject = js["offset"] { + if let exist = js["offset"] { presentKeys.insert("offset") if let val = exist as? Int { self.offset = val } else { - errors.append(FHIRJSONError(key: "offset", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "offset", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["parameter"] { + if let exist = js["parameter"] { presentKeys.insert("parameter") if let val = exist as? [FHIRJSON] { self.parameter = ValueSetExpansionParameter.instantiate(fromArray: val, owner: self) as? [ValueSetExpansionParameter] } else { - errors.append(FHIRJSONError(key: "parameter", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "parameter", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["timestamp"] { + if let exist = js["timestamp"] { presentKeys.insert("timestamp") if let val = exist as? String { self.timestamp = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "timestamp", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "timestamp", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "timestamp")) } - if let exist: AnyObject = js["total"] { + if let exist = js["total"] { presentKeys.insert("total") if let val = exist as? Int { self.total = val } else { - errors.append(FHIRJSONError(key: "total", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "total", wants: Int.self, has: type(of: exist))) } } } @@ -1226,7 +1226,7 @@ public class ValueSetExpansion: BackboneElement { * The codes that are contained in the value set expansion. */ public class ValueSetExpansionContains: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSetExpansionContains" } } @@ -1254,61 +1254,61 @@ public class ValueSetExpansionContains: BackboneElement { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["abstract"] { + if let exist = js["abstract"] { presentKeys.insert("abstract") if let val = exist as? Bool { self.abstract = val } else { - errors.append(FHIRJSONError(key: "abstract", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "abstract", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["code"] { + if let exist = js["code"] { presentKeys.insert("code") if let val = exist as? String { self.code = val } else { - errors.append(FHIRJSONError(key: "code", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "code", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["contains"] { + if let exist = js["contains"] { presentKeys.insert("contains") if let val = exist as? [FHIRJSON] { self.contains = ValueSetExpansionContains.instantiate(fromArray: val, owner: self) as? [ValueSetExpansionContains] } else { - errors.append(FHIRJSONError(key: "contains", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "contains", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["display"] { + if let exist = js["display"] { presentKeys.insert("display") if let val = exist as? String { self.display = val } else { - errors.append(FHIRJSONError(key: "display", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "display", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["system"] { + if let exist = js["system"] { presentKeys.insert("system") if let val = exist as? String { self.system = URL(string: val) } else { - errors.append(FHIRJSONError(key: "system", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "system", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["version"] { + if let exist = js["version"] { presentKeys.insert("version") if let val = exist as? String { self.version = val } else { - errors.append(FHIRJSONError(key: "version", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "version", wants: String.self, has: type(of: exist))) } } } @@ -1349,7 +1349,7 @@ public class ValueSetExpansionContains: BackboneElement { * check whether the expansion is suitable for a particular purpose, or to pick the correct expansion. */ public class ValueSetExpansionParameter: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "ValueSetExpansionParameter" } } @@ -1386,73 +1386,73 @@ public class ValueSetExpansionParameter: BackboneElement { self.name = name } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["name"] { + if let exist = js["name"] { presentKeys.insert("name") if let val = exist as? String { self.name = val } else { - errors.append(FHIRJSONError(key: "name", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "name", wants: String.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "name")) } - if let exist: AnyObject = js["valueBoolean"] { + if let exist = js["valueBoolean"] { presentKeys.insert("valueBoolean") if let val = exist as? Bool { self.valueBoolean = val } else { - errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueBoolean", wants: Bool.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueCode"] { + if let exist = js["valueCode"] { presentKeys.insert("valueCode") if let val = exist as? String { self.valueCode = val } else { - errors.append(FHIRJSONError(key: "valueCode", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueCode", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueDecimal"] { + if let exist = js["valueDecimal"] { presentKeys.insert("valueDecimal") if let val = exist as? NSNumber { self.valueDecimal = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "valueDecimal", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueDecimal", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueInteger"] { + if let exist = js["valueInteger"] { presentKeys.insert("valueInteger") if let val = exist as? Int { self.valueInteger = val } else { - errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueInteger", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueString"] { + if let exist = js["valueString"] { presentKeys.insert("valueString") if let val = exist as? String { self.valueString = val } else { - errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueString", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["valueUri"] { + if let exist = js["valueUri"] { presentKeys.insert("valueUri") if let val = exist as? String { self.valueUri = URL(string: val) } else { - errors.append(FHIRJSONError(key: "valueUri", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "valueUri", wants: String.self, has: type(of: exist))) } } } diff --git a/Sources/Models/VisionPrescription.swift b/Sources/Models/VisionPrescription.swift index 37aa5565..ddf46ce6 100644 --- a/Sources/Models/VisionPrescription.swift +++ b/Sources/Models/VisionPrescription.swift @@ -2,7 +2,7 @@ // VisionPrescription.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/VisionPrescription) on 2016-08-09. +// Generated from FHIR 1.0.2.7202 (http://hl7.org/fhir/StructureDefinition/VisionPrescription) on 2016-09-16. // 2016, SMART Health IT. // @@ -15,7 +15,7 @@ import Foundation * An authorization for the supply of glasses and/or contact lenses to a patient. */ public class VisionPrescription: DomainResource { - override public class var resourceName: String { + override public class var resourceType: String { get { return "VisionPrescription" } } @@ -49,79 +49,79 @@ public class VisionPrescription: DomainResource { super.init(json: json, owner: owner) } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["dateWritten"] { + if let exist = js["dateWritten"] { presentKeys.insert("dateWritten") if let val = exist as? String { self.dateWritten = DateTime(string: val) } else { - errors.append(FHIRJSONError(key: "dateWritten", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dateWritten", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["dispense"] { + if let exist = js["dispense"] { presentKeys.insert("dispense") if let val = exist as? [FHIRJSON] { self.dispense = VisionPrescriptionDispense.instantiate(fromArray: val, owner: self) as? [VisionPrescriptionDispense] } else { - errors.append(FHIRJSONError(key: "dispense", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "dispense", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["encounter"] { + if let exist = js["encounter"] { presentKeys.insert("encounter") if let val = exist as? FHIRJSON { self.encounter = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "encounter", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["identifier"] { + if let exist = js["identifier"] { presentKeys.insert("identifier") if let val = exist as? [FHIRJSON] { self.identifier = Identifier.instantiate(fromArray: val, owner: self) as? [Identifier] } else { - errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "identifier", wants: Array.self, has: type(of: exist))) } } - if let exist: AnyObject = js["patient"] { + if let exist = js["patient"] { presentKeys.insert("patient") if let val = exist as? FHIRJSON { self.patient = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "patient", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["prescriber"] { + if let exist = js["prescriber"] { presentKeys.insert("prescriber") if let val = exist as? FHIRJSON { self.prescriber = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "prescriber", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prescriber", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonCodeableConcept"] { + if let exist = js["reasonCodeableConcept"] { presentKeys.insert("reasonCodeableConcept") if let val = exist as? FHIRJSON { self.reasonCodeableConcept = CodeableConcept(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonCodeableConcept", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["reasonReference"] { + if let exist = js["reasonReference"] { presentKeys.insert("reasonReference") if let val = exist as? FHIRJSON { self.reasonReference = Reference(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "reasonReference", wants: FHIRJSON.self, has: type(of: exist))) } } } @@ -167,7 +167,7 @@ public class VisionPrescription: DomainResource { * Deals with details of the dispense part of the supply specification. */ public class VisionPrescriptionDispense: BackboneElement { - override public class var resourceName: String { + override public class var resourceType: String { get { return "VisionPrescriptionDispense" } } @@ -228,145 +228,145 @@ public class VisionPrescriptionDispense: BackboneElement { self.product = product } - public override func populate(fromJSON json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { - var errors = super.populate(fromJSON: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() + public override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + var errors = super.populate(from: json, presentKeys: &presentKeys) ?? [FHIRJSONError]() if let js = json { - if let exist: AnyObject = js["add"] { + if let exist = js["add"] { presentKeys.insert("add") if let val = exist as? NSNumber { self.add = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "add", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "add", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["axis"] { + if let exist = js["axis"] { presentKeys.insert("axis") if let val = exist as? Int { self.axis = val } else { - errors.append(FHIRJSONError(key: "axis", wants: Int.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "axis", wants: Int.self, has: type(of: exist))) } } - if let exist: AnyObject = js["backCurve"] { + if let exist = js["backCurve"] { presentKeys.insert("backCurve") if let val = exist as? NSNumber { self.backCurve = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "backCurve", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "backCurve", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["base"] { + if let exist = js["base"] { presentKeys.insert("base") if let val = exist as? String { self.base = val } else { - errors.append(FHIRJSONError(key: "base", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "base", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["brand"] { + if let exist = js["brand"] { presentKeys.insert("brand") if let val = exist as? String { self.brand = val } else { - errors.append(FHIRJSONError(key: "brand", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "brand", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["color"] { + if let exist = js["color"] { presentKeys.insert("color") if let val = exist as? String { self.color = val } else { - errors.append(FHIRJSONError(key: "color", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "color", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["cylinder"] { + if let exist = js["cylinder"] { presentKeys.insert("cylinder") if let val = exist as? NSNumber { self.cylinder = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "cylinder", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "cylinder", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["diameter"] { + if let exist = js["diameter"] { presentKeys.insert("diameter") if let val = exist as? NSNumber { self.diameter = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "diameter", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "diameter", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["duration"] { + if let exist = js["duration"] { presentKeys.insert("duration") if let val = exist as? FHIRJSON { self.duration = Quantity(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "duration", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "duration", wants: FHIRJSON.self, has: type(of: exist))) } } - if let exist: AnyObject = js["eye"] { + if let exist = js["eye"] { presentKeys.insert("eye") if let val = exist as? String { self.eye = val } else { - errors.append(FHIRJSONError(key: "eye", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "eye", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["notes"] { + if let exist = js["notes"] { presentKeys.insert("notes") if let val = exist as? String { self.notes = val } else { - errors.append(FHIRJSONError(key: "notes", wants: String.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "notes", wants: String.self, has: type(of: exist))) } } - if let exist: AnyObject = js["power"] { + if let exist = js["power"] { presentKeys.insert("power") if let val = exist as? NSNumber { self.power = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "power", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "power", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["prism"] { + if let exist = js["prism"] { presentKeys.insert("prism") if let val = exist as? NSNumber { self.prism = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "prism", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "prism", wants: NSNumber.self, has: type(of: exist))) } } - if let exist: AnyObject = js["product"] { + if let exist = js["product"] { presentKeys.insert("product") if let val = exist as? FHIRJSON { self.product = Coding(json: val, owner: self) } else { - errors.append(FHIRJSONError(key: "product", wants: FHIRJSON.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "product", wants: FHIRJSON.self, has: type(of: exist))) } } else { errors.append(FHIRJSONError(key: "product")) } - if let exist: AnyObject = js["sphere"] { + if let exist = js["sphere"] { presentKeys.insert("sphere") if let val = exist as? NSNumber { self.sphere = NSDecimalNumber(json: val) } else { - errors.append(FHIRJSONError(key: "sphere", wants: NSNumber.self, has: exist.dynamicType)) + errors.append(FHIRJSONError(key: "sphere", wants: NSNumber.self, has: type(of: exist))) } } } diff --git a/Tests/ModelTests/AccountTests.swift b/Tests/ModelTests/AccountTests.swift index 0450ab92..b9994f2f 100644 --- a/Tests/ModelTests/AccountTests.swift +++ b/Tests/ModelTests/AccountTests.swift @@ -2,7 +2,7 @@ // AccountTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/AllergyIntoleranceTests.swift b/Tests/ModelTests/AllergyIntoleranceTests.swift index ec009208..7111febd 100644 --- a/Tests/ModelTests/AllergyIntoleranceTests.swift +++ b/Tests/ModelTests/AllergyIntoleranceTests.swift @@ -2,7 +2,7 @@ // AllergyIntoleranceTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/AppointmentResponseTests.swift b/Tests/ModelTests/AppointmentResponseTests.swift index 8732a483..8c4ca497 100644 --- a/Tests/ModelTests/AppointmentResponseTests.swift +++ b/Tests/ModelTests/AppointmentResponseTests.swift @@ -2,7 +2,7 @@ // AppointmentResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/AppointmentTests.swift b/Tests/ModelTests/AppointmentTests.swift index c98b085f..b3a1d7ed 100644 --- a/Tests/ModelTests/AppointmentTests.swift +++ b/Tests/ModelTests/AppointmentTests.swift @@ -2,7 +2,7 @@ // AppointmentTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/AuditEventTests.swift b/Tests/ModelTests/AuditEventTests.swift index 185e9c61..2a9d1131 100644 --- a/Tests/ModelTests/AuditEventTests.swift +++ b/Tests/ModelTests/AuditEventTests.swift @@ -2,7 +2,7 @@ // AuditEventTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/BasicTests.swift b/Tests/ModelTests/BasicTests.swift index 02a08841..946b7dee 100644 --- a/Tests/ModelTests/BasicTests.swift +++ b/Tests/ModelTests/BasicTests.swift @@ -2,7 +2,7 @@ // BasicTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/BinaryTests.swift b/Tests/ModelTests/BinaryTests.swift index 3a055ed2..f97925ea 100644 --- a/Tests/ModelTests/BinaryTests.swift +++ b/Tests/ModelTests/BinaryTests.swift @@ -2,7 +2,7 @@ // BinaryTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/BodySiteTests.swift b/Tests/ModelTests/BodySiteTests.swift index 98a67d1c..94242f98 100644 --- a/Tests/ModelTests/BodySiteTests.swift +++ b/Tests/ModelTests/BodySiteTests.swift @@ -2,7 +2,7 @@ // BodySiteTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/BundleTests.swift b/Tests/ModelTests/BundleTests.swift index 73054cc5..622336b5 100644 --- a/Tests/ModelTests/BundleTests.swift +++ b/Tests/ModelTests/BundleTests.swift @@ -2,7 +2,7 @@ // BundleTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/CarePlanTests.swift b/Tests/ModelTests/CarePlanTests.swift index dfe243a4..6f1caaf7 100644 --- a/Tests/ModelTests/CarePlanTests.swift +++ b/Tests/ModelTests/CarePlanTests.swift @@ -2,7 +2,7 @@ // CarePlanTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ClaimResponseTests.swift b/Tests/ModelTests/ClaimResponseTests.swift index 1e9661a3..e8e3fd80 100644 --- a/Tests/ModelTests/ClaimResponseTests.swift +++ b/Tests/ModelTests/ClaimResponseTests.swift @@ -2,7 +2,7 @@ // ClaimResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ClaimTests.swift b/Tests/ModelTests/ClaimTests.swift index 385ac1ff..91b8fab4 100644 --- a/Tests/ModelTests/ClaimTests.swift +++ b/Tests/ModelTests/ClaimTests.swift @@ -2,7 +2,7 @@ // ClaimTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ClinicalImpressionTests.swift b/Tests/ModelTests/ClinicalImpressionTests.swift index 0f2ebd39..74b8cf8a 100644 --- a/Tests/ModelTests/ClinicalImpressionTests.swift +++ b/Tests/ModelTests/ClinicalImpressionTests.swift @@ -2,7 +2,7 @@ // ClinicalImpressionTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/CommunicationRequestTests.swift b/Tests/ModelTests/CommunicationRequestTests.swift index 315b4345..973a4afe 100644 --- a/Tests/ModelTests/CommunicationRequestTests.swift +++ b/Tests/ModelTests/CommunicationRequestTests.swift @@ -2,7 +2,7 @@ // CommunicationRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/CommunicationTests.swift b/Tests/ModelTests/CommunicationTests.swift index 6f61286f..70ec7635 100644 --- a/Tests/ModelTests/CommunicationTests.swift +++ b/Tests/ModelTests/CommunicationTests.swift @@ -2,7 +2,7 @@ // CommunicationTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/CompositionTests.swift b/Tests/ModelTests/CompositionTests.swift index 21bbb368..d01273f7 100644 --- a/Tests/ModelTests/CompositionTests.swift +++ b/Tests/ModelTests/CompositionTests.swift @@ -2,7 +2,7 @@ // CompositionTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ConceptMapTests.swift b/Tests/ModelTests/ConceptMapTests.swift index c47ffbac..bf37877c 100644 --- a/Tests/ModelTests/ConceptMapTests.swift +++ b/Tests/ModelTests/ConceptMapTests.swift @@ -2,7 +2,7 @@ // ConceptMapTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ConditionTests.swift b/Tests/ModelTests/ConditionTests.swift index ab6f44b9..ea3adcbc 100644 --- a/Tests/ModelTests/ConditionTests.swift +++ b/Tests/ModelTests/ConditionTests.swift @@ -2,7 +2,7 @@ // ConditionTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ConformanceTests.swift b/Tests/ModelTests/ConformanceTests.swift index 3398e8aa..f86cb741 100644 --- a/Tests/ModelTests/ConformanceTests.swift +++ b/Tests/ModelTests/ConformanceTests.swift @@ -2,7 +2,7 @@ // ConformanceTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ContractTests.swift b/Tests/ModelTests/ContractTests.swift index f82f9052..00b38aac 100644 --- a/Tests/ModelTests/ContractTests.swift +++ b/Tests/ModelTests/ContractTests.swift @@ -2,7 +2,7 @@ // ContractTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/CoverageTests.swift b/Tests/ModelTests/CoverageTests.swift index c9d473ec..25ddef70 100644 --- a/Tests/ModelTests/CoverageTests.swift +++ b/Tests/ModelTests/CoverageTests.swift @@ -2,7 +2,7 @@ // CoverageTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DataElementTests.swift b/Tests/ModelTests/DataElementTests.swift index b48682df..e0600b21 100644 --- a/Tests/ModelTests/DataElementTests.swift +++ b/Tests/ModelTests/DataElementTests.swift @@ -2,7 +2,7 @@ // DataElementTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DetectedIssueTests.swift b/Tests/ModelTests/DetectedIssueTests.swift index 45134a45..e4a66cd2 100644 --- a/Tests/ModelTests/DetectedIssueTests.swift +++ b/Tests/ModelTests/DetectedIssueTests.swift @@ -2,7 +2,7 @@ // DetectedIssueTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DeviceComponentTests.swift b/Tests/ModelTests/DeviceComponentTests.swift index 5a809f54..d104185c 100644 --- a/Tests/ModelTests/DeviceComponentTests.swift +++ b/Tests/ModelTests/DeviceComponentTests.swift @@ -2,7 +2,7 @@ // DeviceComponentTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DeviceMetricTests.swift b/Tests/ModelTests/DeviceMetricTests.swift index 49661c30..3d04455a 100644 --- a/Tests/ModelTests/DeviceMetricTests.swift +++ b/Tests/ModelTests/DeviceMetricTests.swift @@ -2,7 +2,7 @@ // DeviceMetricTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DeviceTests.swift b/Tests/ModelTests/DeviceTests.swift index 4bfa1ada..0e9aea9c 100644 --- a/Tests/ModelTests/DeviceTests.swift +++ b/Tests/ModelTests/DeviceTests.swift @@ -2,7 +2,7 @@ // DeviceTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DeviceUseRequestTests.swift b/Tests/ModelTests/DeviceUseRequestTests.swift index cb82712d..bcc261e4 100644 --- a/Tests/ModelTests/DeviceUseRequestTests.swift +++ b/Tests/ModelTests/DeviceUseRequestTests.swift @@ -2,7 +2,7 @@ // DeviceUseRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DeviceUseStatementTests.swift b/Tests/ModelTests/DeviceUseStatementTests.swift index 75ad71bb..04d5ee59 100644 --- a/Tests/ModelTests/DeviceUseStatementTests.swift +++ b/Tests/ModelTests/DeviceUseStatementTests.swift @@ -2,7 +2,7 @@ // DeviceUseStatementTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DiagnosticOrderTests.swift b/Tests/ModelTests/DiagnosticOrderTests.swift index 4d515231..04c4478a 100644 --- a/Tests/ModelTests/DiagnosticOrderTests.swift +++ b/Tests/ModelTests/DiagnosticOrderTests.swift @@ -2,7 +2,7 @@ // DiagnosticOrderTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DiagnosticReportTests.swift b/Tests/ModelTests/DiagnosticReportTests.swift index 4e02921a..cba0ae91 100644 --- a/Tests/ModelTests/DiagnosticReportTests.swift +++ b/Tests/ModelTests/DiagnosticReportTests.swift @@ -2,7 +2,7 @@ // DiagnosticReportTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DocumentManifestTests.swift b/Tests/ModelTests/DocumentManifestTests.swift index 37eb8658..bf2a0875 100644 --- a/Tests/ModelTests/DocumentManifestTests.swift +++ b/Tests/ModelTests/DocumentManifestTests.swift @@ -2,7 +2,7 @@ // DocumentManifestTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/DocumentReferenceTests.swift b/Tests/ModelTests/DocumentReferenceTests.swift index f4540848..7893c262 100644 --- a/Tests/ModelTests/DocumentReferenceTests.swift +++ b/Tests/ModelTests/DocumentReferenceTests.swift @@ -2,7 +2,7 @@ // DocumentReferenceTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/EligibilityRequestTests.swift b/Tests/ModelTests/EligibilityRequestTests.swift index 17b94a50..229e9280 100644 --- a/Tests/ModelTests/EligibilityRequestTests.swift +++ b/Tests/ModelTests/EligibilityRequestTests.swift @@ -2,7 +2,7 @@ // EligibilityRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/EligibilityResponseTests.swift b/Tests/ModelTests/EligibilityResponseTests.swift index a101808c..e2920b03 100644 --- a/Tests/ModelTests/EligibilityResponseTests.swift +++ b/Tests/ModelTests/EligibilityResponseTests.swift @@ -2,7 +2,7 @@ // EligibilityResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/EncounterTests.swift b/Tests/ModelTests/EncounterTests.swift index 3890878f..7bdbf867 100644 --- a/Tests/ModelTests/EncounterTests.swift +++ b/Tests/ModelTests/EncounterTests.swift @@ -2,7 +2,7 @@ // EncounterTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/EnrollmentRequestTests.swift b/Tests/ModelTests/EnrollmentRequestTests.swift index ecb2db60..185a55f8 100644 --- a/Tests/ModelTests/EnrollmentRequestTests.swift +++ b/Tests/ModelTests/EnrollmentRequestTests.swift @@ -2,7 +2,7 @@ // EnrollmentRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/EnrollmentResponseTests.swift b/Tests/ModelTests/EnrollmentResponseTests.swift index 1fdbc49d..a45826bc 100644 --- a/Tests/ModelTests/EnrollmentResponseTests.swift +++ b/Tests/ModelTests/EnrollmentResponseTests.swift @@ -2,7 +2,7 @@ // EnrollmentResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/EpisodeOfCareTests.swift b/Tests/ModelTests/EpisodeOfCareTests.swift index 3679f95a..25709319 100644 --- a/Tests/ModelTests/EpisodeOfCareTests.swift +++ b/Tests/ModelTests/EpisodeOfCareTests.swift @@ -2,7 +2,7 @@ // EpisodeOfCareTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ExplanationOfBenefitTests.swift b/Tests/ModelTests/ExplanationOfBenefitTests.swift index a513821e..31711301 100644 --- a/Tests/ModelTests/ExplanationOfBenefitTests.swift +++ b/Tests/ModelTests/ExplanationOfBenefitTests.swift @@ -2,7 +2,7 @@ // ExplanationOfBenefitTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/FamilyMemberHistoryTests.swift b/Tests/ModelTests/FamilyMemberHistoryTests.swift index 33c5f615..a5acf056 100644 --- a/Tests/ModelTests/FamilyMemberHistoryTests.swift +++ b/Tests/ModelTests/FamilyMemberHistoryTests.swift @@ -2,7 +2,7 @@ // FamilyMemberHistoryTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/FlagTests.swift b/Tests/ModelTests/FlagTests.swift index 4a51b8bd..76b12fbf 100644 --- a/Tests/ModelTests/FlagTests.swift +++ b/Tests/ModelTests/FlagTests.swift @@ -2,7 +2,7 @@ // FlagTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/GoalTests.swift b/Tests/ModelTests/GoalTests.swift index c65068dd..19eb5acf 100644 --- a/Tests/ModelTests/GoalTests.swift +++ b/Tests/ModelTests/GoalTests.swift @@ -2,7 +2,7 @@ // GoalTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/GroupTests.swift b/Tests/ModelTests/GroupTests.swift index 0ac1fb7b..c4fbb62a 100644 --- a/Tests/ModelTests/GroupTests.swift +++ b/Tests/ModelTests/GroupTests.swift @@ -2,7 +2,7 @@ // GroupTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/HealthcareServiceTests.swift b/Tests/ModelTests/HealthcareServiceTests.swift index 463ebef8..dd2cc1c4 100644 --- a/Tests/ModelTests/HealthcareServiceTests.swift +++ b/Tests/ModelTests/HealthcareServiceTests.swift @@ -2,7 +2,7 @@ // HealthcareServiceTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ImagingObjectSelectionTests.swift b/Tests/ModelTests/ImagingObjectSelectionTests.swift index 8faba99d..51b3f8e8 100644 --- a/Tests/ModelTests/ImagingObjectSelectionTests.swift +++ b/Tests/ModelTests/ImagingObjectSelectionTests.swift @@ -2,7 +2,7 @@ // ImagingObjectSelectionTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ImagingStudyTests.swift b/Tests/ModelTests/ImagingStudyTests.swift index a5d020fa..ad968056 100644 --- a/Tests/ModelTests/ImagingStudyTests.swift +++ b/Tests/ModelTests/ImagingStudyTests.swift @@ -2,7 +2,7 @@ // ImagingStudyTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ImmunizationRecommendationTests.swift b/Tests/ModelTests/ImmunizationRecommendationTests.swift index 4c68a7a9..fee75c34 100644 --- a/Tests/ModelTests/ImmunizationRecommendationTests.swift +++ b/Tests/ModelTests/ImmunizationRecommendationTests.swift @@ -2,7 +2,7 @@ // ImmunizationRecommendationTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ImmunizationTests.swift b/Tests/ModelTests/ImmunizationTests.swift index 2d796bca..ee04773a 100644 --- a/Tests/ModelTests/ImmunizationTests.swift +++ b/Tests/ModelTests/ImmunizationTests.swift @@ -2,7 +2,7 @@ // ImmunizationTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ImplementationGuideTests.swift b/Tests/ModelTests/ImplementationGuideTests.swift index a7acd1fd..9256259d 100644 --- a/Tests/ModelTests/ImplementationGuideTests.swift +++ b/Tests/ModelTests/ImplementationGuideTests.swift @@ -2,7 +2,7 @@ // ImplementationGuideTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ListTests.swift b/Tests/ModelTests/ListTests.swift index 4aa94b6e..4e7c82cf 100644 --- a/Tests/ModelTests/ListTests.swift +++ b/Tests/ModelTests/ListTests.swift @@ -2,7 +2,7 @@ // ListTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/LocationTests.swift b/Tests/ModelTests/LocationTests.swift index 2d3e38e0..22f1d518 100644 --- a/Tests/ModelTests/LocationTests.swift +++ b/Tests/ModelTests/LocationTests.swift @@ -2,7 +2,7 @@ // LocationTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/MediaTests.swift b/Tests/ModelTests/MediaTests.swift index 01792643..90de6f19 100644 --- a/Tests/ModelTests/MediaTests.swift +++ b/Tests/ModelTests/MediaTests.swift @@ -2,7 +2,7 @@ // MediaTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/MedicationOrderTests.swift b/Tests/ModelTests/MedicationOrderTests.swift index 002806bd..d7449866 100644 --- a/Tests/ModelTests/MedicationOrderTests.swift +++ b/Tests/ModelTests/MedicationOrderTests.swift @@ -2,7 +2,7 @@ // MedicationOrderTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/MedicationTests.swift b/Tests/ModelTests/MedicationTests.swift index 1eb9ccea..ae4cbf7d 100644 --- a/Tests/ModelTests/MedicationTests.swift +++ b/Tests/ModelTests/MedicationTests.swift @@ -2,7 +2,7 @@ // MedicationTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/MessageHeaderTests.swift b/Tests/ModelTests/MessageHeaderTests.swift index bff7b555..ad5a7f32 100644 --- a/Tests/ModelTests/MessageHeaderTests.swift +++ b/Tests/ModelTests/MessageHeaderTests.swift @@ -2,7 +2,7 @@ // MessageHeaderTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/NamingSystemTests.swift b/Tests/ModelTests/NamingSystemTests.swift index 4546fedd..7e5a8f95 100644 --- a/Tests/ModelTests/NamingSystemTests.swift +++ b/Tests/ModelTests/NamingSystemTests.swift @@ -2,7 +2,7 @@ // NamingSystemTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/NutritionOrderTests.swift b/Tests/ModelTests/NutritionOrderTests.swift index 68beac06..d5569d36 100644 --- a/Tests/ModelTests/NutritionOrderTests.swift +++ b/Tests/ModelTests/NutritionOrderTests.swift @@ -2,7 +2,7 @@ // NutritionOrderTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ObservationTests.swift b/Tests/ModelTests/ObservationTests.swift index 504ebcf8..0f1f8704 100644 --- a/Tests/ModelTests/ObservationTests.swift +++ b/Tests/ModelTests/ObservationTests.swift @@ -2,7 +2,7 @@ // ObservationTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/OperationDefinitionTests.swift b/Tests/ModelTests/OperationDefinitionTests.swift index a7b4ee12..55e03111 100644 --- a/Tests/ModelTests/OperationDefinitionTests.swift +++ b/Tests/ModelTests/OperationDefinitionTests.swift @@ -2,7 +2,7 @@ // OperationDefinitionTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/OperationOutcomeTests.swift b/Tests/ModelTests/OperationOutcomeTests.swift index 4da39070..ba61da58 100644 --- a/Tests/ModelTests/OperationOutcomeTests.swift +++ b/Tests/ModelTests/OperationOutcomeTests.swift @@ -2,7 +2,7 @@ // OperationOutcomeTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/OrderResponseTests.swift b/Tests/ModelTests/OrderResponseTests.swift index 00e3c140..3413130a 100644 --- a/Tests/ModelTests/OrderResponseTests.swift +++ b/Tests/ModelTests/OrderResponseTests.swift @@ -2,7 +2,7 @@ // OrderResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/OrderTests.swift b/Tests/ModelTests/OrderTests.swift index 3a2b21e2..41a27d9f 100644 --- a/Tests/ModelTests/OrderTests.swift +++ b/Tests/ModelTests/OrderTests.swift @@ -2,7 +2,7 @@ // OrderTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/OrganizationTests.swift b/Tests/ModelTests/OrganizationTests.swift index aedee156..a287b48b 100644 --- a/Tests/ModelTests/OrganizationTests.swift +++ b/Tests/ModelTests/OrganizationTests.swift @@ -2,7 +2,7 @@ // OrganizationTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ParametersTests.swift b/Tests/ModelTests/ParametersTests.swift index 32028942..9f6f7aac 100644 --- a/Tests/ModelTests/ParametersTests.swift +++ b/Tests/ModelTests/ParametersTests.swift @@ -2,7 +2,7 @@ // ParametersTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/PatientTests.swift b/Tests/ModelTests/PatientTests.swift index dcfbd7fc..d6af423f 100644 --- a/Tests/ModelTests/PatientTests.swift +++ b/Tests/ModelTests/PatientTests.swift @@ -2,7 +2,7 @@ // PatientTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/PaymentNoticeTests.swift b/Tests/ModelTests/PaymentNoticeTests.swift index edf92dd8..da673523 100644 --- a/Tests/ModelTests/PaymentNoticeTests.swift +++ b/Tests/ModelTests/PaymentNoticeTests.swift @@ -2,7 +2,7 @@ // PaymentNoticeTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/PaymentReconciliationTests.swift b/Tests/ModelTests/PaymentReconciliationTests.swift index f7c6f84a..7fadf5f1 100644 --- a/Tests/ModelTests/PaymentReconciliationTests.swift +++ b/Tests/ModelTests/PaymentReconciliationTests.swift @@ -2,7 +2,7 @@ // PaymentReconciliationTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/PersonTests.swift b/Tests/ModelTests/PersonTests.swift index 065b554d..0815c88a 100644 --- a/Tests/ModelTests/PersonTests.swift +++ b/Tests/ModelTests/PersonTests.swift @@ -2,7 +2,7 @@ // PersonTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/PractitionerTests.swift b/Tests/ModelTests/PractitionerTests.swift index 45fa7be8..4cd679d5 100644 --- a/Tests/ModelTests/PractitionerTests.swift +++ b/Tests/ModelTests/PractitionerTests.swift @@ -2,7 +2,7 @@ // PractitionerTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ProcedureRequestTests.swift b/Tests/ModelTests/ProcedureRequestTests.swift index 87fdfda3..200ccf38 100644 --- a/Tests/ModelTests/ProcedureRequestTests.swift +++ b/Tests/ModelTests/ProcedureRequestTests.swift @@ -2,7 +2,7 @@ // ProcedureRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ProcedureTests.swift b/Tests/ModelTests/ProcedureTests.swift index 72463b4c..3735fb75 100644 --- a/Tests/ModelTests/ProcedureTests.swift +++ b/Tests/ModelTests/ProcedureTests.swift @@ -2,7 +2,7 @@ // ProcedureTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ProcessRequestTests.swift b/Tests/ModelTests/ProcessRequestTests.swift index 47714562..46eb4fee 100644 --- a/Tests/ModelTests/ProcessRequestTests.swift +++ b/Tests/ModelTests/ProcessRequestTests.swift @@ -2,7 +2,7 @@ // ProcessRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ProcessResponseTests.swift b/Tests/ModelTests/ProcessResponseTests.swift index 7a8a5a15..8ddeb31b 100644 --- a/Tests/ModelTests/ProcessResponseTests.swift +++ b/Tests/ModelTests/ProcessResponseTests.swift @@ -2,7 +2,7 @@ // ProcessResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ProvenanceTests.swift b/Tests/ModelTests/ProvenanceTests.swift index 031b866a..73cc4ee5 100644 --- a/Tests/ModelTests/ProvenanceTests.swift +++ b/Tests/ModelTests/ProvenanceTests.swift @@ -2,7 +2,7 @@ // ProvenanceTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/QuestionnaireResponseTests.swift b/Tests/ModelTests/QuestionnaireResponseTests.swift index 96ca98b2..10f4685b 100644 --- a/Tests/ModelTests/QuestionnaireResponseTests.swift +++ b/Tests/ModelTests/QuestionnaireResponseTests.swift @@ -2,7 +2,7 @@ // QuestionnaireResponseTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/QuestionnaireTests.swift b/Tests/ModelTests/QuestionnaireTests.swift index f6663806..298f2948 100644 --- a/Tests/ModelTests/QuestionnaireTests.swift +++ b/Tests/ModelTests/QuestionnaireTests.swift @@ -2,7 +2,7 @@ // QuestionnaireTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ReferralRequestTests.swift b/Tests/ModelTests/ReferralRequestTests.swift index 16d6b6d7..18cc9f33 100644 --- a/Tests/ModelTests/ReferralRequestTests.swift +++ b/Tests/ModelTests/ReferralRequestTests.swift @@ -2,7 +2,7 @@ // ReferralRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/RelatedPersonTests.swift b/Tests/ModelTests/RelatedPersonTests.swift index f1c7b88d..98f38e9f 100644 --- a/Tests/ModelTests/RelatedPersonTests.swift +++ b/Tests/ModelTests/RelatedPersonTests.swift @@ -2,7 +2,7 @@ // RelatedPersonTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/RiskAssessmentTests.swift b/Tests/ModelTests/RiskAssessmentTests.swift index 9eb64cc8..1af00925 100644 --- a/Tests/ModelTests/RiskAssessmentTests.swift +++ b/Tests/ModelTests/RiskAssessmentTests.swift @@ -2,7 +2,7 @@ // RiskAssessmentTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ScheduleTests.swift b/Tests/ModelTests/ScheduleTests.swift index 1f82bef6..f1f2c3f7 100644 --- a/Tests/ModelTests/ScheduleTests.swift +++ b/Tests/ModelTests/ScheduleTests.swift @@ -2,7 +2,7 @@ // ScheduleTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/SearchParameterTests.swift b/Tests/ModelTests/SearchParameterTests.swift index 23dd435c..9b053f00 100644 --- a/Tests/ModelTests/SearchParameterTests.swift +++ b/Tests/ModelTests/SearchParameterTests.swift @@ -2,7 +2,7 @@ // SearchParameterTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/SlotTests.swift b/Tests/ModelTests/SlotTests.swift index f66a4a95..e40ffd6b 100644 --- a/Tests/ModelTests/SlotTests.swift +++ b/Tests/ModelTests/SlotTests.swift @@ -2,7 +2,7 @@ // SlotTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/SpecimenTests.swift b/Tests/ModelTests/SpecimenTests.swift index bb1debcb..27e9ed6b 100644 --- a/Tests/ModelTests/SpecimenTests.swift +++ b/Tests/ModelTests/SpecimenTests.swift @@ -2,7 +2,7 @@ // SpecimenTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/StructureDefinitionTests.swift b/Tests/ModelTests/StructureDefinitionTests.swift index 9b8b4969..2040f273 100644 --- a/Tests/ModelTests/StructureDefinitionTests.swift +++ b/Tests/ModelTests/StructureDefinitionTests.swift @@ -2,7 +2,7 @@ // StructureDefinitionTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/SubscriptionTests.swift b/Tests/ModelTests/SubscriptionTests.swift index 504acb47..a9c13869 100644 --- a/Tests/ModelTests/SubscriptionTests.swift +++ b/Tests/ModelTests/SubscriptionTests.swift @@ -2,7 +2,7 @@ // SubscriptionTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/SubstanceTests.swift b/Tests/ModelTests/SubstanceTests.swift index 9410beb5..eff20f9e 100644 --- a/Tests/ModelTests/SubstanceTests.swift +++ b/Tests/ModelTests/SubstanceTests.swift @@ -2,7 +2,7 @@ // SubstanceTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/SupplyDeliveryTests.swift b/Tests/ModelTests/SupplyDeliveryTests.swift index 2e04cc8a..a93d122a 100644 --- a/Tests/ModelTests/SupplyDeliveryTests.swift +++ b/Tests/ModelTests/SupplyDeliveryTests.swift @@ -2,7 +2,7 @@ // SupplyDeliveryTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/SupplyRequestTests.swift b/Tests/ModelTests/SupplyRequestTests.swift index 56854e28..39bb263b 100644 --- a/Tests/ModelTests/SupplyRequestTests.swift +++ b/Tests/ModelTests/SupplyRequestTests.swift @@ -2,7 +2,7 @@ // SupplyRequestTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/TestScriptTests.swift b/Tests/ModelTests/TestScriptTests.swift index 8efe436b..fe615053 100644 --- a/Tests/ModelTests/TestScriptTests.swift +++ b/Tests/ModelTests/TestScriptTests.swift @@ -2,7 +2,7 @@ // TestScriptTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/ValueSetTests.swift b/Tests/ModelTests/ValueSetTests.swift index cc468755..ac0de40e 100644 --- a/Tests/ModelTests/ValueSetTests.swift +++ b/Tests/ModelTests/ValueSetTests.swift @@ -2,7 +2,7 @@ // ValueSetTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/VisionPrescriptionTests.swift b/Tests/ModelTests/VisionPrescriptionTests.swift index 2bbbe68c..74db45f4 100644 --- a/Tests/ModelTests/VisionPrescriptionTests.swift +++ b/Tests/ModelTests/VisionPrescriptionTests.swift @@ -2,7 +2,7 @@ // VisionPrescriptionTests.swift // SwiftFHIR // -// Generated from FHIR 1.0.2.7202 on 2016-08-09. +// Generated from FHIR 1.0.2.7202 on 2016-09-16. // 2016, SMART Health IT. // diff --git a/Tests/ModelTests/XCTestCase+FHIR.swift b/Tests/ModelTests/XCTestCase+FHIR.swift index c6b629f1..46db9bc7 100644 --- a/Tests/ModelTests/XCTestCase+FHIR.swift +++ b/Tests/ModelTests/XCTestCase+FHIR.swift @@ -22,7 +22,7 @@ extension XCTestCase { } func readJSONFile(_ filename: String) throws -> FHIRJSON { - let dir = self.dynamicType.testsDirectory + let dir = type(of: self).testsDirectory XCTAssertTrue(FileManager.default.fileExists(atPath: dir), "You must either first download the FHIR spec or manually adjust `XCTestCase.testsDirectory` to point to your FHIR download directory") let path = (dir as NSString).appendingPathComponent(filename) diff --git a/Tests/ReferenceTests.swift b/Tests/ReferenceTests.swift index 8a4d671c..ed211227 100644 --- a/Tests/ReferenceTests.swift +++ b/Tests/ReferenceTests.swift @@ -16,7 +16,7 @@ Test reference resolving. class ReferenceTests: XCTestCase { func testContainedReference() { - if let path = Bundle(for: self.dynamicType).path(forResource: "ReferenceContained1", ofType: "json", inDirectory: "TestResources") { + if let path = Bundle(for: type(of: self)).path(forResource: "ReferenceContained1", ofType: "json", inDirectory: "TestResources") { let order1 = try! MedicationOrder.instantiate(fromPath: path) XCTAssertEqual("order-ref-contained", order1.id) XCTAssertNotNil(order1.medicationReference) @@ -28,7 +28,7 @@ class ReferenceTests: XCTestCase { XCTAssertTrue(false, "Test resource not bundled") } - if let path = Bundle(for: self.dynamicType).path(forResource: "ReferenceContained2", ofType: "json", inDirectory: "TestResources") { + if let path = Bundle(for: type(of: self)).path(forResource: "ReferenceContained2", ofType: "json", inDirectory: "TestResources") { let order1 = try! MedicationOrder.instantiate(fromPath: path) XCTAssertEqual("order-ref-contained-wrong", order1.id) XCTAssertNotNil(order1.medicationReference) @@ -42,35 +42,35 @@ class ReferenceTests: XCTestCase { } func testBundledReference() { - if let path = Bundle(for: self.dynamicType).path(forResource: "ReferenceBundled", ofType: "json", inDirectory: "TestResources") { + if let path = Bundle(for: type(of: self)).path(forResource: "ReferenceBundled", ofType: "json", inDirectory: "TestResources") { let bundle = try! Bundle.instantiate(fromPath: path) - XCTAssertEqual("Bundle", bundle.dynamicType.resourceName) + XCTAssertEqual("Bundle", type(of: bundle).resourceType) // get resources - let pat23 = bundle.entry?[0].resource as? Patient - XCTAssertEqual("Patient", pat23?.dynamicType.resourceName) - XCTAssertEqual("Darth", pat23?.name?[0].given?[0]) - let patURN = bundle.entry?[1].resource as? Patient - XCTAssertEqual("Patient", patURN?.dynamicType.resourceName) - XCTAssertEqual("Ben", patURN?.name?[0].given?[0]) - let obs123 = bundle.entry?[2].resource as? Observation - XCTAssertEqual("Observation", obs123?.dynamicType.resourceName) - XCTAssertEqual("123", obs123?.id) - let obs56 = bundle.entry?[3].resource as? Observation - XCTAssertEqual("Observation", obs56?.dynamicType.resourceName) - XCTAssertEqual("56", obs56?.id) - let obs34 = bundle.entry?[4].resource as? Observation - XCTAssertEqual("Observation", obs34?.dynamicType.resourceName) - XCTAssertEqual("34", obs34?.id) + let pat23 = bundle.entry?[0].resource as! Patient + XCTAssertEqual("Patient", type(of: pat23).resourceType) + XCTAssertEqual("Darth", pat23.name?[0].given?[0]) + let patURN = bundle.entry?[1].resource as! Patient + XCTAssertEqual("Patient", type(of: patURN).resourceType) + XCTAssertEqual("Ben", patURN.name?[0].given?[0]) + let obs123 = bundle.entry?[2].resource as! Observation + XCTAssertEqual("Observation", type(of: obs123).resourceType) + XCTAssertEqual("123", obs123.id) + let obs56 = bundle.entry?[3].resource as! Observation + XCTAssertEqual("Observation", type(of: obs56).resourceType) + XCTAssertEqual("56", obs56.id) + let obs34 = bundle.entry?[4].resource as! Observation + XCTAssertEqual("Observation", type(of: obs34).resourceType) + XCTAssertEqual("34", obs34.id) // test resolving bundle._server = FHIROpenServer(baseURL: URL(string: "https://fhir.smarthealthit.org")!) - let res1 = obs123!.subject!.resolved(Patient.self) // relative reference, bundled + let res1 = obs123.subject!.resolved(Patient.self) // relative reference, bundled XCTAssertTrue(res1 === pat23) - let res2 = obs123!.subject!.resolved(Medication.self) + let res2 = obs123.subject!.resolved(Medication.self) XCTAssertNil(res2, "Must not resolve on type mismatch") - let res3 = obs56!.subject!.resolved(Patient.self) // bundled, URN-referenced + let res3 = obs56.subject!.resolved(Patient.self) // bundled, URN-referenced XCTAssertTrue(res3 === patURN) /* TODO: this does resolve now, update test @@ -89,7 +89,7 @@ class ReferenceTests: XCTestCase { } func testRelativeReference() { - if let path = Bundle(for: self.dynamicType).path(forResource: "ReferenceRelative", ofType: "json", inDirectory: "TestResources") { + if let path = Bundle(for: type(of: self)).path(forResource: "ReferenceRelative", ofType: "json", inDirectory: "TestResources") { let order1 = try! MedicationOrder.instantiate(fromPath: path) XCTAssertEqual("order-ref-relative", order1.id) XCTAssertEqual("Medication/med-1234", order1.medicationReference?.reference) @@ -110,7 +110,7 @@ class ReferenceTests: XCTestCase { } func testAbsoluteReference() { - if let path = Bundle(for: self.dynamicType).path(forResource: "ReferenceAbsolute", ofType: "json", inDirectory: "TestResources") { + if let path = Bundle(for: type(of: self)).path(forResource: "ReferenceAbsolute", ofType: "json", inDirectory: "TestResources") { let order1 = try! MedicationOrder.instantiate(fromPath: path) XCTAssertEqual("order-ref-absolute", order1.id) XCTAssertEqual("https://fhir-open-api-dstu2.smarthealthit.org/Medication/1", order1.medicationReference?.reference) diff --git a/Tests/RequestTests.swift b/Tests/RequestTests.swift index 7b8abb84..3e203c37 100644 --- a/Tests/RequestTests.swift +++ b/Tests/RequestTests.swift @@ -16,12 +16,12 @@ Test request generation. class RequestTests: XCTestCase { func testJSONGETRequest() { - let handler = FHIRServerJSONRequestHandler(.GET) + let handler = FHIRServerJSONRequestHandler(type: .GET) XCTAssertEqual("application/json+fhir", handler.headers[.accept]) } func testJSONPUTRequest() { - let handler = FHIRServerJSONRequestHandler(.PUT) + let handler = FHIRServerJSONRequestHandler(type: .PUT) var req = URLRequest(url: URL(string: "https://fhir.smarthealthit.org")!) try! handler.prepare(request: &req) XCTAssertEqual("application/json+fhir", handler.headers[.accept]) @@ -41,7 +41,7 @@ class RequestTests: XCTestCase { } func testJSONPOSTRequest() { - let handler = FHIRServerJSONRequestHandler(.POST) + let handler = FHIRServerJSONRequestHandler(type: .POST) var req = URLRequest(url: URL(string: "https://fhir.smarthealthit.org")!) try! handler.prepare(request: &req) XCTAssertEqual("application/json+fhir", handler.headers[.accept]) diff --git a/Tests/ResourceTests.swift b/Tests/ResourceTests.swift index f7e4914d..9022f7ab 100644 --- a/Tests/ResourceTests.swift +++ b/Tests/ResourceTests.swift @@ -179,10 +179,10 @@ class LocalPatientServer: FHIROpenServer { var lastPostedResource: Resource? - override func performPreparedRequest(_ request: URLRequest, withSession session: URLSession, handler: R, callback: ((response: FHIRServerResponse) -> Void)) { + override func performPreparedRequest(_ request: URLRequest, withSession session: URLSession, handler: R, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { guard let path = request.url?.path, "/Patient" == path || path.hasPrefix("/Patient/") else { let res = handler.notSent("Only supports Patient resources, trying to access «\(request.url?.path ?? "nil")»") - callback(response: res) + callback(res) return } @@ -190,7 +190,7 @@ class LocalPatientServer: FHIROpenServer { case "POST": let version = Int(handler.resource?.meta?.versionId ?? "1336")! - let location = "\(self.baseURL.absoluteString ?? "")Patient/\(UUID().uuidString)/_history/\(version+1)" + let location = "\(self.baseURL.absoluteString)Patient/\(UUID().uuidString)/_history/\(version+1)" let headers = ["Location": location, "Last-mODified": "Tue, 3 May 2016 14:45:31 GMT"] let http = HTTPURLResponse(url: request.url!, statusCode: 201, httpVersion: "1.1", headerFields: headers) @@ -200,14 +200,14 @@ class LocalPatientServer: FHIROpenServer { pat.meta?.versionId = "\(version+1)" pat.name = [HumanName(json: ["family": ["POST"]])] - let req = FHIRServerJSONRequestHandler(.POST) + let req = FHIRServerJSONRequestHandler(type: .POST) req.resource = pat try! req.prepareData() - callback(response: req.response(response: http, data: req.data)) + callback(req.response(http, data: req.data)) } else { - callback(response: handler.response(response: http)) + callback(handler.response(http)) } lastPostedResource = handler.resource @@ -222,14 +222,14 @@ class LocalPatientServer: FHIROpenServer { handler.resource = last try! handler.prepareData() - callback(response: handler.response(response: http, data: handler.data)) + callback(handler.response(http, data: handler.data)) } else { - callback(response: handler.notSent("\(request.httpMethod) without preceding “POST” is not supported")) + callback(handler.notSent("\(request.httpMethod) without preceding “POST” is not supported")) } default: - callback(response: handler.notSent("\(request.httpMethod) is not yet supported")) + callback(handler.notSent("\(request.httpMethod) is not yet supported")) } } } diff --git a/fhir-parser b/fhir-parser index 7e15a4ce..dfc141e4 160000 --- a/fhir-parser +++ b/fhir-parser @@ -1 +1 @@ -Subproject commit 7e15a4ce425dae7b92bd1723fca9789e93c1a623 +Subproject commit dfc141e4bd7c662fa41db37b888d05c4c5926718 From 55bf4c5efe9a3ea9d204a3f68f67b6bf497fa3f4 Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Fri, 16 Sep 2016 00:41:30 +0200 Subject: [PATCH 11/20] Update fhir-parser submodule --- fhir-parser | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fhir-parser b/fhir-parser index dfc141e4..99a7fc99 160000 --- a/fhir-parser +++ b/fhir-parser @@ -1 +1 @@ -Subproject commit dfc141e4bd7c662fa41db37b888d05c4c5926718 +Subproject commit 99a7fc99c3c18e134d895e9bf3f15360206c55a9 From 101a901cf2d76f73514fb370ede8808c9a1ad790 Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Fri, 16 Sep 2016 00:49:44 +0200 Subject: [PATCH 12/20] Update changelog and readme --- CHANGELOG.md | 18 ++++++++++++++---- README.md | 3 ++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb5d5441..35bbfaa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,25 @@ Changelog ========= +## 2.8 -## 2.9 +- Update to Swift 3.0 -- Update to FHIR `1.4.0.8139` +## 2.4 -## 2.8 +- Update to FHIR `1.6.0.9663` -- Update to Swift 3.0 + +## 2.3 + +- Update to Swift 2.3 + + +## 2.2.4 + +- Support resolving bundled references +- Logging improvements ## 2.2.3 diff --git a/README.md b/README.md index 48d4bbba..6cb86cad 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,9 @@ See the `develop` branch or specific `feature/x` branches for new Swift or FHIR Version | Swift | FHIR |   ---------|-----------|---------------|----------------------------- - **2.9** | 3.0 | `1.4.0.8139` | STU 3 Montreal, May 2016 **2.8** | 3.0 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) + **2.4** | 2.2 | `1.6.0.9663` | STU 3 Ballot, Sept 2016 + **2.3** | 2.3 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.2.3**| 2.2 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.2** | 2.0-2.2 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.1** | 2.0-2.2 | `1.0.1.7108` | DSTU 2 From 6ce6b39a2fe64f4e56a8070564eac7ea46610891 Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Fri, 16 Sep 2016 08:49:17 +0200 Subject: [PATCH 13/20] Add .swift-version for CocoaPods --- .swift-version | 1 + 1 file changed, 1 insertion(+) create mode 100644 .swift-version diff --git a/.swift-version b/.swift-version new file mode 100644 index 00000000..9f55b2cc --- /dev/null +++ b/.swift-version @@ -0,0 +1 @@ +3.0 From 0712334ab31d7609162fd859c1e36c99b21cbf78 Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Fri, 16 Sep 2016 09:06:24 +0200 Subject: [PATCH 14/20] Revert unnecessary change --- Sources/Client/FHIROpenServer.swift | 2 +- Sources/Client/FHIRServerRequestHandler.swift | 14 +++++++------- Tests/RequestTests.swift | 6 +++--- Tests/ResourceTests.swift | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Sources/Client/FHIROpenServer.swift b/Sources/Client/FHIROpenServer.swift index a01b4aab..ead2f7ed 100644 --- a/Sources/Client/FHIROpenServer.swift +++ b/Sources/Client/FHIROpenServer.swift @@ -84,7 +84,7 @@ open class FHIROpenServer: FHIRServer { - returns: An appropriate `FHIRServerRequestHandler`, for example a _FHIRServerJSONRequestHandler_ if sending and receiving JSON */ open func handlerForRequest(_ ofType: FHIRRequestType, resource: Resource?, headers: FHIRRequestHeaders? = nil) -> FHIRServerRequestHandler? { - let handler = FHIRServerJSONRequestHandler(type: ofType, resource: resource) + let handler = FHIRServerJSONRequestHandler(ofType, resource: resource) if let headers = headers { handler.add(headers: headers) } diff --git a/Sources/Client/FHIRServerRequestHandler.swift b/Sources/Client/FHIRServerRequestHandler.swift index 9984f911..919bd0c1 100644 --- a/Sources/Client/FHIRServerRequestHandler.swift +++ b/Sources/Client/FHIRServerRequestHandler.swift @@ -24,7 +24,7 @@ open class FHIRServerRequestHandler { } /// The HTTP type of the request. - open let type: FHIRRequestType + open let method: FHIRRequestType /// Headers to be used on the request. open var headers: FHIRRequestHeaders @@ -35,8 +35,8 @@ open class FHIRServerRequestHandler { /// The receiver may hold on to a resource that supplies the request's body data. open var resource: Resource? - public init(type: FHIRRequestType, resource: Resource? = nil) { - self.type = type + public init(_ method: FHIRRequestType, resource: Resource? = nil) { + self.method = method self.headers = type(of: self).defaultHeaders self.resource = resource } @@ -73,7 +73,7 @@ open class FHIRServerRequestHandler { */ open func prepare(request: inout URLRequest) throws { try prepareData() - type.prepare(request: &request, body: data) + method.prepare(request: &request, body: data) headers.prepare(request: &request) } @@ -143,7 +143,7 @@ open class FHIRServerJSONRequestHandler: FHIRServerRequestHandler { } open override func prepare(request: inout URLRequest) throws { - switch type { + switch method { case .PUT: headers[.contentType] = "application/json+fhir; charset=utf-8" case .POST: @@ -172,14 +172,14 @@ open class FHIRServerDataRequestHandler: FHIRServerRequestHandler { init(_ type: FHIRRequestType, contentType: String) { self.contentType = contentType - super.init(type: type, resource: nil) + super.init(type, resource: nil) } override open func prepareData() throws { } open override func prepare(request: inout URLRequest) throws { - switch type { + switch method { case .GET: headers[.accept] = contentType case .PUT: diff --git a/Tests/RequestTests.swift b/Tests/RequestTests.swift index 3e203c37..7b8abb84 100644 --- a/Tests/RequestTests.swift +++ b/Tests/RequestTests.swift @@ -16,12 +16,12 @@ Test request generation. class RequestTests: XCTestCase { func testJSONGETRequest() { - let handler = FHIRServerJSONRequestHandler(type: .GET) + let handler = FHIRServerJSONRequestHandler(.GET) XCTAssertEqual("application/json+fhir", handler.headers[.accept]) } func testJSONPUTRequest() { - let handler = FHIRServerJSONRequestHandler(type: .PUT) + let handler = FHIRServerJSONRequestHandler(.PUT) var req = URLRequest(url: URL(string: "https://fhir.smarthealthit.org")!) try! handler.prepare(request: &req) XCTAssertEqual("application/json+fhir", handler.headers[.accept]) @@ -41,7 +41,7 @@ class RequestTests: XCTestCase { } func testJSONPOSTRequest() { - let handler = FHIRServerJSONRequestHandler(type: .POST) + let handler = FHIRServerJSONRequestHandler(.POST) var req = URLRequest(url: URL(string: "https://fhir.smarthealthit.org")!) try! handler.prepare(request: &req) XCTAssertEqual("application/json+fhir", handler.headers[.accept]) diff --git a/Tests/ResourceTests.swift b/Tests/ResourceTests.swift index 9022f7ab..12b54369 100644 --- a/Tests/ResourceTests.swift +++ b/Tests/ResourceTests.swift @@ -200,7 +200,7 @@ class LocalPatientServer: FHIROpenServer { pat.meta?.versionId = "\(version+1)" pat.name = [HumanName(json: ["family": ["POST"]])] - let req = FHIRServerJSONRequestHandler(type: .POST) + let req = FHIRServerJSONRequestHandler(.POST) req.resource = pat try! req.prepareData() From 903b62b8e864159d3f9deb827dae8cab10b6ee06 Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Fri, 16 Sep 2016 11:32:16 +0200 Subject: [PATCH 15/20] More Swift 3 adaptations --- .../Client/DomainResource+Containment.swift | 4 +- Sources/Client/FHIROpenServer.swift | 61 +++++++++++-------- Sources/Client/FHIROperation.swift | 12 ++-- Sources/Client/FHIRSearch.swift | 17 ++++-- Sources/Client/FHIRServerDataResponse.swift | 51 ++++++++++------ Sources/Client/FHIRServerRequestHandler.swift | 33 +++++----- Sources/Client/Resource+Instantiation.swift | 19 +++++- Sources/Client/Resource+REST.swift | 34 +++++------ Sources/Models/Account.swift | 2 +- Sources/Models/AllergyIntolerance.swift | 6 +- Sources/Models/Appointment.swift | 8 +-- Sources/Models/AppointmentResponse.swift | 4 +- Sources/Models/AuditEvent.swift | 18 +++--- Sources/Models/BackboneElement.swift | 2 +- Sources/Models/Basic.swift | 2 +- Sources/Models/BodySite.swift | 6 +- Sources/Models/Bundle.swift | 6 +- Sources/Models/CarePlan.swift | 30 ++++----- Sources/Models/Claim.swift | 26 ++++---- Sources/Models/ClaimResponse.swift | 28 ++++----- Sources/Models/ClinicalImpression.swift | 16 ++--- Sources/Models/CodeableConcept.swift | 2 +- Sources/Models/Communication.swift | 10 +-- Sources/Models/CommunicationRequest.swift | 10 +-- Sources/Models/Composition.swift | 16 ++--- Sources/Models/ConceptMap.swift | 14 ++--- Sources/Models/Condition.swift | 10 +-- Sources/Models/Conformance.swift | 32 +++++----- Sources/Models/Contract.swift | 40 ++++++------ Sources/Models/Coverage.swift | 4 +- Sources/Models/DataElement.swift | 12 ++-- Sources/Models/DetectedIssue.swift | 4 +- Sources/Models/Device.swift | 6 +- Sources/Models/DeviceComponent.swift | 4 +- Sources/Models/DeviceMetric.swift | 2 +- Sources/Models/DeviceUseRequest.swift | 6 +- Sources/Models/DeviceUseStatement.swift | 4 +- Sources/Models/DiagnosticOrder.swift | 18 +++--- Sources/Models/DiagnosticReport.swift | 16 ++--- Sources/Models/DocumentManifest.swift | 10 +-- Sources/Models/DocumentReference.swift | 16 ++--- Sources/Models/DomainResource.swift | 6 +- Sources/Models/Element.swift | 2 +- Sources/Models/ElementDefinition.swift | 8 +-- Sources/Models/EligibilityRequest.swift | 2 +- Sources/Models/EligibilityResponse.swift | 2 +- Sources/Models/Encounter.swift | 30 ++++----- Sources/Models/EnrollmentRequest.swift | 2 +- Sources/Models/EnrollmentResponse.swift | 2 +- Sources/Models/EpisodeOfCare.swift | 14 ++--- Sources/Models/ExplanationOfBenefit.swift | 2 +- Sources/Models/FHIRAbstractBase.swift | 22 ++----- Sources/Models/FHIRAbstractResource.swift | 12 ++-- Sources/Models/FHIRServer.swift | 6 +- Sources/Models/FHIRServerResponse.swift | 30 ++++++--- Sources/Models/FHIRTypes.swift | 2 +- Sources/Models/FamilyMemberHistory.swift | 4 +- Sources/Models/Flag.swift | 2 +- Sources/Models/Goal.swift | 10 +-- Sources/Models/Group.swift | 6 +- Sources/Models/HealthcareService.swift | 20 +++--- Sources/Models/ImagingObjectSelection.swift | 8 +-- Sources/Models/ImagingStudy.swift | 14 ++--- Sources/Models/Immunization.swift | 14 ++--- .../Models/ImmunizationRecommendation.swift | 10 +-- Sources/Models/ImplementationGuide.swift | 16 ++--- Sources/Models/List.swift | 4 +- Sources/Models/Location.swift | 4 +- Sources/Models/Media.swift | 2 +- Sources/Models/Medication.swift | 6 +- Sources/Models/MedicationAdministration.swift | 8 +-- Sources/Models/MedicationDispense.swift | 10 +-- Sources/Models/MedicationOrder.swift | 4 +- Sources/Models/MedicationStatement.swift | 12 ++-- Sources/Models/MessageHeader.swift | 4 +- Sources/Models/Meta.swift | 4 +- Sources/Models/NamingSystem.swift | 8 +-- Sources/Models/NutritionOrder.swift | 24 ++++---- Sources/Models/Observation.swift | 12 ++-- Sources/Models/OperationDefinition.swift | 8 +-- Sources/Models/OperationOutcome.swift | 2 +- Sources/Models/Order.swift | 4 +- Sources/Models/OrderResponse.swift | 4 +- Sources/Models/Organization.swift | 10 +-- Sources/Models/Parameters.swift | 4 +- Sources/Models/Patient.swift | 22 +++---- Sources/Models/PaymentNotice.swift | 2 +- Sources/Models/PaymentReconciliation.swift | 6 +- Sources/Models/Person.swift | 10 +-- Sources/Models/Practitioner.swift | 22 +++---- Sources/Models/Procedure.swift | 20 +++--- Sources/Models/ProcedureRequest.swift | 6 +- Sources/Models/ProcessRequest.swift | 4 +- Sources/Models/ProcessResponse.swift | 6 +- Sources/Models/Provenance.swift | 12 ++-- Sources/Models/Questionnaire.swift | 16 ++--- Sources/Models/QuestionnaireResponse.swift | 8 +-- Sources/Models/ReferralRequest.swift | 8 +-- Sources/Models/RelatedPerson.swift | 8 +-- Sources/Models/RiskAssessment.swift | 4 +- Sources/Models/Schedule.swift | 4 +- Sources/Models/SearchParameter.swift | 4 +- Sources/Models/Signature.swift | 2 +- Sources/Models/Slot.swift | 2 +- Sources/Models/Specimen.swift | 12 ++-- Sources/Models/StructureDefinition.swift | 16 ++--- Sources/Models/Subscription.swift | 4 +- Sources/Models/Substance.swift | 8 +-- Sources/Models/SupplyDelivery.swift | 2 +- Sources/Models/SupplyRequest.swift | 2 +- Sources/Models/TestScript.swift | 26 ++++---- Sources/Models/ValueSet.swift | 28 ++++----- Sources/Models/VisionPrescription.swift | 4 +- Tests/ResourceTests.swift | 6 +- fhir-parser | 2 +- 115 files changed, 661 insertions(+), 616 deletions(-) diff --git a/Sources/Client/DomainResource+Containment.swift b/Sources/Client/DomainResource+Containment.swift index dacca182..37250c30 100644 --- a/Sources/Client/DomainResource+Containment.swift +++ b/Sources/Client/DomainResource+Containment.swift @@ -45,7 +45,7 @@ extension DomainResource { - parameter display: The string that will become the reference's `display` - returns: A `Reference` instance pointing to the contained resource (as "#id") */ - public func contain(resource: Resource, withDisplay display: String? = nil) throws -> Reference { + open func contain(resource: Resource, withDisplay display: String? = nil) throws -> Reference { guard resource !== self else { throw FHIRError.resourceCannotContainItself } @@ -98,7 +98,7 @@ extension DomainResource { - parameter display: The string that will become the reference's `display` - returns: A `Reference`, ready for use */ - public func reference(resource: Resource, withDisplay display: String? = nil) throws -> Reference { + open func reference(resource: Resource, withDisplay display: String? = nil) throws -> Reference { let ref = Reference(json: nil, owner: self) ref.display = display diff --git a/Sources/Client/FHIROpenServer.swift b/Sources/Client/FHIROpenServer.swift index ead2f7ed..fc7e6528 100644 --- a/Sources/Client/FHIROpenServer.swift +++ b/Sources/Client/FHIROpenServer.swift @@ -19,8 +19,8 @@ It knows its base URL, can fetch and hold on to the conformance statement and pe These methods are of interest to you when you create a subclass: -- `handlerForRequest(ofType:resource:)`: what kind of handler your server wants to use. Returns `FHIRServerJSONRequestHandler`. -- `configurableRequest(forURL:)`: the SMART framework returns a request that already has an Authorization headers set, if needed. +- `handlerForRequest(withMethod:resource:)`: what kind of handler your server wants to use. Returns `FHIRServerJSONRequestHandler`. +- `configurableRequest(for:)`: the SMART framework returns a request that already has an Authorization headers set, if needed. */ open class FHIROpenServer: FHIRServer { @@ -50,8 +50,10 @@ open class FHIROpenServer: FHIRServer { This method simply creates an absolute URL from the receiver's `baseURL` and the given path. A chance for subclasses to mess with URL generation if needed. + + - parameter for: The path in the absolute URL */ - open func absoluteURLForPath(_ path: String, handler: FHIRServerRequestHandler) -> URL? { + open func absoluteURL(for path: String, handler: FHIRServerRequestHandler) -> URL? { return URL(string: path, relativeTo: baseURL) } @@ -60,13 +62,19 @@ open class FHIROpenServer: FHIRServer { /** Perform a request of given type against the given path with the (optional) given resource and headers. + + - parameter method: The HTTP method type of the request + - parameter path: The relative path on the server to be interacting against + - parameter resource: The resource to be involved in the request, if any + - parameter additonalHeaders: The headers to set on the request + - parameter callback: A callback, likely called asynchronously, returning a response instance */ - open func performRequest(ofType type: FHIRRequestType, path: String, resource: Resource?, additionalHeaders: FHIRRequestHeaders? = nil, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { - if let handler = handlerForRequest(type, resource: resource, headers: additionalHeaders) { - performRequest(againstPath: path, handler: handler, callback: callback) + open func performRequest(_ method: FHIRRequestMethod, path: String, resource: Resource?, additionalHeaders: FHIRRequestHeaders? = nil, callback: @escaping ((FHIRServerResponse) -> Void)) { + if let handler = handlerForRequest(withMethod: method, resource: resource, headers: additionalHeaders) { + performRequest(against: path, handler: handler, callback: callback) } else { - let res = FHIRServerRequestHandler.noneAvailable(forType: type) + let res = FHIRServerRequestHandler.noneAvailable(for: method) callback(res) } } @@ -79,12 +87,12 @@ open class FHIROpenServer: FHIRServer { Request handlers are responsible for constructing an URLRequest that correctly performs the desired REST interaction. - - parameter ofType: The type of the request (GET, PUT, POST or DELETE) + - parameter method: The request method (GET, PUT, POST or DELETE) - parameter resource: The resource to be involved in the request, if any - - returns: An appropriate `FHIRServerRequestHandler`, for example a _FHIRServerJSONRequestHandler_ if sending and receiving JSON + - returns: An appropriate `FHIRServerRequestHandler`, for example a _FHIRServerJSONRequestHandler_ if sending and receiving JSON */ - open func handlerForRequest(_ ofType: FHIRRequestType, resource: Resource?, headers: FHIRRequestHeaders? = nil) -> FHIRServerRequestHandler? { - let handler = FHIRServerJSONRequestHandler(ofType, resource: resource) + open func handlerForRequest(withMethod method: FHIRRequestMethod, resource: Resource?, headers: FHIRRequestHeaders? = nil) -> FHIRServerRequestHandler? { + let handler = FHIRServerJSONRequestHandler(method, resource: resource) if let headers = headers { handler.add(headers: headers) } @@ -94,38 +102,37 @@ open class FHIROpenServer: FHIRServer { /** Pre-prepare a mutable URLRequest that the handler subsequently prepares and performs. - - parameter forURL: The url to use for the request + - parameter url: The url to use for the request */ - open func configurableRequest(forURL url: URL) -> URLRequest { + open func configurableRequest(for url: URL) -> URLRequest { return URLRequest(url: url) } - /** Method to execute a request against a given relative URL with a given request/response handler. - - parameter againstPath: The path, relative to the server's base; may include URL query and URL fragment (!) - - parameter handler: The RequestHandler that prepares the request and processes the response - - parameter callback: The callback to execute; NOT guaranteed to be performed on the main thread! + - parameter path: The path, relative to the server's base; may include URL query and URL fragment (!) + - parameter handler: The RequestHandler that prepares the request and processes the response + - parameter callback: The callback to execute; NOT guaranteed to be performed on the main thread! */ - open func performRequest(againstPath path: String, handler: R, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { - guard let url = absoluteURLForPath(path, handler: handler) else { + open func performRequest(against path: String, handler: R, callback: @escaping ((FHIRServerResponse) -> Void)) { + guard let url = absoluteURL(for: path, handler: handler) else { let res = handler.notSent("Failed to parse path «\(path)» relative to server base URL") callback(res) return } - performRequest(withURL: url, handler: handler, callback: callback) + performRequest(on: url, handler: handler, callback: callback) } /** Method to execute a request against a given absolute URL with a given request/response handler. - - parameter withURL: The full URL; may include query parts and fragment (!) + - parameter url: The full URL; may include query parts and fragment (!) - parameter handler: The RequestHandler that prepares the request and processes the response - parameter callback: The callback to execute; NOT guaranteed to be performed on the main thread! */ - open func performRequest(withURL url: URL, handler: R, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { - var request = configurableRequest(forURL: url) + open func performRequest(on url: URL, handler: R, callback: @escaping ((FHIRServerResponse) -> Void)) { + var request = configurableRequest(for: url) do { try handler.prepare(request: &request) self.performPreparedRequest(request, handler: handler, callback: callback) @@ -145,7 +152,7 @@ open class FHIROpenServer: FHIRServer { - parameter handler: The RequestHandler that prepares the request and processes the response - parameter callback: The callback to execute; NOT guaranteed to be performed on the main thread! */ - open func performPreparedRequest(_ request: URLRequest, handler: R, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { + open func performPreparedRequest(_ request: URLRequest, handler: R, callback: @escaping ((FHIRServerResponse) -> Void)) { performPreparedRequest(request, withSession: URLSession(), handler: handler, callback: callback) } @@ -157,9 +164,9 @@ open class FHIROpenServer: FHIRServer { - parameter handler: The RequestHandler that prepares the request and processes the response - parameter callback: The callback to execute; NOT guaranteed to be performed on the main thread! */ - open func performPreparedRequest(_ request: URLRequest, withSession session: URLSession, handler: R, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { + open func performPreparedRequest(_ request: URLRequest, withSession session: URLSession, handler: R, callback: @escaping ((FHIRServerResponse) -> Void)) { let task = session.dataTask(with: request) { data, response, error in - let res = handler.response(response, data: data, error: error as NSError?) + let res = handler.response(with: response, data: data, error: error) callback(res) } task.resume() @@ -293,7 +300,7 @@ open class FHIROpenServer: FHIRServer { - parameter operation: The operation instance to perform - parameter callback: The callback to call when the request ends (success or failure) */ - open func perform(_ operation: FHIROperation, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) { + open func perform(_ operation: FHIROperation, callback: @escaping ((FHIRServerResponse) -> Void)) { self.operation(operation.name) { definition in if let def = definition { do { diff --git a/Sources/Client/FHIROperation.swift b/Sources/Client/FHIROperation.swift index 3081e6fb..be054f8a 100644 --- a/Sources/Client/FHIROperation.swift +++ b/Sources/Client/FHIROperation.swift @@ -13,16 +13,16 @@ import Models /** - The context an operation is to be performed against. - */ +The context an operation is to be performed against. +*/ public enum FHIROperationContext { case none, system, resourceType, instance } /** - Named operations to be performed against a FHIR REST endpoint. - */ +Named operations to be performed against a FHIR REST endpoint. +*/ open class FHIROperation: CustomStringConvertible { /// The name of the operation. @@ -116,7 +116,7 @@ open class FHIROperation: CustomStringConvertible { if "in" == param.use { // have the parameter, validate it - if let _ = inParams?[param.name!] { + if nil != inParams?[param.name!] { leftover.removeValue(forKey: param.name!) // TODO: actually validate! @@ -165,7 +165,7 @@ open class FHIROperation: CustomStringConvertible { */ open func perform(onServer server: FHIRServer, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) throws { let path = try serverPath() - server.performRequest(ofType: .GET, path: path, resource: nil, additionalHeaders: nil, callback: callback) + server.performRequest(.GET, path: path, resource: nil, additionalHeaders: nil, callback: callback) } diff --git a/Sources/Client/FHIRSearch.swift b/Sources/Client/FHIRSearch.swift index d759f5d7..98f8e774 100644 --- a/Sources/Client/FHIRSearch.swift +++ b/Sources/Client/FHIRSearch.swift @@ -9,12 +9,17 @@ import Foundation #if !NO_MODEL_IMPORT import Models +public typealias FHIRSearchBundleErrorCallback = ((Models.Bundle?, FHIRError?) -> Void) +#else +public typealias FHIRSearchBundleErrorCallback = ((Bundle?, FHIRError?) -> Void) #endif /** Instances of this class can perform searches on a server. + TODO: needs a refresh!! + Searches are instantiated from MongoDB-like query constructs, like: let srch = Patient.search(["address": "Boston", "gender": "male", "given": ["$exact": "Willis"]]) @@ -101,9 +106,9 @@ open class FHIRSearch Calling this method will always restart search, not fetch subsequent pages. - parameter server: The FHIRServer instance on which to perform the search - - parameter callback: The callback, receives the response Bundle or an NSError message describing what went wrong + - parameter callback: The callback, receives the response Bundle or an Error message describing what went wrong */ - open func perform(_ server: FHIRServer, callback: @escaping ((_ bundle: Bundle?, _ error: FHIRError?) -> Void)) { + open func perform(_ server: FHIRServer, callback: @escaping FHIRSearchBundleErrorCallback) { if nil == profileType { callback(nil, FHIRError.searchResourceTypeNotDefined) return @@ -118,9 +123,9 @@ open class FHIRSearch with no bundle and no error. - parameter server: The FHIRServer instance on which to perform the search - - parameter callback: The callback, receives the response Bundle or an NSError message describing what went wrong + - parameter callback: The callback, receives the response Bundle or an Error message describing what went wrong */ - open func nextPage(_ server: FHIRServer, callback: @escaping ((_ bundle: Bundle?, _ error: FHIRError?) -> Void)) { + open func nextPage(_ server: FHIRServer, callback: @escaping FHIRSearchBundleErrorCallback) { if let next = nextPageURL?.absoluteString { performSearch(server, queryPath: next, callback: callback) } @@ -129,14 +134,14 @@ open class FHIRSearch } } - func performSearch(_ server: FHIRServer, queryPath: String, callback: @escaping ((_ bundle: Bundle?, _ error: FHIRError?) -> Void)) { + func performSearch(_ server: FHIRServer, queryPath: String, callback: @escaping FHIRSearchBundleErrorCallback) { if busy { callback(nil, nil) return } busy = true - server.performRequest(ofType: .GET, path: queryPath, resource: nil, additionalHeaders: nil) { response in + server.performRequest(.GET, path: queryPath, resource: nil, additionalHeaders: nil) { response in self.busy = false if let error = response.error { diff --git a/Sources/Client/FHIRServerDataResponse.swift b/Sources/Client/FHIRServerDataResponse.swift index c6be1093..6fe4e7c1 100644 --- a/Sources/Client/FHIRServerDataResponse.swift +++ b/Sources/Client/FHIRServerDataResponse.swift @@ -71,6 +71,11 @@ extension FHIRServerResponse { } } + /** Initializes with a no-response error. */ + public static func noneReceived() -> Self { + return self.init(error: FHIRError.noResponseReceived) + } + /// Nicely format status code, response headers and response body (if any). public var debugDescription: String { var msg = "HTTP 1.1 \(status)" @@ -99,13 +104,13 @@ open class FHIRServerDataResponse: FHIRServerResponse { open var body: Data? /// The request's operation outcome, if any. - open internal(set) var outcome: OperationOutcome? + public internal(set) var outcome: OperationOutcome? /// The error encountered, if any. open var error: FHIRError? /** - Instantiate a FHIRServerResponse from an NS(HTTP)URLResponse, NSData and an optional NSError. + Instantiate a FHIRServerResponse from a (HTTP)URLResponse, Data and an optional Error. */ public required init(response: URLResponse, data: Data?, error: Error?) { var status = 0 @@ -128,10 +133,13 @@ open class FHIRServerDataResponse: FHIRServerResponse { // was there an error? if let error = error as? NSError, NSURLErrorDomain == error.domain { - self.error = FHIRError.requestError(status, NSURLErrorHumanize(error)) + self.error = FHIRError.requestError(status, error.humanized) + } + else if let error = error as? FHIRError { + self.error = error } else if let error = error { - self.error = FHIRError.error("\(error)") + self.error = FHIRError.error(error.localizedDescription) } self.status = status @@ -143,7 +151,7 @@ open class FHIRServerDataResponse: FHIRServerResponse { self.status = 0 self.headers = [String: String]() if NSURLErrorDomain == (error as NSError).domain { - self.error = FHIRError.requestError(status, NSURLErrorHumanize(error as NSError)) + self.error = FHIRError.requestError(status, (error as NSError).humanized) } else if let error = error as? FHIRError { self.error = error @@ -156,12 +164,12 @@ open class FHIRServerDataResponse: FHIRServerResponse { // MARK: - Responses - open func responseResource(_ expectType: T.Type) -> T? { + open func responseResource(ofType: T.Type) -> T? { return nil } /** Initializes with a no-response error. */ - open class func noneReceived() -> Self { + public final class func noneReceived() -> Self { return self.init(error: FHIRError.noResponseReceived) } @@ -169,9 +177,9 @@ open class FHIRServerDataResponse: FHIRServerResponse { The base method does not actually know how to handle the data to update a resource, but it will still throw `FHIRError.ResponseNoResourceReceived` if body is nil. - - parameter resource: The resource to apply the response data to + - parameter to: The resource to apply the response data to */ - open func applyBody(to resource: Resource) throws { + open func applyBody(to: Resource) throws { guard nil != body else { throw FHIRError.responseNoResourceReceived } @@ -198,7 +206,7 @@ open class FHIRServerJSONResponse: FHIRServerDataResponse { do { let json = try JSONSerialization.jsonObject(with: data, options: []) as? FHIRJSON self.json = json - self.outcome = responseResource(OperationOutcome.self) + self.outcome = responseResource(ofType: OperationOutcome.self) // inspect OperationOutcome if there was an error if status >= 400 { @@ -214,7 +222,7 @@ open class FHIRServerJSONResponse: FHIRServerDataResponse { catch let error as NSError { // Cocoa error 3840 is JSON parsing error; some error responses may not return JSON, don't report an error on those if 3840 != error.code || NSCocoaErrorDomain != error.domain || status < 400 { - let raw = NSString(data: data, encoding: String.Encoding.utf8.rawValue) as? String ?? "" + let raw = String(data: data, encoding: String.Encoding.utf8) ?? "" self.error = FHIRError.jsonParsingError(error.localizedDescription, raw) } } @@ -235,7 +243,7 @@ open class FHIRServerJSONResponse: FHIRServerDataResponse { Uses FHIRElement's factory method to instantiate a resource from the response JSON, if any, and returns that resource if it is indeed of the expected type. */ - open override func responseResource(_ expectType: T.Type) -> T? { + override open func responseResource(ofType: T.Type) -> T? { if let json = json { let resource = Resource.instantiate(from: json, owner: nil) return resource as? T @@ -251,7 +259,7 @@ open class FHIRServerJSONResponse: FHIRServerDataResponse { - parameter resource: The resource to apply the response data to */ - open override func applyBody(to resource: Resource) throws { + override open func applyBody(to resource: Resource) throws { guard let json = json else { throw FHIRError.responseNoResourceReceived } @@ -270,12 +278,14 @@ open class FHIRServerJSONResponse: FHIRServerDataResponse { // MARK: - -/** -Return a human-readable, localized string for error codes of the NSURLErrorDomain. -*/ -func NSURLErrorHumanize(_ error: NSError) -> String { - assert(NSURLErrorDomain == error.domain, "Can only use this function with errors in the NSURLErrorDomain") - switch error.code { +extension NSError { + + /** + Return a human-readable, localized string for error codes of the NSURLErrorDomain (!!). + */ + public var humanized: String { + assert(NSURLErrorDomain == domain, "Can only use this function with errors in the NSURLErrorDomain") + switch code { case NSURLErrorBadURL: return "The URL was malformed".fhir_localized case NSURLErrorTimedOut: return "The connection timed out".fhir_localized case NSURLErrorUnsupportedURL: return "The URL scheme is not supported".fhir_localized @@ -284,7 +294,8 @@ func NSURLErrorHumanize(_ error: NSError) -> String { case NSURLErrorNetworkConnectionLost: return "The network connection was lost".fhir_localized case NSURLErrorDNSLookupFailed: return "The connection failed because the DNS lookup failed".fhir_localized case NSURLErrorHTTPTooManyRedirects: return "The HTTP connection failed due to too many redirects".fhir_localized - default: return error.localizedDescription + default: return localizedDescription + } } } diff --git a/Sources/Client/FHIRServerRequestHandler.swift b/Sources/Client/FHIRServerRequestHandler.swift index 919bd0c1..b50a97cc 100644 --- a/Sources/Client/FHIRServerRequestHandler.swift +++ b/Sources/Client/FHIRServerRequestHandler.swift @@ -15,7 +15,8 @@ import Models /** Base for different request/response handlers. -Would love to make this a protocol but since it has an associated type it cannot be used nicely, hence a class. +Would love to make this a protocol but since it has an associated type which does cannot be used for initialization from subclasses -- the +associated type of the class that implements the method is always used -- it cannot be used nicely. Hence a class. */ open class FHIRServerRequestHandler { @@ -23,8 +24,8 @@ open class FHIRServerRequestHandler { return FHIRRequestHeaders() } - /// The HTTP type of the request. - open let method: FHIRRequestType + /// The HTTP method of the request. + open let method: FHIRRequestMethod /// Headers to be used on the request. open var headers: FHIRRequestHeaders @@ -35,7 +36,7 @@ open class FHIRServerRequestHandler { /// The receiver may hold on to a resource that supplies the request's body data. open var resource: Resource? - public init(_ method: FHIRRequestType, resource: Resource? = nil) { + public init(_ method: FHIRRequestMethod, resource: Resource? = nil) { self.method = method self.headers = type(of: self).defaultHeaders self.resource = resource @@ -69,7 +70,7 @@ open class FHIRServerRequestHandler { /** Give the request type a chance to prepare/alter the URL request. - Typically the FHIRRequestType instance sets the correct HTTPMethod as well as correct FHIR headers. + Typically the FHIRRequestMethod instance sets the correct HTTPMethod as well as correct FHIR headers. */ open func prepare(request: inout URLRequest) throws { try prepareData() @@ -86,8 +87,12 @@ open class FHIRServerRequestHandler { /** Instantiate an object of ResponseType-type based on the response and data that we get. + + - parameter response: The URLResponse that was received + - parameter data: Response data + - parameter error: Error in the response */ - open func response(_ response: URLResponse?, data inData: Data? = nil, error: Error? = nil) -> FHIRServerResponse { + open func response(with response: URLResponse?, data inData: Data? = nil, error: Error? = nil) -> FHIRServerResponse { if let res = response { return type(of: self).ResponseType.init(response: res, data: inData, error: error) } @@ -107,10 +112,10 @@ open class FHIRServerRequestHandler { /** Convenience method to indicate that no request handler for the given type is available. - - parameter forType: The request type + - parameter method: The request type */ - open class func noneAvailable(forType type: FHIRRequestType) -> FHIRServerResponse { - return ResponseType.init(error: FHIRError.noRequestHandlerAvailable(type.rawValue)) + open class func noneAvailable(for method: FHIRRequestMethod) -> FHIRServerResponse { + return ResponseType.init(error: FHIRError.noRequestHandlerAvailable(method.rawValue)) } } @@ -142,7 +147,7 @@ open class FHIRServerJSONRequestHandler: FHIRServerRequestHandler { } // for GET requests we don't have data, which is fine too } - open override func prepare(request: inout URLRequest) throws { + override open func prepare(request: inout URLRequest) throws { switch method { case .PUT: headers[.contentType] = "application/json+fhir; charset=utf-8" @@ -154,7 +159,7 @@ open class FHIRServerJSONRequestHandler: FHIRServerRequestHandler { try super.prepare(request: &request) } - open override class var ResponseType: FHIRServerResponse.Type { + override open class var ResponseType: FHIRServerResponse.Type { return FHIRServerJSONResponse.self } } @@ -170,7 +175,7 @@ open class FHIRServerDataRequestHandler: FHIRServerRequestHandler { open let contentType: String - init(_ type: FHIRRequestType, contentType: String) { + init(_ type: FHIRRequestMethod, contentType: String) { self.contentType = contentType super.init(type, resource: nil) } @@ -178,7 +183,7 @@ open class FHIRServerDataRequestHandler: FHIRServerRequestHandler { override open func prepareData() throws { } - open override func prepare(request: inout URLRequest) throws { + override open func prepare(request: inout URLRequest) throws { switch method { case .GET: headers[.accept] = contentType @@ -193,7 +198,7 @@ open class FHIRServerDataRequestHandler: FHIRServerRequestHandler { try super.prepare(request: &request) } - open override class var ResponseType: FHIRServerResponse.Type { + override open class var ResponseType: FHIRServerResponse.Type { return FHIRServerDataResponse.self } } diff --git a/Sources/Client/Resource+Instantiation.swift b/Sources/Client/Resource+Instantiation.swift index 609c7b11..e7c61c20 100644 --- a/Sources/Client/Resource+Instantiation.swift +++ b/Sources/Client/Resource+Instantiation.swift @@ -36,10 +36,23 @@ public extension Foundation.Bundle { - parameter name: The filename, without ".json" extension, to read the resource from - parameter type: The type the resource is expected to be; must be a subclass of `Resource` - - returns: A Resource subclass corresponding to the "resourceType" entry, as specified under `type` + - returns: A Resource subclass corresponding to the "resourceType" entry, as specified under `type` */ public func fhir_bundledResource(_ name: String, type: T.Type) throws -> T { - if let url = url(forResource: name, withExtension: "json"), let data = try? Data(contentsOf: url) { + return try fhir_bundledResource(name, subdirectory: nil, type: type) + } + + /** + Attempts to read a JSON file with the given name (without ".json") from the given directory. Parses the JSON and instantiates a FHIR + resource corresponding to "resourceType". + + - parameter name: The filename, without ".json" extension, to read the resource from + - parameter subdirectory: The directory name to search for the resource; `nil` for top level + - parameter type: The type the resource is expected to be; must be a subclass of `Resource` + - returns: A Resource subclass corresponding to the "resourceType" entry, as specified under `type` + */ + public func fhir_bundledResource(_ name: String, subdirectory: String?, type: T.Type) throws -> T { + if let url = url(forResource: name, withExtension: "json", subdirectory: subdirectory), let data = try? Data(contentsOf: url) { if let json = try JSONSerialization.jsonObject(with: data, options: []) as? FHIRJSON { if let resource = Resource.instantiate(from: json, owner: nil) as? T { return resource @@ -48,7 +61,7 @@ public extension Foundation.Bundle { } throw FHIRError.resourceFailedToInstantiate(url.description) } - throw FHIRError.resourceFailedToInstantiate(name) + throw FHIRError.resourceFailedToInstantiate((nil == subdirectory) ? "\(name).json" : "\(subdirectory!)/\(name).json") } } diff --git a/Sources/Client/Resource+REST.swift b/Sources/Client/Resource+REST.swift index f463a6c5..cae68f5b 100644 --- a/Sources/Client/Resource+REST.swift +++ b/Sources/Client/Resource+REST.swift @@ -13,10 +13,10 @@ import Models /// The block signature for server interaction callbacks that return an error. -public typealias FHIRErrorCallback = ((_ error: FHIRError?) -> Void) +public typealias FHIRErrorCallback = ((FHIRError?) -> Void) /// The block signature for most server interaction callbacks that return a resource and an error. -public typealias FHIRResourceErrorCallback = ((_ resource: Resource?, _ error: FHIRError?) -> Void) +public typealias FHIRResourceErrorCallback = ((Resource?, FHIRError?) -> Void) /** @@ -105,11 +105,11 @@ public extension Resource { - parameter callback: The callback to execute once done. The callback is NOT guaranteed to be executed on the main thread! */ public class func readFrom(_ path: String, server: FHIRServer, callback: @escaping FHIRResourceErrorCallback) { - server.performRequest(ofType: .GET, path: path, resource: nil, additionalHeaders: nil) { response in + server.performRequest(.GET, path: path, resource: nil, additionalHeaders: nil) { response in if let error = response.error { callback(nil, error) } - else if let resource = response.responseResource(Resource.self) { + else if let resource = response.responseResource(ofType: Resource.self) { resource._server = server do { try response.applyHeaders(to: resource) @@ -148,7 +148,7 @@ public extension Resource { } let headers = FHIRRequestHeaders([.prefer: "return=minimal"]) - server.performRequest(ofType: .POST, path: relativeURLBase(), resource: self, additionalHeaders: headers) { response in + server.performRequest(.POST, path: relativeURLBase(), resource: self, additionalHeaders: headers) { response in if nil == response.error { self._server = server do { @@ -183,7 +183,7 @@ public extension Resource { } let headers = FHIRRequestHeaders([.prefer: "return=representation"]) - server.performRequest(ofType: .POST, path: relativeURLBase(), resource: self, additionalHeaders: headers) { response in + server.performRequest(.POST, path: relativeURLBase(), resource: self, additionalHeaders: headers) { response in if nil == response.error { self._server = server do { @@ -227,11 +227,11 @@ public extension Resource { - parameter callback: The callback to execute once done. The callback is NOT guaranteed to be executed on the main thread! */ - public func update(_ callback: @escaping FHIRErrorCallback) { + public func update(callback: @escaping FHIRErrorCallback) { if let server = _server { do { let path = try relativeURLPath() - server.performRequest(ofType: .PUT, path: path, resource: self, additionalHeaders: nil) { response in + server.performRequest(.PUT, path: path, resource: self, additionalHeaders: nil) { response in do { try response.applyHeaders(to: self) } @@ -255,7 +255,7 @@ public extension Resource { This method forwards to the `delete` class method, substituting the receiver's path and server. */ - public func delete(_ callback: @escaping FHIRErrorCallback) { + public func delete(callback: @escaping FHIRErrorCallback) { if let server = _server { do { let path = try relativeURLPath() @@ -276,7 +276,7 @@ public extension Resource { This implementation issues a DELETE call against the given path on the given server. */ public class func delete(_ path: String, server: FHIRServer, callback: @escaping FHIRErrorCallback) { - server.performRequest(ofType: .DELETE, path: path, resource: nil, additionalHeaders: nil) { response in + server.performRequest(.DELETE, path: path, resource: nil, additionalHeaders: nil) { response in // TODO: should we do some header inspection (response.headers)? callback(response.error) } @@ -293,7 +293,7 @@ public extension Resource { public func search(_ query: Any) -> FHIRSearch { if let _ = self.id { NSLog("UNFINISHED, must add '_id' reference to search expression") - //return FHIRSearch(subject: "_id", reference: myID, type: self.dynamicType) + //return FHIRSearch(subject: "_id", reference: myID, type: type(of: self)) } return FHIRSearch(type: type(of: self), query: query) } @@ -311,11 +311,11 @@ public extension Resource { /** Perform a given operation on the receiver. */ - public func perform(_ operation: FHIROperation, callback: @escaping FHIRResourceErrorCallback) { + public func perform(operation: FHIROperation, callback: @escaping FHIRResourceErrorCallback) { if let server = _server { if let server = server as? FHIROpenServer { operation.instance = self - type(of: self)._perform(operation, server: server, callback: callback) + type(of: self)._perform(operation: operation, server: server, callback: callback) } else { callback(nil, FHIRError.error("Must be living on a FHIROpenServer or subclass")) @@ -329,18 +329,18 @@ public extension Resource { /** Perform a given operation on the receiving type. */ - public class func perform(_ operation: FHIROperation, server: FHIROpenServer, callback: @escaping FHIRResourceErrorCallback) { + public class func perform(operation: FHIROperation, server: FHIROpenServer, callback: @escaping FHIRResourceErrorCallback) { operation.type = self - _perform(operation, server: server, callback: callback) + _perform(operation: operation, server: server, callback: callback) } - class func _perform(_ operation: FHIROperation, server: FHIROpenServer, callback: @escaping FHIRResourceErrorCallback) { + class func _perform(operation: FHIROperation, server: FHIROpenServer, callback: @escaping FHIRResourceErrorCallback) { server.perform(operation) { response in if let error = response.error { callback(nil, error) } else { - let resource = response.responseResource(Resource.self) + let resource = response.responseResource(ofType: Resource.self) resource?._server = server callback(resource, nil) } diff --git a/Sources/Models/Account.swift b/Sources/Models/Account.swift index f1d2fb64..808ed187 100644 --- a/Sources/Models/Account.swift +++ b/Sources/Models/Account.swift @@ -184,7 +184,7 @@ public class Account: DomainResource { json["description"] = description_fhir.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let name = self.name { json["name"] = name.asJSON() diff --git a/Sources/Models/AllergyIntolerance.swift b/Sources/Models/AllergyIntolerance.swift index b2672d41..c0fd481e 100644 --- a/Sources/Models/AllergyIntolerance.swift +++ b/Sources/Models/AllergyIntolerance.swift @@ -224,7 +224,7 @@ public class AllergyIntolerance: DomainResource { json["criticality"] = criticality.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let lastOccurence = self.lastOccurence { json["lastOccurence"] = lastOccurence.asJSON() @@ -239,7 +239,7 @@ public class AllergyIntolerance: DomainResource { json["patient"] = patient.asJSON() } if let reaction = self.reaction { - json["reaction"] = AllergyIntoleranceReaction.asJSONArray(reaction) + json["reaction"] = reaction.map() { $0.asJSON() } } if let recordedDate = self.recordedDate { json["recordedDate"] = recordedDate.asJSON() @@ -406,7 +406,7 @@ public class AllergyIntoleranceReaction: BackboneElement { json["exposureRoute"] = exposureRoute.asJSON() } if let manifestation = self.manifestation { - json["manifestation"] = CodeableConcept.asJSONArray(manifestation) + json["manifestation"] = manifestation.map() { $0.asJSON() } } if let note = self.note { json["note"] = note.asJSON() diff --git a/Sources/Models/Appointment.swift b/Sources/Models/Appointment.swift index 6cfee9b2..ccbf6111 100644 --- a/Sources/Models/Appointment.swift +++ b/Sources/Models/Appointment.swift @@ -201,13 +201,13 @@ public class Appointment: DomainResource { json["end"] = end.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let minutesDuration = self.minutesDuration { json["minutesDuration"] = minutesDuration.asJSON() } if let participant = self.participant { - json["participant"] = AppointmentParticipant.asJSONArray(participant) + json["participant"] = participant.map() { $0.asJSON() } } if let priority = self.priority { json["priority"] = priority.asJSON() @@ -216,7 +216,7 @@ public class Appointment: DomainResource { json["reason"] = reason.asJSON() } if let slot = self.slot { - json["slot"] = Reference.asJSONArray(slot) + json["slot"] = slot.map() { $0.asJSON() } } if let start = self.start { json["start"] = start.asJSON() @@ -326,7 +326,7 @@ public class AppointmentParticipant: BackboneElement { json["status"] = status.asJSON() } if let type = self.type { - json["type"] = CodeableConcept.asJSONArray(type) + json["type"] = type.map() { $0.asJSON() } } return json diff --git a/Sources/Models/AppointmentResponse.swift b/Sources/Models/AppointmentResponse.swift index acb39211..d8f30b70 100644 --- a/Sources/Models/AppointmentResponse.swift +++ b/Sources/Models/AppointmentResponse.swift @@ -155,13 +155,13 @@ public class AppointmentResponse: DomainResource { json["end"] = end.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let participantStatus = self.participantStatus { json["participantStatus"] = participantStatus.asJSON() } if let participantType = self.participantType { - json["participantType"] = CodeableConcept.asJSONArray(participantType) + json["participantType"] = participantType.map() { $0.asJSON() } } if let start = self.start { json["start"] = start.asJSON() diff --git a/Sources/Models/AuditEvent.swift b/Sources/Models/AuditEvent.swift index 7b4610dc..10695f26 100644 --- a/Sources/Models/AuditEvent.swift +++ b/Sources/Models/AuditEvent.swift @@ -105,10 +105,10 @@ public class AuditEvent: DomainResource { json["event"] = event.asJSON() } if let object = self.object { - json["object"] = AuditEventObject.asJSONArray(object) + json["object"] = object.map() { $0.asJSON() } } if let participant = self.participant { - json["participant"] = AuditEventParticipant.asJSONArray(participant) + json["participant"] = participant.map() { $0.asJSON() } } if let source = self.source { json["source"] = source.asJSON() @@ -255,10 +255,10 @@ public class AuditEventEvent: BackboneElement { json["outcomeDesc"] = outcomeDesc.asJSON() } if let purposeOfEvent = self.purposeOfEvent { - json["purposeOfEvent"] = Coding.asJSONArray(purposeOfEvent) + json["purposeOfEvent"] = purposeOfEvent.map() { $0.asJSON() } } if let subtype = self.subtype { - json["subtype"] = Coding.asJSONArray(subtype) + json["subtype"] = subtype.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() @@ -417,7 +417,7 @@ public class AuditEventObject: BackboneElement { json["description"] = description_fhir.asJSON() } if let detail = self.detail { - json["detail"] = AuditEventObjectDetail.asJSONArray(detail) + json["detail"] = detail.map() { $0.asJSON() } } if let identifier = self.identifier { json["identifier"] = identifier.asJSON() @@ -438,7 +438,7 @@ public class AuditEventObject: BackboneElement { json["role"] = role.asJSON() } if let securityLabel = self.securityLabel { - json["securityLabel"] = Coding.asJSONArray(securityLabel) + json["securityLabel"] = securityLabel.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() @@ -710,7 +710,7 @@ public class AuditEventParticipant: BackboneElement { json["policy"] = arr } if let purposeOfUse = self.purposeOfUse { - json["purposeOfUse"] = Coding.asJSONArray(purposeOfUse) + json["purposeOfUse"] = purposeOfUse.map() { $0.asJSON() } } if let reference = self.reference { json["reference"] = reference.asJSON() @@ -719,7 +719,7 @@ public class AuditEventParticipant: BackboneElement { json["requestor"] = requestor.asJSON() } if let role = self.role { - json["role"] = CodeableConcept.asJSONArray(role) + json["role"] = role.map() { $0.asJSON() } } if let userId = self.userId { json["userId"] = userId.asJSON() @@ -868,7 +868,7 @@ public class AuditEventSource: BackboneElement { json["site"] = site.asJSON() } if let type = self.type { - json["type"] = Coding.asJSONArray(type) + json["type"] = type.map() { $0.asJSON() } } return json diff --git a/Sources/Models/BackboneElement.swift b/Sources/Models/BackboneElement.swift index 5b217dae..89b4134a 100644 --- a/Sources/Models/BackboneElement.swift +++ b/Sources/Models/BackboneElement.swift @@ -48,7 +48,7 @@ public class BackboneElement: Element { var json = super.asJSON() if let modifierExtension = self.modifierExtension { - json["modifierExtension"] = Extension.asJSONArray(modifierExtension) + json["modifierExtension"] = modifierExtension.map() { $0.asJSON() } } return json diff --git a/Sources/Models/Basic.swift b/Sources/Models/Basic.swift index 500790a4..28bac861 100644 --- a/Sources/Models/Basic.swift +++ b/Sources/Models/Basic.swift @@ -115,7 +115,7 @@ public class Basic: DomainResource { json["created"] = created.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let subject = self.subject { json["subject"] = subject.asJSON() diff --git a/Sources/Models/BodySite.swift b/Sources/Models/BodySite.swift index 24fbdc9c..661b672f 100644 --- a/Sources/Models/BodySite.swift +++ b/Sources/Models/BodySite.swift @@ -124,13 +124,13 @@ public class BodySite: DomainResource { json["description"] = description_fhir.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let image = self.image { - json["image"] = Attachment.asJSONArray(image) + json["image"] = image.map() { $0.asJSON() } } if let modifier = self.modifier { - json["modifier"] = CodeableConcept.asJSONArray(modifier) + json["modifier"] = modifier.map() { $0.asJSON() } } if let patient = self.patient { json["patient"] = patient.asJSON() diff --git a/Sources/Models/Bundle.swift b/Sources/Models/Bundle.swift index 88580932..10166233 100644 --- a/Sources/Models/Bundle.swift +++ b/Sources/Models/Bundle.swift @@ -105,10 +105,10 @@ public class Bundle: Resource { var json = super.asJSON() if let entry = self.entry { - json["entry"] = BundleEntry.asJSONArray(entry) + json["entry"] = entry.map() { $0.asJSON() } } if let link = self.link { - json["link"] = BundleLink.asJSONArray(link) + json["link"] = link.map() { $0.asJSON() } } if let signature = self.signature { json["signature"] = signature.asJSON() @@ -228,7 +228,7 @@ public class BundleEntry: BackboneElement { json["fullUrl"] = fullUrl.asJSON() } if let link = self.link { - json["link"] = BundleLink.asJSONArray(link) + json["link"] = link.map() { $0.asJSON() } } if let request = self.request { json["request"] = request.asJSON() diff --git a/Sources/Models/CarePlan.swift b/Sources/Models/CarePlan.swift index 27800ef3..f9bfe568 100644 --- a/Sources/Models/CarePlan.swift +++ b/Sources/Models/CarePlan.swift @@ -238,16 +238,16 @@ public class CarePlan: DomainResource { var json = super.asJSON() if let activity = self.activity { - json["activity"] = CarePlanActivity.asJSONArray(activity) + json["activity"] = activity.map() { $0.asJSON() } } if let addresses = self.addresses { - json["addresses"] = Reference.asJSONArray(addresses) + json["addresses"] = addresses.map() { $0.asJSON() } } if let author = self.author { - json["author"] = Reference.asJSONArray(author) + json["author"] = author.map() { $0.asJSON() } } if let category = self.category { - json["category"] = CodeableConcept.asJSONArray(category) + json["category"] = category.map() { $0.asJSON() } } if let context = self.context { json["context"] = context.asJSON() @@ -256,10 +256,10 @@ public class CarePlan: DomainResource { json["description"] = description_fhir.asJSON() } if let goal = self.goal { - json["goal"] = Reference.asJSONArray(goal) + json["goal"] = goal.map() { $0.asJSON() } } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let modified = self.modified { json["modified"] = modified.asJSON() @@ -268,13 +268,13 @@ public class CarePlan: DomainResource { json["note"] = note.asJSON() } if let participant = self.participant { - json["participant"] = CarePlanParticipant.asJSONArray(participant) + json["participant"] = participant.map() { $0.asJSON() } } if let period = self.period { json["period"] = period.asJSON() } if let relatedPlan = self.relatedPlan { - json["relatedPlan"] = CarePlanRelatedPlan.asJSONArray(relatedPlan) + json["relatedPlan"] = relatedPlan.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() @@ -283,7 +283,7 @@ public class CarePlan: DomainResource { json["subject"] = subject.asJSON() } if let support = self.support { - json["support"] = Reference.asJSONArray(support) + json["support"] = support.map() { $0.asJSON() } } return json @@ -367,13 +367,13 @@ public class CarePlanActivity: BackboneElement { var json = super.asJSON() if let actionResulting = self.actionResulting { - json["actionResulting"] = Reference.asJSONArray(actionResulting) + json["actionResulting"] = actionResulting.map() { $0.asJSON() } } if let detail = self.detail { json["detail"] = detail.asJSON() } if let progress = self.progress { - json["progress"] = Annotation.asJSONArray(progress) + json["progress"] = progress.map() { $0.asJSON() } } if let reference = self.reference { json["reference"] = reference.asJSON() @@ -649,13 +649,13 @@ public class CarePlanActivityDetail: BackboneElement { json["description"] = description_fhir.asJSON() } if let goal = self.goal { - json["goal"] = Reference.asJSONArray(goal) + json["goal"] = goal.map() { $0.asJSON() } } if let location = self.location { json["location"] = location.asJSON() } if let performer = self.performer { - json["performer"] = Reference.asJSONArray(performer) + json["performer"] = performer.map() { $0.asJSON() } } if let productCodeableConcept = self.productCodeableConcept { json["productCodeableConcept"] = productCodeableConcept.asJSON() @@ -670,10 +670,10 @@ public class CarePlanActivityDetail: BackboneElement { json["quantity"] = quantity.asJSON() } if let reasonCode = self.reasonCode { - json["reasonCode"] = CodeableConcept.asJSONArray(reasonCode) + json["reasonCode"] = reasonCode.map() { $0.asJSON() } } if let reasonReference = self.reasonReference { - json["reasonReference"] = Reference.asJSONArray(reasonReference) + json["reasonReference"] = reasonReference.map() { $0.asJSON() } } if let scheduledPeriod = self.scheduledPeriod { json["scheduledPeriod"] = scheduledPeriod.asJSON() diff --git a/Sources/Models/Claim.swift b/Sources/Models/Claim.swift index 3d9c2cb7..172a5a0d 100644 --- a/Sources/Models/Claim.swift +++ b/Sources/Models/Claim.swift @@ -404,25 +404,25 @@ public class Claim: DomainResource { json["accidentType"] = accidentType.asJSON() } if let additionalMaterials = self.additionalMaterials { - json["additionalMaterials"] = Coding.asJSONArray(additionalMaterials) + json["additionalMaterials"] = additionalMaterials.map() { $0.asJSON() } } if let condition = self.condition { - json["condition"] = Coding.asJSONArray(condition) + json["condition"] = condition.map() { $0.asJSON() } } if let coverage = self.coverage { - json["coverage"] = ClaimCoverage.asJSONArray(coverage) + json["coverage"] = coverage.map() { $0.asJSON() } } if let created = self.created { json["created"] = created.asJSON() } if let diagnosis = self.diagnosis { - json["diagnosis"] = ClaimDiagnosis.asJSONArray(diagnosis) + json["diagnosis"] = diagnosis.map() { $0.asJSON() } } if let enterer = self.enterer { json["enterer"] = enterer.asJSON() } if let exception = self.exception { - json["exception"] = Coding.asJSONArray(exception) + json["exception"] = exception.map() { $0.asJSON() } } if let facility = self.facility { json["facility"] = facility.asJSON() @@ -431,16 +431,16 @@ public class Claim: DomainResource { json["fundsReserve"] = fundsReserve.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let interventionException = self.interventionException { - json["interventionException"] = Coding.asJSONArray(interventionException) + json["interventionException"] = interventionException.map() { $0.asJSON() } } if let item = self.item { - json["item"] = ClaimItem.asJSONArray(item) + json["item"] = item.map() { $0.asJSON() } } if let missingTeeth = self.missingTeeth { - json["missingTeeth"] = ClaimMissingTeeth.asJSONArray(missingTeeth) + json["missingTeeth"] = missingTeeth.map() { $0.asJSON() } } if let organization = self.organization { json["organization"] = organization.asJSON() @@ -993,7 +993,7 @@ public class ClaimItem: BackboneElement { json["bodySite"] = bodySite.asJSON() } if let detail = self.detail { - json["detail"] = ClaimItemDetail.asJSONArray(detail) + json["detail"] = detail.map() { $0.asJSON() } } if let diagnosisLinkId = self.diagnosisLinkId { var arr = [Any]() @@ -1006,7 +1006,7 @@ public class ClaimItem: BackboneElement { json["factor"] = factor.asJSON() } if let modifier = self.modifier { - json["modifier"] = Coding.asJSONArray(modifier) + json["modifier"] = modifier.map() { $0.asJSON() } } if let net = self.net { json["net"] = net.asJSON() @@ -1033,7 +1033,7 @@ public class ClaimItem: BackboneElement { json["serviceDate"] = serviceDate.asJSON() } if let subSite = self.subSite { - json["subSite"] = Coding.asJSONArray(subSite) + json["subSite"] = subSite.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() @@ -1232,7 +1232,7 @@ public class ClaimItemDetail: BackboneElement { json["service"] = service.asJSON() } if let subDetail = self.subDetail { - json["subDetail"] = ClaimItemDetailSubDetail.asJSONArray(subDetail) + json["subDetail"] = subDetail.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() diff --git a/Sources/Models/ClaimResponse.swift b/Sources/Models/ClaimResponse.swift index dd979d42..31104afd 100644 --- a/Sources/Models/ClaimResponse.swift +++ b/Sources/Models/ClaimResponse.swift @@ -348,10 +348,10 @@ public class ClaimResponse: DomainResource { var json = super.asJSON() if let addItem = self.addItem { - json["addItem"] = ClaimResponseAddItem.asJSONArray(addItem) + json["addItem"] = addItem.map() { $0.asJSON() } } if let coverage = self.coverage { - json["coverage"] = ClaimResponseCoverage.asJSONArray(coverage) + json["coverage"] = coverage.map() { $0.asJSON() } } if let created = self.created { json["created"] = created.asJSON() @@ -360,19 +360,19 @@ public class ClaimResponse: DomainResource { json["disposition"] = disposition.asJSON() } if let error = self.error { - json["error"] = ClaimResponseError.asJSONArray(error) + json["error"] = error.map() { $0.asJSON() } } if let form = self.form { json["form"] = form.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let item = self.item { - json["item"] = ClaimResponseItem.asJSONArray(item) + json["item"] = item.map() { $0.asJSON() } } if let note = self.note { - json["note"] = ClaimResponseNote.asJSONArray(note) + json["note"] = note.map() { $0.asJSON() } } if let organization = self.organization { json["organization"] = organization.asJSON() @@ -539,10 +539,10 @@ public class ClaimResponseAddItem: BackboneElement { var json = super.asJSON() if let adjudication = self.adjudication { - json["adjudication"] = ClaimResponseAddItemAdjudication.asJSONArray(adjudication) + json["adjudication"] = adjudication.map() { $0.asJSON() } } if let detail = self.detail { - json["detail"] = ClaimResponseAddItemDetail.asJSONArray(detail) + json["detail"] = detail.map() { $0.asJSON() } } if let fee = self.fee { json["fee"] = fee.asJSON() @@ -728,7 +728,7 @@ public class ClaimResponseAddItemDetail: BackboneElement { var json = super.asJSON() if let adjudication = self.adjudication { - json["adjudication"] = ClaimResponseAddItemDetailAdjudication.asJSONArray(adjudication) + json["adjudication"] = adjudication.map() { $0.asJSON() } } if let fee = self.fee { json["fee"] = fee.asJSON() @@ -1190,10 +1190,10 @@ public class ClaimResponseItem: BackboneElement { var json = super.asJSON() if let adjudication = self.adjudication { - json["adjudication"] = ClaimResponseItemAdjudication.asJSONArray(adjudication) + json["adjudication"] = adjudication.map() { $0.asJSON() } } if let detail = self.detail { - json["detail"] = ClaimResponseItemDetail.asJSONArray(detail) + json["detail"] = detail.map() { $0.asJSON() } } if let noteNumber = self.noteNumber { var arr = [Any]() @@ -1369,13 +1369,13 @@ public class ClaimResponseItemDetail: BackboneElement { var json = super.asJSON() if let adjudication = self.adjudication { - json["adjudication"] = ClaimResponseItemDetailAdjudication.asJSONArray(adjudication) + json["adjudication"] = adjudication.map() { $0.asJSON() } } if let sequenceLinkId = self.sequenceLinkId { json["sequenceLinkId"] = sequenceLinkId.asJSON() } if let subDetail = self.subDetail { - json["subDetail"] = ClaimResponseItemDetailSubDetail.asJSONArray(subDetail) + json["subDetail"] = subDetail.map() { $0.asJSON() } } return json @@ -1529,7 +1529,7 @@ public class ClaimResponseItemDetailSubDetail: BackboneElement { var json = super.asJSON() if let adjudication = self.adjudication { - json["adjudication"] = ClaimResponseItemDetailSubDetailAdjudication.asJSONArray(adjudication) + json["adjudication"] = adjudication.map() { $0.asJSON() } } if let sequenceLinkId = self.sequenceLinkId { json["sequenceLinkId"] = sequenceLinkId.asJSON() diff --git a/Sources/Models/ClinicalImpression.swift b/Sources/Models/ClinicalImpression.swift index be44cfa2..23a3be23 100644 --- a/Sources/Models/ClinicalImpression.swift +++ b/Sources/Models/ClinicalImpression.swift @@ -269,7 +269,7 @@ public class ClinicalImpression: DomainResource { var json = super.asJSON() if let action = self.action { - json["action"] = Reference.asJSONArray(action) + json["action"] = action.map() { $0.asJSON() } } if let assessor = self.assessor { json["assessor"] = assessor.asJSON() @@ -281,22 +281,22 @@ public class ClinicalImpression: DomainResource { json["description"] = description_fhir.asJSON() } if let finding = self.finding { - json["finding"] = ClinicalImpressionFinding.asJSONArray(finding) + json["finding"] = finding.map() { $0.asJSON() } } if let investigations = self.investigations { - json["investigations"] = ClinicalImpressionInvestigations.asJSONArray(investigations) + json["investigations"] = investigations.map() { $0.asJSON() } } if let patient = self.patient { json["patient"] = patient.asJSON() } if let plan = self.plan { - json["plan"] = Reference.asJSONArray(plan) + json["plan"] = plan.map() { $0.asJSON() } } if let previous = self.previous { json["previous"] = previous.asJSON() } if let problem = self.problem { - json["problem"] = Reference.asJSONArray(problem) + json["problem"] = problem.map() { $0.asJSON() } } if let prognosis = self.prognosis { json["prognosis"] = prognosis.asJSON() @@ -305,10 +305,10 @@ public class ClinicalImpression: DomainResource { json["protocol"] = protocol_fhir.asJSON() } if let resolved = self.resolved { - json["resolved"] = CodeableConcept.asJSONArray(resolved) + json["resolved"] = resolved.map() { $0.asJSON() } } if let ruledOut = self.ruledOut { - json["ruledOut"] = ClinicalImpressionRuledOut.asJSONArray(ruledOut) + json["ruledOut"] = ruledOut.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() @@ -464,7 +464,7 @@ public class ClinicalImpressionInvestigations: BackboneElement { json["code"] = code.asJSON() } if let item = self.item { - json["item"] = Reference.asJSONArray(item) + json["item"] = item.map() { $0.asJSON() } } return json diff --git a/Sources/Models/CodeableConcept.swift b/Sources/Models/CodeableConcept.swift index 948ae9b7..d601a68e 100644 --- a/Sources/Models/CodeableConcept.swift +++ b/Sources/Models/CodeableConcept.swift @@ -60,7 +60,7 @@ public class CodeableConcept: Element { var json = super.asJSON() if let coding = self.coding { - json["coding"] = Coding.asJSONArray(coding) + json["coding"] = coding.map() { $0.asJSON() } } if let text = self.text { json["text"] = text.asJSON() diff --git a/Sources/Models/Communication.swift b/Sources/Models/Communication.swift index 617030d3..96045f36 100644 --- a/Sources/Models/Communication.swift +++ b/Sources/Models/Communication.swift @@ -199,22 +199,22 @@ public class Communication: DomainResource { json["encounter"] = encounter.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let medium = self.medium { - json["medium"] = CodeableConcept.asJSONArray(medium) + json["medium"] = medium.map() { $0.asJSON() } } if let payload = self.payload { - json["payload"] = CommunicationPayload.asJSONArray(payload) + json["payload"] = payload.map() { $0.asJSON() } } if let reason = self.reason { - json["reason"] = CodeableConcept.asJSONArray(reason) + json["reason"] = reason.map() { $0.asJSON() } } if let received = self.received { json["received"] = received.asJSON() } if let recipient = self.recipient { - json["recipient"] = Reference.asJSONArray(recipient) + json["recipient"] = recipient.map() { $0.asJSON() } } if let requestDetail = self.requestDetail { json["requestDetail"] = requestDetail.asJSON() diff --git a/Sources/Models/CommunicationRequest.swift b/Sources/Models/CommunicationRequest.swift index b9ff1dbe..57be9093 100644 --- a/Sources/Models/CommunicationRequest.swift +++ b/Sources/Models/CommunicationRequest.swift @@ -223,22 +223,22 @@ public class CommunicationRequest: DomainResource { json["encounter"] = encounter.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let medium = self.medium { - json["medium"] = CodeableConcept.asJSONArray(medium) + json["medium"] = medium.map() { $0.asJSON() } } if let payload = self.payload { - json["payload"] = CommunicationRequestPayload.asJSONArray(payload) + json["payload"] = payload.map() { $0.asJSON() } } if let priority = self.priority { json["priority"] = priority.asJSON() } if let reason = self.reason { - json["reason"] = CodeableConcept.asJSONArray(reason) + json["reason"] = reason.map() { $0.asJSON() } } if let recipient = self.recipient { - json["recipient"] = Reference.asJSONArray(recipient) + json["recipient"] = recipient.map() { $0.asJSON() } } if let requestedOn = self.requestedOn { json["requestedOn"] = requestedOn.asJSON() diff --git a/Sources/Models/Composition.swift b/Sources/Models/Composition.swift index 97b42ac5..63edd741 100644 --- a/Sources/Models/Composition.swift +++ b/Sources/Models/Composition.swift @@ -237,10 +237,10 @@ public class Composition: DomainResource { var json = super.asJSON() if let attester = self.attester { - json["attester"] = CompositionAttester.asJSONArray(attester) + json["attester"] = attester.map() { $0.asJSON() } } if let author = self.author { - json["author"] = Reference.asJSONArray(author) + json["author"] = author.map() { $0.asJSON() } } if let class_fhir = self.class_fhir { json["class"] = class_fhir.asJSON() @@ -258,13 +258,13 @@ public class Composition: DomainResource { json["encounter"] = encounter.asJSON() } if let event = self.event { - json["event"] = CompositionEvent.asJSONArray(event) + json["event"] = event.map() { $0.asJSON() } } if let identifier = self.identifier { json["identifier"] = identifier.asJSON() } if let section = self.section { - json["section"] = CompositionSection.asJSONArray(section) + json["section"] = section.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() @@ -437,10 +437,10 @@ public class CompositionEvent: BackboneElement { var json = super.asJSON() if let code = self.code { - json["code"] = CodeableConcept.asJSONArray(code) + json["code"] = code.map() { $0.asJSON() } } if let detail = self.detail { - json["detail"] = Reference.asJSONArray(detail) + json["detail"] = detail.map() { $0.asJSON() } } if let period = self.period { json["period"] = period.asJSON() @@ -580,7 +580,7 @@ public class CompositionSection: BackboneElement { json["emptyReason"] = emptyReason.asJSON() } if let entry = self.entry { - json["entry"] = Reference.asJSONArray(entry) + json["entry"] = entry.map() { $0.asJSON() } } if let mode = self.mode { json["mode"] = mode.asJSON() @@ -589,7 +589,7 @@ public class CompositionSection: BackboneElement { json["orderedBy"] = orderedBy.asJSON() } if let section = self.section { - json["section"] = CompositionSection.asJSONArray(section) + json["section"] = section.map() { $0.asJSON() } } if let text = self.text { json["text"] = text.asJSON() diff --git a/Sources/Models/ConceptMap.swift b/Sources/Models/ConceptMap.swift index 4e6ff4ab..a014f75b 100644 --- a/Sources/Models/ConceptMap.swift +++ b/Sources/Models/ConceptMap.swift @@ -274,7 +274,7 @@ public class ConceptMap: DomainResource { var json = super.asJSON() if let contact = self.contact { - json["contact"] = ConceptMapContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let copyright = self.copyright { json["copyright"] = copyright.asJSON() @@ -286,7 +286,7 @@ public class ConceptMap: DomainResource { json["description"] = description_fhir.asJSON() } if let element = self.element { - json["element"] = ConceptMapElement.asJSONArray(element) + json["element"] = element.map() { $0.asJSON() } } if let experimental = self.experimental { json["experimental"] = experimental.asJSON() @@ -322,7 +322,7 @@ public class ConceptMap: DomainResource { json["url"] = url.asJSON() } if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) + json["useContext"] = useContext.map() { $0.asJSON() } } if let version = self.version { json["version"] = version.asJSON() @@ -387,7 +387,7 @@ public class ConceptMapContact: BackboneElement { json["name"] = name.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json @@ -464,7 +464,7 @@ public class ConceptMapElement: BackboneElement { json["codeSystem"] = codeSystem.asJSON() } if let target = self.target { - json["target"] = ConceptMapElementTarget.asJSONArray(target) + json["target"] = target.map() { $0.asJSON() } } return json @@ -589,13 +589,13 @@ public class ConceptMapElementTarget: BackboneElement { json["comments"] = comments.asJSON() } if let dependsOn = self.dependsOn { - json["dependsOn"] = ConceptMapElementTargetDependsOn.asJSONArray(dependsOn) + json["dependsOn"] = dependsOn.map() { $0.asJSON() } } if let equivalence = self.equivalence { json["equivalence"] = equivalence.asJSON() } if let product = self.product { - json["product"] = ConceptMapElementTargetDependsOn.asJSONArray(product) + json["product"] = product.map() { $0.asJSON() } } return json diff --git a/Sources/Models/Condition.swift b/Sources/Models/Condition.swift index 4c5135a7..313f517f 100644 --- a/Sources/Models/Condition.swift +++ b/Sources/Models/Condition.swift @@ -376,7 +376,7 @@ public class Condition: DomainResource { json["asserter"] = asserter.asJSON() } if let bodySite = self.bodySite { - json["bodySite"] = CodeableConcept.asJSONArray(bodySite) + json["bodySite"] = bodySite.map() { $0.asJSON() } } if let category = self.category { json["category"] = category.asJSON() @@ -394,10 +394,10 @@ public class Condition: DomainResource { json["encounter"] = encounter.asJSON() } if let evidence = self.evidence { - json["evidence"] = ConditionEvidence.asJSONArray(evidence) + json["evidence"] = evidence.map() { $0.asJSON() } } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let notes = self.notes { json["notes"] = notes.asJSON() @@ -489,7 +489,7 @@ public class ConditionEvidence: BackboneElement { json["code"] = code.asJSON() } if let detail = self.detail { - json["detail"] = Reference.asJSONArray(detail) + json["detail"] = detail.map() { $0.asJSON() } } return json @@ -548,7 +548,7 @@ public class ConditionStage: BackboneElement { var json = super.asJSON() if let assessment = self.assessment { - json["assessment"] = Reference.asJSONArray(assessment) + json["assessment"] = assessment.map() { $0.asJSON() } } if let summary = self.summary { json["summary"] = summary.asJSON() diff --git a/Sources/Models/Conformance.swift b/Sources/Models/Conformance.swift index 7e116c75..2ef6ebca 100644 --- a/Sources/Models/Conformance.swift +++ b/Sources/Models/Conformance.swift @@ -317,7 +317,7 @@ public class Conformance: DomainResource { json["acceptUnknown"] = acceptUnknown.asJSON() } if let contact = self.contact { - json["contact"] = ConformanceContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let copyright = self.copyright { json["copyright"] = copyright.asJSON() @@ -329,7 +329,7 @@ public class Conformance: DomainResource { json["description"] = description_fhir.asJSON() } if let document = self.document { - json["document"] = ConformanceDocument.asJSONArray(document) + json["document"] = document.map() { $0.asJSON() } } if let experimental = self.experimental { json["experimental"] = experimental.asJSON() @@ -351,13 +351,13 @@ public class Conformance: DomainResource { json["kind"] = kind.asJSON() } if let messaging = self.messaging { - json["messaging"] = ConformanceMessaging.asJSONArray(messaging) + json["messaging"] = messaging.map() { $0.asJSON() } } if let name = self.name { json["name"] = name.asJSON() } if let profile = self.profile { - json["profile"] = Reference.asJSONArray(profile) + json["profile"] = profile.map() { $0.asJSON() } } if let publisher = self.publisher { json["publisher"] = publisher.asJSON() @@ -366,7 +366,7 @@ public class Conformance: DomainResource { json["requirements"] = requirements.asJSON() } if let rest = self.rest { - json["rest"] = ConformanceRest.asJSONArray(rest) + json["rest"] = rest.map() { $0.asJSON() } } if let software = self.software { json["software"] = software.asJSON() @@ -440,7 +440,7 @@ public class ConformanceContact: BackboneElement { json["name"] = name.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json @@ -697,10 +697,10 @@ public class ConformanceMessaging: BackboneElement { json["documentation"] = documentation.asJSON() } if let endpoint = self.endpoint { - json["endpoint"] = ConformanceMessagingEndpoint.asJSONArray(endpoint) + json["endpoint"] = endpoint.map() { $0.asJSON() } } if let event = self.event { - json["event"] = ConformanceMessagingEvent.asJSONArray(event) + json["event"] = event.map() { $0.asJSON() } } if let reliableCache = self.reliableCache { json["reliableCache"] = reliableCache.asJSON() @@ -1106,19 +1106,19 @@ public class ConformanceRest: BackboneElement { json["documentation"] = documentation.asJSON() } if let interaction = self.interaction { - json["interaction"] = ConformanceRestInteraction.asJSONArray(interaction) + json["interaction"] = interaction.map() { $0.asJSON() } } if let mode = self.mode { json["mode"] = mode.asJSON() } if let operation = self.operation { - json["operation"] = ConformanceRestOperation.asJSONArray(operation) + json["operation"] = operation.map() { $0.asJSON() } } if let resource = self.resource { - json["resource"] = ConformanceRestResource.asJSONArray(resource) + json["resource"] = resource.map() { $0.asJSON() } } if let searchParam = self.searchParam { - json["searchParam"] = ConformanceRestResourceSearchParam.asJSONArray(searchParam) + json["searchParam"] = searchParam.map() { $0.asJSON() } } if let security = self.security { json["security"] = security.asJSON() @@ -1471,7 +1471,7 @@ public class ConformanceRestResource: BackboneElement { json["conditionalUpdate"] = conditionalUpdate.asJSON() } if let interaction = self.interaction { - json["interaction"] = ConformanceRestResourceInteraction.asJSONArray(interaction) + json["interaction"] = interaction.map() { $0.asJSON() } } if let profile = self.profile { json["profile"] = profile.asJSON() @@ -1487,7 +1487,7 @@ public class ConformanceRestResource: BackboneElement { json["searchInclude"] = arr } if let searchParam = self.searchParam { - json["searchParam"] = ConformanceRestResourceSearchParam.asJSONArray(searchParam) + json["searchParam"] = searchParam.map() { $0.asJSON() } } if let searchRevInclude = self.searchRevInclude { var arr = [Any]() @@ -1820,7 +1820,7 @@ public class ConformanceRestSecurity: BackboneElement { var json = super.asJSON() if let certificate = self.certificate { - json["certificate"] = ConformanceRestSecurityCertificate.asJSONArray(certificate) + json["certificate"] = certificate.map() { $0.asJSON() } } if let cors = self.cors { json["cors"] = cors.asJSON() @@ -1829,7 +1829,7 @@ public class ConformanceRestSecurity: BackboneElement { json["description"] = description_fhir.asJSON() } if let service = self.service { - json["service"] = CodeableConcept.asJSONArray(service) + json["service"] = service.map() { $0.asJSON() } } return json diff --git a/Sources/Models/Contract.swift b/Sources/Models/Contract.swift index 10f0e052..8857851d 100644 --- a/Sources/Models/Contract.swift +++ b/Sources/Models/Contract.swift @@ -264,19 +264,19 @@ public class Contract: DomainResource { var json = super.asJSON() if let action = self.action { - json["action"] = CodeableConcept.asJSONArray(action) + json["action"] = action.map() { $0.asJSON() } } if let actionReason = self.actionReason { - json["actionReason"] = CodeableConcept.asJSONArray(actionReason) + json["actionReason"] = actionReason.map() { $0.asJSON() } } if let actor = self.actor { - json["actor"] = ContractActor.asJSONArray(actor) + json["actor"] = actor.map() { $0.asJSON() } } if let applies = self.applies { json["applies"] = applies.asJSON() } if let authority = self.authority { - json["authority"] = Reference.asJSONArray(authority) + json["authority"] = authority.map() { $0.asJSON() } } if let bindingAttachment = self.bindingAttachment { json["bindingAttachment"] = bindingAttachment.asJSON() @@ -285,10 +285,10 @@ public class Contract: DomainResource { json["bindingReference"] = bindingReference.asJSON() } if let domain = self.domain { - json["domain"] = Reference.asJSONArray(domain) + json["domain"] = domain.map() { $0.asJSON() } } if let friendly = self.friendly { - json["friendly"] = ContractFriendly.asJSONArray(friendly) + json["friendly"] = friendly.map() { $0.asJSON() } } if let identifier = self.identifier { json["identifier"] = identifier.asJSON() @@ -297,28 +297,28 @@ public class Contract: DomainResource { json["issued"] = issued.asJSON() } if let legal = self.legal { - json["legal"] = ContractLegal.asJSONArray(legal) + json["legal"] = legal.map() { $0.asJSON() } } if let rule = self.rule { - json["rule"] = ContractRule.asJSONArray(rule) + json["rule"] = rule.map() { $0.asJSON() } } if let signer = self.signer { - json["signer"] = ContractSigner.asJSONArray(signer) + json["signer"] = signer.map() { $0.asJSON() } } if let subType = self.subType { - json["subType"] = CodeableConcept.asJSONArray(subType) + json["subType"] = subType.map() { $0.asJSON() } } if let subject = self.subject { - json["subject"] = Reference.asJSONArray(subject) + json["subject"] = subject.map() { $0.asJSON() } } if let term = self.term { - json["term"] = ContractTerm.asJSONArray(term) + json["term"] = term.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() } if let valuedItem = self.valuedItem { - json["valuedItem"] = ContractValuedItem.asJSONArray(valuedItem) + json["valuedItem"] = valuedItem.map() { $0.asJSON() } } return json @@ -389,7 +389,7 @@ public class ContractActor: BackboneElement { json["entity"] = entity.asJSON() } if let role = self.role { - json["role"] = CodeableConcept.asJSONArray(role) + json["role"] = role.map() { $0.asJSON() } } return json @@ -887,19 +887,19 @@ public class ContractTerm: BackboneElement { var json = super.asJSON() if let action = self.action { - json["action"] = CodeableConcept.asJSONArray(action) + json["action"] = action.map() { $0.asJSON() } } if let actionReason = self.actionReason { - json["actionReason"] = CodeableConcept.asJSONArray(actionReason) + json["actionReason"] = actionReason.map() { $0.asJSON() } } if let actor = self.actor { - json["actor"] = ContractTermActor.asJSONArray(actor) + json["actor"] = actor.map() { $0.asJSON() } } if let applies = self.applies { json["applies"] = applies.asJSON() } if let group = self.group { - json["group"] = ContractTerm.asJSONArray(group) + json["group"] = group.map() { $0.asJSON() } } if let identifier = self.identifier { json["identifier"] = identifier.asJSON() @@ -920,7 +920,7 @@ public class ContractTerm: BackboneElement { json["type"] = type.asJSON() } if let valuedItem = self.valuedItem { - json["valuedItem"] = ContractTermValuedItem.asJSONArray(valuedItem) + json["valuedItem"] = valuedItem.map() { $0.asJSON() } } return json @@ -991,7 +991,7 @@ public class ContractTermActor: BackboneElement { json["entity"] = entity.asJSON() } if let role = self.role { - json["role"] = CodeableConcept.asJSONArray(role) + json["role"] = role.map() { $0.asJSON() } } return json diff --git a/Sources/Models/Coverage.swift b/Sources/Models/Coverage.swift index cfdc5f2f..e43bbf28 100644 --- a/Sources/Models/Coverage.swift +++ b/Sources/Models/Coverage.swift @@ -207,7 +207,7 @@ public class Coverage: DomainResource { json["bin"] = bin.asJSON() } if let contract = self.contract { - json["contract"] = Reference.asJSONArray(contract) + json["contract"] = contract.map() { $0.asJSON() } } if let dependent = self.dependent { json["dependent"] = dependent.asJSON() @@ -216,7 +216,7 @@ public class Coverage: DomainResource { json["group"] = group.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let issuer = self.issuer { json["issuer"] = issuer.asJSON() diff --git a/Sources/Models/DataElement.swift b/Sources/Models/DataElement.swift index cf07bf6d..7fe6cb30 100644 --- a/Sources/Models/DataElement.swift +++ b/Sources/Models/DataElement.swift @@ -217,7 +217,7 @@ public class DataElement: DomainResource { var json = super.asJSON() if let contact = self.contact { - json["contact"] = DataElementContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let copyright = self.copyright { json["copyright"] = copyright.asJSON() @@ -226,16 +226,16 @@ public class DataElement: DomainResource { json["date"] = date.asJSON() } if let element = self.element { - json["element"] = ElementDefinition.asJSONArray(element) + json["element"] = element.map() { $0.asJSON() } } if let experimental = self.experimental { json["experimental"] = experimental.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let mapping = self.mapping { - json["mapping"] = DataElementMapping.asJSONArray(mapping) + json["mapping"] = mapping.map() { $0.asJSON() } } if let name = self.name { json["name"] = name.asJSON() @@ -253,7 +253,7 @@ public class DataElement: DomainResource { json["url"] = url.asJSON() } if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) + json["useContext"] = useContext.map() { $0.asJSON() } } if let version = self.version { json["version"] = version.asJSON() @@ -318,7 +318,7 @@ public class DataElementContact: BackboneElement { json["name"] = name.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json diff --git a/Sources/Models/DetectedIssue.swift b/Sources/Models/DetectedIssue.swift index 3a551338..68d15a2b 100644 --- a/Sources/Models/DetectedIssue.swift +++ b/Sources/Models/DetectedIssue.swift @@ -172,10 +172,10 @@ public class DetectedIssue: DomainResource { json["identifier"] = identifier.asJSON() } if let implicated = self.implicated { - json["implicated"] = Reference.asJSONArray(implicated) + json["implicated"] = implicated.map() { $0.asJSON() } } if let mitigation = self.mitigation { - json["mitigation"] = DetectedIssueMitigation.asJSONArray(mitigation) + json["mitigation"] = mitigation.map() { $0.asJSON() } } if let patient = self.patient { json["patient"] = patient.asJSON() diff --git a/Sources/Models/Device.swift b/Sources/Models/Device.swift index 353b9732..704eb0f2 100644 --- a/Sources/Models/Device.swift +++ b/Sources/Models/Device.swift @@ -241,13 +241,13 @@ public class Device: DomainResource { var json = super.asJSON() if let contact = self.contact { - json["contact"] = ContactPoint.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let expiry = self.expiry { json["expiry"] = expiry.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let location = self.location { json["location"] = location.asJSON() @@ -265,7 +265,7 @@ public class Device: DomainResource { json["model"] = model.asJSON() } if let note = self.note { - json["note"] = Annotation.asJSONArray(note) + json["note"] = note.map() { $0.asJSON() } } if let owner = self.owner { json["owner"] = owner.asJSON() diff --git a/Sources/Models/DeviceComponent.swift b/Sources/Models/DeviceComponent.swift index 3f069f21..89a25917 100644 --- a/Sources/Models/DeviceComponent.swift +++ b/Sources/Models/DeviceComponent.swift @@ -186,7 +186,7 @@ public class DeviceComponent: DomainResource { json["measurementPrinciple"] = measurementPrinciple.asJSON() } if let operationalStatus = self.operationalStatus { - json["operationalStatus"] = CodeableConcept.asJSONArray(operationalStatus) + json["operationalStatus"] = operationalStatus.map() { $0.asJSON() } } if let parameterGroup = self.parameterGroup { json["parameterGroup"] = parameterGroup.asJSON() @@ -195,7 +195,7 @@ public class DeviceComponent: DomainResource { json["parent"] = parent.asJSON() } if let productionSpecification = self.productionSpecification { - json["productionSpecification"] = DeviceComponentProductionSpecification.asJSONArray(productionSpecification) + json["productionSpecification"] = productionSpecification.map() { $0.asJSON() } } if let source = self.source { json["source"] = source.asJSON() diff --git a/Sources/Models/DeviceMetric.swift b/Sources/Models/DeviceMetric.swift index 54506872..40b944e7 100644 --- a/Sources/Models/DeviceMetric.swift +++ b/Sources/Models/DeviceMetric.swift @@ -173,7 +173,7 @@ public class DeviceMetric: DomainResource { var json = super.asJSON() if let calibration = self.calibration { - json["calibration"] = DeviceMetricCalibration.asJSONArray(calibration) + json["calibration"] = calibration.map() { $0.asJSON() } } if let category = self.category { json["category"] = category.asJSON() diff --git a/Sources/Models/DeviceUseRequest.swift b/Sources/Models/DeviceUseRequest.swift index d112142b..b2990909 100644 --- a/Sources/Models/DeviceUseRequest.swift +++ b/Sources/Models/DeviceUseRequest.swift @@ -254,10 +254,10 @@ public class DeviceUseRequest: DomainResource { json["encounter"] = encounter.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let indication = self.indication { - json["indication"] = CodeableConcept.asJSONArray(indication) + json["indication"] = indication.map() { $0.asJSON() } } if let notes = self.notes { var arr = [Any]() @@ -273,7 +273,7 @@ public class DeviceUseRequest: DomainResource { json["priority"] = priority.asJSON() } if let prnReason = self.prnReason { - json["prnReason"] = CodeableConcept.asJSONArray(prnReason) + json["prnReason"] = prnReason.map() { $0.asJSON() } } if let recordedOn = self.recordedOn { json["recordedOn"] = recordedOn.asJSON() diff --git a/Sources/Models/DeviceUseStatement.swift b/Sources/Models/DeviceUseStatement.swift index e439bea1..765e53b4 100644 --- a/Sources/Models/DeviceUseStatement.swift +++ b/Sources/Models/DeviceUseStatement.swift @@ -203,10 +203,10 @@ public class DeviceUseStatement: DomainResource { json["device"] = device.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let indication = self.indication { - json["indication"] = CodeableConcept.asJSONArray(indication) + json["indication"] = indication.map() { $0.asJSON() } } if let notes = self.notes { var arr = [Any]() diff --git a/Sources/Models/DiagnosticOrder.swift b/Sources/Models/DiagnosticOrder.swift index 8ea8c4dc..6553d394 100644 --- a/Sources/Models/DiagnosticOrder.swift +++ b/Sources/Models/DiagnosticOrder.swift @@ -192,16 +192,16 @@ public class DiagnosticOrder: DomainResource { json["encounter"] = encounter.asJSON() } if let event = self.event { - json["event"] = DiagnosticOrderEvent.asJSONArray(event) + json["event"] = event.map() { $0.asJSON() } } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let item = self.item { - json["item"] = DiagnosticOrderItem.asJSONArray(item) + json["item"] = item.map() { $0.asJSON() } } if let note = self.note { - json["note"] = Annotation.asJSONArray(note) + json["note"] = note.map() { $0.asJSON() } } if let orderer = self.orderer { json["orderer"] = orderer.asJSON() @@ -210,10 +210,10 @@ public class DiagnosticOrder: DomainResource { json["priority"] = priority.asJSON() } if let reason = self.reason { - json["reason"] = CodeableConcept.asJSONArray(reason) + json["reason"] = reason.map() { $0.asJSON() } } if let specimen = self.specimen { - json["specimen"] = Reference.asJSONArray(specimen) + json["specimen"] = specimen.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() @@ -222,7 +222,7 @@ public class DiagnosticOrder: DomainResource { json["subject"] = subject.asJSON() } if let supportingInformation = self.supportingInformation { - json["supportingInformation"] = Reference.asJSONArray(supportingInformation) + json["supportingInformation"] = supportingInformation.map() { $0.asJSON() } } return json @@ -439,10 +439,10 @@ public class DiagnosticOrderItem: BackboneElement { json["code"] = code.asJSON() } if let event = self.event { - json["event"] = DiagnosticOrderEvent.asJSONArray(event) + json["event"] = event.map() { $0.asJSON() } } if let specimen = self.specimen { - json["specimen"] = Reference.asJSONArray(specimen) + json["specimen"] = specimen.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() diff --git a/Sources/Models/DiagnosticReport.swift b/Sources/Models/DiagnosticReport.swift index 8d53536c..1e88e0fd 100644 --- a/Sources/Models/DiagnosticReport.swift +++ b/Sources/Models/DiagnosticReport.swift @@ -294,7 +294,7 @@ public class DiagnosticReport: DomainResource { json["code"] = code.asJSON() } if let codedDiagnosis = self.codedDiagnosis { - json["codedDiagnosis"] = CodeableConcept.asJSONArray(codedDiagnosis) + json["codedDiagnosis"] = codedDiagnosis.map() { $0.asJSON() } } if let conclusion = self.conclusion { json["conclusion"] = conclusion.asJSON() @@ -309,13 +309,13 @@ public class DiagnosticReport: DomainResource { json["encounter"] = encounter.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let image = self.image { - json["image"] = DiagnosticReportImage.asJSONArray(image) + json["image"] = image.map() { $0.asJSON() } } if let imagingStudy = self.imagingStudy { - json["imagingStudy"] = Reference.asJSONArray(imagingStudy) + json["imagingStudy"] = imagingStudy.map() { $0.asJSON() } } if let issued = self.issued { json["issued"] = issued.asJSON() @@ -324,16 +324,16 @@ public class DiagnosticReport: DomainResource { json["performer"] = performer.asJSON() } if let presentedForm = self.presentedForm { - json["presentedForm"] = Attachment.asJSONArray(presentedForm) + json["presentedForm"] = presentedForm.map() { $0.asJSON() } } if let request = self.request { - json["request"] = Reference.asJSONArray(request) + json["request"] = request.map() { $0.asJSON() } } if let result = self.result { - json["result"] = Reference.asJSONArray(result) + json["result"] = result.map() { $0.asJSON() } } if let specimen = self.specimen { - json["specimen"] = Reference.asJSONArray(specimen) + json["specimen"] = specimen.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() diff --git a/Sources/Models/DocumentManifest.swift b/Sources/Models/DocumentManifest.swift index 8fa0f3c0..71479241 100644 --- a/Sources/Models/DocumentManifest.swift +++ b/Sources/Models/DocumentManifest.swift @@ -191,10 +191,10 @@ public class DocumentManifest: DomainResource { var json = super.asJSON() if let author = self.author { - json["author"] = Reference.asJSONArray(author) + json["author"] = author.map() { $0.asJSON() } } if let content = self.content { - json["content"] = DocumentManifestContent.asJSONArray(content) + json["content"] = content.map() { $0.asJSON() } } if let created = self.created { json["created"] = created.asJSON() @@ -203,16 +203,16 @@ public class DocumentManifest: DomainResource { json["description"] = description_fhir.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let masterIdentifier = self.masterIdentifier { json["masterIdentifier"] = masterIdentifier.asJSON() } if let recipient = self.recipient { - json["recipient"] = Reference.asJSONArray(recipient) + json["recipient"] = recipient.map() { $0.asJSON() } } if let related = self.related { - json["related"] = DocumentManifestRelated.asJSONArray(related) + json["related"] = related.map() { $0.asJSON() } } if let source = self.source { json["source"] = source.asJSON() diff --git a/Sources/Models/DocumentReference.swift b/Sources/Models/DocumentReference.swift index ebdb958a..235ad931 100644 --- a/Sources/Models/DocumentReference.swift +++ b/Sources/Models/DocumentReference.swift @@ -264,13 +264,13 @@ public class DocumentReference: DomainResource { json["authenticator"] = authenticator.asJSON() } if let author = self.author { - json["author"] = Reference.asJSONArray(author) + json["author"] = author.map() { $0.asJSON() } } if let class_fhir = self.class_fhir { json["class"] = class_fhir.asJSON() } if let content = self.content { - json["content"] = DocumentReferenceContent.asJSONArray(content) + json["content"] = content.map() { $0.asJSON() } } if let context = self.context { json["context"] = context.asJSON() @@ -288,7 +288,7 @@ public class DocumentReference: DomainResource { json["docStatus"] = docStatus.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let indexed = self.indexed { json["indexed"] = indexed.asJSON() @@ -297,10 +297,10 @@ public class DocumentReference: DomainResource { json["masterIdentifier"] = masterIdentifier.asJSON() } if let relatesTo = self.relatesTo { - json["relatesTo"] = DocumentReferenceRelatesTo.asJSONArray(relatesTo) + json["relatesTo"] = relatesTo.map() { $0.asJSON() } } if let securityLabel = self.securityLabel { - json["securityLabel"] = CodeableConcept.asJSONArray(securityLabel) + json["securityLabel"] = securityLabel.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() @@ -380,7 +380,7 @@ public class DocumentReferenceContent: BackboneElement { json["attachment"] = attachment.asJSON() } if let format = self.format { - json["format"] = Coding.asJSONArray(format) + json["format"] = format.map() { $0.asJSON() } } return json @@ -502,7 +502,7 @@ public class DocumentReferenceContext: BackboneElement { json["encounter"] = encounter.asJSON() } if let event = self.event { - json["event"] = CodeableConcept.asJSONArray(event) + json["event"] = event.map() { $0.asJSON() } } if let facilityType = self.facilityType { json["facilityType"] = facilityType.asJSON() @@ -514,7 +514,7 @@ public class DocumentReferenceContext: BackboneElement { json["practiceSetting"] = practiceSetting.asJSON() } if let related = self.related { - json["related"] = DocumentReferenceContextRelated.asJSONArray(related) + json["related"] = related.map() { $0.asJSON() } } if let sourcePatientInfo = self.sourcePatientInfo { json["sourcePatientInfo"] = sourcePatientInfo.asJSON() diff --git a/Sources/Models/DomainResource.swift b/Sources/Models/DomainResource.swift index 8351d7a8..233f35de 100644 --- a/Sources/Models/DomainResource.swift +++ b/Sources/Models/DomainResource.swift @@ -84,13 +84,13 @@ public class DomainResource: Resource { var json = super.asJSON() if let contained = self.contained { - json["contained"] = Resource.asJSONArray(contained) + json["contained"] = contained.map() { $0.asJSON() } } if let extension_fhir = self.extension_fhir { - json["extension"] = Extension.asJSONArray(extension_fhir) + json["extension"] = extension_fhir.map() { $0.asJSON() } } if let modifierExtension = self.modifierExtension { - json["modifierExtension"] = Extension.asJSONArray(modifierExtension) + json["modifierExtension"] = modifierExtension.map() { $0.asJSON() } } if let text = self.text { json["text"] = text.asJSON() diff --git a/Sources/Models/Element.swift b/Sources/Models/Element.swift index c4786d7e..5eee7036 100644 --- a/Sources/Models/Element.swift +++ b/Sources/Models/Element.swift @@ -60,7 +60,7 @@ public class Element: FHIRAbstractBase { var json = super.asJSON() if let extension_fhir = self.extension_fhir { - json["extension"] = Extension.asJSONArray(extension_fhir) + json["extension"] = extension_fhir.map() { $0.asJSON() } } if let id = self.id { json["id"] = id.asJSON() diff --git a/Sources/Models/ElementDefinition.swift b/Sources/Models/ElementDefinition.swift index 0d5bbf8b..f6c13c52 100644 --- a/Sources/Models/ElementDefinition.swift +++ b/Sources/Models/ElementDefinition.swift @@ -2734,7 +2734,7 @@ public class ElementDefinition: Element { json["binding"] = binding.asJSON() } if let code = self.code { - json["code"] = Coding.asJSONArray(code) + json["code"] = code.map() { $0.asJSON() } } if let comments = self.comments { json["comments"] = comments.asJSON() @@ -2747,7 +2747,7 @@ public class ElementDefinition: Element { json["condition"] = arr } if let constraint = self.constraint { - json["constraint"] = ElementDefinitionConstraint.asJSONArray(constraint) + json["constraint"] = constraint.map() { $0.asJSON() } } if let defaultValueAddress = self.defaultValueAddress { json["defaultValueAddress"] = defaultValueAddress.asJSON() @@ -3059,7 +3059,7 @@ public class ElementDefinition: Element { json["label"] = label.asJSON() } if let mapping = self.mapping { - json["mapping"] = ElementDefinitionMapping.asJSONArray(mapping) + json["mapping"] = mapping.map() { $0.asJSON() } } if let max = self.max { json["max"] = max.asJSON() @@ -3399,7 +3399,7 @@ public class ElementDefinition: Element { json["slicing"] = slicing.asJSON() } if let type = self.type { - json["type"] = ElementDefinitionType.asJSONArray(type) + json["type"] = type.map() { $0.asJSON() } } return json diff --git a/Sources/Models/EligibilityRequest.swift b/Sources/Models/EligibilityRequest.swift index 4cc157f4..105c543b 100644 --- a/Sources/Models/EligibilityRequest.swift +++ b/Sources/Models/EligibilityRequest.swift @@ -124,7 +124,7 @@ public class EligibilityRequest: DomainResource { json["created"] = created.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let organization = self.organization { json["organization"] = organization.asJSON() diff --git a/Sources/Models/EligibilityResponse.swift b/Sources/Models/EligibilityResponse.swift index 460b07b5..30d15cae 100644 --- a/Sources/Models/EligibilityResponse.swift +++ b/Sources/Models/EligibilityResponse.swift @@ -162,7 +162,7 @@ public class EligibilityResponse: DomainResource { json["disposition"] = disposition.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let organization = self.organization { json["organization"] = organization.asJSON() diff --git a/Sources/Models/Encounter.swift b/Sources/Models/Encounter.swift index 1ef5b7f4..a4f2e13a 100644 --- a/Sources/Models/Encounter.swift +++ b/Sources/Models/Encounter.swift @@ -280,31 +280,31 @@ public class Encounter: DomainResource { json["class"] = class_fhir.asJSON() } if let episodeOfCare = self.episodeOfCare { - json["episodeOfCare"] = Reference.asJSONArray(episodeOfCare) + json["episodeOfCare"] = episodeOfCare.map() { $0.asJSON() } } if let hospitalization = self.hospitalization { json["hospitalization"] = hospitalization.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let incomingReferral = self.incomingReferral { - json["incomingReferral"] = Reference.asJSONArray(incomingReferral) + json["incomingReferral"] = incomingReferral.map() { $0.asJSON() } } if let indication = self.indication { - json["indication"] = Reference.asJSONArray(indication) + json["indication"] = indication.map() { $0.asJSON() } } if let length = self.length { json["length"] = length.asJSON() } if let location = self.location { - json["location"] = EncounterLocation.asJSONArray(location) + json["location"] = location.map() { $0.asJSON() } } if let partOf = self.partOf { json["partOf"] = partOf.asJSON() } if let participant = self.participant { - json["participant"] = EncounterParticipant.asJSONArray(participant) + json["participant"] = participant.map() { $0.asJSON() } } if let patient = self.patient { json["patient"] = patient.asJSON() @@ -316,7 +316,7 @@ public class Encounter: DomainResource { json["priority"] = priority.asJSON() } if let reason = self.reason { - json["reason"] = CodeableConcept.asJSONArray(reason) + json["reason"] = reason.map() { $0.asJSON() } } if let serviceProvider = self.serviceProvider { json["serviceProvider"] = serviceProvider.asJSON() @@ -325,10 +325,10 @@ public class Encounter: DomainResource { json["status"] = status.asJSON() } if let statusHistory = self.statusHistory { - json["statusHistory"] = EncounterStatusHistory.asJSONArray(statusHistory) + json["statusHistory"] = statusHistory.map() { $0.asJSON() } } if let type = self.type { - json["type"] = CodeableConcept.asJSONArray(type) + json["type"] = type.map() { $0.asJSON() } } return json @@ -496,16 +496,16 @@ public class EncounterHospitalization: BackboneElement { json["admitSource"] = admitSource.asJSON() } if let admittingDiagnosis = self.admittingDiagnosis { - json["admittingDiagnosis"] = Reference.asJSONArray(admittingDiagnosis) + json["admittingDiagnosis"] = admittingDiagnosis.map() { $0.asJSON() } } if let destination = self.destination { json["destination"] = destination.asJSON() } if let dietPreference = self.dietPreference { - json["dietPreference"] = CodeableConcept.asJSONArray(dietPreference) + json["dietPreference"] = dietPreference.map() { $0.asJSON() } } if let dischargeDiagnosis = self.dischargeDiagnosis { - json["dischargeDiagnosis"] = Reference.asJSONArray(dischargeDiagnosis) + json["dischargeDiagnosis"] = dischargeDiagnosis.map() { $0.asJSON() } } if let dischargeDisposition = self.dischargeDisposition { json["dischargeDisposition"] = dischargeDisposition.asJSON() @@ -520,10 +520,10 @@ public class EncounterHospitalization: BackboneElement { json["reAdmission"] = reAdmission.asJSON() } if let specialArrangement = self.specialArrangement { - json["specialArrangement"] = CodeableConcept.asJSONArray(specialArrangement) + json["specialArrangement"] = specialArrangement.map() { $0.asJSON() } } if let specialCourtesy = self.specialCourtesy { - json["specialCourtesy"] = CodeableConcept.asJSONArray(specialCourtesy) + json["specialCourtesy"] = specialCourtesy.map() { $0.asJSON() } } return json @@ -686,7 +686,7 @@ public class EncounterParticipant: BackboneElement { json["period"] = period.asJSON() } if let type = self.type { - json["type"] = CodeableConcept.asJSONArray(type) + json["type"] = type.map() { $0.asJSON() } } return json diff --git a/Sources/Models/EnrollmentRequest.swift b/Sources/Models/EnrollmentRequest.swift index a59e9d32..0825aaa5 100644 --- a/Sources/Models/EnrollmentRequest.swift +++ b/Sources/Models/EnrollmentRequest.swift @@ -179,7 +179,7 @@ public class EnrollmentRequest: DomainResource { json["created"] = created.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let organization = self.organization { json["organization"] = organization.asJSON() diff --git a/Sources/Models/EnrollmentResponse.swift b/Sources/Models/EnrollmentResponse.swift index e1803ca0..dece906c 100644 --- a/Sources/Models/EnrollmentResponse.swift +++ b/Sources/Models/EnrollmentResponse.swift @@ -162,7 +162,7 @@ public class EnrollmentResponse: DomainResource { json["disposition"] = disposition.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let organization = self.organization { json["organization"] = organization.asJSON() diff --git a/Sources/Models/EpisodeOfCare.swift b/Sources/Models/EpisodeOfCare.swift index 82a0fba6..6688de40 100644 --- a/Sources/Models/EpisodeOfCare.swift +++ b/Sources/Models/EpisodeOfCare.swift @@ -186,13 +186,13 @@ public class EpisodeOfCare: DomainResource { json["careManager"] = careManager.asJSON() } if let careTeam = self.careTeam { - json["careTeam"] = EpisodeOfCareCareTeam.asJSONArray(careTeam) + json["careTeam"] = careTeam.map() { $0.asJSON() } } if let condition = self.condition { - json["condition"] = Reference.asJSONArray(condition) + json["condition"] = condition.map() { $0.asJSON() } } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let managingOrganization = self.managingOrganization { json["managingOrganization"] = managingOrganization.asJSON() @@ -204,16 +204,16 @@ public class EpisodeOfCare: DomainResource { json["period"] = period.asJSON() } if let referralRequest = self.referralRequest { - json["referralRequest"] = Reference.asJSONArray(referralRequest) + json["referralRequest"] = referralRequest.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() } if let statusHistory = self.statusHistory { - json["statusHistory"] = EpisodeOfCareStatusHistory.asJSONArray(statusHistory) + json["statusHistory"] = statusHistory.map() { $0.asJSON() } } if let type = self.type { - json["type"] = CodeableConcept.asJSONArray(type) + json["type"] = type.map() { $0.asJSON() } } return json @@ -290,7 +290,7 @@ public class EpisodeOfCareCareTeam: BackboneElement { json["period"] = period.asJSON() } if let role = self.role { - json["role"] = CodeableConcept.asJSONArray(role) + json["role"] = role.map() { $0.asJSON() } } return json diff --git a/Sources/Models/ExplanationOfBenefit.swift b/Sources/Models/ExplanationOfBenefit.swift index 7bd13ab7..5cf7d9d5 100644 --- a/Sources/Models/ExplanationOfBenefit.swift +++ b/Sources/Models/ExplanationOfBenefit.swift @@ -163,7 +163,7 @@ public class ExplanationOfBenefit: DomainResource { json["disposition"] = disposition.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let organization = self.organization { json["organization"] = organization.asJSON() diff --git a/Sources/Models/FHIRAbstractBase.swift b/Sources/Models/FHIRAbstractBase.swift index e26152ce..16453cac 100644 --- a/Sources/Models/FHIRAbstractBase.swift +++ b/Sources/Models/FHIRAbstractBase.swift @@ -8,11 +8,11 @@ /** - * Abstract superclass for all FHIR data elements. - */ +Abstract superclass for all FHIR data elements. +*/ open class FHIRAbstractBase: CustomStringConvertible { - /// The name of the resource or element. + /// The type of the resource or element. open class var resourceType: String { get { return "FHIRAbstractBase" } } @@ -85,16 +85,6 @@ open class FHIRAbstractBase: CustomStringConvertible { return FHIRJSON() } - /** - Calls `asJSON()` on all elements in the array and returns the resulting array full of FHIRJSON dictionaries. - - - parameter array: The array of elements to map to FHIRJSON - - returns: An array of FHIRJSON elements representing the given resources - */ - open class func asJSONArray(_ array: [FHIRAbstractBase]) -> [FHIRJSON] { - return array.map() { $0.asJSON() } - } - // MARK: - Factories @@ -130,7 +120,7 @@ open class FHIRAbstractBase: CustomStringConvertible { // MARK: - Resolving References /** Returns the resolved reference with the given id, if it has been resolved already. */ - open func resolvedReference(_ refid: String) -> Resource? { + public func resolvedReference(_ refid: String) -> Resource? { if let resolved = _resolved?[refid] { return resolved } @@ -146,7 +136,7 @@ open class FHIRAbstractBase: CustomStringConvertible { - parameter refid: The reference identifier as String - parameter resolved: The resource that was resolved */ - open func didResolveReference(_ refid: String, resolved: Resource) { + public func didResolveReference(_ refid: String, resolved: Resource) { if nil != _resolved { _resolved![refid] = resolved } @@ -188,7 +178,7 @@ open class FHIRAbstractBase: CustomStringConvertible { } - // MARK: - Printable + // MARK: - CustomStringConvertible open var description: String { return "<\(type(of: self).resourceType)>" diff --git a/Sources/Models/FHIRAbstractResource.swift b/Sources/Models/FHIRAbstractResource.swift index 698fef4e..de14074b 100644 --- a/Sources/Models/FHIRAbstractResource.swift +++ b/Sources/Models/FHIRAbstractResource.swift @@ -10,15 +10,15 @@ import Foundation /** - * Abstract superclass for all FHIR resource models. - */ +Abstract superclass for all FHIR resource models. +*/ open class FHIRAbstractResource: FHIRAbstractBase { /// A specific version id, if the instance was created using `vread`. - open var _versionId: String? + public var _versionId: String? /// If this instance lives on a server, this property represents that server. - open var _server: FHIRServer? { + public var _server: FHIRServer? { get { return __server ?? owningResource?._server } set { __server = newValue } } @@ -33,7 +33,7 @@ open class FHIRAbstractResource: FHIRAbstractBase { The Resource, in contrast to the base element, definitely wants "resourceType" to be present. Will return an error complaining about it missing if it's not present. */ - open override func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { + override open func populate(from json: FHIRJSON?, presentKeys: inout Set) -> [FHIRJSONError]? { guard let json = json else { return nil } @@ -56,7 +56,7 @@ open class FHIRAbstractResource: FHIRAbstractBase { } - // MARK: - Printable + // MARK: - CustomStringConvertible override open var description: String { return "<\(type(of: self).resourceType)> \(__server?.baseURL.absoluteString ?? "nil")" diff --git a/Sources/Models/FHIRServer.swift b/Sources/Models/FHIRServer.swift index fc8663c7..85666a14 100644 --- a/Sources/Models/FHIRServer.swift +++ b/Sources/Models/FHIRServer.swift @@ -12,7 +12,7 @@ import Foundation /** Struct to describe REST request types, with a convenience method to make a request FHIR compliant. */ -public enum FHIRRequestType: String { +public enum FHIRRequestMethod: String { case GET = "GET" case PUT = "PUT" case POST = "POST" @@ -112,12 +112,12 @@ public protocol FHIRServer { /* Execute a request of given type against the given path, which is relative to the receiver's `baseURL`, with the given resource (if any). - - parameter ofType: The HTTP method type of the request + - parameter method: The HTTP method type of the request - parameter path: The relative path on the server to be interacting against - parameter resource: The resource to be involved in the request, if any - parameter additonalHeaders: The headers to set on the request - parameter callback: A callback, likely called asynchronously, returning a response instance */ - func performRequest(ofType: FHIRRequestType, path: String, resource: Resource?, additionalHeaders: FHIRRequestHeaders?, callback: @escaping ((_ response: FHIRServerResponse) -> Void)) + func performRequest(_ method: FHIRRequestMethod, path: String, resource: Resource?, additionalHeaders: FHIRRequestHeaders?, callback: @escaping ((FHIRServerResponse) -> Void)) } diff --git a/Sources/Models/FHIRServerResponse.swift b/Sources/Models/FHIRServerResponse.swift index 5f56657d..5984b462 100644 --- a/Sources/Models/FHIRServerResponse.swift +++ b/Sources/Models/FHIRServerResponse.swift @@ -32,26 +32,35 @@ public protocol FHIRServerResponse { /** - Instantiate a FHIRServerResponse from an (HTTP)URLResponse, Data and an Error. + Instantiate a FHIRServerResponse from an URLResponse, Data and an Error. */ init(response: URLResponse, data: Data?, error: Error?) + /** + Instantiate a response that only represents an error, possibly because it wasn't even sent. + */ init(error: Error) // MARK: - Responses - func responseResource(_ expectType: T.Type) -> T? + /** + Extract the resource of the given type from the response, if possible. + + - parameter ofType: The type of resource to extract + - returns: The resource that was found in the response if it is of the desired type, nil otherwise + */ + func responseResource(ofType: T.Type) -> T? /** The response should inspect response headers and update resource data like `id` and `meta` accordingly. This method must not be called if the response has a non-nil error. - - throws: The method should only throw on severe cases, like if Location headers were returned that don't match the resource type - - parameter resource: The resource to apply response data to + - throws: The method should only throw on severe cases, like if Location headers were returned that don't match the resource type + - parameter to: The resource to apply response data to */ - func applyHeaders(to resource: Resource) throws + func applyHeaders(to: Resource) throws /** The response should apply response body data to the given resource. It should throw `FHIRError.ResponseNoResourceReceived` if there was @@ -59,12 +68,15 @@ public protocol FHIRServerResponse { This method must not be called if the response has a non-nil error. - - throws: The method should throw if resource data was returned that doesn't match the given resource's type, but also if there was no - response data at all (`FHIRError.ResponseNoResourceReceived` in that case) - - parameter resource: The resource to apply response data to + - throws: The method should throw if resource data was returned that doesn't match the given resource's type, but also if there + was no response data at all (`FHIRError.ResponseNoResourceReceived` in that case) + - parameter to: The resource to apply response data to */ - func applyBody(to resource: Resource) throws + func applyBody(to: Resource) throws + /** + Represent a response that was not received. + */ static func noneReceived() -> Self } diff --git a/Sources/Models/FHIRTypes.swift b/Sources/Models/FHIRTypes.swift index 2382d3f2..130567f6 100644 --- a/Sources/Models/FHIRTypes.swift +++ b/Sources/Models/FHIRTypes.swift @@ -82,7 +82,7 @@ Execute a `print()`, prepending filename, line and function/method name, if `DEB */ public func fhir_logIfDebug(_ message: @autoclosure () -> String, function: String = #function, file: String = #file, line: Int = #line) { #if DEBUG - print("SwiftFHIR [\(file.lastPathComponent):\(line)] \(function) \(message())") + print("SwiftFHIR [\((file as NSString).lastPathComponent):\(line)] \(function) \(message())") #endif } diff --git a/Sources/Models/FamilyMemberHistory.swift b/Sources/Models/FamilyMemberHistory.swift index 7906f097..d8db85c5 100644 --- a/Sources/Models/FamilyMemberHistory.swift +++ b/Sources/Models/FamilyMemberHistory.swift @@ -312,7 +312,7 @@ public class FamilyMemberHistory: DomainResource { json["bornString"] = bornString.asJSON() } if let condition = self.condition { - json["condition"] = FamilyMemberHistoryCondition.asJSONArray(condition) + json["condition"] = condition.map() { $0.asJSON() } } if let date = self.date { json["date"] = date.asJSON() @@ -336,7 +336,7 @@ public class FamilyMemberHistory: DomainResource { json["gender"] = gender.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let name = self.name { json["name"] = name.asJSON() diff --git a/Sources/Models/Flag.swift b/Sources/Models/Flag.swift index 34e17af5..32519994 100644 --- a/Sources/Models/Flag.swift +++ b/Sources/Models/Flag.swift @@ -161,7 +161,7 @@ public class Flag: DomainResource { json["encounter"] = encounter.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let period = self.period { json["period"] = period.asJSON() diff --git a/Sources/Models/Goal.swift b/Sources/Models/Goal.swift index efe13b81..5f3fca6d 100644 --- a/Sources/Models/Goal.swift +++ b/Sources/Models/Goal.swift @@ -242,25 +242,25 @@ public class Goal: DomainResource { var json = super.asJSON() if let addresses = self.addresses { - json["addresses"] = Reference.asJSONArray(addresses) + json["addresses"] = addresses.map() { $0.asJSON() } } if let author = self.author { json["author"] = author.asJSON() } if let category = self.category { - json["category"] = CodeableConcept.asJSONArray(category) + json["category"] = category.map() { $0.asJSON() } } if let description_fhir = self.description_fhir { json["description"] = description_fhir.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let note = self.note { - json["note"] = Annotation.asJSONArray(note) + json["note"] = note.map() { $0.asJSON() } } if let outcome = self.outcome { - json["outcome"] = GoalOutcome.asJSONArray(outcome) + json["outcome"] = outcome.map() { $0.asJSON() } } if let priority = self.priority { json["priority"] = priority.asJSON() diff --git a/Sources/Models/Group.swift b/Sources/Models/Group.swift index f1631149..7ef75459 100644 --- a/Sources/Models/Group.swift +++ b/Sources/Models/Group.swift @@ -150,16 +150,16 @@ public class Group: DomainResource { json["actual"] = actual.asJSON() } if let characteristic = self.characteristic { - json["characteristic"] = GroupCharacteristic.asJSONArray(characteristic) + json["characteristic"] = characteristic.map() { $0.asJSON() } } if let code = self.code { json["code"] = code.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let member = self.member { - json["member"] = GroupMember.asJSONArray(member) + json["member"] = member.map() { $0.asJSON() } } if let name = self.name { json["name"] = name.asJSON() diff --git a/Sources/Models/HealthcareService.swift b/Sources/Models/HealthcareService.swift index f07b6885..54eba59f 100644 --- a/Sources/Models/HealthcareService.swift +++ b/Sources/Models/HealthcareService.swift @@ -313,16 +313,16 @@ public class HealthcareService: DomainResource { json["availabilityExceptions"] = availabilityExceptions.asJSON() } if let availableTime = self.availableTime { - json["availableTime"] = HealthcareServiceAvailableTime.asJSONArray(availableTime) + json["availableTime"] = availableTime.map() { $0.asJSON() } } if let characteristic = self.characteristic { - json["characteristic"] = CodeableConcept.asJSONArray(characteristic) + json["characteristic"] = characteristic.map() { $0.asJSON() } } if let comment = self.comment { json["comment"] = comment.asJSON() } if let coverageArea = self.coverageArea { - json["coverageArea"] = Reference.asJSONArray(coverageArea) + json["coverageArea"] = coverageArea.map() { $0.asJSON() } } if let eligibility = self.eligibility { json["eligibility"] = eligibility.asJSON() @@ -334,13 +334,13 @@ public class HealthcareService: DomainResource { json["extraDetails"] = extraDetails.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let location = self.location { json["location"] = location.asJSON() } if let notAvailable = self.notAvailable { - json["notAvailable"] = HealthcareServiceNotAvailable.asJSONArray(notAvailable) + json["notAvailable"] = notAvailable.map() { $0.asJSON() } } if let photo = self.photo { json["photo"] = photo.asJSON() @@ -359,7 +359,7 @@ public class HealthcareService: DomainResource { json["publicKey"] = publicKey.asJSON() } if let referralMethod = self.referralMethod { - json["referralMethod"] = CodeableConcept.asJSONArray(referralMethod) + json["referralMethod"] = referralMethod.map() { $0.asJSON() } } if let serviceCategory = self.serviceCategory { json["serviceCategory"] = serviceCategory.asJSON() @@ -368,13 +368,13 @@ public class HealthcareService: DomainResource { json["serviceName"] = serviceName.asJSON() } if let serviceProvisionCode = self.serviceProvisionCode { - json["serviceProvisionCode"] = CodeableConcept.asJSONArray(serviceProvisionCode) + json["serviceProvisionCode"] = serviceProvisionCode.map() { $0.asJSON() } } if let serviceType = self.serviceType { - json["serviceType"] = HealthcareServiceServiceType.asJSONArray(serviceType) + json["serviceType"] = serviceType.map() { $0.asJSON() } } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json @@ -609,7 +609,7 @@ public class HealthcareServiceServiceType: BackboneElement { var json = super.asJSON() if let specialty = self.specialty { - json["specialty"] = CodeableConcept.asJSONArray(specialty) + json["specialty"] = specialty.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() diff --git a/Sources/Models/ImagingObjectSelection.swift b/Sources/Models/ImagingObjectSelection.swift index b6a32366..568da0f7 100644 --- a/Sources/Models/ImagingObjectSelection.swift +++ b/Sources/Models/ImagingObjectSelection.swift @@ -159,7 +159,7 @@ public class ImagingObjectSelection: DomainResource { json["patient"] = patient.asJSON() } if let study = self.study { - json["study"] = ImagingObjectSelectionStudy.asJSONArray(study) + json["study"] = study.map() { $0.asJSON() } } if let title = self.title { json["title"] = title.asJSON() @@ -264,7 +264,7 @@ public class ImagingObjectSelectionStudy: BackboneElement { json["imagingStudy"] = imagingStudy.asJSON() } if let series = self.series { - json["series"] = ImagingObjectSelectionStudySeries.asJSONArray(series) + json["series"] = series.map() { $0.asJSON() } } if let uid = self.uid { json["uid"] = uid.asJSON() @@ -350,7 +350,7 @@ public class ImagingObjectSelectionStudySeries: BackboneElement { var json = super.asJSON() if let instance = self.instance { - json["instance"] = ImagingObjectSelectionStudySeriesInstance.asJSONArray(instance) + json["instance"] = instance.map() { $0.asJSON() } } if let uid = self.uid { json["uid"] = uid.asJSON() @@ -456,7 +456,7 @@ public class ImagingObjectSelectionStudySeriesInstance: BackboneElement { var json = super.asJSON() if let frames = self.frames { - json["frames"] = ImagingObjectSelectionStudySeriesInstanceFrames.asJSONArray(frames) + json["frames"] = frames.map() { $0.asJSON() } } if let sopClass = self.sopClass { json["sopClass"] = sopClass.asJSON() diff --git a/Sources/Models/ImagingStudy.swift b/Sources/Models/ImagingStudy.swift index a8e5f23f..9a06e84b 100644 --- a/Sources/Models/ImagingStudy.swift +++ b/Sources/Models/ImagingStudy.swift @@ -261,13 +261,13 @@ public class ImagingStudy: DomainResource { json["description"] = description_fhir.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let interpreter = self.interpreter { json["interpreter"] = interpreter.asJSON() } if let modalityList = self.modalityList { - json["modalityList"] = Coding.asJSONArray(modalityList) + json["modalityList"] = modalityList.map() { $0.asJSON() } } if let numberOfInstances = self.numberOfInstances { json["numberOfInstances"] = numberOfInstances.asJSON() @@ -276,19 +276,19 @@ public class ImagingStudy: DomainResource { json["numberOfSeries"] = numberOfSeries.asJSON() } if let order = self.order { - json["order"] = Reference.asJSONArray(order) + json["order"] = order.map() { $0.asJSON() } } if let patient = self.patient { json["patient"] = patient.asJSON() } if let procedure = self.procedure { - json["procedure"] = Reference.asJSONArray(procedure) + json["procedure"] = procedure.map() { $0.asJSON() } } if let referrer = self.referrer { json["referrer"] = referrer.asJSON() } if let series = self.series { - json["series"] = ImagingStudySeries.asJSONArray(series) + json["series"] = series.map() { $0.asJSON() } } if let started = self.started { json["started"] = started.asJSON() @@ -490,7 +490,7 @@ public class ImagingStudySeries: BackboneElement { json["description"] = description_fhir.asJSON() } if let instance = self.instance { - json["instance"] = ImagingStudySeriesInstance.asJSONArray(instance) + json["instance"] = instance.map() { $0.asJSON() } } if let laterality = self.laterality { json["laterality"] = laterality.asJSON() @@ -631,7 +631,7 @@ public class ImagingStudySeriesInstance: BackboneElement { var json = super.asJSON() if let content = self.content { - json["content"] = Attachment.asJSONArray(content) + json["content"] = content.map() { $0.asJSON() } } if let number = self.number { json["number"] = number.asJSON() diff --git a/Sources/Models/Immunization.swift b/Sources/Models/Immunization.swift index acda57d1..11bc23e6 100644 --- a/Sources/Models/Immunization.swift +++ b/Sources/Models/Immunization.swift @@ -330,7 +330,7 @@ public class Immunization: DomainResource { json["explanation"] = explanation.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let location = self.location { json["location"] = location.asJSON() @@ -342,7 +342,7 @@ public class Immunization: DomainResource { json["manufacturer"] = manufacturer.asJSON() } if let note = self.note { - json["note"] = Annotation.asJSONArray(note) + json["note"] = note.map() { $0.asJSON() } } if let patient = self.patient { json["patient"] = patient.asJSON() @@ -351,7 +351,7 @@ public class Immunization: DomainResource { json["performer"] = performer.asJSON() } if let reaction = self.reaction { - json["reaction"] = ImmunizationReaction.asJSONArray(reaction) + json["reaction"] = reaction.map() { $0.asJSON() } } if let reported = self.reported { json["reported"] = reported.asJSON() @@ -369,7 +369,7 @@ public class Immunization: DomainResource { json["status"] = status.asJSON() } if let vaccinationProtocol = self.vaccinationProtocol { - json["vaccinationProtocol"] = ImmunizationVaccinationProtocol.asJSONArray(vaccinationProtocol) + json["vaccinationProtocol"] = vaccinationProtocol.map() { $0.asJSON() } } if let vaccineCode = self.vaccineCode { json["vaccineCode"] = vaccineCode.asJSON() @@ -434,10 +434,10 @@ public class ImmunizationExplanation: BackboneElement { var json = super.asJSON() if let reason = self.reason { - json["reason"] = CodeableConcept.asJSONArray(reason) + json["reason"] = reason.map() { $0.asJSON() } } if let reasonNotGiven = self.reasonNotGiven { - json["reasonNotGiven"] = CodeableConcept.asJSONArray(reasonNotGiven) + json["reasonNotGiven"] = reasonNotGiven.map() { $0.asJSON() } } return json @@ -683,7 +683,7 @@ public class ImmunizationVaccinationProtocol: BackboneElement { json["seriesDoses"] = seriesDoses.asJSON() } if let targetDisease = self.targetDisease { - json["targetDisease"] = CodeableConcept.asJSONArray(targetDisease) + json["targetDisease"] = targetDisease.map() { $0.asJSON() } } return json diff --git a/Sources/Models/ImmunizationRecommendation.swift b/Sources/Models/ImmunizationRecommendation.swift index 66fbb2ef..95486a56 100644 --- a/Sources/Models/ImmunizationRecommendation.swift +++ b/Sources/Models/ImmunizationRecommendation.swift @@ -86,13 +86,13 @@ public class ImmunizationRecommendation: DomainResource { var json = super.asJSON() if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let patient = self.patient { json["patient"] = patient.asJSON() } if let recommendation = self.recommendation { - json["recommendation"] = ImmunizationRecommendationRecommendation.asJSONArray(recommendation) + json["recommendation"] = recommendation.map() { $0.asJSON() } } return json @@ -241,7 +241,7 @@ public class ImmunizationRecommendationRecommendation: BackboneElement { json["date"] = date.asJSON() } if let dateCriterion = self.dateCriterion { - json["dateCriterion"] = ImmunizationRecommendationRecommendationDateCriterion.asJSONArray(dateCriterion) + json["dateCriterion"] = dateCriterion.map() { $0.asJSON() } } if let doseNumber = self.doseNumber { json["doseNumber"] = doseNumber.asJSON() @@ -253,10 +253,10 @@ public class ImmunizationRecommendationRecommendation: BackboneElement { json["protocol"] = protocol_fhir.asJSON() } if let supportingImmunization = self.supportingImmunization { - json["supportingImmunization"] = Reference.asJSONArray(supportingImmunization) + json["supportingImmunization"] = supportingImmunization.map() { $0.asJSON() } } if let supportingPatientInformation = self.supportingPatientInformation { - json["supportingPatientInformation"] = Reference.asJSONArray(supportingPatientInformation) + json["supportingPatientInformation"] = supportingPatientInformation.map() { $0.asJSON() } } if let vaccineCode = self.vaccineCode { json["vaccineCode"] = vaccineCode.asJSON() diff --git a/Sources/Models/ImplementationGuide.swift b/Sources/Models/ImplementationGuide.swift index 233bec1a..ab38cfba 100644 --- a/Sources/Models/ImplementationGuide.swift +++ b/Sources/Models/ImplementationGuide.swift @@ -273,7 +273,7 @@ public class ImplementationGuide: DomainResource { json["binary"] = arr } if let contact = self.contact { - json["contact"] = ImplementationGuideContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let copyright = self.copyright { json["copyright"] = copyright.asJSON() @@ -282,7 +282,7 @@ public class ImplementationGuide: DomainResource { json["date"] = date.asJSON() } if let dependency = self.dependency { - json["dependency"] = ImplementationGuideDependency.asJSONArray(dependency) + json["dependency"] = dependency.map() { $0.asJSON() } } if let description_fhir = self.description_fhir { json["description"] = description_fhir.asJSON() @@ -294,13 +294,13 @@ public class ImplementationGuide: DomainResource { json["fhirVersion"] = fhirVersion.asJSON() } if let global = self.global { - json["global"] = ImplementationGuideGlobal.asJSONArray(global) + json["global"] = global.map() { $0.asJSON() } } if let name = self.name { json["name"] = name.asJSON() } if let package = self.package { - json["package"] = ImplementationGuidePackage.asJSONArray(package) + json["package"] = package.map() { $0.asJSON() } } if let page = self.page { json["page"] = page.asJSON() @@ -315,7 +315,7 @@ public class ImplementationGuide: DomainResource { json["url"] = url.asJSON() } if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) + json["useContext"] = useContext.map() { $0.asJSON() } } if let version = self.version { json["version"] = version.asJSON() @@ -380,7 +380,7 @@ public class ImplementationGuideContact: BackboneElement { json["name"] = name.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json @@ -621,7 +621,7 @@ public class ImplementationGuidePackage: BackboneElement { json["name"] = name.asJSON() } if let resource = self.resource { - json["resource"] = ImplementationGuidePackageResource.asJSONArray(resource) + json["resource"] = resource.map() { $0.asJSON() } } return json @@ -928,7 +928,7 @@ public class ImplementationGuidePage: BackboneElement { json["package"] = arr } if let page = self.page { - json["page"] = ImplementationGuidePage.asJSONArray(page) + json["page"] = page.map() { $0.asJSON() } } if let source = self.source { json["source"] = source.asJSON() diff --git a/Sources/Models/List.swift b/Sources/Models/List.swift index 7868b439..8c22fc9b 100644 --- a/Sources/Models/List.swift +++ b/Sources/Models/List.swift @@ -217,10 +217,10 @@ public class List: DomainResource { json["encounter"] = encounter.asJSON() } if let entry = self.entry { - json["entry"] = ListEntry.asJSONArray(entry) + json["entry"] = entry.map() { $0.asJSON() } } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let mode = self.mode { json["mode"] = mode.asJSON() diff --git a/Sources/Models/Location.swift b/Sources/Models/Location.swift index e7a485cc..4277b47a 100644 --- a/Sources/Models/Location.swift +++ b/Sources/Models/Location.swift @@ -187,7 +187,7 @@ public class Location: DomainResource { json["description"] = description_fhir.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let managingOrganization = self.managingOrganization { json["managingOrganization"] = managingOrganization.asJSON() @@ -211,7 +211,7 @@ public class Location: DomainResource { json["status"] = status.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() diff --git a/Sources/Models/Media.swift b/Sources/Models/Media.swift index c12b0e92..607d039d 100644 --- a/Sources/Models/Media.swift +++ b/Sources/Models/Media.swift @@ -207,7 +207,7 @@ public class Media: DomainResource { json["height"] = height.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let operator_fhir = self.operator_fhir { json["operator"] = operator_fhir.asJSON() diff --git a/Sources/Models/Medication.swift b/Sources/Models/Medication.swift index 3e39f1a7..29d4e667 100644 --- a/Sources/Models/Medication.swift +++ b/Sources/Models/Medication.swift @@ -171,7 +171,7 @@ public class MedicationPackage: BackboneElement { json["container"] = container.asJSON() } if let content = self.content { - json["content"] = MedicationPackageContent.asJSONArray(content) + json["content"] = content.map() { $0.asJSON() } } return json @@ -313,13 +313,13 @@ public class MedicationProduct: BackboneElement { var json = super.asJSON() if let batch = self.batch { - json["batch"] = MedicationProductBatch.asJSONArray(batch) + json["batch"] = batch.map() { $0.asJSON() } } if let form = self.form { json["form"] = form.asJSON() } if let ingredient = self.ingredient { - json["ingredient"] = MedicationProductIngredient.asJSONArray(ingredient) + json["ingredient"] = ingredient.map() { $0.asJSON() } } return json diff --git a/Sources/Models/MedicationAdministration.swift b/Sources/Models/MedicationAdministration.swift index 55c28bec..6a1af3b3 100644 --- a/Sources/Models/MedicationAdministration.swift +++ b/Sources/Models/MedicationAdministration.swift @@ -255,7 +255,7 @@ public class MedicationAdministration: DomainResource { var json = super.asJSON() if let device = self.device { - json["device"] = Reference.asJSONArray(device) + json["device"] = device.map() { $0.asJSON() } } if let dosage = self.dosage { json["dosage"] = dosage.asJSON() @@ -270,7 +270,7 @@ public class MedicationAdministration: DomainResource { json["encounter"] = encounter.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let medicationCodeableConcept = self.medicationCodeableConcept { json["medicationCodeableConcept"] = medicationCodeableConcept.asJSON() @@ -291,10 +291,10 @@ public class MedicationAdministration: DomainResource { json["prescription"] = prescription.asJSON() } if let reasonGiven = self.reasonGiven { - json["reasonGiven"] = CodeableConcept.asJSONArray(reasonGiven) + json["reasonGiven"] = reasonGiven.map() { $0.asJSON() } } if let reasonNotGiven = self.reasonNotGiven { - json["reasonNotGiven"] = CodeableConcept.asJSONArray(reasonNotGiven) + json["reasonNotGiven"] = reasonNotGiven.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() diff --git a/Sources/Models/MedicationDispense.swift b/Sources/Models/MedicationDispense.swift index d37bc56d..593e103a 100644 --- a/Sources/Models/MedicationDispense.swift +++ b/Sources/Models/MedicationDispense.swift @@ -254,7 +254,7 @@ public class MedicationDispense: DomainResource { var json = super.asJSON() if let authorizingPrescription = self.authorizingPrescription { - json["authorizingPrescription"] = Reference.asJSONArray(authorizingPrescription) + json["authorizingPrescription"] = authorizingPrescription.map() { $0.asJSON() } } if let daysSupply = self.daysSupply { json["daysSupply"] = daysSupply.asJSON() @@ -266,7 +266,7 @@ public class MedicationDispense: DomainResource { json["dispenser"] = dispenser.asJSON() } if let dosageInstruction = self.dosageInstruction { - json["dosageInstruction"] = MedicationDispenseDosageInstruction.asJSONArray(dosageInstruction) + json["dosageInstruction"] = dosageInstruction.map() { $0.asJSON() } } if let identifier = self.identifier { json["identifier"] = identifier.asJSON() @@ -287,7 +287,7 @@ public class MedicationDispense: DomainResource { json["quantity"] = quantity.asJSON() } if let receiver = self.receiver { - json["receiver"] = Reference.asJSONArray(receiver) + json["receiver"] = receiver.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() @@ -626,10 +626,10 @@ public class MedicationDispenseSubstitution: BackboneElement { var json = super.asJSON() if let reason = self.reason { - json["reason"] = CodeableConcept.asJSONArray(reason) + json["reason"] = reason.map() { $0.asJSON() } } if let responsibleParty = self.responsibleParty { - json["responsibleParty"] = Reference.asJSONArray(responsibleParty) + json["responsibleParty"] = responsibleParty.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() diff --git a/Sources/Models/MedicationOrder.swift b/Sources/Models/MedicationOrder.swift index 09e4df58..b5e6d164 100644 --- a/Sources/Models/MedicationOrder.swift +++ b/Sources/Models/MedicationOrder.swift @@ -263,13 +263,13 @@ public class MedicationOrder: DomainResource { json["dispenseRequest"] = dispenseRequest.asJSON() } if let dosageInstruction = self.dosageInstruction { - json["dosageInstruction"] = MedicationOrderDosageInstruction.asJSONArray(dosageInstruction) + json["dosageInstruction"] = dosageInstruction.map() { $0.asJSON() } } if let encounter = self.encounter { json["encounter"] = encounter.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let medicationCodeableConcept = self.medicationCodeableConcept { json["medicationCodeableConcept"] = medicationCodeableConcept.asJSON() diff --git a/Sources/Models/MedicationStatement.swift b/Sources/Models/MedicationStatement.swift index 5d85c5e6..3dd3abcf 100644 --- a/Sources/Models/MedicationStatement.swift +++ b/Sources/Models/MedicationStatement.swift @@ -17,7 +17,9 @@ import Foundation * 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 e.g. the patient's memory, from a prescription - * bottle, or from a list of medications the patient, clinician or other party maintains The primary difference + * 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 @@ -264,7 +266,7 @@ public class MedicationStatement: DomainResource { json["dateAsserted"] = dateAsserted.asJSON() } if let dosage = self.dosage { - json["dosage"] = MedicationStatementDosage.asJSONArray(dosage) + json["dosage"] = dosage.map() { $0.asJSON() } } if let effectiveDateTime = self.effectiveDateTime { json["effectiveDateTime"] = effectiveDateTime.asJSON() @@ -273,7 +275,7 @@ public class MedicationStatement: DomainResource { json["effectivePeriod"] = effectivePeriod.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let informationSource = self.informationSource { json["informationSource"] = informationSource.asJSON() @@ -297,13 +299,13 @@ public class MedicationStatement: DomainResource { json["reasonForUseReference"] = reasonForUseReference.asJSON() } if let reasonNotTaken = self.reasonNotTaken { - json["reasonNotTaken"] = CodeableConcept.asJSONArray(reasonNotTaken) + json["reasonNotTaken"] = reasonNotTaken.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() } if let supportingInformation = self.supportingInformation { - json["supportingInformation"] = Reference.asJSONArray(supportingInformation) + json["supportingInformation"] = supportingInformation.map() { $0.asJSON() } } if let wasNotTaken = self.wasNotTaken { json["wasNotTaken"] = wasNotTaken.asJSON() diff --git a/Sources/Models/MessageHeader.swift b/Sources/Models/MessageHeader.swift index 6d81e42e..135a571c 100644 --- a/Sources/Models/MessageHeader.swift +++ b/Sources/Models/MessageHeader.swift @@ -190,10 +190,10 @@ public class MessageHeader: DomainResource { json["author"] = author.asJSON() } if let data = self.data { - json["data"] = Reference.asJSONArray(data) + json["data"] = data.map() { $0.asJSON() } } if let destination = self.destination { - json["destination"] = MessageHeaderDestination.asJSONArray(destination) + json["destination"] = destination.map() { $0.asJSON() } } if let enterer = self.enterer { json["enterer"] = enterer.asJSON() diff --git a/Sources/Models/Meta.swift b/Sources/Models/Meta.swift index 7fa2aa7b..e9c25e3e 100644 --- a/Sources/Models/Meta.swift +++ b/Sources/Models/Meta.swift @@ -107,10 +107,10 @@ public class Meta: Element { json["profile"] = arr } if let security = self.security { - json["security"] = Coding.asJSONArray(security) + json["security"] = security.map() { $0.asJSON() } } if let tag = self.tag { - json["tag"] = Coding.asJSONArray(tag) + json["tag"] = tag.map() { $0.asJSON() } } if let versionId = self.versionId { json["versionId"] = versionId.asJSON() diff --git a/Sources/Models/NamingSystem.swift b/Sources/Models/NamingSystem.swift index f8a10b2b..7e8567f3 100644 --- a/Sources/Models/NamingSystem.swift +++ b/Sources/Models/NamingSystem.swift @@ -218,7 +218,7 @@ public class NamingSystem: DomainResource { var json = super.asJSON() if let contact = self.contact { - json["contact"] = NamingSystemContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let date = self.date { json["date"] = date.asJSON() @@ -248,13 +248,13 @@ public class NamingSystem: DomainResource { json["type"] = type.asJSON() } if let uniqueId = self.uniqueId { - json["uniqueId"] = NamingSystemUniqueId.asJSONArray(uniqueId) + json["uniqueId"] = uniqueId.map() { $0.asJSON() } } if let usage = self.usage { json["usage"] = usage.asJSON() } if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) + json["useContext"] = useContext.map() { $0.asJSON() } } return json @@ -316,7 +316,7 @@ public class NamingSystemContact: BackboneElement { json["name"] = name.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json diff --git a/Sources/Models/NutritionOrder.swift b/Sources/Models/NutritionOrder.swift index e084ee13..c86bb680 100644 --- a/Sources/Models/NutritionOrder.swift +++ b/Sources/Models/NutritionOrder.swift @@ -193,7 +193,7 @@ public class NutritionOrder: DomainResource { var json = super.asJSON() if let allergyIntolerance = self.allergyIntolerance { - json["allergyIntolerance"] = Reference.asJSONArray(allergyIntolerance) + json["allergyIntolerance"] = allergyIntolerance.map() { $0.asJSON() } } if let dateTime = self.dateTime { json["dateTime"] = dateTime.asJSON() @@ -205,13 +205,13 @@ public class NutritionOrder: DomainResource { json["enteralFormula"] = enteralFormula.asJSON() } if let excludeFoodModifier = self.excludeFoodModifier { - json["excludeFoodModifier"] = CodeableConcept.asJSONArray(excludeFoodModifier) + json["excludeFoodModifier"] = excludeFoodModifier.map() { $0.asJSON() } } if let foodPreferenceModifier = self.foodPreferenceModifier { - json["foodPreferenceModifier"] = CodeableConcept.asJSONArray(foodPreferenceModifier) + json["foodPreferenceModifier"] = foodPreferenceModifier.map() { $0.asJSON() } } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let oralDiet = self.oralDiet { json["oralDiet"] = oralDiet.asJSON() @@ -226,7 +226,7 @@ public class NutritionOrder: DomainResource { json["status"] = status.asJSON() } if let supplement = self.supplement { - json["supplement"] = NutritionOrderSupplement.asJSONArray(supplement) + json["supplement"] = supplement.map() { $0.asJSON() } } return json @@ -376,7 +376,7 @@ public class NutritionOrderEnteralFormula: BackboneElement { json["additiveType"] = additiveType.asJSON() } if let administration = self.administration { - json["administration"] = NutritionOrderEnteralFormulaAdministration.asJSONArray(administration) + json["administration"] = administration.map() { $0.asJSON() } } if let administrationInstruction = self.administrationInstruction { json["administrationInstruction"] = administrationInstruction.asJSON() @@ -595,22 +595,22 @@ public class NutritionOrderOralDiet: BackboneElement { var json = super.asJSON() if let fluidConsistencyType = self.fluidConsistencyType { - json["fluidConsistencyType"] = CodeableConcept.asJSONArray(fluidConsistencyType) + json["fluidConsistencyType"] = fluidConsistencyType.map() { $0.asJSON() } } if let instruction = self.instruction { json["instruction"] = instruction.asJSON() } if let nutrient = self.nutrient { - json["nutrient"] = NutritionOrderOralDietNutrient.asJSONArray(nutrient) + json["nutrient"] = nutrient.map() { $0.asJSON() } } if let schedule = self.schedule { - json["schedule"] = Timing.asJSONArray(schedule) + json["schedule"] = schedule.map() { $0.asJSON() } } if let texture = self.texture { - json["texture"] = NutritionOrderOralDietTexture.asJSONArray(texture) + json["texture"] = texture.map() { $0.asJSON() } } if let type = self.type { - json["type"] = CodeableConcept.asJSONArray(type) + json["type"] = type.map() { $0.asJSON() } } return json @@ -839,7 +839,7 @@ public class NutritionOrderSupplement: BackboneElement { json["quantity"] = quantity.asJSON() } if let schedule = self.schedule { - json["schedule"] = Timing.asJSONArray(schedule) + json["schedule"] = schedule.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() diff --git a/Sources/Models/Observation.swift b/Sources/Models/Observation.swift index 5264aa23..b3406fc1 100644 --- a/Sources/Models/Observation.swift +++ b/Sources/Models/Observation.swift @@ -421,7 +421,7 @@ public class Observation: DomainResource { json["comments"] = comments.asJSON() } if let component = self.component { - json["component"] = ObservationComponent.asJSONArray(component) + json["component"] = component.map() { $0.asJSON() } } if let dataAbsentReason = self.dataAbsentReason { json["dataAbsentReason"] = dataAbsentReason.asJSON() @@ -439,7 +439,7 @@ public class Observation: DomainResource { json["encounter"] = encounter.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let interpretation = self.interpretation { json["interpretation"] = interpretation.asJSON() @@ -451,13 +451,13 @@ public class Observation: DomainResource { json["method"] = method.asJSON() } if let performer = self.performer { - json["performer"] = Reference.asJSONArray(performer) + json["performer"] = performer.map() { $0.asJSON() } } if let referenceRange = self.referenceRange { - json["referenceRange"] = ObservationReferenceRange.asJSONArray(referenceRange) + json["referenceRange"] = referenceRange.map() { $0.asJSON() } } if let related = self.related { - json["related"] = ObservationRelated.asJSONArray(related) + json["related"] = related.map() { $0.asJSON() } } if let specimen = self.specimen { json["specimen"] = specimen.asJSON() @@ -704,7 +704,7 @@ public class ObservationComponent: BackboneElement { json["dataAbsentReason"] = dataAbsentReason.asJSON() } if let referenceRange = self.referenceRange { - json["referenceRange"] = ObservationReferenceRange.asJSONArray(referenceRange) + json["referenceRange"] = referenceRange.map() { $0.asJSON() } } if let valueAttachment = self.valueAttachment { json["valueAttachment"] = valueAttachment.asJSON() diff --git a/Sources/Models/OperationDefinition.swift b/Sources/Models/OperationDefinition.swift index fee274c5..f5b5f523 100644 --- a/Sources/Models/OperationDefinition.swift +++ b/Sources/Models/OperationDefinition.swift @@ -300,7 +300,7 @@ public class OperationDefinition: DomainResource { json["code"] = code.asJSON() } if let contact = self.contact { - json["contact"] = OperationDefinitionContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let date = self.date { json["date"] = date.asJSON() @@ -327,7 +327,7 @@ public class OperationDefinition: DomainResource { json["notes"] = notes.asJSON() } if let parameter = self.parameter { - json["parameter"] = OperationDefinitionParameter.asJSONArray(parameter) + json["parameter"] = parameter.map() { $0.asJSON() } } if let publisher = self.publisher { json["publisher"] = publisher.asJSON() @@ -414,7 +414,7 @@ public class OperationDefinitionContact: BackboneElement { json["name"] = name.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json @@ -593,7 +593,7 @@ public class OperationDefinitionParameter: BackboneElement { json["name"] = name.asJSON() } if let part = self.part { - json["part"] = OperationDefinitionParameter.asJSONArray(part) + json["part"] = part.map() { $0.asJSON() } } if let profile = self.profile { json["profile"] = profile.asJSON() diff --git a/Sources/Models/OperationOutcome.swift b/Sources/Models/OperationOutcome.swift index 75f6e9c6..f3c1bf3a 100644 --- a/Sources/Models/OperationOutcome.swift +++ b/Sources/Models/OperationOutcome.swift @@ -57,7 +57,7 @@ public class OperationOutcome: DomainResource { var json = super.asJSON() if let issue = self.issue { - json["issue"] = OperationOutcomeIssue.asJSONArray(issue) + json["issue"] = issue.map() { $0.asJSON() } } return json diff --git a/Sources/Models/Order.swift b/Sources/Models/Order.swift index 31568a76..5ce291d1 100644 --- a/Sources/Models/Order.swift +++ b/Sources/Models/Order.swift @@ -154,10 +154,10 @@ public class Order: DomainResource { json["date"] = date.asJSON() } if let detail = self.detail { - json["detail"] = Reference.asJSONArray(detail) + json["detail"] = detail.map() { $0.asJSON() } } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let reasonCodeableConcept = self.reasonCodeableConcept { json["reasonCodeableConcept"] = reasonCodeableConcept.asJSON() diff --git a/Sources/Models/OrderResponse.swift b/Sources/Models/OrderResponse.swift index 0f812c82..ecc63fdc 100644 --- a/Sources/Models/OrderResponse.swift +++ b/Sources/Models/OrderResponse.swift @@ -137,10 +137,10 @@ public class OrderResponse: DomainResource { json["description"] = description_fhir.asJSON() } if let fulfillment = self.fulfillment { - json["fulfillment"] = Reference.asJSONArray(fulfillment) + json["fulfillment"] = fulfillment.map() { $0.asJSON() } } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let orderStatus = self.orderStatus { json["orderStatus"] = orderStatus.asJSON() diff --git a/Sources/Models/Organization.swift b/Sources/Models/Organization.swift index dad07e3f..3bb4d072 100644 --- a/Sources/Models/Organization.swift +++ b/Sources/Models/Organization.swift @@ -137,13 +137,13 @@ public class Organization: DomainResource { json["active"] = active.asJSON() } if let address = self.address { - json["address"] = Address.asJSONArray(address) + json["address"] = address.map() { $0.asJSON() } } if let contact = self.contact { - json["contact"] = OrganizationContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let name = self.name { json["name"] = name.asJSON() @@ -152,7 +152,7 @@ public class Organization: DomainResource { json["partOf"] = partOf.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() @@ -245,7 +245,7 @@ public class OrganizationContact: BackboneElement { json["purpose"] = purpose.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json diff --git a/Sources/Models/Parameters.swift b/Sources/Models/Parameters.swift index 8ea2627c..c59806b2 100644 --- a/Sources/Models/Parameters.swift +++ b/Sources/Models/Parameters.swift @@ -49,7 +49,7 @@ public class Parameters: Resource { var json = super.asJSON() if let parameter = self.parameter { - json["parameter"] = ParametersParameter.asJSONArray(parameter) + json["parameter"] = parameter.map() { $0.asJSON() } } return json @@ -528,7 +528,7 @@ public class ParametersParameter: BackboneElement { json["name"] = name.asJSON() } if let part = self.part { - json["part"] = ParametersParameter.asJSONArray(part) + json["part"] = part.map() { $0.asJSON() } } if let resource = self.resource { json["resource"] = resource.asJSON() diff --git a/Sources/Models/Patient.swift b/Sources/Models/Patient.swift index cb672ed7..c3e5a036 100644 --- a/Sources/Models/Patient.swift +++ b/Sources/Models/Patient.swift @@ -268,7 +268,7 @@ public class Patient: DomainResource { json["active"] = active.asJSON() } if let address = self.address { - json["address"] = Address.asJSONArray(address) + json["address"] = address.map() { $0.asJSON() } } if let animal = self.animal { json["animal"] = animal.asJSON() @@ -277,13 +277,13 @@ public class Patient: DomainResource { json["birthDate"] = birthDate.asJSON() } if let careProvider = self.careProvider { - json["careProvider"] = Reference.asJSONArray(careProvider) + json["careProvider"] = careProvider.map() { $0.asJSON() } } if let communication = self.communication { - json["communication"] = PatientCommunication.asJSONArray(communication) + json["communication"] = communication.map() { $0.asJSON() } } if let contact = self.contact { - json["contact"] = PatientContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let deceasedBoolean = self.deceasedBoolean { json["deceasedBoolean"] = deceasedBoolean.asJSON() @@ -295,10 +295,10 @@ public class Patient: DomainResource { json["gender"] = gender.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let link = self.link { - json["link"] = PatientLink.asJSONArray(link) + json["link"] = link.map() { $0.asJSON() } } if let managingOrganization = self.managingOrganization { json["managingOrganization"] = managingOrganization.asJSON() @@ -313,13 +313,13 @@ public class Patient: DomainResource { json["multipleBirthInteger"] = multipleBirthInteger.asJSON() } if let name = self.name { - json["name"] = HumanName.asJSONArray(name) + json["name"] = name.map() { $0.asJSON() } } if let photo = self.photo { - json["photo"] = Attachment.asJSONArray(photo) + json["photo"] = photo.map() { $0.asJSON() } } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json @@ -608,10 +608,10 @@ public class PatientContact: BackboneElement { json["period"] = period.asJSON() } if let relationship = self.relationship { - json["relationship"] = CodeableConcept.asJSONArray(relationship) + json["relationship"] = relationship.map() { $0.asJSON() } } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json diff --git a/Sources/Models/PaymentNotice.swift b/Sources/Models/PaymentNotice.swift index 36bca6c0..a68e0223 100644 --- a/Sources/Models/PaymentNotice.swift +++ b/Sources/Models/PaymentNotice.swift @@ -169,7 +169,7 @@ public class PaymentNotice: DomainResource { json["created"] = created.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let organization = self.organization { json["organization"] = organization.asJSON() diff --git a/Sources/Models/PaymentReconciliation.swift b/Sources/Models/PaymentReconciliation.swift index 01c43718..829b0700 100644 --- a/Sources/Models/PaymentReconciliation.swift +++ b/Sources/Models/PaymentReconciliation.swift @@ -228,7 +228,7 @@ public class PaymentReconciliation: DomainResource { json["created"] = created.asJSON() } if let detail = self.detail { - json["detail"] = PaymentReconciliationDetail.asJSONArray(detail) + json["detail"] = detail.map() { $0.asJSON() } } if let disposition = self.disposition { json["disposition"] = disposition.asJSON() @@ -237,10 +237,10 @@ public class PaymentReconciliation: DomainResource { json["form"] = form.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let note = self.note { - json["note"] = PaymentReconciliationNote.asJSONArray(note) + json["note"] = note.map() { $0.asJSON() } } if let organization = self.organization { json["organization"] = organization.asJSON() diff --git a/Sources/Models/Person.swift b/Sources/Models/Person.swift index 4fa02a72..e4d3c051 100644 --- a/Sources/Models/Person.swift +++ b/Sources/Models/Person.swift @@ -159,7 +159,7 @@ public class Person: DomainResource { json["active"] = active.asJSON() } if let address = self.address { - json["address"] = Address.asJSONArray(address) + json["address"] = address.map() { $0.asJSON() } } if let birthDate = self.birthDate { json["birthDate"] = birthDate.asJSON() @@ -168,22 +168,22 @@ public class Person: DomainResource { json["gender"] = gender.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let link = self.link { - json["link"] = PersonLink.asJSONArray(link) + json["link"] = link.map() { $0.asJSON() } } if let managingOrganization = self.managingOrganization { json["managingOrganization"] = managingOrganization.asJSON() } if let name = self.name { - json["name"] = HumanName.asJSONArray(name) + json["name"] = name.map() { $0.asJSON() } } if let photo = self.photo { json["photo"] = photo.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json diff --git a/Sources/Models/Practitioner.swift b/Sources/Models/Practitioner.swift index 20ff7a4d..59c80ce8 100644 --- a/Sources/Models/Practitioner.swift +++ b/Sources/Models/Practitioner.swift @@ -171,34 +171,34 @@ public class Practitioner: DomainResource { json["active"] = active.asJSON() } if let address = self.address { - json["address"] = Address.asJSONArray(address) + json["address"] = address.map() { $0.asJSON() } } if let birthDate = self.birthDate { json["birthDate"] = birthDate.asJSON() } if let communication = self.communication { - json["communication"] = CodeableConcept.asJSONArray(communication) + json["communication"] = communication.map() { $0.asJSON() } } if let gender = self.gender { json["gender"] = gender.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let name = self.name { json["name"] = name.asJSON() } if let photo = self.photo { - json["photo"] = Attachment.asJSONArray(photo) + json["photo"] = photo.map() { $0.asJSON() } } if let practitionerRole = self.practitionerRole { - json["practitionerRole"] = PractitionerPractitionerRole.asJSONArray(practitionerRole) + json["practitionerRole"] = practitionerRole.map() { $0.asJSON() } } if let qualification = self.qualification { - json["qualification"] = PractitionerQualification.asJSONArray(qualification) + json["qualification"] = qualification.map() { $0.asJSON() } } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json @@ -305,10 +305,10 @@ public class PractitionerPractitionerRole: BackboneElement { var json = super.asJSON() if let healthcareService = self.healthcareService { - json["healthcareService"] = Reference.asJSONArray(healthcareService) + json["healthcareService"] = healthcareService.map() { $0.asJSON() } } if let location = self.location { - json["location"] = Reference.asJSONArray(location) + json["location"] = location.map() { $0.asJSON() } } if let managingOrganization = self.managingOrganization { json["managingOrganization"] = managingOrganization.asJSON() @@ -320,7 +320,7 @@ public class PractitionerPractitionerRole: BackboneElement { json["role"] = role.asJSON() } if let specialty = self.specialty { - json["specialty"] = CodeableConcept.asJSONArray(specialty) + json["specialty"] = specialty.map() { $0.asJSON() } } return json @@ -413,7 +413,7 @@ public class PractitionerQualification: BackboneElement { json["code"] = code.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let issuer = self.issuer { json["issuer"] = issuer.asJSON() diff --git a/Sources/Models/Procedure.swift b/Sources/Models/Procedure.swift index 2ee54a0d..38e7566f 100644 --- a/Sources/Models/Procedure.swift +++ b/Sources/Models/Procedure.swift @@ -330,7 +330,7 @@ public class Procedure: DomainResource { var json = super.asJSON() if let bodySite = self.bodySite { - json["bodySite"] = CodeableConcept.asJSONArray(bodySite) + json["bodySite"] = bodySite.map() { $0.asJSON() } } if let category = self.category { json["category"] = category.asJSON() @@ -339,19 +339,19 @@ public class Procedure: DomainResource { json["code"] = code.asJSON() } if let complication = self.complication { - json["complication"] = CodeableConcept.asJSONArray(complication) + json["complication"] = complication.map() { $0.asJSON() } } if let encounter = self.encounter { json["encounter"] = encounter.asJSON() } if let focalDevice = self.focalDevice { - json["focalDevice"] = ProcedureFocalDevice.asJSONArray(focalDevice) + json["focalDevice"] = focalDevice.map() { $0.asJSON() } } if let followUp = self.followUp { - json["followUp"] = CodeableConcept.asJSONArray(followUp) + json["followUp"] = followUp.map() { $0.asJSON() } } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let location = self.location { json["location"] = location.asJSON() @@ -360,7 +360,7 @@ public class Procedure: DomainResource { json["notPerformed"] = notPerformed.asJSON() } if let notes = self.notes { - json["notes"] = Annotation.asJSONArray(notes) + json["notes"] = notes.map() { $0.asJSON() } } if let outcome = self.outcome { json["outcome"] = outcome.asJSON() @@ -372,19 +372,19 @@ public class Procedure: DomainResource { json["performedPeriod"] = performedPeriod.asJSON() } if let performer = self.performer { - json["performer"] = ProcedurePerformer.asJSONArray(performer) + json["performer"] = performer.map() { $0.asJSON() } } if let reasonCodeableConcept = self.reasonCodeableConcept { json["reasonCodeableConcept"] = reasonCodeableConcept.asJSON() } if let reasonNotPerformed = self.reasonNotPerformed { - json["reasonNotPerformed"] = CodeableConcept.asJSONArray(reasonNotPerformed) + json["reasonNotPerformed"] = reasonNotPerformed.map() { $0.asJSON() } } if let reasonReference = self.reasonReference { json["reasonReference"] = reasonReference.asJSON() } if let report = self.report { - json["report"] = Reference.asJSONArray(report) + json["report"] = report.map() { $0.asJSON() } } if let request = self.request { json["request"] = request.asJSON() @@ -396,7 +396,7 @@ public class Procedure: DomainResource { json["subject"] = subject.asJSON() } if let used = self.used { - json["used"] = Reference.asJSONArray(used) + json["used"] = used.map() { $0.asJSON() } } return json diff --git a/Sources/Models/ProcedureRequest.swift b/Sources/Models/ProcedureRequest.swift index e4dfbc75..b148bafe 100644 --- a/Sources/Models/ProcedureRequest.swift +++ b/Sources/Models/ProcedureRequest.swift @@ -271,7 +271,7 @@ public class ProcedureRequest: DomainResource { json["asNeededCodeableConcept"] = asNeededCodeableConcept.asJSON() } if let bodySite = self.bodySite { - json["bodySite"] = CodeableConcept.asJSONArray(bodySite) + json["bodySite"] = bodySite.map() { $0.asJSON() } } if let code = self.code { json["code"] = code.asJSON() @@ -280,10 +280,10 @@ public class ProcedureRequest: DomainResource { json["encounter"] = encounter.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let notes = self.notes { - json["notes"] = Annotation.asJSONArray(notes) + json["notes"] = notes.map() { $0.asJSON() } } if let orderedOn = self.orderedOn { json["orderedOn"] = orderedOn.asJSON() diff --git a/Sources/Models/ProcessRequest.swift b/Sources/Models/ProcessRequest.swift index f82f317b..a47ee334 100644 --- a/Sources/Models/ProcessRequest.swift +++ b/Sources/Models/ProcessRequest.swift @@ -251,7 +251,7 @@ public class ProcessRequest: DomainResource { json["exclude"] = arr } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let include = self.include { var arr = [Any]() @@ -261,7 +261,7 @@ public class ProcessRequest: DomainResource { json["include"] = arr } if let item = self.item { - json["item"] = ProcessRequestItem.asJSONArray(item) + json["item"] = item.map() { $0.asJSON() } } if let nullify = self.nullify { json["nullify"] = nullify.asJSON() diff --git a/Sources/Models/ProcessResponse.swift b/Sources/Models/ProcessResponse.swift index 5b6d58cd..824404cc 100644 --- a/Sources/Models/ProcessResponse.swift +++ b/Sources/Models/ProcessResponse.swift @@ -198,16 +198,16 @@ public class ProcessResponse: DomainResource { json["disposition"] = disposition.asJSON() } if let error = self.error { - json["error"] = Coding.asJSONArray(error) + json["error"] = error.map() { $0.asJSON() } } if let form = self.form { json["form"] = form.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let notes = self.notes { - json["notes"] = ProcessResponseNotes.asJSONArray(notes) + json["notes"] = notes.map() { $0.asJSON() } } if let organization = self.organization { json["organization"] = organization.asJSON() diff --git a/Sources/Models/Provenance.swift b/Sources/Models/Provenance.swift index 2b6f556b..f507cb15 100644 --- a/Sources/Models/Provenance.swift +++ b/Sources/Models/Provenance.swift @@ -178,10 +178,10 @@ public class Provenance: DomainResource { json["activity"] = activity.asJSON() } if let agent = self.agent { - json["agent"] = ProvenanceAgent.asJSONArray(agent) + json["agent"] = agent.map() { $0.asJSON() } } if let entity = self.entity { - json["entity"] = ProvenanceEntity.asJSONArray(entity) + json["entity"] = entity.map() { $0.asJSON() } } if let location = self.location { json["location"] = location.asJSON() @@ -197,16 +197,16 @@ public class Provenance: DomainResource { json["policy"] = arr } if let reason = self.reason { - json["reason"] = CodeableConcept.asJSONArray(reason) + json["reason"] = reason.map() { $0.asJSON() } } if let recorded = self.recorded { json["recorded"] = recorded.asJSON() } if let signature = self.signature { - json["signature"] = Signature.asJSONArray(signature) + json["signature"] = signature.map() { $0.asJSON() } } if let target = self.target { - json["target"] = Reference.asJSONArray(target) + json["target"] = target.map() { $0.asJSON() } } return json @@ -303,7 +303,7 @@ public class ProvenanceAgent: BackboneElement { json["actor"] = actor.asJSON() } if let relatedAgent = self.relatedAgent { - json["relatedAgent"] = ProvenanceAgentRelatedAgent.asJSONArray(relatedAgent) + json["relatedAgent"] = relatedAgent.map() { $0.asJSON() } } if let role = self.role { json["role"] = role.asJSON() diff --git a/Sources/Models/Questionnaire.swift b/Sources/Models/Questionnaire.swift index cf7f31ee..9dd80623 100644 --- a/Sources/Models/Questionnaire.swift +++ b/Sources/Models/Questionnaire.swift @@ -152,7 +152,7 @@ public class Questionnaire: DomainResource { json["group"] = group.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let publisher = self.publisher { json["publisher"] = publisher.asJSON() @@ -168,7 +168,7 @@ public class Questionnaire: DomainResource { json["subjectType"] = arr } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } if let version = self.version { json["version"] = version.asJSON() @@ -302,16 +302,16 @@ public class QuestionnaireGroup: BackboneElement { var json = super.asJSON() if let concept = self.concept { - json["concept"] = Coding.asJSONArray(concept) + json["concept"] = concept.map() { $0.asJSON() } } if let group = self.group { - json["group"] = QuestionnaireGroup.asJSONArray(group) + json["group"] = group.map() { $0.asJSON() } } if let linkId = self.linkId { json["linkId"] = linkId.asJSON() } if let question = self.question { - json["question"] = QuestionnaireGroupQuestion.asJSONArray(question) + json["question"] = question.map() { $0.asJSON() } } if let repeats = self.repeats { json["repeats"] = repeats.asJSON() @@ -466,16 +466,16 @@ public class QuestionnaireGroupQuestion: BackboneElement { var json = super.asJSON() if let concept = self.concept { - json["concept"] = Coding.asJSONArray(concept) + json["concept"] = concept.map() { $0.asJSON() } } if let group = self.group { - json["group"] = QuestionnaireGroup.asJSONArray(group) + json["group"] = group.map() { $0.asJSON() } } if let linkId = self.linkId { json["linkId"] = linkId.asJSON() } if let option = self.option { - json["option"] = Coding.asJSONArray(option) + json["option"] = option.map() { $0.asJSON() } } if let options = self.options { json["options"] = options.asJSON() diff --git a/Sources/Models/QuestionnaireResponse.swift b/Sources/Models/QuestionnaireResponse.swift index d1b728bc..2af66225 100644 --- a/Sources/Models/QuestionnaireResponse.swift +++ b/Sources/Models/QuestionnaireResponse.swift @@ -285,13 +285,13 @@ public class QuestionnaireResponseGroup: BackboneElement { var json = super.asJSON() if let group = self.group { - json["group"] = QuestionnaireResponseGroup.asJSONArray(group) + json["group"] = group.map() { $0.asJSON() } } if let linkId = self.linkId { json["linkId"] = linkId.asJSON() } if let question = self.question { - json["question"] = QuestionnaireResponseGroupQuestion.asJSONArray(question) + json["question"] = question.map() { $0.asJSON() } } if let subject = self.subject { json["subject"] = subject.asJSON() @@ -371,7 +371,7 @@ public class QuestionnaireResponseGroupQuestion: BackboneElement { var json = super.asJSON() if let answer = self.answer { - json["answer"] = QuestionnaireResponseGroupQuestionAnswer.asJSONArray(answer) + json["answer"] = answer.map() { $0.asJSON() } } if let linkId = self.linkId { json["linkId"] = linkId.asJSON() @@ -580,7 +580,7 @@ public class QuestionnaireResponseGroupQuestionAnswer: BackboneElement { var json = super.asJSON() if let group = self.group { - json["group"] = QuestionnaireResponseGroup.asJSONArray(group) + json["group"] = group.map() { $0.asJSON() } } if let valueAttachment = self.valueAttachment { json["valueAttachment"] = valueAttachment.asJSON() diff --git a/Sources/Models/ReferralRequest.swift b/Sources/Models/ReferralRequest.swift index 2c71e903..415e6a13 100644 --- a/Sources/Models/ReferralRequest.swift +++ b/Sources/Models/ReferralRequest.swift @@ -253,7 +253,7 @@ public class ReferralRequest: DomainResource { json["fulfillmentTime"] = fulfillmentTime.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let patient = self.patient { json["patient"] = patient.asJSON() @@ -265,13 +265,13 @@ public class ReferralRequest: DomainResource { json["reason"] = reason.asJSON() } if let recipient = self.recipient { - json["recipient"] = Reference.asJSONArray(recipient) + json["recipient"] = recipient.map() { $0.asJSON() } } if let requester = self.requester { json["requester"] = requester.asJSON() } if let serviceRequested = self.serviceRequested { - json["serviceRequested"] = CodeableConcept.asJSONArray(serviceRequested) + json["serviceRequested"] = serviceRequested.map() { $0.asJSON() } } if let specialty = self.specialty { json["specialty"] = specialty.asJSON() @@ -280,7 +280,7 @@ public class ReferralRequest: DomainResource { json["status"] = status.asJSON() } if let supportingInformation = self.supportingInformation { - json["supportingInformation"] = Reference.asJSONArray(supportingInformation) + json["supportingInformation"] = supportingInformation.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() diff --git a/Sources/Models/RelatedPerson.swift b/Sources/Models/RelatedPerson.swift index e2f2a92a..75a950b4 100644 --- a/Sources/Models/RelatedPerson.swift +++ b/Sources/Models/RelatedPerson.swift @@ -166,7 +166,7 @@ public class RelatedPerson: DomainResource { var json = super.asJSON() if let address = self.address { - json["address"] = Address.asJSONArray(address) + json["address"] = address.map() { $0.asJSON() } } if let birthDate = self.birthDate { json["birthDate"] = birthDate.asJSON() @@ -175,7 +175,7 @@ public class RelatedPerson: DomainResource { json["gender"] = gender.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let name = self.name { json["name"] = name.asJSON() @@ -187,13 +187,13 @@ public class RelatedPerson: DomainResource { json["period"] = period.asJSON() } if let photo = self.photo { - json["photo"] = Attachment.asJSONArray(photo) + json["photo"] = photo.map() { $0.asJSON() } } if let relationship = self.relationship { json["relationship"] = relationship.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json diff --git a/Sources/Models/RiskAssessment.swift b/Sources/Models/RiskAssessment.swift index fd8aaf6f..d37ca6d9 100644 --- a/Sources/Models/RiskAssessment.swift +++ b/Sources/Models/RiskAssessment.swift @@ -156,7 +156,7 @@ public class RiskAssessment: DomainResource { var json = super.asJSON() if let basis = self.basis { - json["basis"] = Reference.asJSONArray(basis) + json["basis"] = basis.map() { $0.asJSON() } } if let condition = self.condition { json["condition"] = condition.asJSON() @@ -180,7 +180,7 @@ public class RiskAssessment: DomainResource { json["performer"] = performer.asJSON() } if let prediction = self.prediction { - json["prediction"] = RiskAssessmentPrediction.asJSONArray(prediction) + json["prediction"] = prediction.map() { $0.asJSON() } } if let subject = self.subject { json["subject"] = subject.asJSON() diff --git a/Sources/Models/Schedule.swift b/Sources/Models/Schedule.swift index 5177188f..fe37d512 100644 --- a/Sources/Models/Schedule.swift +++ b/Sources/Models/Schedule.swift @@ -109,13 +109,13 @@ public class Schedule: DomainResource { json["comment"] = comment.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let planningHorizon = self.planningHorizon { json["planningHorizon"] = planningHorizon.asJSON() } if let type = self.type { - json["type"] = CodeableConcept.asJSONArray(type) + json["type"] = type.map() { $0.asJSON() } } return json diff --git a/Sources/Models/SearchParameter.swift b/Sources/Models/SearchParameter.swift index f6a24342..8e086848 100644 --- a/Sources/Models/SearchParameter.swift +++ b/Sources/Models/SearchParameter.swift @@ -251,7 +251,7 @@ public class SearchParameter: DomainResource { json["code"] = code.asJSON() } if let contact = self.contact { - json["contact"] = SearchParameterContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let date = self.date { json["date"] = date.asJSON() @@ -353,7 +353,7 @@ public class SearchParameterContact: BackboneElement { json["name"] = name.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json diff --git a/Sources/Models/Signature.swift b/Sources/Models/Signature.swift index 6f40c4be..7465ec18 100644 --- a/Sources/Models/Signature.swift +++ b/Sources/Models/Signature.swift @@ -144,7 +144,7 @@ public class Signature: Element { json["contentType"] = contentType.asJSON() } if let type = self.type { - json["type"] = Coding.asJSONArray(type) + json["type"] = type.map() { $0.asJSON() } } if let when = self.when { json["when"] = when.asJSON() diff --git a/Sources/Models/Slot.swift b/Sources/Models/Slot.swift index 39d69643..62df6eae 100644 --- a/Sources/Models/Slot.swift +++ b/Sources/Models/Slot.swift @@ -160,7 +160,7 @@ public class Slot: DomainResource { json["freeBusyType"] = freeBusyType.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let overbooked = self.overbooked { json["overbooked"] = overbooked.asJSON() diff --git a/Sources/Models/Specimen.swift b/Sources/Models/Specimen.swift index edef2697..d3db15ef 100644 --- a/Sources/Models/Specimen.swift +++ b/Sources/Models/Specimen.swift @@ -171,13 +171,13 @@ public class Specimen: DomainResource { json["collection"] = collection.asJSON() } if let container = self.container { - json["container"] = SpecimenContainer.asJSONArray(container) + json["container"] = container.map() { $0.asJSON() } } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let parent = self.parent { - json["parent"] = Reference.asJSONArray(parent) + json["parent"] = parent.map() { $0.asJSON() } } if let receivedTime = self.receivedTime { json["receivedTime"] = receivedTime.asJSON() @@ -189,7 +189,7 @@ public class Specimen: DomainResource { json["subject"] = subject.asJSON() } if let treatment = self.treatment { - json["treatment"] = SpecimenTreatment.asJSONArray(treatment) + json["treatment"] = treatment.map() { $0.asJSON() } } if let type = self.type { json["type"] = type.asJSON() @@ -465,7 +465,7 @@ public class SpecimenContainer: BackboneElement { json["description"] = description_fhir.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let specimenQuantity = self.specimenQuantity { json["specimenQuantity"] = specimenQuantity.asJSON() @@ -542,7 +542,7 @@ public class SpecimenTreatment: BackboneElement { var json = super.asJSON() if let additive = self.additive { - json["additive"] = Reference.asJSONArray(additive) + json["additive"] = additive.map() { $0.asJSON() } } if let description_fhir = self.description_fhir { json["description"] = description_fhir.asJSON() diff --git a/Sources/Models/StructureDefinition.swift b/Sources/Models/StructureDefinition.swift index 7a6d218b..4ce671c1 100644 --- a/Sources/Models/StructureDefinition.swift +++ b/Sources/Models/StructureDefinition.swift @@ -368,13 +368,13 @@ public class StructureDefinition: DomainResource { json["base"] = base.asJSON() } if let code = self.code { - json["code"] = Coding.asJSONArray(code) + json["code"] = code.map() { $0.asJSON() } } if let constrainedType = self.constrainedType { json["constrainedType"] = constrainedType.asJSON() } if let contact = self.contact { - json["contact"] = StructureDefinitionContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let context = self.context { var arr = [Any]() @@ -408,13 +408,13 @@ public class StructureDefinition: DomainResource { json["fhirVersion"] = fhirVersion.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let kind = self.kind { json["kind"] = kind.asJSON() } if let mapping = self.mapping { - json["mapping"] = StructureDefinitionMapping.asJSONArray(mapping) + json["mapping"] = mapping.map() { $0.asJSON() } } if let name = self.name { json["name"] = name.asJSON() @@ -435,7 +435,7 @@ public class StructureDefinition: DomainResource { json["url"] = url.asJSON() } if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) + json["useContext"] = useContext.map() { $0.asJSON() } } if let version = self.version { json["version"] = version.asJSON() @@ -500,7 +500,7 @@ public class StructureDefinitionContact: BackboneElement { json["name"] = name.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json @@ -557,7 +557,7 @@ public class StructureDefinitionDifferential: BackboneElement { var json = super.asJSON() if let element = self.element { - json["element"] = ElementDefinition.asJSONArray(element) + json["element"] = element.map() { $0.asJSON() } } return json @@ -715,7 +715,7 @@ public class StructureDefinitionSnapshot: BackboneElement { var json = super.asJSON() if let element = self.element { - json["element"] = ElementDefinition.asJSONArray(element) + json["element"] = element.map() { $0.asJSON() } } return json diff --git a/Sources/Models/Subscription.swift b/Sources/Models/Subscription.swift index d0f11828..f09e1b25 100644 --- a/Sources/Models/Subscription.swift +++ b/Sources/Models/Subscription.swift @@ -159,7 +159,7 @@ public class Subscription: DomainResource { json["channel"] = channel.asJSON() } if let contact = self.contact { - json["contact"] = ContactPoint.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let criteria = self.criteria { json["criteria"] = criteria.asJSON() @@ -177,7 +177,7 @@ public class Subscription: DomainResource { json["status"] = status.asJSON() } if let tag = self.tag { - json["tag"] = Coding.asJSONArray(tag) + json["tag"] = tag.map() { $0.asJSON() } } return json diff --git a/Sources/Models/Substance.swift b/Sources/Models/Substance.swift index 50756c6a..43f9640d 100644 --- a/Sources/Models/Substance.swift +++ b/Sources/Models/Substance.swift @@ -115,7 +115,7 @@ public class Substance: DomainResource { var json = super.asJSON() if let category = self.category { - json["category"] = CodeableConcept.asJSONArray(category) + json["category"] = category.map() { $0.asJSON() } } if let code = self.code { json["code"] = code.asJSON() @@ -124,13 +124,13 @@ public class Substance: DomainResource { json["description"] = description_fhir.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let ingredient = self.ingredient { - json["ingredient"] = SubstanceIngredient.asJSONArray(ingredient) + json["ingredient"] = ingredient.map() { $0.asJSON() } } if let instance = self.instance { - json["instance"] = SubstanceInstance.asJSONArray(instance) + json["instance"] = instance.map() { $0.asJSON() } } return json diff --git a/Sources/Models/SupplyDelivery.swift b/Sources/Models/SupplyDelivery.swift index 7d81cd44..210e1a3b 100644 --- a/Sources/Models/SupplyDelivery.swift +++ b/Sources/Models/SupplyDelivery.swift @@ -180,7 +180,7 @@ public class SupplyDelivery: DomainResource { json["quantity"] = quantity.asJSON() } if let receiver = self.receiver { - json["receiver"] = Reference.asJSONArray(receiver) + json["receiver"] = receiver.map() { $0.asJSON() } } if let status = self.status { json["status"] = status.asJSON() diff --git a/Sources/Models/SupplyRequest.swift b/Sources/Models/SupplyRequest.swift index dccfa1ce..5d59869b 100644 --- a/Sources/Models/SupplyRequest.swift +++ b/Sources/Models/SupplyRequest.swift @@ -195,7 +195,7 @@ public class SupplyRequest: DomainResource { json["status"] = status.asJSON() } if let supplier = self.supplier { - json["supplier"] = Reference.asJSONArray(supplier) + json["supplier"] = supplier.map() { $0.asJSON() } } if let when = self.when { json["when"] = when.asJSON() diff --git a/Sources/Models/TestScript.swift b/Sources/Models/TestScript.swift index fc3dafce..e82239ad 100644 --- a/Sources/Models/TestScript.swift +++ b/Sources/Models/TestScript.swift @@ -306,7 +306,7 @@ public class TestScript: DomainResource { var json = super.asJSON() if let contact = self.contact { - json["contact"] = TestScriptContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let copyright = self.copyright { json["copyright"] = copyright.asJSON() @@ -321,7 +321,7 @@ public class TestScript: DomainResource { json["experimental"] = experimental.asJSON() } if let fixture = self.fixture { - json["fixture"] = TestScriptFixture.asJSONArray(fixture) + json["fixture"] = fixture.map() { $0.asJSON() } } if let identifier = self.identifier { json["identifier"] = identifier.asJSON() @@ -336,7 +336,7 @@ public class TestScript: DomainResource { json["name"] = name.asJSON() } if let profile = self.profile { - json["profile"] = Reference.asJSONArray(profile) + json["profile"] = profile.map() { $0.asJSON() } } if let publisher = self.publisher { json["publisher"] = publisher.asJSON() @@ -354,16 +354,16 @@ public class TestScript: DomainResource { json["teardown"] = teardown.asJSON() } if let test = self.test { - json["test"] = TestScriptTest.asJSONArray(test) + json["test"] = test.map() { $0.asJSON() } } if let url = self.url { json["url"] = url.asJSON() } if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) + json["useContext"] = useContext.map() { $0.asJSON() } } if let variable = self.variable { - json["variable"] = TestScriptVariable.asJSONArray(variable) + json["variable"] = variable.map() { $0.asJSON() } } if let version = self.version { json["version"] = version.asJSON() @@ -428,7 +428,7 @@ public class TestScriptContact: BackboneElement { json["name"] = name.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json @@ -573,10 +573,10 @@ public class TestScriptMetadata: BackboneElement { var json = super.asJSON() if let capability = self.capability { - json["capability"] = TestScriptMetadataCapability.asJSONArray(capability) + json["capability"] = capability.map() { $0.asJSON() } } if let link = self.link { - json["link"] = TestScriptMetadataLink.asJSONArray(link) + json["link"] = link.map() { $0.asJSON() } } return json @@ -848,7 +848,7 @@ public class TestScriptSetup: BackboneElement { var json = super.asJSON() if let action = self.action { - json["action"] = TestScriptSetupAction.asJSONArray(action) + json["action"] = action.map() { $0.asJSON() } } if let metadata = self.metadata { json["metadata"] = metadata.asJSON() @@ -1439,7 +1439,7 @@ public class TestScriptSetupActionOperation: BackboneElement { json["params"] = params.asJSON() } if let requestHeader = self.requestHeader { - json["requestHeader"] = TestScriptSetupActionOperationRequestHeader.asJSONArray(requestHeader) + json["requestHeader"] = requestHeader.map() { $0.asJSON() } } if let resource = self.resource { json["resource"] = resource.asJSON() @@ -1588,7 +1588,7 @@ public class TestScriptTeardown: BackboneElement { var json = super.asJSON() if let action = self.action { - json["action"] = TestScriptTeardownAction.asJSONArray(action) + json["action"] = action.map() { $0.asJSON() } } return json @@ -1725,7 +1725,7 @@ public class TestScriptTest: BackboneElement { var json = super.asJSON() if let action = self.action { - json["action"] = TestScriptTestAction.asJSONArray(action) + json["action"] = action.map() { $0.asJSON() } } if let description_fhir = self.description_fhir { json["description"] = description_fhir.asJSON() diff --git a/Sources/Models/ValueSet.swift b/Sources/Models/ValueSet.swift index ec1efd04..08c8f501 100644 --- a/Sources/Models/ValueSet.swift +++ b/Sources/Models/ValueSet.swift @@ -279,7 +279,7 @@ public class ValueSet: DomainResource { json["compose"] = compose.asJSON() } if let contact = self.contact { - json["contact"] = ValueSetContact.asJSONArray(contact) + json["contact"] = contact.map() { $0.asJSON() } } if let copyright = self.copyright { json["copyright"] = copyright.asJSON() @@ -324,7 +324,7 @@ public class ValueSet: DomainResource { json["url"] = url.asJSON() } if let useContext = self.useContext { - json["useContext"] = CodeableConcept.asJSONArray(useContext) + json["useContext"] = useContext.map() { $0.asJSON() } } if let version = self.version { json["version"] = version.asJSON() @@ -427,7 +427,7 @@ public class ValueSetCodeSystem: BackboneElement { json["caseSensitive"] = caseSensitive.asJSON() } if let concept = self.concept { - json["concept"] = ValueSetCodeSystemConcept.asJSONArray(concept) + json["concept"] = concept.map() { $0.asJSON() } } if let system = self.system { json["system"] = system.asJSON() @@ -556,13 +556,13 @@ public class ValueSetCodeSystemConcept: BackboneElement { json["code"] = code.asJSON() } if let concept = self.concept { - json["concept"] = ValueSetCodeSystemConcept.asJSONArray(concept) + json["concept"] = concept.map() { $0.asJSON() } } if let definition = self.definition { json["definition"] = definition.asJSON() } if let designation = self.designation { - json["designation"] = ValueSetCodeSystemConceptDesignation.asJSONArray(designation) + json["designation"] = designation.map() { $0.asJSON() } } if let display = self.display { json["display"] = display.asJSON() @@ -724,7 +724,7 @@ public class ValueSetCompose: BackboneElement { var json = super.asJSON() if let exclude = self.exclude { - json["exclude"] = ValueSetComposeInclude.asJSONArray(exclude) + json["exclude"] = exclude.map() { $0.asJSON() } } if let import_fhir = self.import_fhir { var arr = [Any]() @@ -734,7 +734,7 @@ public class ValueSetCompose: BackboneElement { json["import"] = arr } if let include = self.include { - json["include"] = ValueSetComposeInclude.asJSONArray(include) + json["include"] = include.map() { $0.asJSON() } } return json @@ -824,10 +824,10 @@ public class ValueSetComposeInclude: BackboneElement { var json = super.asJSON() if let concept = self.concept { - json["concept"] = ValueSetComposeIncludeConcept.asJSONArray(concept) + json["concept"] = concept.map() { $0.asJSON() } } if let filter = self.filter { - json["filter"] = ValueSetComposeIncludeFilter.asJSONArray(filter) + json["filter"] = filter.map() { $0.asJSON() } } if let system = self.system { json["system"] = system.asJSON() @@ -916,7 +916,7 @@ public class ValueSetComposeIncludeConcept: BackboneElement { json["code"] = code.asJSON() } if let designation = self.designation { - json["designation"] = ValueSetCodeSystemConceptDesignation.asJSONArray(designation) + json["designation"] = designation.map() { $0.asJSON() } } if let display = self.display { json["display"] = display.asJSON() @@ -1076,7 +1076,7 @@ public class ValueSetContact: BackboneElement { json["name"] = name.asJSON() } if let telecom = self.telecom { - json["telecom"] = ContactPoint.asJSONArray(telecom) + json["telecom"] = telecom.map() { $0.asJSON() } } return json @@ -1197,7 +1197,7 @@ public class ValueSetExpansion: BackboneElement { var json = super.asJSON() if let contains = self.contains { - json["contains"] = ValueSetExpansionContains.asJSONArray(contains) + json["contains"] = contains.map() { $0.asJSON() } } if let identifier = self.identifier { json["identifier"] = identifier.asJSON() @@ -1206,7 +1206,7 @@ public class ValueSetExpansion: BackboneElement { json["offset"] = offset.asJSON() } if let parameter = self.parameter { - json["parameter"] = ValueSetExpansionParameter.asJSONArray(parameter) + json["parameter"] = parameter.map() { $0.asJSON() } } if let timestamp = self.timestamp { json["timestamp"] = timestamp.asJSON() @@ -1325,7 +1325,7 @@ public class ValueSetExpansionContains: BackboneElement { json["code"] = code.asJSON() } if let contains = self.contains { - json["contains"] = ValueSetExpansionContains.asJSONArray(contains) + json["contains"] = contains.map() { $0.asJSON() } } if let display = self.display { json["display"] = display.asJSON() diff --git a/Sources/Models/VisionPrescription.swift b/Sources/Models/VisionPrescription.swift index ddf46ce6..ae375559 100644 --- a/Sources/Models/VisionPrescription.swift +++ b/Sources/Models/VisionPrescription.swift @@ -135,13 +135,13 @@ public class VisionPrescription: DomainResource { json["dateWritten"] = dateWritten.asJSON() } if let dispense = self.dispense { - json["dispense"] = VisionPrescriptionDispense.asJSONArray(dispense) + json["dispense"] = dispense.map() { $0.asJSON() } } if let encounter = self.encounter { json["encounter"] = encounter.asJSON() } if let identifier = self.identifier { - json["identifier"] = Identifier.asJSONArray(identifier) + json["identifier"] = identifier.map() { $0.asJSON() } } if let patient = self.patient { json["patient"] = patient.asJSON() diff --git a/Tests/ResourceTests.swift b/Tests/ResourceTests.swift index 12b54369..9f24b120 100644 --- a/Tests/ResourceTests.swift +++ b/Tests/ResourceTests.swift @@ -204,10 +204,10 @@ class LocalPatientServer: FHIROpenServer { req.resource = pat try! req.prepareData() - callback(req.response(http, data: req.data)) + callback(req.response(with: http, data: req.data)) } else { - callback(handler.response(http)) + callback(handler.response(with: http)) } lastPostedResource = handler.resource @@ -222,7 +222,7 @@ class LocalPatientServer: FHIROpenServer { handler.resource = last try! handler.prepareData() - callback(handler.response(http, data: handler.data)) + callback(handler.response(with: http, data: handler.data)) } else { callback(handler.notSent("\(request.httpMethod) without preceding “POST” is not supported")) diff --git a/fhir-parser b/fhir-parser index 99a7fc99..7c79b9dc 160000 --- a/fhir-parser +++ b/fhir-parser @@ -1 +1 @@ -Subproject commit 99a7fc99c3c18e134d895e9bf3f15360206c55a9 +Subproject commit 7c79b9dcce3b6f015b3bb5c323f6b16296009b77 From 48d3e4af83d8c70a0c3a5ebcbdf206d6a3b04b75 Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Tue, 27 Sep 2016 14:55:32 +0200 Subject: [PATCH 16/20] =?UTF-8?q?Add=20FHIR=E2=84=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6cb86cad..5653bebf 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,11 @@ FHIR Swift Classes ================== -These are [Swift](https://developer.apple.com/swift/) classes representing data models of [🔥 FHIR](http://www.hl7.org/fhir) resource profiles, compatible with **iOS 7** and **OS X 10.9** and later. +These are [Swift][] classes representing data models of [🔥 FHIR][fhir] resource profiles, compatible with **iOS 7** and **OS X 10.9** and later. Building _Swift 3_ frameworks requires Xcode 8 or later, using frameworks on iOS requires **iOS 8**. This work is [Apache licensed](LICENSE.txt). +FHIR® is the registered trademark of [HL7][] and is used with the permission of HL7. ### Versioning @@ -15,6 +16,7 @@ See the `develop` branch or specific `feature/x` branches for new Swift or FHIR Version | Swift | FHIR |   ---------|-----------|---------------|----------------------------- + **2.9** | 3.0 | `1.6.0.9663` | STU 3 Ballot, Sep 2016 **2.8** | 3.0 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) **2.4** | 2.2 | `1.6.0.9663` | STU 3 Ballot, Sept 2016 **2.3** | 2.3 | `1.0.2.7202` | DSTU 2 (_+ technical errata_) @@ -30,7 +32,7 @@ See the `develop` branch or specific `feature/x` branches for new Swift or FHIR SMART on FHIR ------------- -The [Swift-SMART](https://github.com/smart-on-fhir/Swift-SMART) framework utilizes these classes. +The [Swift-SMART][] framework utilizes these classes. It also adds an implementation of the _FHIRServer_ protocol to make for a complete FHIR client framework. - [Programming Guide](https://github.com/smart-on-fhir/Swift-SMART/wiki) with code examples @@ -66,7 +68,7 @@ Working, at least to some extent: - Serialize to JSON - Resolve contained/bundled/relative/absolute resource references - Contain resources -- Construct searches with NoSQL-like statements (cf. [fhir.js](https://github.com/FHIR/fhir.js)) +- Construct searches with NoSQL-like statements (cf. [fhir.js][]) - Perform operations - Use example resources for auto-created class unit tests + Tests deserialization from file @@ -85,7 +87,7 @@ Custom classes and protocols start with `FHIR` to not make them clash with profi FHIR Profile Data Models ------------------------ -Classes are generated from FHIR profiles with our [Python FHIR parser](https://github.com/smart-on-fhir/fhir-parser). +Classes are generated from FHIR profiles with our [Python FHIR parser][fhir-parser]. ### Verbousness @@ -146,3 +148,10 @@ If search is restricted to a reference property, this applies: - If the search token does contain a forward slash it is assumed to be an absolute reference and no `:InstanceType` will be appended: `GET {base-url}/Thing?referenced={uri}` + +[swift]: https://developer.apple.com/swift/ +[fhir]: http://www.hl7.org/fhir +[hl7]: http://hl7.org/ +[swift-smart]: https://github.com/smart-on-fhir/Swift-SMART +[fhir.js]: https://github.com/FHIR/fhir.js +[fhir-parser]: https://github.com/smart-on-fhir/fhir-parser From fae5a34e44016d2231f053597546f52cdfb62c42 Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Fri, 11 Nov 2016 11:43:25 -0500 Subject: [PATCH 17/20] Make compile on Linux Fixes #2 --- Sources/Client/FHIRSearch.swift | 6 +- Sources/Client/FHIRServerDataResponse.swift | 19 ++- Sources/Client/Resource+REST.swift | 4 +- Sources/Models/DateAndTime.swift | 127 ++++++++++++------ Sources/Models/FHIRTypes.swift | 10 +- Sources/Models/JSON-extensions.swift | 2 +- SwiftFHIR.xcodeproj/project.pbxproj | 22 ++- Tests/{ => ClientTests}/ExtensionsTest.swift | 0 Tests/{ => ClientTests}/FHIRSearchTests.swift | 0 Tests/{ => ClientTests}/ReferenceTests.swift | 0 Tests/{ => ClientTests}/RequestTests.swift | 0 Tests/{ => ClientTests}/ResourceTests.swift | 0 fhir-parser | 2 +- 13 files changed, 134 insertions(+), 58 deletions(-) rename Tests/{ => ClientTests}/ExtensionsTest.swift (100%) rename Tests/{ => ClientTests}/FHIRSearchTests.swift (100%) rename Tests/{ => ClientTests}/ReferenceTests.swift (100%) rename Tests/{ => ClientTests}/RequestTests.swift (100%) rename Tests/{ => ClientTests}/ResourceTests.swift (100%) diff --git a/Sources/Client/FHIRSearch.swift b/Sources/Client/FHIRSearch.swift index 98f8e774..adc1e576 100644 --- a/Sources/Client/FHIRSearch.swift +++ b/Sources/Client/FHIRSearch.swift @@ -149,7 +149,11 @@ open class FHIRSearch } else { let jsonres = response as! FHIRServerJSONResponse - let bundle = Bundle(json: jsonres.json) + #if !NO_MODEL_IMPORT + let bundle = Models.Bundle(json: jsonres.json) + #else + let bundle = SwiftFHIR.Bundle(json: jsonres.json) + #endif bundle._server = server if let entries = bundle.entry { for entry in entries { diff --git a/Sources/Client/FHIRServerDataResponse.swift b/Sources/Client/FHIRServerDataResponse.swift index 6fe4e7c1..b1e114e9 100644 --- a/Sources/Client/FHIRServerDataResponse.swift +++ b/Sources/Client/FHIRServerDataResponse.swift @@ -132,7 +132,7 @@ open class FHIRServerDataResponse: FHIRServerResponse { } // was there an error? - if let error = error as? NSError, NSURLErrorDomain == error.domain { + if let error = error, NSURLErrorDomain == error._domain { self.error = FHIRError.requestError(status, error.humanized) } else if let error = error as? FHIRError { @@ -150,8 +150,8 @@ open class FHIRServerDataResponse: FHIRServerResponse { public required init(error: Error) { self.status = 0 self.headers = [String: String]() - if NSURLErrorDomain == (error as NSError).domain { - self.error = FHIRError.requestError(status, (error as NSError).humanized) + if NSURLErrorDomain == error._domain { + self.error = FHIRError.requestError(status, error.humanized) } else if let error = error as? FHIRError { self.error = error @@ -278,14 +278,19 @@ open class FHIRServerJSONResponse: FHIRServerDataResponse { // MARK: - -extension NSError { +extension Error { /** - Return a human-readable, localized string for error codes of the NSURLErrorDomain (!!). + Return a human-readable, localized string for error codes of the NSURLErrorDomain. Will simply return `localizedDescription` for if the + receiver is not of that domain. + + The list of errors that are "humanized" is not necessarily exhaustive. All strings are returned `fhir_localized`. */ public var humanized: String { - assert(NSURLErrorDomain == domain, "Can only use this function with errors in the NSURLErrorDomain") - switch code { + guard NSURLErrorDomain == _domain else { + return localizedDescription + } + switch _code { case NSURLErrorBadURL: return "The URL was malformed".fhir_localized case NSURLErrorTimedOut: return "The connection timed out".fhir_localized case NSURLErrorUnsupportedURL: return "The URL scheme is not supported".fhir_localized diff --git a/Sources/Client/Resource+REST.swift b/Sources/Client/Resource+REST.swift index cae68f5b..1f1fa379 100644 --- a/Sources/Client/Resource+REST.swift +++ b/Sources/Client/Resource+REST.swift @@ -117,8 +117,8 @@ public extension Resource { catch let error { fhir_warn("Error applying response headers after `read` call: \(error)") } - if nil == resource.id { - resource.id = (path as NSString).lastPathComponent + if nil == resource.id, let lpc = URL(string: path) { + resource.id = lpc.lastPathComponent } callback(resource, nil) } diff --git a/Sources/Models/DateAndTime.swift b/Sources/Models/DateAndTime.swift index fa4cf5f4..381e201d 100644 --- a/Sources/Models/DateAndTime.swift +++ b/Sources/Models/DateAndTime.swift @@ -258,12 +258,22 @@ public struct FHIRTime: DateAndTime { return DateNSDateConverter.sharedConverter.create(fromTime: self) } + // TODO: this implementation uses a workaround using string coercion instead of format: "%02d:%02d:%@" because %@ with String is not + // supported on Linux (SR-957) public var description: String { if let secStr = tookSecondsFromString { + #if os(Linux) + return String(format: "%02d:%02d:", hour, minute) + secStr + #else return String(format: "%02d:%02d:%@", hour, minute, secStr) + #endif } if let s = second { + #if os(Linux) + return String(format: "%02d:%02d:", hour, minute) + ((s < 10) ? "0" : "") + String(format: "%g", s) + #else return String(format: "%02d:%02d:%@%g", hour, minute, (s < 10) ? "0" : "", s) + #endif } return String(format: "%02d:%02d", hour, minute) } @@ -381,7 +391,7 @@ public struct DateTime: DateAndTime { public var description: String { if let tm = time { if let tz = timeZoneString ?? timeZone?.offset() { - return String(format: "%@T%@%@", date.description, tm.description, tz) + return "\(date.description)T\(tm.description)\(tz)" } } return date.description @@ -493,7 +503,7 @@ public struct Instant: DateAndTime { public var description: String { let tz = timeZoneString ?? timeZone.offset() - return String(format: "%@T%@%@", date.description, time.description, tz) + return "\(date.description)T\(time.description)\(tz)" } public static func <(lhs: Instant, rhs: Instant) -> Bool { @@ -579,7 +589,7 @@ class DateNSDateConverter { let comp = calendar.dateComponents(flags, from: inDate) let date = FHIRDate(year: comp.year!, month: UInt8(comp.month!), day: UInt8(comp.day!)) - let zone = (comp as NSDateComponents).timeZone ?? utc + let zone = comp.timeZone ?? utc let secs = Double(comp.second!) + (Double(comp.nanosecond!) / 1000000000) let time = FHIRTime(hour: UInt8(comp.hour!), minute: UInt8(comp.minute!), second: secs) @@ -658,37 +668,31 @@ class DateAndTimeParser { // scan date (must have at least the year) if !isTimeOnly { - var year = 0 - if scanner.scanInt(&year) && year < 10000 { // dates above 9999 are considered special cases - var month = 0 - if scanner.scanString("-", into: nil) && scanner.scanInt(&month) && month <= 12 { - var day = 0 - if scanner.scanString("-", into: nil) && scanner.scanInt(&day) && day <= 31 { - date = FHIRDate(year: year, month: UInt8(month), day: UInt8(day)) + if let year = scanner.fhir_scanInt(), year < 10000 { // dates above 9999 are considered special cases + if nil != scanner.fhir_scanString("-"), let month = scanner.fhir_scanInt(), month <= 12 { + if nil != scanner.fhir_scanString("-"), let day = scanner.fhir_scanInt(), day <= 31 { + date = FHIRDate(year: Int(year), month: UInt8(month), day: UInt8(day)) } else { - date = FHIRDate(year: year, month: UInt8(month), day: nil) + date = FHIRDate(year: Int(year), month: UInt8(month), day: nil) } } else { - date = FHIRDate(year: year, month: nil, day: nil) + date = FHIRDate(year: Int(year), month: nil, day: nil) } } } // scan time - if isTimeOnly || scanner.scanString("T", into: nil) { - var hour = 0 - var minute = 0 - if scanner.scanInt(&hour) && hour >= 0 && hour < 24 && scanner.scanString(":", into: nil) - && scanner.scanInt(&minute) && minute >= 0 && minute < 60 { + if isTimeOnly || nil != scanner.fhir_scanString("T") { + if let hour = scanner.fhir_scanInt(), hour >= 0 && hour < 24 && nil != scanner.fhir_scanString(":"), + let minute = scanner.fhir_scanInt(), minute >= 0 && minute < 60 { let digitSet = CharacterSet.decimalDigits var decimalSet = NSMutableCharacterSet.decimalDigits decimalSet.insert(".") - var secStr: NSString? - if scanner.scanString(":", into: nil) && scanner.scanCharacters(from: decimalSet as CharacterSet, into: &secStr), let secStr = secStr as? String, let second = Double(secStr), second < 60.0 { + if nil != scanner.fhir_scanString(":"), let secStr = scanner.fhir_scanCharacters(from: decimalSet as CharacterSet), let second = Double(secStr), second < 60.0 { time = FHIRTime(hour: UInt8(hour), minute: UInt8(minute), second: second, secondsFromString: secStr) } else { @@ -696,35 +700,33 @@ class DateAndTimeParser { } // scan zone - if !scanner.isAtEnd { - var negStr: NSString? - if scanner.scanString("Z", into: nil) { + if !scanner.fhir_isAtEnd { + if nil != scanner.fhir_scanString("Z") { tz = TimeZone(abbreviation: "UTC") tzString = "Z" } - else if scanner.scanString("-", into: &negStr) || scanner.scanString("+", into: nil) { - tzString = (nil == negStr) ? "+" : "-" - var hourStr: NSString? - if scanner.scanCharacters(from: digitSet, into: &hourStr) { - tzString! += hourStr! as String + else if var tzStr = (scanner.fhir_scanString("-") ?? scanner.fhir_scanString("+")) { + if let hourStr = scanner.fhir_scanCharacters(from: digitSet) { + tzStr += hourStr var tzhour = 0 var tzmin = 0 - if 2 == hourStr?.length { - tzhour = hourStr!.integerValue - if scanner.scanString(":", into: nil) && scanner.scanInt(&tzmin) { - tzString! += (tzmin < 10) ? ":0\(tzmin)" : ":\(tzmin)" - if tzmin >= 60 { - tzmin = 0 + if 2 == hourStr.characters.count { + tzhour = Int(hourStr) ?? 0 + if nil != scanner.fhir_scanString(":"), let tzm = scanner.fhir_scanInt() { + tzStr += (tzm < 10) ? ":0\(tzm)" : ":\(tzm)" + if tzm < 60 { + tzmin = tzm } } } - else if 4 == hourStr?.length { - tzhour = Int(hourStr!.substring(to: 2))! - tzmin = Int(hourStr!.substring(from: 2))! + else if 4 == hourStr.characters.count { + tzhour = Int(hourStr.substring(to: hourStr.index(hourStr.startIndex, offsetBy: 2)))! + tzmin = Int(hourStr.substring(from: hourStr.index(hourStr.startIndex, offsetBy: 2)))! } let offset = tzhour * 3600 + tzmin * 60 - tz = TimeZone(secondsFromGMT: nil == negStr ? offset : -1 * offset) + tz = TimeZone(secondsFromGMT: "+" == tzStr ? offset : -1 * offset) + tzString = tzStr } } } @@ -786,7 +788,56 @@ extension TimeZone { let hr = abs((secsFromGMT / 3600) - (secsFromGMT % 3600)) let min = abs((secsFromGMT % 3600) / 60) - return String(format: "%@%02d:%02d", secsFromGMT >= 0 ? "+" : "-", hr, min) + return (secsFromGMT >= 0 ? "+" : "-") + String(format: "%02d:%02d", hr, min) + } +} + + +/** +Extend Scanner to account for interface differences between macOS and Linux (as of November 2016) +*/ +extension Scanner { + + public var fhir_isAtEnd: Bool { + #if os(Linux) + return atEnd + #else + return isAtEnd + #endif + } + + public func fhir_scanString(_ searchString: String) -> String? { + #if os(Linux) + return scanString(string: searchString) + #else + var str: NSString? + if scanString(searchString, into: &str) { + return str as? String + } + return nil + #endif + } + + public func fhir_scanCharacters(from set: CharacterSet) -> String? { + #if os(Linux) + return scanCharactersFromSet(set) + #else + var str: NSString? + if scanCharacters(from: set, into: &str) { + return str as? String + } + return nil + #endif + } + + public func fhir_scanInt() -> Int? { + var int = 0 + #if os(Linux) + let flag = scanInteger(&int) + #else + let flag = scanInt(&int) + #endif + return flag ? int : nil } } diff --git a/Sources/Models/FHIRTypes.swift b/Sources/Models/FHIRTypes.swift index 130567f6..ada99b00 100644 --- a/Sources/Models/FHIRTypes.swift +++ b/Sources/Models/FHIRTypes.swift @@ -71,9 +71,15 @@ public struct Base64Binary: ExpressibleByStringLiteral, CustomStringConvertible, extension String { /** Convenience getter using `NSLocalizedString()` with no comment. + + TODO: On Linux this currently simply returns self */ public var fhir_localized: String { + #if os(Linux) + return self + #else return NSLocalizedString(self, comment: "") + #endif } } @@ -82,7 +88,7 @@ Execute a `print()`, prepending filename, line and function/method name, if `DEB */ public func fhir_logIfDebug(_ message: @autoclosure () -> String, function: String = #function, file: String = #file, line: Int = #line) { #if DEBUG - print("SwiftFHIR [\((file as NSString).lastPathComponent):\(line)] \(function) \(message())") + print("SwiftFHIR [\(URL(fileURLWithPath: file).lastPathComponent):\(line)] \(function) \(message())") #endif } @@ -90,6 +96,6 @@ public func fhir_logIfDebug(_ message: @autoclosure () -> String, function: Stri Execute a `print()`, prepending filename, line and function/method name and "WARNING" prepended. */ public func fhir_warn(_ message: @autoclosure () -> String, function: String = #function, file: String = #file, line: Int = #line) { - print("SwiftFHIR [\((file as NSString).lastPathComponent):\(line)] \(function) WARNING: \(message())") + print("SwiftFHIR [\(URL(fileURLWithPath: file).lastPathComponent):\(line)] \(function) WARNING: \(message())") } diff --git a/Sources/Models/JSON-extensions.swift b/Sources/Models/JSON-extensions.swift index afebac3c..0c2c70cd 100644 --- a/Sources/Models/JSON-extensions.swift +++ b/Sources/Models/JSON-extensions.swift @@ -66,7 +66,7 @@ extension NSDecimalNumber { */ public convenience init(json: NSNumber) { if let _ = json.stringValue.characters.index(of: ".") { - self.init(string: NSString(format: "%.15g", json.doubleValue) as String) + self.init(string: String(format: "%.15g", json.doubleValue)) } else { self.init(string: "\(json)") diff --git a/SwiftFHIR.xcodeproj/project.pbxproj b/SwiftFHIR.xcodeproj/project.pbxproj index e04e4bdb..9b9602cb 100644 --- a/SwiftFHIR.xcodeproj/project.pbxproj +++ b/SwiftFHIR.xcodeproj/project.pbxproj @@ -441,6 +441,7 @@ EE545F3B1A66805600E17B0C /* SwiftFHIR.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE684C1E19A789BA00B5A2C0 /* SwiftFHIR.framework */; }; EE684CCF19A7CEF000B5A2C0 /* ExtensionsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE684CCE19A7CEF000B5A2C0 /* ExtensionsTest.swift */; }; EE6DA8631A5D4B3A00E00708 /* SwiftFHIR.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE6DA8571A5D4B1000E00708 /* SwiftFHIR.framework */; }; + EE8250411DD631610097A737 /* ResourceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE01F9721C58FC51003AEA7E /* ResourceTests.swift */; }; EE8901231B7E07D700F1EDBF /* Element+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8901221B7E07D700F1EDBF /* Element+Extensions.swift */; }; EE8901241B7E07D700F1EDBF /* Element+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8901221B7E07D700F1EDBF /* Element+Extensions.swift */; }; EE9B31F41ACAD93400980AA9 /* Resource+REST.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE9B31F31ACAD93400980AA9 /* Resource+REST.swift */; }; @@ -839,13 +840,9 @@ isa = PBXGroup; children = ( EE684C2C19A789BA00B5A2C0 /* Info.plist */, - EE684CCE19A7CEF000B5A2C0 /* ExtensionsTest.swift */, - EEE5DF361A5D862B002AFF53 /* FHIRSearchTests.swift */, - EE1F49D41C0D14F60095BF0F /* ReferenceTests.swift */, - EE01F9721C58FC51003AEA7E /* ResourceTests.swift */, - EE39069E1CD3E4F6008FECEA /* RequestTests.swift */, - EE1F49DE1C0D1BB40095BF0F /* TestResources */, + EE8250401DD62E0B0097A737 /* ClientTests */, EEEB096E19AD248700C324FC /* ModelTests */, + EE1F49DE1C0D1BB40095BF0F /* TestResources */, EEEE31191BB278E3008866E2 /* AppKit.framework */, ); path = Tests; @@ -991,6 +988,18 @@ path = Sources/Models; sourceTree = ""; }; + EE8250401DD62E0B0097A737 /* ClientTests */ = { + isa = PBXGroup; + children = ( + EE684CCE19A7CEF000B5A2C0 /* ExtensionsTest.swift */, + EEE5DF361A5D862B002AFF53 /* FHIRSearchTests.swift */, + EE1F49D41C0D14F60095BF0F /* ReferenceTests.swift */, + EE01F9721C58FC51003AEA7E /* ResourceTests.swift */, + EE39069E1CD3E4F6008FECEA /* RequestTests.swift */, + ); + path = ClientTests; + sourceTree = ""; + }; EE9B31F61ACAD94800980AA9 /* Client */ = { isa = PBXGroup; children = ( @@ -1734,6 +1743,7 @@ EE02F7E91ACF259B00179969 /* RiskAssessmentTests.swift in Sources */, EE02F7D51ACF259B00179969 /* PractitionerTests.swift in Sources */, EE02F7EB1ACF259B00179969 /* ScheduleTests.swift in Sources */, + EE8250411DD631610097A737 /* ResourceTests.swift in Sources */, EE02F7991ACF259B00179969 /* FamilyMemberHistoryTests.swift in Sources */, EE02F7AB1ACF259B00179969 /* ImmunizationTests.swift in Sources */, EE02F76F1ACF259B00179969 /* ContractTests.swift in Sources */, diff --git a/Tests/ExtensionsTest.swift b/Tests/ClientTests/ExtensionsTest.swift similarity index 100% rename from Tests/ExtensionsTest.swift rename to Tests/ClientTests/ExtensionsTest.swift diff --git a/Tests/FHIRSearchTests.swift b/Tests/ClientTests/FHIRSearchTests.swift similarity index 100% rename from Tests/FHIRSearchTests.swift rename to Tests/ClientTests/FHIRSearchTests.swift diff --git a/Tests/ReferenceTests.swift b/Tests/ClientTests/ReferenceTests.swift similarity index 100% rename from Tests/ReferenceTests.swift rename to Tests/ClientTests/ReferenceTests.swift diff --git a/Tests/RequestTests.swift b/Tests/ClientTests/RequestTests.swift similarity index 100% rename from Tests/RequestTests.swift rename to Tests/ClientTests/RequestTests.swift diff --git a/Tests/ResourceTests.swift b/Tests/ClientTests/ResourceTests.swift similarity index 100% rename from Tests/ResourceTests.swift rename to Tests/ClientTests/ResourceTests.swift diff --git a/fhir-parser b/fhir-parser index 7c79b9dc..37c75a3b 160000 --- a/fhir-parser +++ b/fhir-parser @@ -1 +1 @@ -Subproject commit 7c79b9dcce3b6f015b3bb5c323f6b16296009b77 +Subproject commit 37c75a3bdb4c3dfc0e925b0621293ba0b9b5205f From 8b77abbecf2603f5ffd000b846e0bd6b36c1acaf Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Fri, 11 Nov 2016 12:12:52 -0500 Subject: [PATCH 18/20] Move test resources outside of `Tests` --- SwiftFHIR.xcodeproj/project.pbxproj | 2 +- {Tests/TestResources => TestResources}/ReferenceAbsolute.json | 0 {Tests/TestResources => TestResources}/ReferenceBundled.json | 0 {Tests/TestResources => TestResources}/ReferenceContained1.json | 0 {Tests/TestResources => TestResources}/ReferenceContained2.json | 0 {Tests/TestResources => TestResources}/ReferenceRelative.json | 0 6 files changed, 1 insertion(+), 1 deletion(-) rename {Tests/TestResources => TestResources}/ReferenceAbsolute.json (100%) rename {Tests/TestResources => TestResources}/ReferenceBundled.json (100%) rename {Tests/TestResources => TestResources}/ReferenceContained1.json (100%) rename {Tests/TestResources => TestResources}/ReferenceContained2.json (100%) rename {Tests/TestResources => TestResources}/ReferenceRelative.json (100%) diff --git a/SwiftFHIR.xcodeproj/project.pbxproj b/SwiftFHIR.xcodeproj/project.pbxproj index 9b9602cb..0bb1fcde 100644 --- a/SwiftFHIR.xcodeproj/project.pbxproj +++ b/SwiftFHIR.xcodeproj/project.pbxproj @@ -727,7 +727,7 @@ EE1F49CE1C0D06360095BF0F /* FHIROpenServer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FHIROpenServer.swift; sourceTree = ""; }; EE1F49D11C0D11060095BF0F /* FHIRBaseServer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FHIRBaseServer.swift; sourceTree = ""; }; EE1F49D41C0D14F60095BF0F /* ReferenceTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReferenceTests.swift; sourceTree = ""; }; - EE1F49DE1C0D1BB40095BF0F /* TestResources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = TestResources; sourceTree = ""; }; + EE1F49DE1C0D1BB40095BF0F /* TestResources */ = {isa = PBXFileReference; lastKnownFileType = folder; name = TestResources; path = ../TestResources; sourceTree = ""; }; EE39069E1CD3E4F6008FECEA /* RequestTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RequestTests.swift; sourceTree = ""; }; EE684C1E19A789BA00B5A2C0 /* SwiftFHIR.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SwiftFHIR.framework; sourceTree = BUILT_PRODUCTS_DIR; }; EE684C2219A789BA00B5A2C0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; diff --git a/Tests/TestResources/ReferenceAbsolute.json b/TestResources/ReferenceAbsolute.json similarity index 100% rename from Tests/TestResources/ReferenceAbsolute.json rename to TestResources/ReferenceAbsolute.json diff --git a/Tests/TestResources/ReferenceBundled.json b/TestResources/ReferenceBundled.json similarity index 100% rename from Tests/TestResources/ReferenceBundled.json rename to TestResources/ReferenceBundled.json diff --git a/Tests/TestResources/ReferenceContained1.json b/TestResources/ReferenceContained1.json similarity index 100% rename from Tests/TestResources/ReferenceContained1.json rename to TestResources/ReferenceContained1.json diff --git a/Tests/TestResources/ReferenceContained2.json b/TestResources/ReferenceContained2.json similarity index 100% rename from Tests/TestResources/ReferenceContained2.json rename to TestResources/ReferenceContained2.json diff --git a/Tests/TestResources/ReferenceRelative.json b/TestResources/ReferenceRelative.json similarity index 100% rename from Tests/TestResources/ReferenceRelative.json rename to TestResources/ReferenceRelative.json From 6cbf29db75b2a092b0a03f18e5b70c01f70d4d9b Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Thu, 15 Dec 2016 12:24:49 +0100 Subject: [PATCH 19/20] =?UTF-8?q?Don=E2=80=99t=20reference=20SwiftFHIR=20i?= =?UTF-8?q?tself?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/Client/FHIRSearch.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Client/FHIRSearch.swift b/Sources/Client/FHIRSearch.swift index adc1e576..61ad0d34 100644 --- a/Sources/Client/FHIRSearch.swift +++ b/Sources/Client/FHIRSearch.swift @@ -152,7 +152,7 @@ open class FHIRSearch #if !NO_MODEL_IMPORT let bundle = Models.Bundle(json: jsonres.json) #else - let bundle = SwiftFHIR.Bundle(json: jsonres.json) + let bundle = Bundle(json: jsonres.json) #endif bundle._server = server if let entries = bundle.entry { From 4d712209b9a9bdefa269a1168c17103cc13a435a Mon Sep 17 00:00:00 2001 From: Pascal Pfiffner Date: Thu, 15 Dec 2016 12:44:52 +0100 Subject: [PATCH 20/20] Update Xcode settings --- .../xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme | 2 +- .../xcshareddata/xcschemes/SwiftFHIR-iOS.xcscheme | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme b/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme index 96b4ae60..91f951fd 100644 --- a/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme +++ b/SwiftFHIR.xcodeproj/xcshareddata/xcschemes/SwiftFHIR-OSX.xcscheme @@ -1,6 +1,6 @@