Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter by encounter types implemented in observation endpoint on esm-generic-patient-widgets-app #827

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/esm-generic-patient-widgets-app/src/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ export const configSchema = {
_default: 5,
},
},
showGraphByDefault: {
_type: Type.Boolean,
_description: 'Displayed graph by default',
_default: true,
},
Comment on lines +50 to +54
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if this should be added as part of this PR?

encounterTypes: {
_type: Type.Array,
_elements: {
_type: Type.String,
},
_default: [],
},
};

export interface ConfigObject {
Expand All @@ -60,4 +72,8 @@ export interface ConfigObject {
table: {
pageSize: number;
};
showGraphByDefault: boolean;
encounterTypes: Array<{
encounterType: string;
}>;
Comment on lines +76 to +78
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
encounterTypes: Array<{
encounterType: string;
}>;
encounterTypes: Array<string>;

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { openmrsFetch, fhirBaseUrl, useConfig, FHIRResource, FHIRCode } from '@o
export const pageSize = 100;

export function useObs(patientUuid: string): UseObsResult {
const { data } = useConfig();
const { encounterTypes, data } = useConfig();

const {
data: result,
Expand All @@ -14,8 +14,8 @@ export function useObs(patientUuid: string): UseObsResult {
`${fhirBaseUrl}/Observation?subject:Patient=${patientUuid}&code=` +
data.map((d) => d.concept).join(',') +
'&_summary=data&_sort=-date' +
`&_count=${pageSize}
`,
`&_count=${pageSize}` +
`&encounter.type=${encounterTypes.toString()}`,
openmrsFetch,
);

Expand Down