Skip to content

Commit

Permalink
make sure that medication requests and procedures display pateint fri…
Browse files Browse the repository at this point in the history
…endly descriptions if possible.

related #122
  • Loading branch information
AnalogJ committed Apr 23, 2023
1 parent 1aa3cd3 commit b2a2f0d
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 5 deletions.
2 changes: 1 addition & 1 deletion backend/pkg/web/handler/glossary.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func FindCodeSystem(codeSystem string) (string, error) {
if codeSystemId, ok := codeSystemIds[codeSystem]; ok {
return codeSystemId, nil
} else {
return "", fmt.Errorf("Code System not found")
return "", fmt.Errorf("Code System not found: %s", codeSystem)
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@ import {FastenDisplayModel} from '../../../../lib/models/fasten/fasten-display-m
export interface FhirResourceComponentInterface {
displayModel: FastenDisplayModel;
showDetails: boolean;

//these are used to populate the description of the resource. May not be available for all resources
resourceCode?: string;
resourceCodeSystem?: string;

markForCheck()
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {MediaComponent} from '../resources/media/media.component';

@Component({
selector: 'fhir-resource',
changeDetection: ChangeDetectionStrategy.OnPush,
changeDetection: ChangeDetectionStrategy.Default,
templateUrl: './fhir-resource.component.html',
styleUrls: ['./fhir-resource.component.scss']
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ <h6 class="card-title">{{displayModel?.medication_reference?.display}}</h6>
<!-- </div>-->
</div>
<div #collapse="ngbCollapse" [(ngbCollapse)]="isCollapsed" class="card-body">
<p class="az-content-text mg-b-20">An order or request for both supply of the medication and the instructions for administration of the medication to a patient.</p>
<p class="az-content-text mg-b-20" *ngIf="!(resourceCode && resourceCodeSystem); else lookupCode">An order or request for both supply of the medication and the instructions for administration of the medication to a patient.</p>
<fhir-ui-table [displayModel]="displayModel" [tableData]="tableData"></fhir-ui-table>
</div>
<div *ngIf="showDetails" class="card-footer">
<a class="float-right" routerLink="/source/{{displayModel?.source_id}}/resource/{{displayModel?.source_resource_id}}">details</a>
</div>
</div>

<ng-template #lookupCode>
<app-glossary-lookup class="az-content-text mg-b-20" [code]="resourceCode" [codeSystem]="resourceCodeSystem"></app-glossary-lookup>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import {MedicationRequestModel} from '../../../../../lib/models/resources/medica
export class MedicationRequestComponent implements OnInit, FhirResourceComponentInterface {
@Input() displayModel: MedicationRequestModel | null
@Input() showDetails: boolean = true
//these are used to populate the description of the resource. May not be available for all resources
resourceCode?: string;
resourceCodeSystem?: string;

isCollapsed: boolean = false

tableData: TableRowItem[] = []
Expand All @@ -20,6 +24,9 @@ export class MedicationRequestComponent implements OnInit, FhirResourceComponent

ngOnInit(): void {

this.resourceCode = this.displayModel?.medication_codeable_concept?.code
this.resourceCodeSystem = this.displayModel?.medication_codeable_concept?.system

this.tableData = [
{
label: 'Medication',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@ <h6 class="card-title">{{displayModel?.display}}</h6>
<!-- </div>-->
</div>
<div #collapse="ngbCollapse" [(ngbCollapse)]="isCollapsed" class="card-body">
<p class="az-content-text mg-b-20">An action that is or was performed on or for a patient, practitioner, device, organization, or location. For example, this can be a physical intervention on a patient like an operation, or less invasive like long term services, counseling, or hypnotherapy.</p>
<p class="az-content-text mg-b-20" *ngIf="!(resourceCode && resourceCodeSystem); else lookupCode">An action that is or was performed on or for a patient, practitioner, device, organization, or location. For example, this can be a physical intervention on a patient like an operation, or less invasive like long term services, counseling, or hypnotherapy.</p>
<fhir-ui-table [displayModel]="displayModel" [tableData]="tableData"></fhir-ui-table>
</div>
<div *ngIf="showDetails" class="card-footer">
<a class="float-right" routerLink="/source/{{displayModel?.source_id}}/resource/{{displayModel?.source_resource_id}}">details</a>
</div>
</div>

<ng-template #lookupCode>
<app-glossary-lookup class="az-content-text mg-b-20" [code]="resourceCode" [codeSystem]="resourceCodeSystem"></app-glossary-lookup>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ import {ProcedureModel} from '../../../../../lib/models/resources/procedure-mode
export class ProcedureComponent implements OnInit, FhirResourceComponentInterface {
@Input() displayModel: ProcedureModel | null
@Input() showDetails: boolean = true

//these are used to populate the description of the resource. May not be available for all resources
resourceCode?: string;
resourceCodeSystem?: string;

isCollapsed: boolean = false

tableData: TableRowItem[] = []
Expand All @@ -20,6 +25,15 @@ export class ProcedureComponent implements OnInit, FhirResourceComponentInterfac

ngOnInit(): void {

//medline only supports CPT procedure codes - "http://www.ama-assn.org/go/cpt", "2.16.840.1.113883.6.12"
for(let coding of this.displayModel?.coding ?? []){
if(coding.system == "http://www.ama-assn.org/go/cpt" || coding.system == "2.16.840.1.113883.6.12"){
this.resourceCode = coding.code
this.resourceCodeSystem = coding.system
break
}
}

this.tableData = [
{
label: 'Identification',
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/models/resources/procedure-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class ProcedureModel extends FastenDisplayModel {
performed_period_end: string|undefined;
has_performed_period: boolean|undefined;
has_coding: boolean|undefined;
coding: string|undefined;
coding: CodingModel[]|undefined;
category: string|undefined;
location_reference: string|undefined;
has_performer_data: boolean|undefined;
Expand Down

0 comments on commit b2a2f0d

Please sign in to comment.