-
Notifications
You must be signed in to change notification settings - Fork 3
BN-37 | Add. Clinical Config Loader #8
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
Conversation
src/schemas/appConfig.schema.json
Outdated
| "properties": { | ||
| "patientInformation": { | ||
| "type": "object", | ||
| "required": ["translationKey", "type"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove required and types
src/schemas/appConfig.schema.json
Outdated
| "type": "object", | ||
| "required": ["id", "name", "description", "url", "requiredPrivilege"], | ||
| "properties": { | ||
| "id": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove
src/schemas/appConfig.schema.json
Outdated
| "type": "string", | ||
| "description": "URL to access the dashboard data" | ||
| }, | ||
| "requiredPrivilege": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove string and add array
src/constants/dashboard.ts
Outdated
| export const DEPARTMENT_CONFIG_URL = (departmentURL: string) => | ||
| `/bahmni_config/openmrs/apps/clinical/dashboards/${departmentURL}`; | ||
|
|
||
| export const DASHBOARD_CONFIG_URL = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please call this as CLINICAL_CONFIG_URL and the above one as DASHBOARD_CONFIG_URL
src/constants/errors.ts
Outdated
| export const ERROR_TITLES = { | ||
| CONFIG_ERROR: 'Configuration Error', | ||
| VALIDATION_ERROR: 'Validation Error', | ||
| DEPARTMENT_ERROR: 'Department Configuration Error', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Department Configuration error could be confusing
| import React from 'react'; | ||
| import { renderHook } from '@testing-library/react'; | ||
| import { useConfig } from '../useConfig'; | ||
| import { ConfigContextType } from '../../types/config'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use @types ??
src/providers/ConfigProvider.tsx
Outdated
| ) { | ||
| const configMap: Record<string, string> = {}; | ||
| dashboardConfig.dashboards.forEach((dashboard) => { | ||
| const departmentID = dashboard.id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no id for a dashboard
src/providers/ConfigProvider.tsx
Outdated
| const departmentURL = dashboard.url; | ||
| configMap[departmentID] = departmentURL; | ||
| }); | ||
| setConfig(configMap); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why set only dashboard URL references only? why not have our entire config in context ?
src/types/config.ts
Outdated
| }; | ||
| actions: Array<Record<string, unknown>>; | ||
| dashboards: Array<{ | ||
| id: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Id to be removed
src/providers/ConfigProvider.tsx
Outdated
| }); | ||
| setConfig(configMap); | ||
| } else { | ||
| const error = new Error(CONFIG_ERROR_MESSAGES.NO_DASHBOARDS); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NO dashboards should not be an error by ConfigProvider, it should be the responsibility of the reading component to display error or an info message to the user
src/__mocks__/configMocks.ts
Outdated
|
|
||
| // Happy Path Mocks | ||
| export const validFullConfig = { | ||
| section: [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mocks seems to be different from our actual config which doesn't have sections. please update
JIRA -> BN-37
This PR adds functionality to load clinical configuration from the pre configured source of configuration.
Key Features
Implementation Details
Next Steps
Preview
