From 032f940b966510c5dd257de8ff5d6965ef6ced24 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Fri, 11 Aug 2023 15:51:33 -0600 Subject: [PATCH 1/6] ui fixes for medical history page. (broken details links and [Object object]) --- .../allergy-intolerance.component.ts | 4 ++-- .../fhir/resources/binary/binary.component.ts | 3 ++- .../resources/immunization/immunization.component.ts | 4 ++-- .../medication-request/medication-request.component.ts | 4 ++-- .../resources/medication/medication.component.html | 2 +- .../fhir/resources/medication/medication.component.ts | 9 +++++---- .../resources/practitioner/practitioner.component.ts | 4 ++-- .../fhir/resources/procedure/procedure.component.ts | 4 ++-- .../report-medical-history-condition.component.html | 2 +- .../src/lib/models/resources/adverse-event-model.ts | 3 +++ .../lib/models/resources/allergy-intolerance-model.ts | 3 +++ frontend/src/lib/models/resources/appointment-model.ts | 3 ++- frontend/src/lib/models/resources/care-plan-model.ts | 5 ++++- frontend/src/lib/models/resources/care-team-model.ts | 2 +- frontend/src/lib/models/resources/condition-model.ts | 3 ++- frontend/src/lib/models/resources/device-model.ts | 2 ++ .../lib/models/resources/diagnostic-report-model.ts | 2 ++ .../lib/models/resources/document-reference-model.ts | 3 ++- frontend/src/lib/models/resources/encounter-model.ts | 3 ++- .../lib/models/resources/medication-dispense-model.ts | 3 ++- frontend/src/lib/models/resources/medication-model.ts | 10 ++++------ .../lib/models/resources/medication-request-model.ts | 6 ++++-- frontend/src/lib/models/resources/observation-model.ts | 3 ++- frontend/src/lib/models/resources/procedure-model.ts | 3 ++- 24 files changed, 56 insertions(+), 34 deletions(-) diff --git a/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.ts b/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.ts index aa3e7029d..9db9d7020 100644 --- a/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.ts +++ b/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.ts @@ -1,7 +1,7 @@ import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core'; import {FhirResourceComponentInterface} from '../../fhir-resource/fhir-resource-component-interface'; import {TableRowItem, TableRowItemDataType} from '../../common/table/table-row-item'; -import {Router} from '@angular/router'; +import {Router, RouterModule} from '@angular/router'; import {AllergyIntoleranceModel} from '../../../../../lib/models/resources/allergy-intolerance-model'; import {NgbCollapseModule} from "@ng-bootstrap/ng-bootstrap"; import {CommonModule} from "@angular/common"; @@ -10,7 +10,7 @@ import {TableComponent} from "../../common/table/table.component"; @Component({ standalone: true, - imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent], + imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent, RouterModule], selector: 'fhir-allergy-intolerance', templateUrl: './allergy-intolerance.component.html', styleUrls: ['./allergy-intolerance.component.scss'] diff --git a/frontend/src/app/components/fhir/resources/binary/binary.component.ts b/frontend/src/app/components/fhir/resources/binary/binary.component.ts index 73169e9fe..191a2e552 100644 --- a/frontend/src/app/components/fhir/resources/binary/binary.component.ts +++ b/frontend/src/app/components/fhir/resources/binary/binary.component.ts @@ -1,7 +1,7 @@ import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core'; import {BinaryModel} from '../../../../../lib/models/resources/binary-model'; import {FhirResourceComponentInterface} from '../../fhir-resource/fhir-resource-component-interface'; -import {Router} from '@angular/router'; +import {Router, RouterModule} from '@angular/router'; import {AttachmentModel} from '../../../../../lib/models/datatypes/attachment-model'; import {FastenApiService} from '../../../../services/fasten-api.service'; import {NgbCollapseModule} from "@ng-bootstrap/ng-bootstrap"; @@ -30,6 +30,7 @@ import {AuthService} from "../../../../services/auth.service"; BinaryTextComponent, DicomComponent, HighlightModule, + RouterModule ], providers: [FastenApiService, AuthService], selector: 'fhir-binary', diff --git a/frontend/src/app/components/fhir/resources/immunization/immunization.component.ts b/frontend/src/app/components/fhir/resources/immunization/immunization.component.ts index 6807384f9..88f3c5233 100644 --- a/frontend/src/app/components/fhir/resources/immunization/immunization.component.ts +++ b/frontend/src/app/components/fhir/resources/immunization/immunization.component.ts @@ -1,6 +1,6 @@ import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core'; import {FhirResourceComponentInterface} from '../../fhir-resource/fhir-resource-component-interface'; -import {Router} from '@angular/router'; +import {Router, RouterModule} from '@angular/router'; import {ImmunizationModel} from '../../../../../lib/models/resources/immunization-model'; import {TableRowItem, TableRowItemDataType} from '../../common/table/table-row-item'; import * as _ from "lodash"; @@ -11,7 +11,7 @@ import {TableComponent} from "../../common/table/table.component"; @Component({ standalone: true, - imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent], + imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent, RouterModule], selector: 'fhir-immunization', templateUrl: './immunization.component.html', styleUrls: ['./immunization.component.scss'] diff --git a/frontend/src/app/components/fhir/resources/medication-request/medication-request.component.ts b/frontend/src/app/components/fhir/resources/medication-request/medication-request.component.ts index 9aec51320..bb7c26ef9 100644 --- a/frontend/src/app/components/fhir/resources/medication-request/medication-request.component.ts +++ b/frontend/src/app/components/fhir/resources/medication-request/medication-request.component.ts @@ -1,7 +1,7 @@ import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core'; import {FhirResourceComponentInterface} from '../../fhir-resource/fhir-resource-component-interface'; import {TableRowItem, TableRowItemDataType} from '../../common/table/table-row-item'; -import {Router} from '@angular/router'; +import {Router, RouterModule} from '@angular/router'; import {MedicationRequestModel} from '../../../../../lib/models/resources/medication-request-model'; import {NgbCollapseModule} from "@ng-bootstrap/ng-bootstrap"; import {CommonModule} from "@angular/common"; @@ -11,7 +11,7 @@ import {GlossaryLookupComponent} from '../../../glossary-lookup/glossary-lookup. @Component({ standalone: true, - imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent, GlossaryLookupComponent], + imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent, GlossaryLookupComponent, RouterModule], selector: 'fhir-medication-request', templateUrl: './medication-request.component.html', styleUrls: ['./medication-request.component.scss'] diff --git a/frontend/src/app/components/fhir/resources/medication/medication.component.html b/frontend/src/app/components/fhir/resources/medication/medication.component.html index 20f72813b..558bf8de4 100644 --- a/frontend/src/app/components/fhir/resources/medication/medication.component.html +++ b/frontend/src/app/components/fhir/resources/medication/medication.component.html @@ -1,7 +1,7 @@
-
{{displayModel?.title?.display}}
+
{{displayModel?.title}}

Start date {{displayModel?.sort_date | date}}

