generated from StanfordBDHG/SwiftPackageTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Fixing procedure dates ## ♻️ Current situation & Problem Not all procedures had dates being extracted from the JSON resources. Without all of the dates being sent to the LLM, it cannot understand the full context and timeline of the patients procedures. ## ⚙️ Release Notes The only change in this PR was made in [FHIRResource.swift](2354244). The modification ensures that the end date of the procedure is taken in each of the resources (which is consistent between DSTU2 and R4). ``` if case let .period(period) = procedure.performed { return try? period.end?.value?.asNSDate() } ``` ## 📝 Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md). --------- Co-authored-by: Paul Schmiedmayer <[email protected]>
- Loading branch information
1 parent
d60882b
commit 07c2e56
Showing
9 changed files
with
212 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// This source file is part of the Stanford Spezi open source project | ||
// | ||
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import Foundation | ||
import ModelsR4 | ||
|
||
|
||
extension Condition.OnsetX { | ||
var date: Date? { | ||
switch self { | ||
case let .dateTime(date): | ||
return try? date.value?.asNSDate() | ||
case let .period(period): | ||
return period.date | ||
case .age: | ||
return nil | ||
case .range: | ||
return nil | ||
case .string: | ||
return nil | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Sources/SpeziFHIR/Extensions/DiagnosticReportEffectiveXR4+Date.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// This source file is part of the Stanford Spezi open source project | ||
// | ||
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import Foundation | ||
import ModelsR4 | ||
|
||
|
||
extension DiagnosticReport.EffectiveX { | ||
var date: Date? { | ||
switch self { | ||
case let .dateTime(date): | ||
return try? date.value?.asNSDate() | ||
case let .period(period): | ||
return period.date | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Sources/SpeziFHIR/Extensions/ImmunizationOccurrenceXR4+Date.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// This source file is part of the Stanford Spezi open source project | ||
// | ||
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import Foundation | ||
import ModelsR4 | ||
|
||
|
||
extension Immunization.OccurrenceX { | ||
var date: Date? { | ||
switch self { | ||
case let .dateTime(date): | ||
return try? date.value?.asNSDate() | ||
case .string: | ||
return nil | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Sources/SpeziFHIR/Extensions/MedicationAdministrationEffectiveXR4+Date.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// | ||
// This source file is part of the Stanford Spezi open source project | ||
// | ||
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import Foundation | ||
import ModelsR4 | ||
|
||
|
||
extension Period { | ||
var date: Date? { | ||
if let endDate = try? end?.value?.asNSDate() { | ||
return endDate | ||
} | ||
if let startDate = try? start?.value?.asNSDate() { | ||
return startDate | ||
} | ||
return nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// This source file is part of the Stanford Spezi open source project | ||
// | ||
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import Foundation | ||
import ModelsR4 | ||
|
||
|
||
extension MedicationAdministration.EffectiveX { | ||
var date: Date? { | ||
switch self { | ||
case let .dateTime(date): | ||
return try? date.value?.asNSDate() | ||
case let .period(period): | ||
return period.date | ||
} | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
Sources/SpeziFHIR/Extensions/ProcedurePerformedXR4+Date.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// This source file is part of the Stanford Spezi open source project | ||
// | ||
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import Foundation | ||
import ModelsR4 | ||
|
||
|
||
extension Procedure.PerformedX { | ||
var date: Date? { | ||
switch self { | ||
case let .dateTime(date): | ||
return try? date.value?.asNSDate() | ||
case let .period(period): | ||
return period.date | ||
case .age: | ||
return nil | ||
case .range: | ||
return nil | ||
case .string: | ||
return nil | ||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
Sources/SpeziFHIR/Extensions/SupplyDeliveryOccurrenceXR4+Date.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// This source file is part of the Stanford Spezi open source project | ||
// | ||
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import Foundation | ||
import ModelsR4 | ||
|
||
|
||
extension SupplyDelivery.OccurrenceX { | ||
var date: Date? { | ||
switch self { | ||
case let .dateTime(date): | ||
return try? date.value?.asNSDate() | ||
case let .period(period): | ||
return period.date | ||
case .timing: | ||
return nil | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters