Skip to content

Commit

Permalink
Bakport old changes from previous connectathon
Browse files Browse the repository at this point in the history
  • Loading branch information
ir4y committed Aug 22, 2024
1 parent bd61906 commit e7a88cc
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 0 deletions.
27 changes: 27 additions & 0 deletions resources/seeds/Mapping/place-order.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
type: FHIRPath
resourceType: Mapping
body:
type: transaction
entry:
- request:
url: "ServiceRequest"
method: POST
resource:
status: 'active'
category:
- coding:
- code: '108252007'
display: 'Laboratory procedure'
system: 'http://snomed.info/sct'
code:
text: "{{ QuestionnaireResponse.repeat(item).where(linkId='test-code').answer.valueString }}"
intent: "{{ QuestionnaireResponse.repeat(item).where(linkId='intent').answer.valueCoding.code }}"
priority: "{{ QuestionnaireResponse.repeat(item).where(linkId='priority').answer.valueCoding.code }}"
encounter:
reference: "{{ 'Encounter/' + QuestionnaireResponse.repeat(item).where(linkId='encounter-id').answer.valueString }}"
requester:
reference: "{{ 'Practitioner/' + QuestionnaireResponse.repeat(item).where(linkId='practitiner-id').answer.valueString }}"
subject:
reference: "{{ 'Patient/' + QuestionnaireResponse.repeat(item).where(linkId='patient-id').answer.valueString }}"
performer:
- reference: "{{ QuestionnaireResponse.repeat(item).where(linkId='assigned-organization').answer.valueReference.reference }}"
78 changes: 78 additions & 0 deletions resources/seeds/Questionnaire/place-order.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
resourceType: Questionnaire
url: https://aidbox.emr.beda.software/ui/console#/entities/Questionnaire/place-order
meta:
profile:
- https://beda.software/beda-emr-questionnaire
name: e-request
title: Laboratory procedure eRequest
status: active
subjectType:
- Encounter
launchContext:
- name:
code: Patient
type:
- Patient
- name:
code: Author
type:
- Practitioner
- name:
code: Encounter
type:
- Encounter
mapping:
- id: place-order
resourceType: Mapping
item:
- linkId: test-code
text: Test Codes
required: true
type: string
- linkId: intent
text: Intent
required: true
type: choice
answerValueSet: request-intent
- linkId: priority
required: true
text: Priority
type: choice
answerValueSet: request-priority
- linkId: assigned-organization
text: Assigned organization
type: reference
referenceResource:
- Organization
required: true
answerExpression:
language: application/x-fhir-query
expression: "Organization?type=lab"
choiceColumn:
- forDisplay: true
path: name
answerValueSet: request-priority
- linkId: patient-id
type: string
text: patientId
readOnly: true
hidden: true
initialExpression:
language: text/fhirpath
expression: "%Patient.id"
- linkId: encounter-id
type: string
text: encounterId
readOnly: true
hidden: true
initialExpression:
language: text/fhirpath
expression: "%Encounter.id"
- linkId: practitiner-id
type: string
text: practitinerId
readOnly: true
hidden: true
initialExpression:
language: text/fhirpath
expression: "%Author.id"
10 changes: 10 additions & 0 deletions src/containers/PatientDetails/Dashboard/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
prepareImmunizations,
prepareMedications,
prepareServiceRequest,
prepareAuERequest,
} from 'src/containers/PatientDetails/PatientOverviewDynamic/components/StandardCard/prepare';
import { CreatinineDashboardContainer } from 'src/containers/PatientDetails/PatientOverviewDynamic/containers/CreatinineDashboardContainer';
import { GeneralInformationDashboardContainer } from 'src/containers/PatientDetails/PatientOverviewDynamic/containers/GeneralIInformationDashboardContainer';
Expand All @@ -34,6 +35,15 @@ export const patientDashboardConfig: DashboardInstance = {
{
widget: GeneralInformationDashboardContainer,
},
{
query: {
resourceType: 'ServiceRequest',
search: (patient: Patient) => ({
subject: patient.id,
}),
},
widget: StandardCardContainerFabric(prepareAuERequest),
},
{
query: {
resourceType: 'Observation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,64 @@ export function prepareServiceRequest(
],
};
}

export function prepareAuERequest(
serviceRequests: ServiceRequest[],
_provenanceList: Provenance[],
total: number,
): OverviewCard<ServiceRequest> {
return {
title: t`Orders`,
key: 'service-request',
icon: <HeartOutlined />,
data: serviceRequests,
total,
getKey: (r: ServiceRequest) => r.id!,
columns: [
{
title: t`ID`,
key: 'id',
render: (resource: ServiceRequest) => resource.id!,
width: 300,
},
{
title: t`Name`,
key: 'name',
render: (resource: ServiceRequest) => resource.code?.text ?? resource.code?.coding?.[0]?.display,
width: 200,
},
{
title: t`Status`,
key: 'status',
render: (resource: ServiceRequest) => resource.status,
width: 100,
},
{
title: t`External ids`,
key: 'externalid',
render: (r: ServiceRequest) => {
const identifier = r.identifier?.[0];
if (identifier) {
const { value, system } = identifier;
const srLink = `${system}/${value}`;
const taskLink = `https://sparked.npd.telstrahealth.com/ereq/fhir/Task?focus=${value}`;
return (
<div>
<a href={srLink} target="_blank" rel="noreferrer">
ServiceRrequest
</a>
<br />
<a href={taskLink} target="_blank" rel="noreferrer">
Task
</a>
</div>
);
} else {
return '';
}
},
width: 320,
},
],
};
}

0 comments on commit e7a88cc

Please sign in to comment.