Skip to content

Commit

Permalink
Update payload configs
Browse files Browse the repository at this point in the history
  • Loading branch information
kahummer committed Jul 18, 2024
1 parent d29fa4e commit cd0ad0f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ export const location: ILocation = {
export const encounterBodyLocationFlag = {
resourceType: 'Encounter',
id: '7892014e-56d7-53c1-9df0-b4642dba2486',
identifier: [{ use: 'usual', value: 'd8f6bb0d-a2ed-4bee-982b-846845930dbc' }],
status: 'finished',
class: {
system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode',
Expand Down Expand Up @@ -216,7 +215,6 @@ export const locationUpdatedFlag = {
export const createdObservationLocationFlag = {
resourceType: 'Observation',
id: '5e524254-80f9-5d96-bcde-0e28d72f7aff',
identifier: [{ use: 'usual', value: 'a065c211-cf3e-4b5b-972f-fdac0e45fef7' }],
status: 'final',
category: [
{
Expand Down Expand Up @@ -253,7 +251,7 @@ export const createdObservationLocationFlag = {
],
text: 'Yes (qualifier value)',
},
note: [{ text: 'Some comments here' }],
note: [{ text: 'Some comments here', time: '2017-07-13T19:31:00.000Z' }],
meta: {
tag: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,6 @@ export const productFlag: IFlag = {
export const createdEncounterProductFlag = {
resourceType: 'Encounter',
id: '15e2dd99-91f7-5dc8-b84b-14d546610f3c',
identifier: [{ use: 'usual', value: 'd8f6bb0d-a2ed-4bee-982b-846845930dbc' }],
status: 'finished',
class: {
system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode',
Expand Down Expand Up @@ -603,7 +602,6 @@ export const createdEncounterProductFlag = {
],
text: 'elective',
},
participant: [{ individual: { reference: 'Practitioner/practitionerId' } }],
period: { start: '2023-09-13T03:56:00.000+00:00', end: '2023-09-13T04:20:00.000+00:00' } as any,
reasonCode: [
{
Expand Down Expand Up @@ -646,11 +644,12 @@ export const createdEncounterProductFlag = {
},
],
},
participant: [{ individual: { reference: 'Practitioner/practitionerId' } }],
};

export const createdObservationProductFlag = {
resourceType: 'Observation',
id: 'd15869ed-1ab1-5dc8-b07c-d384bc4ce9b8',
identifier: [{ use: 'usual', value: 'a065c211-cf3e-4b5b-972f-fdac0e45fef7' }],
status: 'final',
category: [
{
Expand Down Expand Up @@ -689,7 +688,7 @@ export const createdObservationProductFlag = {
],
text: 'Yes (qualifier value)',
},
note: [{ text: 'Some comments here' }],
note: [{ text: 'Some comments here', time: '2017-07-13T19:31:00.000Z' }],
meta: {
tag: [
{
Expand Down
24 changes: 0 additions & 24 deletions packages/fhir-flag/src/components/Utils/payloadConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { IObservation } from '@smile-cdr/fhirts/dist/FHIR-R4/interfaces/IObserva

export const encounter: IEncounter = {
resourceType: 'Encounter',
id: 'd8f6bb0d-a2ed-4bee-982b-846845930dbc',
identifier: [{ use: 'usual', value: 'd8f6bb0d-a2ed-4bee-982b-846845930dbc' }],
status: 'finished',
class: {
system: 'http://terminology.hl7.org/CodeSystem/v3-ActCode',
Expand Down Expand Up @@ -44,13 +42,6 @@ export const encounter: IEncounter = {
],
text: 'elective',
},
participant: [
{
individual: {
reference: 'Practitioner/631f2c90-43cc-4ae3-a3a5-c539dff7bc3c',
},
},
],
period: {
start: '2023-09-13T03:56:00.000+00:00' as any,
end: '2023-09-13T04:20:00.000+00:00' as any,
Expand All @@ -67,21 +58,11 @@ export const encounter: IEncounter = {
text: 'Service Point Check',
},
],
location: [
{
location: {
reference: 'Location/493f46d8-6dfe-4505-ab63-9d78c789400e',
},
status: 'active',
},
],
partOf: { reference: 'Encounter/2492dd29-81bf-4628-96cd-f747f48d7e16' },
};

export const observation: IObservation = {
resourceType: 'Observation',
id: 'a065c211-cf3e-4b5b-972f-fdac0e45fef7',
identifier: [{ use: 'usual', value: 'a065c211-cf3e-4b5b-972f-fdac0e45fef7' }],
status: 'final',
category: [
{
Expand Down Expand Up @@ -115,14 +96,10 @@ export const observation: IObservation = {
],
text: 'Vist Flag Observation',
},
subject: { reference: 'Location/6f3980e0-d1d6-4a7a-a950-939f3ca7b301' },
focus: [{ reference: 'Flag/6f3980e0-d1d6-4a7a-a950-939f3ca7b301' }],
encounter: { reference: 'Encounter/6f3980e0-d1d6-4a7a-a950-939f3ca7b301' },
effectivePeriod: {
start: '2024-02-01T00:00:00.00Z' as any,
end: '2024-02-01T00:00:00.00Z' as any,
},
performer: [{ reference: 'Practitioner/6f3980e0-d1d6-4a7a-a950-939f3ca7b301' }],
valueCodeableConcept: {
coding: [
{
Expand All @@ -133,5 +110,4 @@ export const observation: IObservation = {
],
text: 'Yes (qualifier value)',
},
note: [{ time: '2024-02-01T00:00:00.00Z' as any, text: 'Please enter fixed reason' }],
};
4 changes: 2 additions & 2 deletions packages/fhir-flag/src/components/Utils/tests/utils.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ describe('Utility functions', () => {
encounter: { reference: 'Encounter/mocked-uuid' },
focus: [{ reference: 'Location/123' }, { reference: `Flag/${flag.id}` }],
performer: undefined,
note: [{ text: 'Test comments' }],
note: [{ text: 'Test comments', time: expect.any(String) }],
};

const result = generateObservationPayload(
Expand Down Expand Up @@ -182,7 +182,7 @@ describe('Utility functions', () => {
encounter: { reference: 'Encounter/mocked-uuid' },
focus: [{ reference: `Flag/1a3a0d65-b6ad-40af-b6cd-2e8801614de9` }],
performer: [{ reference: `Practitioner/practitioner123` }],
note: [{ text: 'Test comments' }],
note: [{ text: 'Test comments', time: expect.any(String) }],
};

const result = generateObservationPayload(
Expand Down
9 changes: 6 additions & 3 deletions packages/fhir-flag/src/components/Utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export const generateObservationPayload = (
practitionerId: string,
locationReference: string,
values: CloseFlagFormFields
) => {
): IObservation => {
const commonProperties = generateCommonProperties(ObservationResourceType, flag);
const encounterProperties = generateCommonProperties(EncounterResourceType, flag);
const isSPCHECKOrCNBEN = conceptsHaveCodings(flag.category, [
Expand All @@ -118,7 +118,8 @@ export const generateObservationPayload = (
performer: isSPCHECKOrCNBEN
? [{ reference: `${PractitionerResourceType}/${practitionerId}` }]
: undefined,
note: observation.note?.[0]?.text ? [{ text: values.comments }] : observation.note,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
note: [{ time: new Date().toISOString() as any, text: values.comments }],
};
};

Expand All @@ -144,7 +145,8 @@ export const putCloseFlagResources = async (
listSubject as string,
values
);

console.log('encounterPayload', encounterPayload);

Check warning on line 148 in packages/fhir-flag/src/components/Utils/utils.tsx

View workflow job for this annotation

GitHub Actions / test (22.x, ubuntu-latest)

Unexpected console statement
console.log('observationPayload', observationPayload);

Check warning on line 149 in packages/fhir-flag/src/components/Utils/utils.tsx

View workflow job for this annotation

GitHub Actions / test (22.x, ubuntu-latest)

Unexpected console statement
const updatedFlag = {
...activeFlag,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand All @@ -165,6 +167,7 @@ export const putCloseFlagResources = async (
});
})
.catch((err) => {
console.log('err------', err);

Check warning on line 170 in packages/fhir-flag/src/components/Utils/utils.tsx

View workflow job for this annotation

GitHub Actions / test (22.x, ubuntu-latest)

Unexpected console statement
reject(err);
});
});
Expand Down

0 comments on commit cd0ad0f

Please sign in to comment.