{{displayModel?.status}} diff --git a/frontend/src/app/components/fhir/resources/medication/medication.component.ts b/frontend/src/app/components/fhir/resources/medication/medication.component.ts index 955bfd4f1..a1f1d8a13 100644 --- a/frontend/src/app/components/fhir/resources/medication/medication.component.ts +++ b/frontend/src/app/components/fhir/resources/medication/medication.component.ts @@ -1,17 +1,18 @@ import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core'; import {FhirResourceComponentInterface} from '../../fhir-resource/fhir-resource-component-interface'; import {TableRowItem, TableRowItemDataType} from '../../common/table/table-row-item'; -import {Router} from '@angular/router'; +import {Router, RouterModule} from '@angular/router'; import {MedicationModel} from '../../../../../lib/models/resources/medication-model'; import {NgbCollapseModule} from "@ng-bootstrap/ng-bootstrap"; import {CommonModule} from "@angular/common"; import {BadgeComponent} from "../../common/badge/badge.component"; import {TableComponent} from "../../common/table/table.component"; import {GlossaryLookupComponent} from '../../../glossary-lookup/glossary-lookup.component'; +import * as _ from "lodash"; @Component({ standalone: true, - imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent, GlossaryLookupComponent], + imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent, GlossaryLookupComponent, RouterModule], selector: 'fhir-medication', templateUrl: './medication.component.html', styleUrls: ['./medication.component.scss'] @@ -31,8 +32,8 @@ export class MedicationComponent implements OnInit, FhirResourceComponentInterfa constructor(public changeRef: ChangeDetectorRef, public router: Router) {} ngOnInit(): void { - this.resourceCode = this.displayModel?.title?.code - this.resourceCodeSystem = this.displayModel?.title?.system + this.resourceCode = _.get(this.displayModel?.code, 'coding[0].code') + this.resourceCodeSystem = _.get(this.displayModel?.code, 'coding[0].system') this.tableData = [ { diff --git a/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts b/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts index 845fe5a67..87039ab84 100644 --- a/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts +++ b/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts @@ -2,7 +2,7 @@ import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core'; import {FhirResourceComponentInterface} from '../../fhir-resource/fhir-resource-component-interface'; import {ImmunizationModel} from '../../../../../lib/models/resources/immunization-model'; import {TableRowItem} from '../../common/table/table-row-item'; -import {Router} from '@angular/router'; +import {Router, RouterModule} from '@angular/router'; import {PractitionerModel} from '../../../../../lib/models/resources/practitioner-model'; import {NgbCollapseModule} from "@ng-bootstrap/ng-bootstrap"; import {CommonModule} from "@angular/common"; @@ -11,7 +11,7 @@ import {TableComponent} from "../../common/table/table.component"; @Component({ standalone: true, - imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent], + imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent, RouterModule], selector: 'app-practitioner', templateUrl: './practitioner.component.html', styleUrls: ['./practitioner.component.scss'] diff --git a/frontend/src/app/components/fhir/resources/procedure/procedure.component.ts b/frontend/src/app/components/fhir/resources/procedure/procedure.component.ts index d7664b135..e73dcc107 100644 --- a/frontend/src/app/components/fhir/resources/procedure/procedure.component.ts +++ b/frontend/src/app/components/fhir/resources/procedure/procedure.component.ts @@ -1,7 +1,7 @@ import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core'; import {FhirResourceComponentInterface} from '../../fhir-resource/fhir-resource-component-interface'; import {TableRowItem, TableRowItemDataType} from '../../common/table/table-row-item'; -import {Router} from '@angular/router'; +import {Router, RouterModule} from '@angular/router'; import {ProcedureModel} from '../../../../../lib/models/resources/procedure-model'; import {NgbCollapseModule} from "@ng-bootstrap/ng-bootstrap"; import {CommonModule} from "@angular/common"; @@ -11,7 +11,7 @@ import {GlossaryLookupComponent} from '../../../glossary-lookup/glossary-lookup. @Component({ standalone: true, - imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent, GlossaryLookupComponent], + imports: [NgbCollapseModule, CommonModule, BadgeComponent, TableComponent, GlossaryLookupComponent, RouterModule], selector: 'fhir-procedure', templateUrl: './procedure.component.html', styleUrls: ['./procedure.component.scss'] diff --git a/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.html b/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.html index d9249ff5c..0ebbf6501 100644 --- a/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.html +++ b/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.html @@ -80,7 +80,7 @@
  • - {{medication.title}} + {{medication.title }} diff --git a/frontend/src/lib/models/resources/adverse-event-model.ts b/frontend/src/lib/models/resources/adverse-event-model.ts index facf41828..2fbdabbbf 100644 --- a/frontend/src/lib/models/resources/adverse-event-model.ts +++ b/frontend/src/lib/models/resources/adverse-event-model.ts @@ -6,6 +6,8 @@ import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; export class AdverseEventModel extends FastenDisplayModel { + code: CodableConceptModel | undefined + subject: ReferenceModel | undefined description: string | undefined event_type: string | undefined @@ -25,6 +27,7 @@ export class AdverseEventModel extends FastenDisplayModel { commonDTO(fhirResource:any ){ + this.code = _.get(fhirResource, 'event'); this.subject = _.get(fhirResource, 'subject'); this.date = _.get(fhirResource, 'date'); let seriousness = _.get(fhirResource, 'seriousness', []) diff --git a/frontend/src/lib/models/resources/allergy-intolerance-model.ts b/frontend/src/lib/models/resources/allergy-intolerance-model.ts index db92b6393..38cd2316f 100644 --- a/frontend/src/lib/models/resources/allergy-intolerance-model.ts +++ b/frontend/src/lib/models/resources/allergy-intolerance-model.ts @@ -4,8 +4,10 @@ import {fhirVersions, ResourceType} from '../constants' import {ReferenceModel} from '../datatypes/reference-model'; import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; +import {CodableConceptModel} from '../datatypes/codable-concept-model'; export class AllergyIntoleranceModel extends FastenDisplayModel { + code: CodableConceptModel | undefined title: string | undefined status: string | undefined @@ -26,6 +28,7 @@ export class AllergyIntoleranceModel extends FastenDisplayModel { commonDTO(fhirResource: any) { + this.code = _.get(fhirResource, 'code'); // this.reaction = _.get(fhirResource, 'reaction', []); this.asserter = _.get(fhirResource, 'asserter'); this.type = _.get(fhirResource, 'type'); diff --git a/frontend/src/lib/models/resources/appointment-model.ts b/frontend/src/lib/models/resources/appointment-model.ts index c749f435b..6756bcb1d 100644 --- a/frontend/src/lib/models/resources/appointment-model.ts +++ b/frontend/src/lib/models/resources/appointment-model.ts @@ -7,7 +7,7 @@ import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; export class AppointmentModel extends FastenDisplayModel { - + code: CodableConceptModel | undefined description: string|undefined status: string|undefined start: string|undefined @@ -30,6 +30,7 @@ export class AppointmentModel extends FastenDisplayModel { commonDTO(fhirResource:any) { + this.code = _.get(fhirResource, 'serviceType.0') || _.get(fhirResource, 'reasonCode.0'); this.description = _.get(fhirResource, 'description'); this.status = _.get(fhirResource, 'status'); this.start = _.get(fhirResource, 'start'); diff --git a/frontend/src/lib/models/resources/care-plan-model.ts b/frontend/src/lib/models/resources/care-plan-model.ts index fc9adb474..7014eddbd 100644 --- a/frontend/src/lib/models/resources/care-plan-model.ts +++ b/frontend/src/lib/models/resources/care-plan-model.ts @@ -3,9 +3,10 @@ import * as _ from "lodash"; import {ReferenceModel} from '../datatypes/reference-model'; import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; +import {CodableConceptModel} from '../datatypes/codable-concept-model'; export class CarePlanModel extends FastenDisplayModel { - + code: CodableConceptModel | undefined status: string | undefined expiry: string | undefined category: any[] | undefined @@ -32,6 +33,8 @@ export class CarePlanModel extends FastenDisplayModel { } commonDTO(fhirResource: any) { + this.code = _.get(fhirResource, 'category'); + this.status = _.get(fhirResource, 'status', ''); this.expiry = _.get(fhirResource, 'expiry'); this.category = _.get(fhirResource, 'category'); diff --git a/frontend/src/lib/models/resources/care-team-model.ts b/frontend/src/lib/models/resources/care-team-model.ts index 590faf795..09f9b4b4e 100644 --- a/frontend/src/lib/models/resources/care-team-model.ts +++ b/frontend/src/lib/models/resources/care-team-model.ts @@ -6,7 +6,7 @@ import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; export class CareTeamModel extends FastenDisplayModel { - + code: CodableConceptModel | undefined name: string | undefined status: string | undefined period_start: string | undefined diff --git a/frontend/src/lib/models/resources/condition-model.ts b/frontend/src/lib/models/resources/condition-model.ts index 167c71fbb..646b24a09 100644 --- a/frontend/src/lib/models/resources/condition-model.ts +++ b/frontend/src/lib/models/resources/condition-model.ts @@ -6,7 +6,7 @@ import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; export class ConditionModel extends FastenDisplayModel { - + code: CodableConceptModel | undefined code_text: string | undefined code_id: string | undefined code_system: string | undefined @@ -30,6 +30,7 @@ export class ConditionModel extends FastenDisplayModel { commonDTO(fhirResource:any){ + this.code = _.get(fhirResource, 'code') this.code_text = _.get(fhirResource, 'code.coding.0.display') || _.get(fhirResource, 'code.text') || diff --git a/frontend/src/lib/models/resources/device-model.ts b/frontend/src/lib/models/resources/device-model.ts index 17f390f79..5c2eca16a 100644 --- a/frontend/src/lib/models/resources/device-model.ts +++ b/frontend/src/lib/models/resources/device-model.ts @@ -6,6 +6,7 @@ import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; export class DeviceModel extends FastenDisplayModel { + code: CodableConceptModel | undefined model: string | undefined status: string | undefined @@ -27,6 +28,7 @@ export class DeviceModel extends FastenDisplayModel { commonDTO(fhirResource:any){ + this.code = _.get(fhirResource, 'type'); this.model = _.get(fhirResource, 'model') || _.get(fhirResource,"code.text", 'Device'); this.status = _.get(fhirResource, 'status', ''); this.get_type_coding = _.get(fhirResource, 'type.coding'); diff --git a/frontend/src/lib/models/resources/diagnostic-report-model.ts b/frontend/src/lib/models/resources/diagnostic-report-model.ts index efeda7823..1e067814d 100644 --- a/frontend/src/lib/models/resources/diagnostic-report-model.ts +++ b/frontend/src/lib/models/resources/diagnostic-report-model.ts @@ -7,6 +7,7 @@ import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; export class DiagnosticReportModel extends FastenDisplayModel { + code: CodableConceptModel | undefined title: string | undefined status: string | undefined @@ -26,6 +27,7 @@ export class DiagnosticReportModel extends FastenDisplayModel { } commonDTO(fhirResource:any){ + this.code = _.get(fhirResource, 'code'); this.title = _.get(fhirResource, 'code.text') || _.get(fhirResource, 'code.display') || diff --git a/frontend/src/lib/models/resources/document-reference-model.ts b/frontend/src/lib/models/resources/document-reference-model.ts index 040662046..981b3904c 100644 --- a/frontend/src/lib/models/resources/document-reference-model.ts +++ b/frontend/src/lib/models/resources/document-reference-model.ts @@ -10,7 +10,7 @@ import {BinaryModel} from './binary-model'; import {AttachmentModel} from '../datatypes/attachment-model'; export class DocumentReferenceModel extends FastenDisplayModel { - + code: CodableConceptModel | undefined description: string | undefined status: string | undefined category: CodableConceptModel | undefined @@ -36,6 +36,7 @@ export class DocumentReferenceModel extends FastenDisplayModel { commonDTO(fhirResource:any){ + this.code = _.get(fhirResource, 'type'); this.description = _.get(fhirResource, 'description'); this.status = _.get(fhirResource, 'status'); this.type_coding = _.get(fhirResource, 'type.coding[0]'); diff --git a/frontend/src/lib/models/resources/encounter-model.ts b/frontend/src/lib/models/resources/encounter-model.ts index 94b051aa1..33bb0a153 100644 --- a/frontend/src/lib/models/resources/encounter-model.ts +++ b/frontend/src/lib/models/resources/encounter-model.ts @@ -7,7 +7,7 @@ import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; export class EncounterModel extends FastenDisplayModel { - + code: CodableConceptModel | undefined period_end: string | undefined period_start: string | undefined has_participant: boolean | undefined @@ -30,6 +30,7 @@ export class EncounterModel extends FastenDisplayModel { } commonDTO(fhirResource:any){ + this.code = _.get(fhirResource, 'serviceType') || _.get(fhirResource, 'type.0'); this.resource_status = _.get(fhirResource, 'status'); this.location_display = _.get( fhirResource, diff --git a/frontend/src/lib/models/resources/medication-dispense-model.ts b/frontend/src/lib/models/resources/medication-dispense-model.ts index 3fa1569f0..023dd2a6b 100644 --- a/frontend/src/lib/models/resources/medication-dispense-model.ts +++ b/frontend/src/lib/models/resources/medication-dispense-model.ts @@ -7,7 +7,7 @@ import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; export class MedicationDispenseModel extends FastenDisplayModel { - + code: CodableConceptModel | undefined medication_title: string|undefined medication_coding: string|undefined type_coding: string|undefined @@ -24,6 +24,7 @@ export class MedicationDispenseModel extends FastenDisplayModel { commonDTO(fhirResource:any){ + this.code = _.get(fhirResource, 'medicationCodeableConcept'); this.type_coding = _.get(fhirResource, 'type.coding.0'); this.when_prepared = _.get(fhirResource, 'whenPrepared'); }; diff --git a/frontend/src/lib/models/resources/medication-model.ts b/frontend/src/lib/models/resources/medication-model.ts index ec1156f5d..67abbf947 100644 --- a/frontend/src/lib/models/resources/medication-model.ts +++ b/frontend/src/lib/models/resources/medication-model.ts @@ -7,8 +7,8 @@ import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; export class MedicationModel extends FastenDisplayModel { - - title: CodingModel|undefined + code: CodableConceptModel|undefined + title: string|undefined is_brand: string|undefined manufacturer: string|undefined has_product_form:boolean|undefined @@ -29,10 +29,8 @@ export class MedicationModel extends FastenDisplayModel { } commonDTO(fhirResource:any){ - this.title = _.get(fhirResource, 'code.coding.0'); - if (!this.title) { - this.title = { display: _.get(fhirResource, 'code.text', '') }; - } + this.code = _.get(fhirResource, 'code') + this.title = _.get(fhirResource, 'code.text') || _.get(fhirResource, 'code.coding.0.display'); this.manufacturer = _.get(fhirResource, 'manufacturer'); }; diff --git a/frontend/src/lib/models/resources/medication-request-model.ts b/frontend/src/lib/models/resources/medication-request-model.ts index e7bfddd05..c659c33aa 100644 --- a/frontend/src/lib/models/resources/medication-request-model.ts +++ b/frontend/src/lib/models/resources/medication-request-model.ts @@ -4,9 +4,10 @@ import {fhirVersions, ResourceType} from '../constants'; import {FastenOptions} from '../fasten/fasten-options'; import * as _ from "lodash"; import {ReferenceModel} from '../datatypes/reference-model'; +import {CodableConceptModel} from '../datatypes/codable-concept-model'; export class MedicationRequestModel extends FastenDisplayModel { - + code: CodableConceptModel|undefined display: string|undefined medication_reference: ReferenceModel|undefined medication_codeable_concept: CodingModel|undefined @@ -27,6 +28,7 @@ export class MedicationRequestModel extends FastenDisplayModel { fhirResource, 'medicationCodeableConcept.coding.0', ); + this.code = _.get(fhirResource, 'medicationCodeableConcept'); this.reason_code = _.get(fhirResource, 'reasonCode'); this.status = _.get(fhirResource, 'status'); this.dosage_instruction = _.get(fhirResource, 'dosageInstruction'); @@ -37,6 +39,6 @@ export class MedicationRequestModel extends FastenDisplayModel { this.created = _.get(fhirResource, 'authoredOn'); this.intent = _.get(fhirResource, 'intent'); - this.display = _.get(fhirResource, 'medicationCodeableConcept.text') || this.medication_codeable_concept?.display || _.get(fhirResource, 'medicationCodeableConcept.text') || this.medication_reference?.display + this.display = _.get(fhirResource, 'medicationCodeableConcept.text') || _.get(fhirResource, 'medicationCodeableConcept.0.display') || _.get(fhirResource, 'dosageInstruction.0.text') || 'unknown' } } diff --git a/frontend/src/lib/models/resources/observation-model.ts b/frontend/src/lib/models/resources/observation-model.ts index 6157f2231..105015d85 100644 --- a/frontend/src/lib/models/resources/observation-model.ts +++ b/frontend/src/lib/models/resources/observation-model.ts @@ -8,7 +8,7 @@ import {FastenOptions} from '../fasten/fasten-options'; export class ObservationModel extends FastenDisplayModel { - + code: CodableConceptModel | undefined effective_date: string code_coding_display: string code_text: string @@ -25,6 +25,7 @@ export class ObservationModel extends FastenDisplayModel { super(fastenOptions) this.source_resource_type = ResourceType.Observation this.effective_date = _.get(fhirResource, 'effectiveDateTime'); + this.code = _.get(fhirResource, 'code'); this.code_coding_display = _.get(fhirResource, 'code.coding.0.display'); this.code_text = _.get(fhirResource, 'code.text', ''); this.value_quantity_value = _.get(fhirResource, 'valueQuantity.value', ''); diff --git a/frontend/src/lib/models/resources/procedure-model.ts b/frontend/src/lib/models/resources/procedure-model.ts index 26029e036..b6ab70065 100644 --- a/frontend/src/lib/models/resources/procedure-model.ts +++ b/frontend/src/lib/models/resources/procedure-model.ts @@ -7,7 +7,7 @@ import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; export class ProcedureModel extends FastenDisplayModel { - + code: CodableConceptModel| undefined display: string|undefined; status: string|undefined; has_performed_datetime: boolean|undefined; @@ -42,6 +42,7 @@ export class ProcedureModel extends FastenDisplayModel { this.has_performed_period = !!(this.performed_period_start || this.performed_period_end); this.has_coding = _.has(fhirResource, 'code.coding'); this.coding = _.get(fhirResource, 'code.coding', []); + this.code = _.get(fhirResource, 'code'); this.category = _.get(fhirResource, 'category.coding[0]'); this.location_reference = _.get(fhirResource, 'location'); this.has_performer_data = _.has(fhirResource, 'performer.0.actor.display'); From 65984452fe884499e0aaf24626fa18685ea507a9 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Fri, 11 Aug 2023 16:51:07 -0600 Subject: [PATCH 2/6] cleanup html attachments. fixing attachment titles. --- .../app/components/fhir/datatypes/html/html.component.html | 2 -- .../report-medical-history-condition.component.html | 4 ++-- frontend/src/lib/models/resources/device-model.ts | 2 +- frontend/src/lib/models/resources/document-reference-model.ts | 2 ++ 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/components/fhir/datatypes/html/html.component.html b/frontend/src/app/components/fhir/datatypes/html/html.component.html index d77043879..76cef78c1 100644 --- a/frontend/src/app/components/fhir/datatypes/html/html.component.html +++ b/frontend/src/app/components/fhir/datatypes/html/html.component.html @@ -1,3 +1 @@ -

    html works!

    -
    diff --git a/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.html b/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.html index 0ebbf6501..5c1ce433e 100644 --- a/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.html +++ b/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.html @@ -111,7 +111,7 @@ Tests and Examinations:
    • - {{diagnosticReport.title}} + {{diagnosticReport.sort_title || diagnosticReport.title}} @@ -124,7 +124,7 @@ Attachments:
      • - {{documentReference.sort_title}} + {{documentReference.sort_title || documentReference.title}} diff --git a/frontend/src/lib/models/resources/device-model.ts b/frontend/src/lib/models/resources/device-model.ts index 5c2eca16a..a59564825 100644 --- a/frontend/src/lib/models/resources/device-model.ts +++ b/frontend/src/lib/models/resources/device-model.ts @@ -29,7 +29,7 @@ export class DeviceModel extends FastenDisplayModel { commonDTO(fhirResource:any){ this.code = _.get(fhirResource, 'type'); - this.model = _.get(fhirResource, 'model') || _.get(fhirResource,"code.text", 'Device'); + this.model = _.get(fhirResource, 'model') || _.get(fhirResource,"code.text") || _.get(fhirResource,"code.coding.0.display") || 'Unknown Device'; this.status = _.get(fhirResource, 'status', ''); this.get_type_coding = _.get(fhirResource, 'type.coding'); this.has_type_coding = Array.isArray(this.get_type_coding); diff --git a/frontend/src/lib/models/resources/document-reference-model.ts b/frontend/src/lib/models/resources/document-reference-model.ts index 981b3904c..b2241cc2c 100644 --- a/frontend/src/lib/models/resources/document-reference-model.ts +++ b/frontend/src/lib/models/resources/document-reference-model.ts @@ -11,6 +11,7 @@ import {AttachmentModel} from '../datatypes/attachment-model'; export class DocumentReferenceModel extends FastenDisplayModel { code: CodableConceptModel | undefined + title: string | undefined description: string | undefined status: string | undefined category: CodableConceptModel | undefined @@ -37,6 +38,7 @@ export class DocumentReferenceModel extends FastenDisplayModel { commonDTO(fhirResource:any){ this.code = _.get(fhirResource, 'type'); + this.title = _.get(fhirResource, 'category.0.text') || _.get(fhirResource, 'category.0.coding.0.display') || _.get(fhirResource, 'type.text') || _.get(fhirResource, 'type.coding.0.display'); this.description = _.get(fhirResource, 'description'); this.status = _.get(fhirResource, 'status'); this.type_coding = _.get(fhirResource, 'type.coding[0]'); From 1ca1e09987bfe6a10ffaeaf3696a7a53c8e23144 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Fri, 11 Aug 2023 21:20:49 -0600 Subject: [PATCH 3/6] UI updates. --- .../fhir/common/table/table-row-item.ts | 6 +- .../fhir/common/table/table.component.html | 4 + .../fhir/common/table/table.component.ts | 3 +- .../codable-concept.component.html | 7 + .../codable-concept.component.scss | 0 .../codable-concept.component.spec.ts | 23 +++ .../codable-concept.component.ts | 22 +++ .../allergy-intolerance.component.ts | 6 +- .../document-reference.component.ts | 6 +- .../immunization/immunization.component.ts | 6 - .../practitioner/practitioner.component.html | 2 +- .../practitioner/practitioner.component.ts | 20 +-- ...ort-medical-history-condition.component.ts | 4 +- ...istory-explanation-of-benefit.component.ts | 4 +- frontend/src/app/components/shared.module.ts | 135 +++++++++--------- .../lib/models/datatypes/human-name-model.ts | 4 +- .../models/resources/practitioner-model.ts | 7 +- 17 files changed, 158 insertions(+), 101 deletions(-) create mode 100644 frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.html create mode 100644 frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.scss create mode 100644 frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.spec.ts create mode 100644 frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.ts diff --git a/frontend/src/app/components/fhir/common/table/table-row-item.ts b/frontend/src/app/components/fhir/common/table/table-row-item.ts index b1491d681..9d6267a33 100644 --- a/frontend/src/app/components/fhir/common/table/table-row-item.ts +++ b/frontend/src/app/components/fhir/common/table/table-row-item.ts @@ -1,9 +1,10 @@ import {ReferenceModel} from '../../../../../lib/models/datatypes/reference-model'; import {CodingModel} from '../../../../../lib/models/datatypes/coding-model'; +import {CodableConceptModel} from '../../../../../lib/models/datatypes/codable-concept-model'; export class TableRowItem { label?: string - data?: string | ReferenceModel | CodingModel | CodingModel[] + data?: string | ReferenceModel | CodingModel | CodingModel[] | CodableConceptModel data_type?: TableRowItemDataType enabled?: boolean //determine if this row should be displayed } @@ -12,5 +13,6 @@ export enum TableRowItemDataType { String = "string", Reference = "reference", Coding = "coding", - CodingList = "codingList" + CodingList = "codingList", + CodableConcept = "codableConcept", } diff --git a/frontend/src/app/components/fhir/common/table/table.component.html b/frontend/src/app/components/fhir/common/table/table.component.html index 6363e9bbd..edd749d85 100644 --- a/frontend/src/app/components/fhir/common/table/table.component.html +++ b/frontend/src/app/components/fhir/common/table/table.component.html @@ -10,8 +10,12 @@ + + + diff --git a/frontend/src/app/components/fhir/common/table/table.component.ts b/frontend/src/app/components/fhir/common/table/table.component.ts index 0f6beadf6..2dd56c828 100644 --- a/frontend/src/app/components/fhir/common/table/table.component.ts +++ b/frontend/src/app/components/fhir/common/table/table.component.ts @@ -4,10 +4,11 @@ import {FastenDisplayModel} from '../../../../../lib/models/fasten/fasten-displa import {CommonModule} from "@angular/common"; import {CodingComponent} from "../../datatypes/coding/coding.component"; import {Router, RouterModule} from "@angular/router"; +import {CodableConceptComponent} from '../../datatypes/codable-concept/codable-concept.component'; @Component({ standalone: true, - imports: [CommonModule, CodingComponent, RouterModule], + imports: [CommonModule, CodingComponent, RouterModule, CodableConceptComponent], providers: [RouterModule], selector: 'fhir-ui-table', templateUrl: './table.component.html', diff --git a/frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.html b/frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.html new file mode 100644 index 000000000..cc696b3a5 --- /dev/null +++ b/frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.html @@ -0,0 +1,7 @@ + +
        + {{codableConcept?.text || codableConcept?.coding?.[0]?.display}} + + ({{codableConcept?.coding?.[0]?.code || '?'}}) + +
        diff --git a/frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.scss b/frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.spec.ts b/frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.spec.ts new file mode 100644 index 000000000..83a90b5f3 --- /dev/null +++ b/frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CodableConceptComponent } from './codable-concept.component'; + +describe('CodableConceptComponent', () => { + let component: CodableConceptComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [ CodableConceptComponent ] + }) + .compileComponents(); + + fixture = TestBed.createComponent(CodableConceptComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.ts b/frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.ts new file mode 100644 index 000000000..7e00aa67e --- /dev/null +++ b/frontend/src/app/components/fhir/datatypes/codable-concept/codable-concept.component.ts @@ -0,0 +1,22 @@ +import {Component, Input, OnInit} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {CodingComponent} from '../coding/coding.component'; +import {CodingModel} from '../../../../../lib/models/datatypes/coding-model'; +import {CodableConceptModel} from '../../../../../lib/models/datatypes/codable-concept-model'; + +@Component({ + standalone: true, + imports: [CommonModule], + selector: 'fhir-codable-concept', + templateUrl: './codable-concept.component.html', + styleUrls: ['./codable-concept.component.scss'] +}) +export class CodableConceptComponent implements OnInit { + @Input() codableConcept: CodableConceptModel + + constructor() { } + + ngOnInit(): void { + } + +} diff --git a/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.ts b/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.ts index 9db9d7020..aaef1d785 100644 --- a/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.ts +++ b/frontend/src/app/components/fhir/resources/allergy-intolerance/allergy-intolerance.component.ts @@ -29,9 +29,9 @@ export class AllergyIntoleranceComponent implements OnInit, FhirResourceComponen this.tableData = [ { label: 'Substance', - data: this.displayModel?.substance_coding, - data_type: TableRowItemDataType.CodingList, - enabled: !!this.displayModel?.substance_coding, + data: this.displayModel?.code, + data_type: TableRowItemDataType.CodableConcept, + enabled: !!this.displayModel?.code, }, { label: 'Type', diff --git a/frontend/src/app/components/fhir/resources/document-reference/document-reference.component.ts b/frontend/src/app/components/fhir/resources/document-reference/document-reference.component.ts index 49d42325b..1965a75fb 100644 --- a/frontend/src/app/components/fhir/resources/document-reference/document-reference.component.ts +++ b/frontend/src/app/components/fhir/resources/document-reference/document-reference.component.ts @@ -28,12 +28,12 @@ export class DocumentReferenceComponent implements OnInit, FhirResourceComponent }, { label: 'Category', - data: this.displayModel?.category?.coding, - data_type: TableRowItemDataType.CodingList, + data: this.displayModel?.category, + data_type: TableRowItemDataType.CodableConcept, enabled: !!this.displayModel?.category, }, // { - // label: 'Performer', + // label: 'Author', // data: this.displayModel?.performer, // data_type: TableRowItemDataType.Reference, // enabled: this.displayModel?.has_performer, diff --git a/frontend/src/app/components/fhir/resources/immunization/immunization.component.ts b/frontend/src/app/components/fhir/resources/immunization/immunization.component.ts index 88f3c5233..18351c03a 100644 --- a/frontend/src/app/components/fhir/resources/immunization/immunization.component.ts +++ b/frontend/src/app/components/fhir/resources/immunization/immunization.component.ts @@ -65,12 +65,6 @@ export class ImmunizationComponent implements OnInit, FhirResourceComponentInter data_type: TableRowItemDataType.Reference, enabled: !!this.displayModel?.performer, }, - // { - // label: 'Note', - // testId: 'note', - // data: note && , - // status: note, - // }, { label: 'Route', data: this.displayModel?.route, diff --git a/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.html b/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.html index e6bb86a5b..1ff00e02a 100644 --- a/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.html +++ b/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.html @@ -1,7 +1,7 @@
        -
        {{displayModel?.sort_title}}
        +
        {{displayModel?.sort_title || displayModel?.name?.[0]?.displayName}}

        Date{{displayModel?.sort_date}}

        {{displayModel?.status}} diff --git a/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts b/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts index 87039ab84..1d2359800 100644 --- a/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts +++ b/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts @@ -48,16 +48,16 @@ export class PractitionerComponent implements OnInit, FhirResourceComponentInter // ), // status: isContactData, // }, - // { - // label: 'Address', - // data: this.displayModel?.address., - // status: !!this.displayModel?.address, - // }, - // { - // label: 'Telephone', - // data: this.displayModel.telecom, - // enabled: !!this.displayModel.telecom, - // }, + { + label: 'Address', + data: this.displayModel?.address, + enabled: !!this.displayModel?.address, + }, + { + label: 'Telephone', + data: this.displayModel.telecom, + enabled: !!this.displayModel.telecom, + }, ]; for(let idCoding of (this.displayModel?.identifier || [])){ this.tableData.push({ diff --git a/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.ts b/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.ts index 069e0f78e..62c6b579f 100644 --- a/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.ts +++ b/frontend/src/app/components/report-medical-history-condition/report-medical-history-condition.component.ts @@ -109,8 +109,8 @@ export class ReportMedicalHistoryConditionComponent implements OnInit { {}, involvedInCareMap[id], { - displayName: practitionerModel.name?.family && practitionerModel.name?.given ? `${practitionerModel.name?.family }, ${practitionerModel.name?.given}` : practitionerModel.name?.text, - role: qualification?.display || practitionerModel.name?.prefix || practitionerModel.name?.suffix, + displayName: practitionerModel.name?.[0]?.displayName, + role: qualification?.display || practitionerModel.name?.[0]?.suffix, email: email, displayModel: resource }, diff --git a/frontend/src/app/components/report-medical-history-explanation-of-benefit/report-medical-history-explanation-of-benefit.component.ts b/frontend/src/app/components/report-medical-history-explanation-of-benefit/report-medical-history-explanation-of-benefit.component.ts index cbc2e1009..acd5f9880 100644 --- a/frontend/src/app/components/report-medical-history-explanation-of-benefit/report-medical-history-explanation-of-benefit.component.ts +++ b/frontend/src/app/components/report-medical-history-explanation-of-benefit/report-medical-history-explanation-of-benefit.component.ts @@ -117,8 +117,8 @@ export class ReportMedicalHistoryExplanationOfBenefitComponent implements OnInit {}, involvedInCareMap[id], { - displayName: practitionerModel.name?.family && practitionerModel.name?.given ? `${practitionerModel.name?.family }, ${practitionerModel.name?.given}` : practitionerModel.name?.text, - role: qualification?.display || practitionerModel.name?.prefix || practitionerModel.name?.suffix, + displayName: practitionerModel.name?.[0]?.displayName, + role: qualification?.display || practitionerModel.name?.[0]?.suffix, email: email, displayModel: resource, }, diff --git a/frontend/src/app/components/shared.module.ts b/frontend/src/app/components/shared.module.ts index 711dd8206..9afe60c61 100644 --- a/frontend/src/app/components/shared.module.ts +++ b/frontend/src/app/components/shared.module.ts @@ -75,6 +75,7 @@ import { MedicalSourcesFilterComponent } from './medical-sources-filter/medical- import { MedicalSourcesConnectedComponent } from './medical-sources-connected/medical-sources-connected.component'; import { MedicalSourcesCategoryLookupPipe } from './medical-sources-filter/medical-sources-category-lookup.pipe'; import { MedicalSourcesCardComponent } from './medical-sources-card/medical-sources-card.component'; +import { CodableConceptComponent } from './fhir/datatypes/codable-concept/codable-concept.component'; @NgModule({ imports: [ @@ -112,6 +113,7 @@ import { MedicalSourcesCardComponent } from './medical-sources-card/medical-sour BinaryComponent, GridstackComponent, GridstackItemComponent, + CodableConceptComponent ], declarations: [ @@ -163,74 +165,75 @@ import { MedicalSourcesCardComponent } from './medical-sources-card/medical-sour MedicalSourcesCategoryLookupPipe, MedicalSourcesCardComponent, ], - exports: [ - BinaryComponent, - ComponentsSidebarComponent, - DiagnosticReportComponent, - DocumentReferenceComponent, - FallbackComponent, - FhirResourceComponent, - FhirResourceOutletDirective, - ImmunizationComponent, - ListAdverseEventComponent, - ListAllergyIntoleranceComponent, - ListAppointmentComponent, - ListCarePlanComponent, - ListCommunicationComponent, - ListConditionComponent, - ListCoverageComponent, - ListDeviceComponent, - ListDeviceRequestComponent, - ListDiagnosticReportComponent, - ListDocumentReferenceComponent, - ListEncounterComponent, - ListGenericResourceComponent, - ListGoalComponent, - ListImmunizationComponent, - ListMedicationAdministrationComponent, - ListMedicationComponent, - ListMedicationDispenseComponent, - ListMedicationRequestComponent, - ListNutritionOrderComponent, - ListObservationComponent, - ListPatientComponent, - ListProcedureComponent, - ListServiceRequestComponent, - MedicalSourcesFilterComponent, - MedicationRequestComponent, - NlmTypeaheadComponent, - PractitionerComponent, - ProcedureComponent, - ReportHeaderComponent, - ReportLabsObservationComponent, - ReportMedicalHistoryConditionComponent, - ReportMedicalHistoryEditorComponent, - ReportMedicalHistoryExplanationOfBenefitComponent, - ResourceListComponent, - ResourceListOutletDirective, - ToastComponent, - UtilitiesSidebarComponent, - MedicalSourcesCardComponent, - MedicalSourcesConnectedComponent, + exports: [ + BinaryComponent, + ComponentsSidebarComponent, + DiagnosticReportComponent, + DocumentReferenceComponent, + FallbackComponent, + FhirResourceComponent, + FhirResourceOutletDirective, + ImmunizationComponent, + ListAdverseEventComponent, + ListAllergyIntoleranceComponent, + ListAppointmentComponent, + ListCarePlanComponent, + ListCommunicationComponent, + ListConditionComponent, + ListCoverageComponent, + ListDeviceComponent, + ListDeviceRequestComponent, + ListDiagnosticReportComponent, + ListDocumentReferenceComponent, + ListEncounterComponent, + ListGenericResourceComponent, + ListGoalComponent, + ListImmunizationComponent, + ListMedicationAdministrationComponent, + ListMedicationComponent, + ListMedicationDispenseComponent, + ListMedicationRequestComponent, + ListNutritionOrderComponent, + ListObservationComponent, + ListPatientComponent, + ListProcedureComponent, + ListServiceRequestComponent, + MedicalSourcesFilterComponent, + MedicationRequestComponent, + NlmTypeaheadComponent, + PractitionerComponent, + ProcedureComponent, + ReportHeaderComponent, + ReportLabsObservationComponent, + ReportMedicalHistoryConditionComponent, + ReportMedicalHistoryEditorComponent, + ReportMedicalHistoryExplanationOfBenefitComponent, + ResourceListComponent, + ResourceListOutletDirective, + ToastComponent, + UtilitiesSidebarComponent, + MedicalSourcesCardComponent, + MedicalSourcesConnectedComponent, - //standalone components - BadgeComponent, - TableComponent, - CodingComponent, - LoadingSpinnerComponent, - GlossaryLookupComponent, - AllergyIntoleranceComponent, - MedicationComponent, - MedicationRequestComponent, - PractitionerComponent, - ProcedureComponent, - ImmunizationComponent, - BinaryComponent, - GridstackComponent, - GridstackItemComponent, - MedicalSourcesCategoryLookupPipe, + //standalone components + BadgeComponent, + TableComponent, + CodingComponent, + LoadingSpinnerComponent, + GlossaryLookupComponent, + AllergyIntoleranceComponent, + MedicationComponent, + MedicationRequestComponent, + PractitionerComponent, + ProcedureComponent, + ImmunizationComponent, + BinaryComponent, + GridstackComponent, + GridstackItemComponent, + MedicalSourcesCategoryLookupPipe, + CodableConceptComponent, - ] + ] }) export class SharedModule { } diff --git a/frontend/src/lib/models/datatypes/human-name-model.ts b/frontend/src/lib/models/datatypes/human-name-model.ts index 6a8a53746..450e7de99 100644 --- a/frontend/src/lib/models/datatypes/human-name-model.ts +++ b/frontend/src/lib/models/datatypes/human-name-model.ts @@ -6,7 +6,7 @@ export class HumanNameModel { suffix: string textName: string use: string - header: string + displayName: string constructor(fhirData: any) { @@ -15,6 +15,6 @@ export class HumanNameModel { this.suffix = _.get(fhirData, 'suffix', []).join(' '); this.textName = _.get(fhirData, 'text'); this.use = _.get(fhirData, 'use'); - this.header = this.textName ? this.textName : `${this.givenName} ${this.familyName} ${this.suffix}`.trim(); + this.displayName = this.textName ? this.textName : `${this.givenName} ${this.familyName}`.trim(); } } diff --git a/frontend/src/lib/models/resources/practitioner-model.ts b/frontend/src/lib/models/resources/practitioner-model.ts index b09eee0fc..769d6fdc2 100644 --- a/frontend/src/lib/models/resources/practitioner-model.ts +++ b/frontend/src/lib/models/resources/practitioner-model.ts @@ -5,11 +5,12 @@ import {ReferenceModel} from '../datatypes/reference-model'; import {CodingModel} from '../datatypes/coding-model'; import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; +import {HumanNameModel} from '../datatypes/human-name-model'; export class PractitionerModel extends FastenDisplayModel { identifier: CodingModel[]|undefined - name: any|undefined + name: HumanNameModel[]|undefined gender: string|undefined status: string|undefined is_contact_data: boolean|undefined @@ -44,11 +45,11 @@ export class PractitionerModel extends FastenDisplayModel { }; dstu2DTO(fhirResource:any){ - this.name = _.get(fhirResource, 'name'); + this.name = [new HumanNameModel(_.get(fhirResource, 'name'))]; }; stu3DTO(fhirResource:any){ - this.name = _.get(fhirResource, 'name.0'); + this.name = _.get(fhirResource, 'name',[]).map((name:any): HumanNameModel => new HumanNameModel(name)); this.address = _.get(fhirResource, 'address.0'); this.telecom = _.get(fhirResource, 'telecom'); }; From 3ae2fc9fff3fdafeaee0fd848b1806042fff4300 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Fri, 11 Aug 2023 23:44:34 -0600 Subject: [PATCH 4/6] adding pagination to the explore page. fixes #216 simplified fallback component for table list --- backend/pkg/constants.go | 2 + backend/pkg/database/sqlite_repository.go | 13 +++-- .../pkg/models/list_resource_query_options.go | 4 ++ backend/pkg/web/handler/resource_fhir.go | 12 ++++- .../list-fallback-resource.component.html | 14 ----- .../list-fallback-resource.component.scss | 0 .../list-fallback-resource.component.spec.ts | 23 -------- .../list-fallback-resource.component.ts | 25 --------- .../list-fallback.component.html | 28 ++++++++++ .../list-fallback.component.ts | 14 +++++ .../list-generic-resource.component.html | 7 ++- .../list-generic-resource.component.ts | 53 ++++++++++++++++--- .../resource-list/resource-list.component.ts | 40 ++++---------- frontend/src/app/components/shared.module.ts | 6 ++- .../source-detail.component.html | 6 ++- .../source-detail/source-detail.component.ts | 2 + .../src/app/services/fasten-api.service.ts | 5 +- 17 files changed, 146 insertions(+), 108 deletions(-) delete mode 100644 frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.html delete mode 100644 frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.scss delete mode 100644 frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.spec.ts delete mode 100644 frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.ts create mode 100644 frontend/src/app/components/list-generic-resource/list-fallback.component.html create mode 100644 frontend/src/app/components/list-generic-resource/list-fallback.component.ts diff --git a/backend/pkg/constants.go b/backend/pkg/constants.go index f2a81ceae..b16fb2d9a 100644 --- a/backend/pkg/constants.go +++ b/backend/pkg/constants.go @@ -3,6 +3,8 @@ package pkg type ResourceGraphType string const ( + ResourceListPageSize int = 20 + ContextKeyTypeConfig string = "CONFIG" ContextKeyTypeDatabase string = "REPOSITORY" ContextKeyTypeLogger string = "LOGGER" diff --git a/backend/pkg/database/sqlite_repository.go b/backend/pkg/database/sqlite_repository.go index 200070e0e..ca3216049 100644 --- a/backend/pkg/database/sqlite_repository.go +++ b/backend/pkg/database/sqlite_repository.go @@ -400,13 +400,18 @@ func (sr *SqliteRepository) ListResources(ctx context.Context, queryOptions mode if err != nil { return nil, err } - results := queryBuilder. + queryBuilder = queryBuilder. Where(queryParam). - Table(tableName). - Find(&wrappedResourceModels) + Table(tableName) - return wrappedResourceModels, results.Error + if queryOptions.Limit > 0 { + queryBuilder = queryBuilder.Limit(queryOptions.Limit).Offset(queryOptions.Offset) + } + return wrappedResourceModels, queryBuilder.Find(&wrappedResourceModels).Error } else { + if queryOptions.Limit > 0 { + queryBuilder = queryBuilder.Limit(queryOptions.Limit).Offset(queryOptions.Offset) + } //there is no FHIR Resource name specified, so we're querying across all FHIR resources return sr.getResourcesFromAllTables(queryBuilder, queryParam) } diff --git a/backend/pkg/models/list_resource_query_options.go b/backend/pkg/models/list_resource_query_options.go index 6c75c46a0..c3a86309b 100644 --- a/backend/pkg/models/list_resource_query_options.go +++ b/backend/pkg/models/list_resource_query_options.go @@ -17,4 +17,8 @@ type ListResourceQueryOptions struct { SourceID string SourceResourceType string SourceResourceID string + + //pagination + Limit int + Offset int } diff --git a/backend/pkg/web/handler/resource_fhir.go b/backend/pkg/web/handler/resource_fhir.go index 743c3bd86..ccedd516c 100644 --- a/backend/pkg/web/handler/resource_fhir.go +++ b/backend/pkg/web/handler/resource_fhir.go @@ -8,6 +8,7 @@ import ( "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "net/http" + "strconv" "strings" ) @@ -48,7 +49,16 @@ func ListResourceFhir(c *gin.Context) { if len(c.Query("sourceResourceID")) > 0 { listResourceQueryOptions.SourceResourceID = c.Query("sourceResourceID") } - + if len(c.Query("page")) > 0 { + listResourceQueryOptions.Limit = pkg.ResourceListPageSize //hardcoded number of resources per page + pageNumb, err := strconv.Atoi(c.Query("page")) + if err != nil { + logger.Errorln("An error occurred while calculating page number", err) + c.JSON(http.StatusInternalServerError, gin.H{"success": false}) + return + } + listResourceQueryOptions.Offset = pageNumb * listResourceQueryOptions.Limit + } wrappedResourceModels, err := databaseRepo.ListResources(c, listResourceQueryOptions) if c.Query("sortBy") == "title" { diff --git a/frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.html b/frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.html deleted file mode 100644 index 20599d911..000000000 --- a/frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.scss b/frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.spec.ts b/frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.spec.ts deleted file mode 100644 index fa5fd0b48..000000000 --- a/frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ListFallbackResourceComponent } from './list-fallback-resource.component'; - -describe('ListFallbackResourceComponent', () => { - let component: ListFallbackResourceComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [ ListFallbackResourceComponent ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(ListFallbackResourceComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.ts b/frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.ts deleted file mode 100644 index 9d70da650..000000000 --- a/frontend/src/app/components/list-fallback-resource/list-fallback-resource.component.ts +++ /dev/null @@ -1,25 +0,0 @@ -import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core'; -import {ResourceFhir} from '../../models/fasten/resource_fhir'; -import {ResourceListComponentInterface} from '../list-generic-resource/list-generic-resource.component'; -import {Router} from '@angular/router'; - -@Component({ - selector: 'app-list-fallback-resource', - templateUrl: './list-fallback-resource.component.html', - styleUrls: ['./list-fallback-resource.component.scss'] -}) -export class ListFallbackResourceComponent implements OnInit, ResourceListComponentInterface { - - @Input() resourceList: ResourceFhir[] = [] - - constructor(public changeRef: ChangeDetectorRef, public router: Router) {} - - ngOnInit(): void { - console.log("RESOURCE LIST INSIDE FALLBACK", this.resourceList) - } - - markForCheck(){ - this.changeRef.markForCheck() - } - -} diff --git a/frontend/src/app/components/list-generic-resource/list-fallback.component.html b/frontend/src/app/components/list-generic-resource/list-fallback.component.html new file mode 100644 index 000000000..01d5c5e63 --- /dev/null +++ b/frontend/src/app/components/list-generic-resource/list-fallback.component.html @@ -0,0 +1,28 @@ +
        + + + + + +
        diff --git a/frontend/src/app/components/list-generic-resource/list-fallback.component.ts b/frontend/src/app/components/list-generic-resource/list-fallback.component.ts new file mode 100644 index 000000000..17d497e1b --- /dev/null +++ b/frontend/src/app/components/list-generic-resource/list-fallback.component.ts @@ -0,0 +1,14 @@ +import {Component, OnChanges, OnInit} from '@angular/core'; +import {GenericColumnDefn, ListGenericResourceComponent, ResourceListComponentInterface} from './list-generic-resource.component'; + +@Component({ + selector: 'app-list-fallback', + templateUrl: './list-fallback.component.html', + styleUrls: ['./list-generic-resource.component.scss'] +}) +export class ListFallbackComponent extends ListGenericResourceComponent { + columnDefinitions: GenericColumnDefn[] = [ + { title: 'Id', versions: '*', getter: e => e.id }, + { title: 'Title', versions: '*', getter: e => e.reasonCode?.[0] }, + ] +} diff --git a/frontend/src/app/components/list-generic-resource/list-generic-resource.component.html b/frontend/src/app/components/list-generic-resource/list-generic-resource.component.html index e327bc2c2..5f306da33 100644 --- a/frontend/src/app/components/list-generic-resource/list-generic-resource.component.html +++ b/frontend/src/app/components/list-generic-resource/list-generic-resource.component.html @@ -19,11 +19,14 @@ [headerHeight]="50" [footerHeight]="50" rowHeight="auto" - [limit]="10" + [externalPaging]="true" + [count]="totalElements" + [offset]="currentPage.offset" + [limit]="20" [rows]="rows" [selectionType]="SelectionType.single" (select)="onSelect($event)" - + (page)="changePage($event)" >
        diff --git a/frontend/src/app/components/list-generic-resource/list-generic-resource.component.ts b/frontend/src/app/components/list-generic-resource/list-generic-resource.component.ts index c2698d8c8..54766d1f8 100644 --- a/frontend/src/app/components/list-generic-resource/list-generic-resource.component.ts +++ b/frontend/src/app/components/list-generic-resource/list-generic-resource.component.ts @@ -3,10 +3,15 @@ import {DatatableComponent, ColumnMode, SelectionType} from '@swimlane/ngx-datat import {ResourceFhir} from '../../models/fasten/resource_fhir'; import {FORMATTERS, getPath, obsValue, attributeXTime} from './utils'; import {Router} from '@angular/router'; +import {Observable, of} from 'rxjs'; +import {map} from 'rxjs/operators'; +import {FastenApiService} from '../../services/fasten-api.service'; //all Resource list components must implement this Interface export interface ResourceListComponentInterface { - resourceList: ResourceFhir[]; + resourceListType: string; + totalElements: number; + sourceId: string; markForCheck() } @@ -20,14 +25,22 @@ export class GenericColumnDefn { defaultValue?: string } +class PageInfo { + offset: number = 0 //this is the current page number. 0 is the first page. Matches the ng-datatable structure +} + @Component({ selector: 'app-list-generic-resource', templateUrl: './list-generic-resource.component.html', styleUrls: ['./list-generic-resource.component.scss'] }) export class ListGenericResourceComponent implements OnInit, ResourceListComponentInterface { + @Input() totalElements: number; + @Input() resourceListType: string; + @Input() sourceId: string; - @Input() resourceList: ResourceFhir[] = [] + currentPage: PageInfo = {offset: 0} + // @Input() resourceList: ResourceFhir[] = [] // description: string // c: ListGenericResourceComponentColumn[] = [] @@ -40,25 +53,53 @@ export class ListGenericResourceComponent implements OnInit, ResourceListCompone ColumnMode = ColumnMode; SelectionType = SelectionType; - constructor(public changeRef: ChangeDetectorRef, public router: Router) {} + constructor(public changeRef: ChangeDetectorRef, public router: Router, public fastenApi: FastenApiService) { + + } ngOnInit(): void { console.log("INIT GENERIC RESOURCE") + this.currentPage = {offset: 0} - this.renderList() + this.changePage(this.currentPage) } markForCheck(){ this.changeRef.markForCheck() } - renderList(){ + changePage(page: PageInfo){ + console.log("Requesting page:" + JSON.stringify(page)) + this.currentPage = page; + this.fastenApi.getResources(this.resourceListType, this.sourceId, null, this.currentPage.offset) + .subscribe((resourceList: ResourceFhir[]) => { + this.renderList(resourceList) + this.markForCheck() + }); + } + + // getResources(page?: number): Observable{ + // // if(this.resourceListType && !this.resourceListCache[this.resourceListType]){ + // // // this resource type list has not been downloaded yet, do so now + // return + // .pipe(map((resourceList: ResourceFhir[]) => { + // //cache this response so we can skip the request next time + // // this.resourceListCache[this.resourceListType] = resourceList + // return resourceList + // })) + // // } else { + // // return of(this.resourceListCache[this.resourceListType] || []) + // // } + // } + + + renderList(resourceList: ResourceFhir[]){ console.log("GENERIC RESOURCE RENDERLSIT") this.columns = this.columnDefinitions.map((defn) => { let column = {name: defn.title, prop: defn.title.replace(/[^A-Z0-9]/ig, "_")} return column }) - this.rows = this.resourceList.map((resource) => { + this.rows = resourceList.map((resource) => { let row = { source_id: resource.source_id, source_resource_type: resource.source_resource_type, diff --git a/frontend/src/app/components/resource-list/resource-list.component.ts b/frontend/src/app/components/resource-list/resource-list.component.ts index 0be094772..7aff5b812 100644 --- a/frontend/src/app/components/resource-list/resource-list.component.ts +++ b/frontend/src/app/components/resource-list/resource-list.component.ts @@ -29,7 +29,7 @@ import {ListAppointmentComponent} from '../list-generic-resource/list-appointmen import {ListDeviceComponent} from '../list-generic-resource/list-device.component'; import {ListDiagnosticReportComponent} from '../list-generic-resource/list-diagnostic-report.component'; import {ListGoalComponent} from '../list-generic-resource/list-goal.component'; -import {ListFallbackResourceComponent} from '../list-fallback-resource/list-fallback-resource.component'; +import {ListFallbackComponent} from '../list-generic-resource/list-fallback.component'; @Component({ selector: 'source-resource-list', @@ -41,9 +41,7 @@ export class ResourceListComponent implements OnInit, OnChanges { @Input() source: Source; @Input() resourceListType: string; - resourceListCache: { [name:string]: ResourceFhir[] } = {} - - + @Input() selectedTotalElements: number; //location to dynamically load the resource list @ViewChild(ResourceListOutletDirective, {static: true}) resourceListOutlet!: ResourceListOutletDirective; @@ -63,30 +61,14 @@ export class ResourceListComponent implements OnInit, OnChanges { const viewContainerRef = this.resourceListOutlet.viewContainerRef; viewContainerRef.clear(); - this.getResources().subscribe((resourceList) => { - let componentType = this.typeLookup(this.resourceListType) - if(componentType != null){ - console.log("Attempting to create component", this.resourceListType, componentType) - const componentRef = viewContainerRef.createComponent(componentType); - componentRef.instance.resourceList = resourceList; - componentRef.instance.markForCheck() - - } - }) - } - - getResources(): Observable{ - - if(this.resourceListType && !this.resourceListCache[this.resourceListType]){ - // this resource type list has not been downloaded yet, do so now - return this.fastenApi.getResources(this.resourceListType, this.source.id) - .pipe(map((resourceList: ResourceFhir[]) => { - //cache this response so we can skip the request next time - this.resourceListCache[this.resourceListType] = resourceList - return resourceList - })) - } else { - return of(this.resourceListCache[this.resourceListType] || []) + let componentType = this.typeLookup(this.resourceListType) + if(componentType != null){ + console.log("Attempting to create component", this.resourceListType, componentType) + const componentRef = viewContainerRef.createComponent(componentType); + componentRef.instance.totalElements = this.selectedTotalElements; + componentRef.instance.resourceListType = this.resourceListType; + componentRef.instance.sourceId = this.source.id; + componentRef.instance.markForCheck() } } @@ -164,7 +146,7 @@ export class ResourceListComponent implements OnInit, OnChanges { } default: { console.warn("Unknown component type, using fallback", resourceType) - return ListFallbackResourceComponent; + return ListFallbackComponent; } } diff --git a/frontend/src/app/components/shared.module.ts b/frontend/src/app/components/shared.module.ts index 9afe60c61..3176bb2f3 100644 --- a/frontend/src/app/components/shared.module.ts +++ b/frontend/src/app/components/shared.module.ts @@ -12,6 +12,7 @@ import {ListEncounterComponent} from './list-generic-resource/list-encounter.com import {ListImmunizationComponent} from './list-generic-resource/list-immunization.component' import {ListMedicationAdministrationComponent} from './list-generic-resource/list-medication-administration.component'; import {ListMedicationComponent} from './list-generic-resource/list-medication.component' +import {ListFallbackComponent} from './list-generic-resource/list-fallback.component' import {ListMedicationDispenseComponent} from './list-generic-resource/list-medication-dispense.component'; import {ListMedicationRequestComponent} from './list-generic-resource/list-medication-request.component' import {ListNutritionOrderComponent} from './list-generic-resource/list-nutrition-order.component'; @@ -30,7 +31,6 @@ import {ListAppointmentComponent} from './list-generic-resource/list-appointment import {ListDeviceComponent} from './list-generic-resource/list-device.component'; import {ListDiagnosticReportComponent} from './list-generic-resource/list-diagnostic-report.component'; import {ListGoalComponent} from './list-generic-resource/list-goal.component'; -import { ListFallbackResourceComponent } from './list-fallback-resource/list-fallback-resource.component'; import {NgbCollapseModule, NgbModule} from '@ng-bootstrap/ng-bootstrap'; import { ToastComponent } from './toast/toast.component'; import { MomentModule } from 'ngx-moment'; @@ -145,7 +145,7 @@ import { CodableConceptComponent } from './fhir/datatypes/codable-concept/codabl ListGoalComponent, ResourceListComponent, ResourceListOutletDirective, - ListFallbackResourceComponent, + ListFallbackComponent, ToastComponent, ReportHeaderComponent, ReportMedicalHistoryEditorComponent, @@ -155,6 +155,7 @@ import { CodableConceptComponent } from './fhir/datatypes/codable-concept/codabl FhirResourceComponent, FhirResourceOutletDirective, FallbackComponent, + ListFallbackComponent, DiagnosticReportComponent, NlmTypeaheadComponent, DocumentReferenceComponent, @@ -171,6 +172,7 @@ import { CodableConceptComponent } from './fhir/datatypes/codable-concept/codabl DiagnosticReportComponent, DocumentReferenceComponent, FallbackComponent, + ListFallbackComponent, FhirResourceComponent, FhirResourceOutletDirective, ImmunizationComponent, diff --git a/frontend/src/app/pages/source-detail/source-detail.component.html b/frontend/src/app/pages/source-detail/source-detail.component.html index a6b6bd80f..97b403746 100644 --- a/frontend/src/app/pages/source-detail/source-detail.component.html +++ b/frontend/src/app/pages/source-detail/source-detail.component.html @@ -63,7 +63,11 @@
        - +
  • diff --git a/frontend/src/app/pages/source-detail/source-detail.component.ts b/frontend/src/app/pages/source-detail/source-detail.component.ts index 4a3a2cc71..7db163017 100644 --- a/frontend/src/app/pages/source-detail/source-detail.component.ts +++ b/frontend/src/app/pages/source-detail/source-detail.component.ts @@ -16,6 +16,7 @@ export class SourceDetailComponent implements OnInit { selectedSource: Source = null selectedPatient: ResourceFhir = null selectedResourceType: string = null + selectedTotalElements: number = 0 resourceTypeCounts: { [name: string]: number } = {} @@ -43,6 +44,7 @@ export class SourceDetailComponent implements OnInit { selectResourceType(resourceType: string) { this.selectedResourceType = resourceType + this.selectedTotalElements = this.resourceTypeCounts[resourceType] } //functions to call on patient diff --git a/frontend/src/app/services/fasten-api.service.ts b/frontend/src/app/services/fasten-api.service.ts index 59764f1a2..919984858 100644 --- a/frontend/src/app/services/fasten-api.service.ts +++ b/frontend/src/app/services/fasten-api.service.ts @@ -138,7 +138,7 @@ export class FastenApiService { ); } - getResources(sourceResourceType?: string, sourceID?: string, sourceResourceID?: string): Observable { + getResources(sourceResourceType?: string, sourceID?: string, sourceResourceID?: string, page?: number): Observable { let queryParams = {} if(sourceResourceType){ queryParams["sourceResourceType"] = sourceResourceType @@ -150,6 +150,9 @@ export class FastenApiService { if(sourceResourceID){ queryParams["sourceResourceID"] = sourceResourceID } + if(page !== undefined){ + queryParams["page"] = page + } return this._httpClient.get(`${GetEndpointAbsolutePath(globalThis.location, environment.fasten_api_endpoint_base)}/secure/resource/fhir`, {params: queryParams}) .pipe( From 7c32bee96618b2951ebc9baf2a62a5c922c337bd Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sat, 12 Aug 2023 00:04:29 -0600 Subject: [PATCH 5/6] Practitioner UI tweaks. --- .../practitioner/practitioner.component.ts | 32 +++++++++++++------ .../src/lib/models/datatypes/address-model.ts | 3 ++ .../models/resources/practitioner-model.ts | 5 +-- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts b/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts index 1d2359800..b5c3037e2 100644 --- a/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts +++ b/frontend/src/app/components/fhir/resources/practitioner/practitioner.component.ts @@ -48,16 +48,6 @@ export class PractitionerComponent implements OnInit, FhirResourceComponentInter // ), // status: isContactData, // }, - { - label: 'Address', - data: this.displayModel?.address, - enabled: !!this.displayModel?.address, - }, - { - label: 'Telephone', - data: this.displayModel.telecom, - enabled: !!this.displayModel.telecom, - }, ]; for(let idCoding of (this.displayModel?.identifier || [])){ this.tableData.push({ @@ -66,6 +56,28 @@ export class PractitionerComponent implements OnInit, FhirResourceComponentInter enabled: true, }) } + if(this.displayModel?.address){ + let address = this.displayModel?.address + let addressParts = [] + if(address.line){ + addressParts.push(address.line.join(' ')) + } + if(address.city){ + addressParts.push(address.city) + } + if(address.state){ + addressParts.push(address.state) + } + if(address.postalCode){ + addressParts.push(address.postalCode) + } + + this.tableData.push({ + label: 'Address', + data: addressParts.join(", "), + enabled: !!addressParts, + }) + } for(let telecom of (this.displayModel?.telecom || [])){ this.tableData.push({ label: telecom.system, diff --git a/frontend/src/lib/models/datatypes/address-model.ts b/frontend/src/lib/models/datatypes/address-model.ts index 6862e3d9a..1c85ec89e 100644 --- a/frontend/src/lib/models/datatypes/address-model.ts +++ b/frontend/src/lib/models/datatypes/address-model.ts @@ -9,6 +9,9 @@ export class AddressModel { constructor(fhirData: any) { + if(!fhirData){ + return + } this.city = fhirpath.evaluate(fhirData, "city").join("") this.line = fhirpath.evaluate(fhirData, "line") this.state = fhirpath.evaluate(fhirData, "state").join("") diff --git a/frontend/src/lib/models/resources/practitioner-model.ts b/frontend/src/lib/models/resources/practitioner-model.ts index 769d6fdc2..225c0dc66 100644 --- a/frontend/src/lib/models/resources/practitioner-model.ts +++ b/frontend/src/lib/models/resources/practitioner-model.ts @@ -6,6 +6,7 @@ import {CodingModel} from '../datatypes/coding-model'; import {FastenDisplayModel} from '../fasten/fasten-display-model'; import {FastenOptions} from '../fasten/fasten-options'; import {HumanNameModel} from '../datatypes/human-name-model'; +import {AddressModel} from '../datatypes/address-model'; export class PractitionerModel extends FastenDisplayModel { @@ -19,7 +20,7 @@ export class PractitionerModel extends FastenDisplayModel { relationship: string }|undefined telecom: { system?: string, value?: string, use?: string }[]|undefined - address: string|undefined + address: AddressModel|undefined birthdate: string|undefined qualification: { code: string, system: string }[]|undefined @@ -50,7 +51,7 @@ export class PractitionerModel extends FastenDisplayModel { stu3DTO(fhirResource:any){ this.name = _.get(fhirResource, 'name',[]).map((name:any): HumanNameModel => new HumanNameModel(name)); - this.address = _.get(fhirResource, 'address.0'); + this.address = new AddressModel(_.get(fhirResource, 'address.0')); this.telecom = _.get(fhirResource, 'telecom'); }; From 76ab7b8c63e4e93a73f4135f86ce550479bea7a5 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Sat, 12 Aug 2023 07:30:19 -0600 Subject: [PATCH 6/6] make sure explore page loading animation is present until all source lookups are complete. --- .../app/pages/explore/explore.component.html | 30 ++----------------- .../app/pages/explore/explore.component.ts | 15 +--------- 2 files changed, 4 insertions(+), 41 deletions(-) diff --git a/frontend/src/app/pages/explore/explore.component.html b/frontend/src/app/pages/explore/explore.component.html index db07d0bfe..695687073 100644 --- a/frontend/src/app/pages/explore/explore.component.html +++ b/frontend/src/app/pages/explore/explore.component.html @@ -5,7 +5,9 @@ - +
    @@ -42,32 +44,6 @@

    No Sources Found!

    - - - - - - - -
    diff --git a/frontend/src/app/pages/explore/explore.component.ts b/frontend/src/app/pages/explore/explore.component.ts index 642c7625a..1010e41ac 100644 --- a/frontend/src/app/pages/explore/explore.component.ts +++ b/frontend/src/app/pages/explore/explore.component.ts @@ -24,7 +24,6 @@ export class ExploreComponent implements OnInit { ngOnInit(): void { this.loading = true this.fastenApi.getSources().subscribe(results => { - this.loading = false //handle connected sources sources const connectedSources = results as Source[] @@ -32,6 +31,7 @@ export class ExploreComponent implements OnInit { for(const ndx in connectedSources){ this.connectedSources.push({source: connectedSources[ndx], metadata: connectedMetadata[ndx]}) } + this.loading = false }) }, error => { this.loading = false @@ -44,19 +44,6 @@ export class ExploreComponent implements OnInit { state: sourceListItem.source }); - // if(this.status[sourceListItem.metadata.source_type] || !sourceListItem.source){ - // //if this source is currently "loading" dont open the modal window - // return - // } - // - // this.modalSelectedSourceListItem = sourceListItem - // this.modalService.open(contentModalRef, {ariaLabelledBy: 'modal-basic-title'}).result.then((result) => { - // this.modalSelectedSourceListItem = null - // this.modalCloseResult = `Closed with: ${result}`; - // }, (reason) => { - // this.modalSelectedSourceListItem = null - // this.modalCloseResult = `Dismissed ${this.getDismissReason(reason)}`; - // }); } }