Skip to content

Commit

Permalink
Merge pull request #65 from Bahmni/BAH-3040
Browse files Browse the repository at this point in the history
BAH-3040 | Save lab panel test results
  • Loading branch information
riyaTw authored Sep 18, 2023
2 parents 607604e + c9f160b commit f1f3762
Show file tree
Hide file tree
Showing 9 changed files with 298 additions and 237 deletions.
8 changes: 7 additions & 1 deletion src/__mocks__/patientLabDetails.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ export const mockPendingLabOrder = {
testName: 'Dummy Test',
date: 'May 03, 2022',
orderedBy: 'Superman',
}
},
{
id: 'abf-123',
testName: 'Haemoglobin',
date: 'May 03, 2022',
orderedBy: 'Superman',
},
],
goTo: jest.fn(),
currentPage: 1,
Expand Down
13 changes: 12 additions & 1 deletion src/__mocks__/pendingLabOrders.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,18 @@ export const mockPendingLabOrdersResponse: LabOrdersFetchResponse = {
provider: 'Super Man',
providerUuid: '2',
fulfillerStatus: null,
}
},
{
concept: {
name: 'Haemoglobin',
uuid: '21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
},
orderDate: 1657188834000,
orderUuid: 'abf-123',
provider: 'Super Man',
providerUuid: '2',
fulfillerStatus: null,
},
],
}

