fixing fhir-resource tests.
This commit is contained in:
parent
d972f1fab1
commit
844a40fe5c
|
@ -1,10 +1,10 @@
|
|||
<div class="card card-fhir-resource" >
|
||||
<div class="card-header" (click)="isCollapsed = ! isCollapsed">
|
||||
<div>
|
||||
<h6 class="card-title">{{displayModel.title}}</h6>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel.recorded_date"><strong>Recorded on</strong> {{displayModel.recorded_date | date}}</p>
|
||||
<h6 class="card-title">{{displayModel?.title}}</h6>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel?.recorded_date"><strong>Recorded on</strong> {{displayModel?.recorded_date | date}}</p>
|
||||
</div>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel.status">{{displayModel.status}}</fhir-ui-badge>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel?.status">{{displayModel?.status}}</fhir-ui-badge>
|
||||
</div>
|
||||
<div #collapse="ngbCollapse" [(ngbCollapse)]="isCollapsed" class="card-body">
|
||||
<p class="az-content-text mg-b-20">Risk of harmful or undesirable physiological response which is specific to an individual and associated with exposure to a substance.</p>
|
||||
|
|
|
@ -23,31 +23,31 @@ export class AllergyIntoleranceComponent implements OnInit, FhirResourceComponen
|
|||
this.tableData = [
|
||||
{
|
||||
label: 'Substance',
|
||||
data: this.displayModel.substance_coding,
|
||||
data: this.displayModel?.substance_coding,
|
||||
data_type: TableRowItemDataType.CodingList,
|
||||
enabled: !!this.displayModel.substance_coding,
|
||||
enabled: !!this.displayModel?.substance_coding,
|
||||
},
|
||||
{
|
||||
label: 'Type',
|
||||
data: this.displayModel.type,
|
||||
enabled: !!this.displayModel.type,
|
||||
data: this.displayModel?.type,
|
||||
enabled: !!this.displayModel?.type,
|
||||
},
|
||||
{
|
||||
label: 'Category',
|
||||
data: this.displayModel.category?.join(" "),
|
||||
enabled: !!this.displayModel.category,
|
||||
data: this.displayModel?.category?.join(" "),
|
||||
enabled: !!this.displayModel?.category,
|
||||
},
|
||||
{
|
||||
label: 'Patient',
|
||||
data: this.displayModel.patient,
|
||||
data: this.displayModel?.patient,
|
||||
data_type: TableRowItemDataType.Reference,
|
||||
enabled: !!this.displayModel.patient,
|
||||
enabled: !!this.displayModel?.patient,
|
||||
},
|
||||
{
|
||||
label: 'Asserted by',
|
||||
data: this.displayModel.asserter,
|
||||
data: this.displayModel?.asserter,
|
||||
data_type: TableRowItemDataType.Reference,
|
||||
enabled: !!this.displayModel.asserter,
|
||||
enabled: !!this.displayModel?.asserter,
|
||||
},
|
||||
// {
|
||||
// label: 'Manifestation',
|
||||
|
|
|
@ -19,5 +19,5 @@
|
|||
<fhir-binary-text [displayModel]="displayModel"></fhir-binary-text>
|
||||
</ng-template>
|
||||
<ng-template #showEmpty>
|
||||
Unknown Binary content type {{displayModel.content_type}}
|
||||
Unknown Binary content type {{displayModel?.content_type}}
|
||||
</ng-template>
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<div class="card card-fhir-resource" >
|
||||
<div class="card-header" (click)="isCollapsed = ! isCollapsed">
|
||||
<div>
|
||||
<h6 class="card-title">{{displayModel.title}}</h6>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel.effective_datetime"><strong>Start date</strong> {{displayModel.effective_datetime | date}}</p>
|
||||
<h6 class="card-title">{{displayModel?.title}}</h6>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel?.effective_datetime"><strong>Start date</strong> {{displayModel?.effective_datetime | date}}</p>
|
||||
</div>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel.status">{{displayModel.status}}</fhir-ui-badge>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel?.status">{{displayModel?.status}}</fhir-ui-badge>
|
||||
<!-- <div class="btn-group">-->
|
||||
<!-- <button class="btn active">Day</button>-->
|
||||
<!-- <button class="btn">Week</button>-->
|
||||
|
|
|
@ -22,25 +22,25 @@ export class DiagnosticReportComponent implements OnInit, FhirResourceComponentI
|
|||
this.tableData = [
|
||||
{
|
||||
label: 'Issued',
|
||||
data: this.displayModel.issued,
|
||||
enabled: !!this.displayModel.issued,
|
||||
data: this.displayModel?.issued,
|
||||
enabled: !!this.displayModel?.issued,
|
||||
},
|
||||
{
|
||||
label: 'Category',
|
||||
data: this.displayModel.category_coding,
|
||||
data: this.displayModel?.category_coding,
|
||||
data_type: TableRowItemDataType.CodingList,
|
||||
enabled: this.displayModel.has_category_coding,
|
||||
enabled: this.displayModel?.has_category_coding,
|
||||
},
|
||||
{
|
||||
label: 'Performer',
|
||||
data: this.displayModel.performer,
|
||||
data: this.displayModel?.performer,
|
||||
data_type: TableRowItemDataType.Reference,
|
||||
enabled: this.displayModel.has_performer,
|
||||
enabled: this.displayModel?.has_performer,
|
||||
},
|
||||
{
|
||||
label: 'Conclusion',
|
||||
data: this.displayModel.conclusion,
|
||||
enabled: !!this.displayModel.conclusion,
|
||||
data: this.displayModel?.conclusion,
|
||||
enabled: !!this.displayModel?.conclusion,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<div class="card card-fhir-resource" >
|
||||
<div class="card-header" (click)="isCollapsed = ! isCollapsed">
|
||||
<div>
|
||||
<h6 class="card-title">{{displayModel.title}}</h6>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel.sort_date"><strong>Start date</strong> {{displayModel.sort_date | date}}</p>
|
||||
<h6 class="card-title">{{displayModel?.title}}</h6>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel?.sort_date"><strong>Start date</strong> {{displayModel?.sort_date | date}}</p>
|
||||
</div>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel.status">{{displayModel.status}}</fhir-ui-badge>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel?.status">{{displayModel?.status}}</fhir-ui-badge>
|
||||
<!-- <div class="btn-group">-->
|
||||
<!-- <button class="btn active">Day</button>-->
|
||||
<!-- <button class="btn">Week</button>-->
|
||||
|
|
|
@ -24,40 +24,40 @@ export class ImmunizationComponent implements OnInit, FhirResourceComponentInter
|
|||
|
||||
this.tableData.push( {
|
||||
label: 'Manufacturer Text',
|
||||
data: this.displayModel.manufacturer_text,
|
||||
enabled: !!this.displayModel.manufacturer_text,
|
||||
data: this.displayModel?.manufacturer_text,
|
||||
enabled: !!this.displayModel?.manufacturer_text,
|
||||
},
|
||||
{
|
||||
label: 'Manufacturer Text',
|
||||
data: `${this.displayModel.lot_number}` + this.displayModel.lot_number_expiration_date ? ` expires on ${this.displayModel.lot_number_expiration_date}` : '',
|
||||
enabled: this.displayModel.has_lot_number,
|
||||
data: `${this.displayModel?.lot_number}` + this.displayModel?.lot_number_expiration_date ? ` expires on ${this.displayModel?.lot_number_expiration_date}` : '',
|
||||
enabled: this.displayModel?.has_lot_number,
|
||||
},
|
||||
{
|
||||
label: 'Dosage',
|
||||
data:
|
||||
[
|
||||
_.get(this.displayModel.dose_quantity, 'value'),
|
||||
_.get(this.displayModel.dose_quantity, 'unit') || _.get(this.displayModel.dose_quantity, 'code'),
|
||||
_.get(this.displayModel?.dose_quantity, 'value'),
|
||||
_.get(this.displayModel?.dose_quantity, 'unit') || _.get(this.displayModel?.dose_quantity, 'code'),
|
||||
].join(' '),
|
||||
enabled: this.displayModel.has_dose_quantity,
|
||||
enabled: this.displayModel?.has_dose_quantity,
|
||||
},
|
||||
{
|
||||
label: 'Patient',
|
||||
data: this.displayModel.patient,
|
||||
data: this.displayModel?.patient,
|
||||
data_type: TableRowItemDataType.Reference,
|
||||
enabled: !!this.displayModel.patient,
|
||||
enabled: !!this.displayModel?.patient,
|
||||
},
|
||||
{
|
||||
label: 'Requester',
|
||||
data: this.displayModel.requester,
|
||||
data: this.displayModel?.requester,
|
||||
data_type: TableRowItemDataType.Reference,
|
||||
enabled: !!this.displayModel.requester,
|
||||
enabled: !!this.displayModel?.requester,
|
||||
},
|
||||
{
|
||||
label: 'Performer',
|
||||
data: this.displayModel.performer,
|
||||
data: this.displayModel?.performer,
|
||||
data_type: TableRowItemDataType.Reference,
|
||||
enabled: !!this.displayModel.performer,
|
||||
enabled: !!this.displayModel?.performer,
|
||||
},
|
||||
// {
|
||||
// label: 'Note',
|
||||
|
@ -67,20 +67,20 @@ export class ImmunizationComponent implements OnInit, FhirResourceComponentInter
|
|||
// },
|
||||
{
|
||||
label: 'Route',
|
||||
data: this.displayModel.route,
|
||||
data: this.displayModel?.route,
|
||||
data_type: TableRowItemDataType.CodingList,
|
||||
enabled: this.displayModel.has_route,
|
||||
enabled: this.displayModel?.has_route,
|
||||
},
|
||||
{
|
||||
label: 'Location',
|
||||
data: this.displayModel.location,
|
||||
enabled: !!this.displayModel.location,
|
||||
data: this.displayModel?.location,
|
||||
enabled: !!this.displayModel?.location,
|
||||
},
|
||||
{
|
||||
label: 'Site',
|
||||
data: this.displayModel.site,
|
||||
data: this.displayModel?.site,
|
||||
data_type: TableRowItemDataType.CodingList,
|
||||
enabled: this.displayModel.has_site,
|
||||
enabled: this.displayModel?.has_site,
|
||||
})
|
||||
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<div class="card card-fhir-resource" >
|
||||
<div class="card-header" (click)="isCollapsed = ! isCollapsed">
|
||||
<div>
|
||||
<h6 class="card-title">{{displayModel.medication_reference.display}}</h6>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel.sort_date"><strong>Start date</strong> {{displayModel.sort_date | date}}</p>
|
||||
<h6 class="card-title">{{displayModel?.medication_reference.display}}</h6>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel?.sort_date"><strong>Start date</strong> {{displayModel?.sort_date | date}}</p>
|
||||
</div>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel.status">{{displayModel.status}}</fhir-ui-badge>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel?.status">{{displayModel?.status}}</fhir-ui-badge>
|
||||
<!-- <div class="btn-group">-->
|
||||
<!-- <button class="btn active">Day</button>-->
|
||||
<!-- <button class="btn">Week</button>-->
|
||||
|
|
|
@ -10,7 +10,7 @@ import {MedicationRequestModel} from '../../../../../lib/models/resources/medica
|
|||
styleUrls: ['./medication-request.component.scss']
|
||||
})
|
||||
export class MedicationRequestComponent implements OnInit, FhirResourceComponentInterface {
|
||||
@Input() displayModel: MedicationRequestModel
|
||||
@Input() displayModel: MedicationRequestModel | null
|
||||
@Input() showDetails: boolean = true
|
||||
isCollapsed: boolean = false
|
||||
|
||||
|
@ -23,31 +23,31 @@ export class MedicationRequestComponent implements OnInit, FhirResourceComponent
|
|||
this.tableData = [
|
||||
{
|
||||
label: 'Medication',
|
||||
data: this.displayModel.medication_codeable_concept,
|
||||
data: this.displayModel?.medication_codeable_concept,
|
||||
data_type: TableRowItemDataType.Coding,
|
||||
enabled: !!this.displayModel.medication_codeable_concept,
|
||||
enabled: !!this.displayModel?.medication_codeable_concept,
|
||||
},
|
||||
{
|
||||
label: 'Requester',
|
||||
data: this.displayModel.requester,
|
||||
data: this.displayModel?.requester,
|
||||
data_type: TableRowItemDataType.Reference,
|
||||
enabled: !!this.displayModel.requester,
|
||||
enabled: !!this.displayModel?.requester,
|
||||
},
|
||||
{
|
||||
label: 'Created',
|
||||
data: this.displayModel.created,
|
||||
enabled: !!this.displayModel.created,
|
||||
data: this.displayModel?.created,
|
||||
enabled: !!this.displayModel?.created,
|
||||
},
|
||||
{
|
||||
label: 'Type of request',
|
||||
data: this.displayModel.intent,
|
||||
enabled: !!this.displayModel.intent,
|
||||
data: this.displayModel?.intent,
|
||||
enabled: !!this.displayModel?.intent,
|
||||
},
|
||||
{
|
||||
label: 'Reason',
|
||||
data: this.displayModel.reason_code,
|
||||
data: this.displayModel?.reason_code,
|
||||
data_type: TableRowItemDataType.Coding,
|
||||
enabled: !!this.displayModel.reason_code,
|
||||
enabled: !!this.displayModel?.reason_code,
|
||||
},
|
||||
// {
|
||||
// label: 'Dosage',
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
<div class="card-header" (click)="isCollapsed = ! isCollapsed">
|
||||
<div>
|
||||
<h6 class="card-title">{{displayModel.title}}</h6>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel.sort_date"><strong>Start date</strong> {{displayModel.sort_date | date}}</p>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel?.sort_date"><strong>Start date</strong> {{displayModel?.sort_date | date}}</p>
|
||||
</div>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel.status">{{displayModel.status}}</fhir-ui-badge>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel?.status">{{displayModel?.status}}</fhir-ui-badge>
|
||||
<!-- <div class="btn-group">-->
|
||||
<!-- <button class="btn active">Day</button>-->
|
||||
<!-- <button class="btn">Week</button>-->
|
||||
|
|
|
@ -23,15 +23,15 @@ export class MedicationComponent implements OnInit, FhirResourceComponentInterfa
|
|||
this.tableData = [
|
||||
{
|
||||
label: 'Manufacturer',
|
||||
data: this.displayModel.manufacturer,
|
||||
data: this.displayModel?.manufacturer,
|
||||
data_type: TableRowItemDataType.Reference,
|
||||
enabled: !!this.displayModel.manufacturer,
|
||||
enabled: !!this.displayModel?.manufacturer,
|
||||
},
|
||||
{
|
||||
label: 'Form',
|
||||
data: this.displayModel.product_form,
|
||||
data: this.displayModel?.product_form,
|
||||
data_type: TableRowItemDataType.CodingList,
|
||||
enabled: !!this.displayModel.product_form,
|
||||
enabled: !!this.displayModel?.product_form,
|
||||
},
|
||||
// {
|
||||
// label: 'Ingredient',
|
||||
|
@ -44,9 +44,9 @@ export class MedicationComponent implements OnInit, FhirResourceComponentInterfa
|
|||
// },
|
||||
{
|
||||
label: 'Package container',
|
||||
data: this.displayModel.package_coding,
|
||||
data: this.displayModel?.package_coding,
|
||||
data_type: TableRowItemDataType.CodingList,
|
||||
enabled: this.displayModel.has_package_coding,
|
||||
enabled: this.displayModel?.has_package_coding,
|
||||
},
|
||||
// {
|
||||
// label: 'Images',
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<div class="card card-fhir-resource" >
|
||||
<div class="card-header" (click)="isCollapsed = ! isCollapsed">
|
||||
<div>
|
||||
<h6 class="card-title">{{displayModel.sort_title}}</h6>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel.sort_date"><strong>Date</strong>{{displayModel.sort_date}}</p>
|
||||
<h6 class="card-title">{{displayModel?.sort_title}}</h6>
|
||||
<p class="card-text tx-gray-400" *ngIf="displayModel?.sort_date"><strong>Date</strong>{{displayModel?.sort_date}}</p>
|
||||
</div>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel.status">{{displayModel.status}}</fhir-ui-badge>
|
||||
<fhir-ui-badge class="float-right" [status]="displayModel?.status">{{displayModel?.status}}</fhir-ui-badge>
|
||||
<!-- <div class="btn-group">-->
|
||||
<!-- <button class="btn active">Day</button>-->
|
||||
<!-- <button class="btn">Week</button>-->
|
||||
|
|
|
@ -11,7 +11,7 @@ import {PractitionerModel} from '../../../../../lib/models/resources/practitione
|
|||
styleUrls: ['./practitioner.component.scss']
|
||||
})
|
||||
export class PractitionerComponent implements OnInit, FhirResourceComponentInterface {
|
||||
@Input() displayModel: PractitionerModel
|
||||
@Input() displayModel: PractitionerModel | null
|
||||
@Input() showDetails: boolean = true
|
||||
|
||||
isCollapsed: boolean = false
|
||||
|
@ -31,8 +31,8 @@ export class PractitionerComponent implements OnInit, FhirResourceComponentInter
|
|||
// },
|
||||
{
|
||||
label: 'Gender',
|
||||
data: this.displayModel.gender,
|
||||
enabled: !!this.displayModel.gender,
|
||||
data: this.displayModel?.gender,
|
||||
enabled: !!this.displayModel?.gender,
|
||||
},
|
||||
// {
|
||||
// label: 'Birth date',
|
||||
|
|
|
@ -10,7 +10,7 @@ import {ProcedureModel} from '../../../../../lib/models/resources/procedure-mode
|
|||
styleUrls: ['./procedure.component.scss']
|
||||
})
|
||||
export class ProcedureComponent implements OnInit, FhirResourceComponentInterface {
|
||||
@Input() displayModel: ProcedureModel
|
||||
@Input() displayModel: ProcedureModel | null
|
||||
@Input() showDetails: boolean = true
|
||||
isCollapsed: boolean = false
|
||||
|
||||
|
@ -23,20 +23,20 @@ export class ProcedureComponent implements OnInit, FhirResourceComponentInterfac
|
|||
this.tableData = [
|
||||
{
|
||||
label: 'Identification',
|
||||
data: this.displayModel.coding,
|
||||
data: this.displayModel?.coding,
|
||||
data_type: TableRowItemDataType.CodingList,
|
||||
enabled: this.displayModel.has_coding,
|
||||
enabled: this.displayModel?.has_coding,
|
||||
},
|
||||
{
|
||||
label: 'Category',
|
||||
data: this.displayModel.category,
|
||||
data: this.displayModel?.category,
|
||||
data_type: TableRowItemDataType.Coding,
|
||||
enabled: !!this.displayModel.category,
|
||||
enabled: !!this.displayModel?.category,
|
||||
},
|
||||
{
|
||||
label: 'Performed by',
|
||||
data: this.displayModel.performer,
|
||||
enabled: this.displayModel.has_performer_data,
|
||||
data: this.displayModel?.performer,
|
||||
enabled: this.displayModel?.has_performer_data,
|
||||
},
|
||||
// {
|
||||
// label: 'Reason procedure performed',
|
||||
|
@ -45,9 +45,9 @@ export class ProcedureComponent implements OnInit, FhirResourceComponentInterfac
|
|||
// },
|
||||
{
|
||||
label: 'Location',
|
||||
data: this.displayModel.location_reference,
|
||||
data: this.displayModel?.location_reference,
|
||||
data_type: TableRowItemDataType.Reference,
|
||||
enabled: !!this.displayModel.location_reference,
|
||||
enabled: !!this.displayModel?.location_reference,
|
||||
},
|
||||
// {
|
||||
// label: 'Additional information about the procedure',
|
||||
|
@ -56,9 +56,9 @@ export class ProcedureComponent implements OnInit, FhirResourceComponentInterfac
|
|||
// },
|
||||
{
|
||||
label: 'The result of procedure',
|
||||
data: this.displayModel.outcome,
|
||||
data: this.displayModel?.outcome,
|
||||
data_type: TableRowItemDataType.Coding,
|
||||
enabled: !!this.displayModel.outcome,
|
||||
enabled: !!this.displayModel?.outcome,
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -1,16 +1,27 @@
|
|||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ReportHeaderComponent } from './report-header.component';
|
||||
import {FastenApiService} from '../../services/fasten-api.service';
|
||||
import {NgbModalModule} from '@ng-bootstrap/ng-bootstrap';
|
||||
import {of} from 'rxjs';
|
||||
|
||||
describe('ReportHeaderComponent', () => {
|
||||
let component: ReportHeaderComponent;
|
||||
let fixture: ComponentFixture<ReportHeaderComponent>;
|
||||
let mockedFastenApiService
|
||||
|
||||
beforeEach(async () => {
|
||||
mockedFastenApiService = jasmine.createSpyObj('FastenApiService', ['getResources'])
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ ReportHeaderComponent ]
|
||||
declarations: [ ReportHeaderComponent ],
|
||||
providers: [{
|
||||
provide: FastenApiService,
|
||||
useValue: mockedFastenApiService
|
||||
}]
|
||||
})
|
||||
.compileComponents();
|
||||
mockedFastenApiService.getResources.and.returnValue(of({}));
|
||||
|
||||
fixture = TestBed.createComponent(ReportHeaderComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
|
Loading…
Reference in New Issue