Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding medical record wizard for lab results. #350

Merged
merged 5 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixing pagination.
  • Loading branch information
AnalogJ committed Dec 8, 2023
commit c9b3e82f5ea50ac7a18629b5298ab2a61d155b0f
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ <h4 class="modal-title" id="modal-basic-title">DICOM tags</h4>
class="mr-auto"
[collectionSize]="metaData.length"
[(page)]="tagsPage"
[maxSize]="15"
[pageSize]="tagsPageSize"
(pageChange)="refreshTags()"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,13 @@ export class ObservationComponent implements OnInit {


//populate chart data

this.barChartLabels.push(
formatDate(this.displayModel?.effective_date, "mediumDate", "en-US", undefined)
)
if(this.displayModel?.effective_date) {
this.barChartLabels.push(
formatDate(this.displayModel?.effective_date, "mediumDate", "en-US", undefined)
)
} else {
this.barChartLabels.push("")
}

this.barChartData[0].data = [[this.displayModel?.reference_range?.[0]?.low?.value, this.displayModel?.reference_range?.[0]?.high?.value]]
this.barChartData[1].data = [[this.displayModel?.value_quantity_value as number, this.displayModel?.value_quantity_value as number]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Resource,
Bundle,
Organization,
Practitioner, MedicationRequest, Patient, Encounter, DocumentReference, Media, DiagnosticReport, Reference, Binary, HumanName
Practitioner, MedicationRequest, Patient, Encounter, DocumentReference, Media, DiagnosticReport, Reference, Binary, HumanName, Observation
} from 'fhir/r4';
import {uuidV4} from '../../../lib/utils/uuid';
import {OrganizationModel} from '../../../lib/models/resources/organization-model';
Expand All @@ -24,14 +24,14 @@ import {FastenDisplayModel} from '../../../lib/models/fasten/fasten-display-mode
import {generateReferenceUriFromResourceOrReference} from '../../../lib/utils/bundle_references';
import {HumanNameModel} from '../../../lib/models/datatypes/human-name-model';

export interface WizardFhirResourceWrapper<T extends OrganizationModel | PractitionerModel | EncounterModel> {
export interface WizardFhirResourceWrapper<T extends OrganizationModel | PractitionerModel | EncounterModel | Bundle> {
data: T,
action: 'find'|'create'
}

interface ResourceStorage {
[resourceType: string]: {
[resourceId: string]: Condition | Patient | MedicationRequest | Organization | FhirLocation | Practitioner | Procedure | Encounter | DocumentReference | Media | DiagnosticReport | Binary | Reference
[resourceId: string]: Condition | Patient | MedicationRequest | Organization | FhirLocation | Practitioner | Procedure | Encounter | DocumentReference | Media | DiagnosticReport | Binary | Observation | Reference
}
}

Expand Down Expand Up @@ -72,6 +72,9 @@ export function GenerateR4ResourceLookup(resourceCreate: MedicalRecordWizardForm

//DocumentReference -> (Optional) Binary
//DiagnosticReport -> Media
for(let labresult of resourceCreate.labresults) {
resourceStorage = resourceCreateLabResultsToR4DiagnosticReports(resourceStorage, labresult)
}
//ImagingStudy
//ImagingSelection

Expand Down Expand Up @@ -436,6 +439,24 @@ function resourceAttachmentToR4DiagnosticReport(resourceStorage: ResourceStorage
return resourceStorage
}

function resourceCreateLabResultsToR4DiagnosticReports(resourceStorage: ResourceStorage, resourceLabResult: WizardFhirResourceWrapper<Bundle>): ResourceStorage {
resourceLabResult.data.entry.forEach((entry) => {

if (entry.resource.resourceType === 'Observation') {
resourceStorage['Observation'] = resourceStorage['Observation'] || {}
let resource = entry.resource as Observation
resourceStorage['Observation'][resource.id] = resource
} else if (entry.resource.resourceType === 'DiagnosticReport') {
resourceStorage['DiagnosticReport'] = resourceStorage['DiagnosticReport'] || {}
let resource = entry.resource as DiagnosticReport
resourceStorage['DiagnosticReport'][resource.id] = resource
} else {
console.log('Unknown resource type: ', entry.resource.resourceType)
}
})
return resourceStorage
}


function findEncounter(resourceStorage: ResourceStorage): Encounter | Reference {
let [encounterId] = Object.keys(resourceStorage['Encounter'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ <h1 class="az-dashboard-title">Condition</h1>
[collectionSize]="allEncountersIds.length"
[(page)]="currentPage"
[pageSize]="pageSize"
[maxSize]="15"
(pageChange)="pageChange()"
>
</ngb-pagination>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ <h1 class="az-dashboard-title">Observations</h1>
<div class="col-12 d-flex justify-content-center flex-nowrap">
<ngb-pagination
[collectionSize]="allObservationGroups.length"
[maxSize]="15"
[(page)]="currentPage"
[pageSize]="pageSize"
(pageChange)="populateObservationsForCurrentPage()"
Expand Down