Expand Down
16 changes: 9 additions & 7 deletions src/__mocks__/selectTests.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const mockLabTestsResponse: LabTestResult = {
setMembers: [],
},
{
uuid: 'fe769568-16da-4d9e-9c99-fbed0a8a60f5',
uuid: '21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
name: {
display: 'Haemoglobin',
uuid: 'b8b8c317-43d2-4c4b-a67d-2ef3782c53eb',
Expand Down Expand Up @@ -170,7 +170,7 @@ export const mockLabTestsResponse: LabTestResult = {
setMembers: [],
},
{
uuid: 'fe769568-16da-4d9e-9c99-fbed0a8a60f5',
uuid: '21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
name: {
display: 'Haemoglobin',
uuid: 'b8b8c317-43d2-4c4b-a67d-2ef3782c53eb',
Expand Down Expand Up @@ -373,7 +373,7 @@ export const mockAlltestAndPanels = [
setMembers: [],
},
{
uuid: 'fe769568-16da-4d9e-9c99-fbed0a8a60f5',
uuid: '21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
name: {
display: 'Haemoglobin',
uuid: 'b8b8c317-43d2-4c4b-a67d-2ef3782c53eb',
Expand Down Expand Up @@ -456,7 +456,7 @@ export const mockAlltestAndPanels = [
setMembers: [],
},
{
uuid: 'fe769568-16da-4d9e-9c99-fbed0a8a60f5',
uuid: '21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
name: {
display: 'Haemoglobin',
uuid: 'b8b8c317-43d2-4c4b-a67d-2ef3782c53eb',
Expand Down Expand Up @@ -555,8 +555,10 @@ export const selfDiagnosticRequestBody = reportDate =>
export const diagnosticReportRequestBodyWithBasedOn = reportDate =>
`{"resourceType":"DiagnosticReport","status":"final","code":{"coding":[{"code":"07a128f7-f596-45d5-a2a9-c447bc9e5112","display":"Absolute Eosinphil Count"}]},"subject":{"reference":"Patient/123"},"issued":"${reportDate}","presentedForm":[{"url":"100/76-Patient Document-7baff463-fdaa-43d0-a402-aa948c296958.pdf","title":"test.pdf"}],"basedOn":[{"identifier":{"value":"abc-123"},"reference":"ServiceRequest","display":"Absolute Eosinphil Count"}],"performer":[{"reference":"Practitioner/1"}]}`
export const testResultsdiagnosticReportRequestBody = reportDate =>
`{"resourceType":"DiagnosticReport","status":"final","code":{"coding":[{"code":"07a128f7-f596-45d5-a2a9-c447bc9e5112"}]},"subject":{"reference":"Patient/123"},"issued":"${reportDate}","contained":[{"resourceType":"Observation","id":"lab-test-result","status":"final","code":{"coding":[{"code":"07a128f7-f596-45d5-a2a9-c447bc9e5112"}]},"subject":{"reference":"Patient/123"},"valueBoolean":false}],"result":[{"reference":"#lab-test-result","type":"Observation"}],"conclusion":"Normal Report","basedOn":[{"identifier":{"value":"abc-123"},"reference":"ServiceRequest"}],"performer":[{"reference":"Practitioner/1"}]}`
`{"resourceType":"DiagnosticReport","status":"final","code":{"coding":[{"code":"07a128f7-f596-45d5-a2a9-c447bc9e5112"}]},"subject":{"reference":"Patient/123"},"issued":"${reportDate}","contained":[{"resourceType":"Observation","id":"lab-test-result1","status":"final","code":{"coding":[{"code":"07a128f7-f596-45d5-a2a9-c447bc9e5112","display":"Absolute Eosinphil Count"}]},"subject":{"reference":"Patient/123"},"valueBoolean":false}],"result":[{"reference":"#lab-test-result1","type":"Observation"}],"conclusion":"Normal Report","basedOn":[{"identifier":{"value":"abc-123"},"reference":"ServiceRequest"}],"performer":[{"reference":"Practitioner/1"}]}`
export const testResultsdiagnosticNumericReportRequestBody = reportDate =>
`{"resourceType":"DiagnosticReport","status":"final","code":{"coding":[{"code":"1643AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}]},"subject":{"reference":"Patient/123"},"issued":"${reportDate}","contained":[{"resourceType":"Observation","id":"lab-test-result","status":"final","code":{"coding":[{"code":"1643AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}]},"subject":{"reference":"Patient/123"},"valueQuantity":{"value":"7"}}],"result":[{"reference":"#lab-test-result","type":"Observation"}],"conclusion":"Normal Report","basedOn":[{"identifier":{"value":"abe-123"},"reference":"ServiceRequest"}],"performer":[{"reference":"Practitioner/2"}]}`
`{"resourceType":"DiagnosticReport","status":"final","code":{"coding":[{"code":"21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}]},"subject":{"reference":"Patient/123"},"issued":"${reportDate}","contained":[{"resourceType":"Observation","id":"lab-test-result1","status":"final","code":{"coding":[{"code":"21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","display":"Haemoglobin"}]},"subject":{"reference":"Patient/123"},"valueQuantity":{"value":"11"}}],"result":[{"reference":"#lab-test-result1","type":"Observation"}],"conclusion":"Normal Report","basedOn":[{"identifier":{"value":"abf-123"},"reference":"ServiceRequest"}],"performer":[{"reference":"Practitioner/2"}]}`
export const testResultsdiagnosticInterpretationReportRequestBody = reportDate =>
`{"resourceType":"DiagnosticReport","status":"final","code":{"coding":[{"code":"1643AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}]},"subject":{"reference":"Patient/123"},"issued":"${reportDate}","contained":[{"resourceType":"Observation","id":"lab-test-result","status":"final","code":{"coding":[{"code":"1643AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}]},"subject":{"reference":"Patient/123"},"interpretation":[{"coding":[{"code":"A"}]}],"valueQuantity":{"value":"7"}}],"result":[{"reference":"#lab-test-result","type":"Observation"}],"conclusion":"Normal Report","basedOn":[{"identifier":{"value":"abe-123"},"reference":"ServiceRequest"}],"performer":[{"reference":"Practitioner/2"}]}`
`{"resourceType":"DiagnosticReport","status":"final","code":{"coding":[{"code":"21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}]},"subject":{"reference":"Patient/123"},"issued":"${reportDate}","contained":[{"resourceType":"Observation","id":"lab-test-result1","status":"final","code":{"coding":[{"code":"21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","display":"Haemoglobin"}]},"subject":{"reference":"Patient/123"},"interpretation":[{"coding":[{"code":"A"}]}],"valueQuantity":{"value":"11"}}],"result":[{"reference":"#lab-test-result1","type":"Observation"}],"conclusion":"Normal Report","basedOn":[{"identifier":{"value":"abf-123"},"reference":"ServiceRequest"}],"performer":[{"reference":"Practitioner/2"}]}`
export const panelTestResultsDiagnosticReportRequestBody = reportDate =>
`{"resourceType":"DiagnosticReport","status":"final","code":{"coding":[{"code":"5b0cdc41-7371-4c2f-a1e4-ed1bf7416a8d","display":"Anaemia panel"}]},"subject":{"reference":"Patient/123"},"issued":"${reportDate}","contained":[{"resourceType":"Observation","id":"lab-test-result1","status":"final","code":{"coding":[{"code":"07a128f7-f596-45d5-a2a9-c447bc9e5112","display":"Absolute Eosinphil Count"}]},"subject":{"reference":"Patient/123"},"valueQuantity":{"value":"40"}},{"resourceType":"Observation","id":"lab-test-result2","status":"final","code":{"coding":[{"code":"21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","display":"Haemoglobin"}]},"subject":{"reference":"Patient/123"},"valueCodeableConcept":{"coding":[{"code":"703AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA","display":"Positive"}]}}],"result":[{"reference":"#lab-test-result1","type":"Observation"},{"reference":"#lab-test-result2","type":"Observation"}],"basedOn":[{"identifier":{"value":"5b0cdc41-7371-4c2f-a1e4-ed1bf7416a8d"},"reference":"ServiceRequest","display":"Anaemia panel"}]}`
224 changes: 80 additions & 144 deletions src/__mocks__/testResults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ export const mockTestResultResponse: any = {

export const mockPanelTestResult = {
data: {
uuid: '161430AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
uuid: '5b0cdc41-7371-4c2f-a1e4-ed1bf7416a8d',
name: {
display: 'Routine blood panel',
uuid: '110966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Routine blood panel',
display: 'Anaemia Panel',
uuid: '8ce76a2c-e63d-4358-aabb-f8c5a6239fbd',
name: 'Anaemia Panel',
locale: 'en',
localePreferred: true,
conceptNameType: 'FULLY_SPECIFIED',
Expand All @@ -106,9 +106,9 @@ export const mockPanelTestResult = {
},
names: [
{
display: 'Routine blood panel',
display: 'Anaemia Panel',
uuid: '110966BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Routine blood panel',
name: 'Anaemia Panel',
locale: 'en',
localePreferred: true,
conceptNameType: 'FULLY_SPECIFIED',
Expand Down Expand Up @@ -149,11 +149,11 @@ export const mockPanelTestResult = {
answers: [],
setMembers: [
{
uuid: '1015AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
uuid: '07a128f7-f596-45d5-a2a9-c447bc9e5112',
name: {
display: 'Hematocrit',
uuid: '1066BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Hematocrit',
display: 'Absolute Eosinphil Count',
uuid: 'fd2ec116-74c9-4d48-86cf-1c7e8aa1a748',
name: 'Absolute Eosinphil Count',
locale: 'en',
localePreferred: true,
conceptNameType: 'FULLY_SPECIFIED',
Expand All @@ -180,7 +180,7 @@ export const mockPanelTestResult = {
conceptNameType: 'FULLY_SPECIFIED',
links: [],
resourceVersion: '1.9',
}
},
],
set: false,
datatype: {
Expand Down Expand Up @@ -229,90 +229,10 @@ export const mockPanelTestResult = {
resourceVersion: '2.0',
},
{
uuid: '1026AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
name: {
display: 'Differential',
uuid: '1079BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Differential',
locale: 'en',
localePreferred: true,
conceptNameType: 'FULLY_SPECIFIED',
links: [],
resourceVersion: '1.9',
},
names: [
{
display: 'Differential',
uuid: '1079BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Differential',
locale: 'en',
localePreferred: true,
conceptNameType: 'FULLY_SPECIFIED',
links: [],
resourceVersion: '1.9',
},
{
display: 'Diff',
uuid: '86758BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Diff',
locale: 'en',
localePreferred: false,
conceptNameType: 'SHORT',
links: [],
resourceVersion: '1.9',
},
],
set: true,
datatype: {
uuid: '8d4a4c94-c2cc-11de-8d13-0010c6dffd0f',
display: 'N/A',
name: 'N/A',
description:
'Not associated with a datatype (e.g., term answers, sets)',
hl7Abbreviation: 'ZZ',
retired: false,
links: [],
resourceVersion: '1.8',
},
conceptClass: {
uuid: '8d492026-c2cc-11de-8d13-0010c6dffd0f',
display: 'LabSet',
name: 'LabSet',
description: 'Panels',
retired: false,
links: [],
resourceVersion: '1.8',
},
hiNormal: null,
hiAbsolute: null,
hiCritical: null,
lowNormal: null,
lowAbsolute: null,
lowCritical: null,
units: null,
allowDecimal: null,
handler: null,
descriptions: [
{
display:
'Describes the relative distribution of the different types of white blood cells',
uuid: '1028FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
description:
'Describes the relative distribution of the different types of white blood cells',
locale: 'en',
links: [],
resourceVersion: '1.9',
},
],
answers: [],
setMembers: [],
resourceVersion: '2.0',
},
{
uuid: '1643AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
uuid: '21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
name: {
display: 'Rapid test for malaria',
uuid: '1923BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
display: 'Haemoglobin',
uuid: 'b8b8c317-43d2-4c4b-a67d-2ef3782c53eb',
name: 'Rapid test for malaria',
locale: 'en',
localePreferred: true,
Expand Down Expand Up @@ -425,26 +345,61 @@ export const mockPanelTestResult = {

export const mockTestResult = {
data: {
uuid: '1643AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
uuid: '21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
name: {
display: 'Dummy test',
uuid: '1923BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Dummy test',
display: 'Haemoglobin',
uuid: '23BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Haemoglobin',
locale: 'en',
localePreferred: true,
conceptNameType: 'FULLY_SPECIFIED',
links: [],
resourceVersion: '1.9',
},
names: [
{
display: 'RDT Malaria',
uuid: '86926BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'RDT Malaria',
display: 'Hemoglobin',
uuid: '110964BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Hemoglobin',
locale: 'en',
localePreferred: false,
conceptNameType: 'SHORT',
links: [],
conceptNameType: null,
links: [
{
rel: 'self',
uri:
'http://localhost:8080/openmrs/ws/rest/v1/concept/21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/110964BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
resourceAlias: 'name',
},
{
rel: 'full',
uri:
'http://localhost:8080/openmrs/ws/rest/v1/concept/21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/110964BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB?v=full',
resourceAlias: 'name',
},
],
resourceVersion: '1.9',
},
{
display: 'Haemoglobin',
uuid: '23BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Haemoglobin',
locale: 'en',
localePreferred: true,
conceptNameType: 'FULLY_SPECIFIED',
links: [
{
rel: 'self',
uri:
'http://localhost:8080/openmrs/ws/rest/v1/concept/21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/23BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
resourceAlias: 'name',
},
{
rel: 'full',
uri:
'http://localhost:8080/openmrs/ws/rest/v1/concept/21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/name/23BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB?v=full',
resourceAlias: 'name',
},
],
resourceVersion: '1.9',
},
],
Expand All @@ -469,71 +424,52 @@ export const mockTestResult = {
links: [],
resourceVersion: '1.8',
},
hiNormal: null,
hiNormal: 17.8,
hiAbsolute: null,
hiCritical: null,
lowNormal: null,
lowAbsolute: null,
lowCritical: null,
units: null,
allowDecimal: null,
lowNormal: 10.4,
lowAbsolute: 0,
lowCritical: 7,
units: 'g/dL',
allowDecimal: true,
handler: null,
descriptions: [
{
display: 'Test for rapid diagnosis of Malaria.',
uuid: '1483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
description: 'Test for rapid diagnosis of Malaria.',
display:
'The iron-containing respiratory pigment in red blood cells of vertebrates, consisting of about 6 percent heme and 94 percent globin.',
uuid: '21FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
description:
'The iron-containing respiratory pigment in red blood cells of vertebrates, consisting of about 6 percent heme and 94 percent globin.',
locale: 'en',
links: [
{
rel: 'self',
uri:
'http://localhost/openmrs/ws/rest/v1/concept/1643AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/1483FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
'http://localhost:8080/openmrs/ws/rest/v1/concept/21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/21FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
resourceAlias: 'description',
},
],
resourceVersion: '1.9',
},
],
answers: [
{
uuid: '703AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
name: {
display: 'Positive',
uuid: '737BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Positive',
locale: 'en',
localePreferred: true,
conceptNameType: 'FULLY_SPECIFIED',
links: [],
resourceVersion: '1.9',
},
names: [
{
display: 'Positive',
uuid: '737BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB',
name: 'Positive',
locale: 'en',
localePreferred: true,
conceptNameType: 'FULLY_SPECIFIED',
links: [],
resourceVersion: '1.9',
rel: 'full',
uri:
'http://localhost:8080/openmrs/ws/rest/v1/concept/21AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/description/21FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF?v=full',
resourceAlias: 'description',
},
],
displayString: 'Positive',
resourceVersion: '2.0',
resourceVersion: '1.9',
},
],
answers: [],
setMembers: [],
resourceVersion: '2.0',
},
}

export const mockSelectedPendingOrder = [
{
id: '161430AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA',
testName: 'Routine blood panel',
id: '5b0cdc41-7371-4c2f-a1e4-ed1bf7416a8d',
testName: 'Anaemia panel',
date: 'May 03, 2022',
orderedBy: 'Superman',
conceptUuid: '5b0cdc41-7371-4c2f-a1e4-ed1bf7416a8d',
},
]
Loading

0 comments on commit f1f3762

Please sign in to comment.