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 569a26f2..f9f61613 100644
--- a/frontend/src/app/pages/source-detail/source-detail.component.ts
+++ b/frontend/src/app/pages/source-detail/source-detail.component.ts
@@ -2,6 +2,8 @@ import {Component, OnInit, ViewChild} from '@angular/core';
import {ActivatedRoute, Router} from '@angular/router';
import {Source} from '../../models/fasten/source';
import {FastenApiService} from '../../services/fasten-api.service';
+import {ResourceFhir} from '../../models/fasten/resource_fhir';
+import {getPath} from '../../components/list-generic-resource/utils';
@Component({
@@ -12,6 +14,7 @@ import {FastenApiService} from '../../services/fasten-api.service';
export class SourceDetailComponent implements OnInit {
selectedSource: Source = null
+ selectedPatient: ResourceFhir = null
selectedResourceType: string = null
resourceTypeCounts: { [name: string]: number } = {}
@@ -27,6 +30,7 @@ export class SourceDetailComponent implements OnInit {
//always request the source summary
this.fastenApi.getSourceSummary(this.route.snapshot.paramMap.get('source_id')).subscribe((sourceSummary) => {
this.selectedSource = sourceSummary.source;
+ this.selectedPatient = sourceSummary.patient;
for(let resourceTypeCount of sourceSummary.resource_type_counts){
this.resourceTypeCounts[resourceTypeCount.resource_type] = resourceTypeCount.count
}
@@ -36,4 +40,42 @@ export class SourceDetailComponent implements OnInit {
selectResourceType(resourceType: string) {
this.selectedResourceType = resourceType
}
+
+ //functions to call on patient
+ getPatientName(){
+ // @ts-ignore
+ return `${getPath(this.selectedPatient?.payload, 'name.0.family')}, ${getPath(this.selectedPatient?.payload, 'name.0.given').join(' ')}`
+ }
+ getPatientGender(){
+ return getPath(this.selectedPatient?.payload, 'gender')
+ }
+ getPatientMRN(){
+ return getPath(this.selectedPatient?.payload, 'identifier.0.value')
+ }
+ getPatientEmail(){
+ // @ts-ignore
+ return (this.selectedPatient?.payload?.telecom || []).filter(
+ telecom => telecom.system === 'email',
+ )[0]?.value
+ }
+ getPatientDOB(){
+ return getPath(this.selectedPatient?.payload, 'birthDate')
+
+ }
+ getPatientPhone(){
+ // @ts-ignore
+ return (this.selectedPatient?.payload?.telecom || []).filter(
+ telecom => telecom.system === 'phone',
+ )[0]?.value
+ }
+ getPatientAge(){
+ return ''
+ }
+ getPatientAddress(){
+ const line = getPath(this.selectedPatient?.payload, 'address.0.line')
+ const city = getPath(this.selectedPatient?.payload, 'address.0.city')
+ const state = getPath(this.selectedPatient?.payload, 'address.0.state')
+ return `${line}, ${city}, ${state}`
+ }
+
}
diff --git a/frontend/src/styles.scss b/frontend/src/styles.scss
index e4d120b2..e01d960c 100644
--- a/frontend/src/styles.scss
+++ b/frontend/src/styles.scss
@@ -15,6 +15,12 @@
cursor: auto !important;
}
+// if text is too long, we can truncate
+.truncate {
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+}
/* You can add global styles to this file, and also import other style files */
/*