generated from StanfordBDHG/NextJSTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Use engagehf-models package ## ♻️ Current situation & Problem Previously, model types were copied from Firebase repository. This PR aims to clean this up. Closes #15 ## ✅ Testing It's a draft, because it relies on features from StanfordBDHG/ENGAGE-HF-Firebase#128 to work. We can merge this as StanfordBDHG/ENGAGE-HF-Firebase#128 gets released. ### Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordBDHG/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordBDHG/.github/blob/main/CONTRIBUTING.md).
- Loading branch information
1 parent
ad11c0a
commit 3c4f08a
Showing
45 changed files
with
7,821 additions
and
14,065 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
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
File renamed without changes.
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
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,62 @@ | ||
// | ||
// This source file is part of the ENGAGE-HF project based on the Stanford Spezi Template Application project | ||
// | ||
// SPDX-FileCopyrightText: 2023 Stanford University | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
import { type FHIRMedicationRequest } from '@/modules/firebase/models' | ||
|
||
export const getMedicationRequestData = (medication: { | ||
medication: string | ||
drug: string | ||
frequencyPerDay: number | ||
quantity: number | ||
instructions: string | ||
}): FHIRMedicationRequest => ({ | ||
id: null, | ||
extension: null, | ||
resourceType: 'MedicationRequest', | ||
medicationReference: { | ||
reference: `medications/${medication.medication}/drugs/${medication.drug}`, | ||
type: null, | ||
display: null, | ||
identifier: null, | ||
}, | ||
dosageInstruction: [ | ||
{ | ||
text: medication.instructions, | ||
timing: { | ||
code: null, | ||
repeat: { | ||
frequency: medication.frequencyPerDay, | ||
period: 1, | ||
periodUnit: 'd', | ||
timeOfDay: null, | ||
}, | ||
}, | ||
doseAndRate: [ | ||
{ | ||
type: null, | ||
doseQuantity: { | ||
code: '{tbl}', | ||
system: 'http://unitsofmeasure.org', | ||
unit: 'tbl.', | ||
value: medication.quantity, | ||
}, | ||
}, | ||
], | ||
patientInstruction: null, | ||
}, | ||
], | ||
}) | ||
|
||
export const getMedicationRequestMedicationIds = ( | ||
request: FHIRMedicationRequest, | ||
) => { | ||
const reference = request.medicationReference?.reference.split('/') | ||
return { | ||
medicationId: reference?.at(1), | ||
drugId: reference?.at(3), | ||
} | ||
} |
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,63 @@ | ||
// | ||
// This source file is part of the Stanford Biodesign Digital Health ENGAGE-HF open-source project | ||
// | ||
// SPDX-FileCopyrightText: 2023 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
import type { | ||
fhirAllergyIntoleranceConverter, | ||
fhirAppointmentConverter, | ||
fhirCodingConverter, | ||
fhirElementConverter, | ||
fhirMedicationRequestConverter, | ||
fhirObservationConverter, | ||
fhirResourceConverter, | ||
InferEncoded, | ||
invitationConverter, | ||
medicationClassConverter, | ||
organizationConverter, | ||
userConverter, | ||
} from '@stanfordbdhg/engagehf-models' | ||
|
||
export type Organization = InferEncoded<typeof organizationConverter> & { | ||
id: string | ||
} | ||
|
||
export type Invitation = InferEncoded<typeof invitationConverter> | ||
|
||
export type User = InferEncoded<typeof userConverter> & { id: string } | ||
|
||
export type FHIRElement = InferEncoded<typeof fhirElementConverter> | ||
export const basicFhirElement: FHIRElement = { | ||
id: null, | ||
extension: null, | ||
} | ||
|
||
export type FHIRResource = InferEncoded<typeof fhirResourceConverter> | ||
|
||
export type FHIRCoding = InferEncoded<typeof fhirCodingConverter> | ||
export const basicFhirCoding: FHIRCoding = { | ||
...basicFhirElement, | ||
system: null, | ||
version: null, | ||
code: null, | ||
display: null, | ||
userSelected: null, | ||
} | ||
|
||
export type FHIRMedicationRequest = InferEncoded< | ||
typeof fhirMedicationRequestConverter | ||
> | ||
|
||
export type MedicationClass = InferEncoded<typeof medicationClassConverter> | ||
|
||
export type FHIRObservation = InferEncoded<typeof fhirObservationConverter> | ||
|
||
export type FHIRAllergyIntolerance = InferEncoded< | ||
typeof fhirAllergyIntoleranceConverter | ||
> | ||
|
||
export type FHIRAppointment = InferEncoded<typeof fhirAppointmentConverter> | ||
|
||
export type LocalizedText = string | Record<string, string> |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.