From 779986e838e946b6aafa1ebbbfda8a8879a72a6a Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Tue, 7 Jan 2025 09:32:56 +0530 Subject: [PATCH 1/6] default to home health --- src/components/Encounter/CreateEncounterForm.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Encounter/CreateEncounterForm.tsx b/src/components/Encounter/CreateEncounterForm.tsx index 8bc81f74865..22d6a22ea6c 100644 --- a/src/components/Encounter/CreateEncounterForm.tsx +++ b/src/components/Encounter/CreateEncounterForm.tsx @@ -139,7 +139,7 @@ export default function CreateEncounterForm({ resolver: zodResolver(encounterFormSchema), defaultValues: { status: "planned", - encounter_class: encounterClass || "amb", + encounter_class: encounterClass || "hh", priority: "routine", organizations: [], }, From 91c7df91c45b6d6baba63d62eac1a0996041c89d Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Tue, 7 Jan 2025 09:55:19 +0530 Subject: [PATCH 2/6] update to env config --- .example.env | 3 +++ care.config.ts | 2 ++ src/components/Encounter/CreateEncounterForm.tsx | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.example.env b/.example.env index 8cee07d7925..19bc6e6caa2 100644 --- a/.example.env +++ b/.example.env @@ -67,5 +67,8 @@ REACT_JWT_TOKEN_REFRESH_INTERVAL= # Minimum encounter date (default: 2020-01-01) REACT_MIN_ENCOUNTER_DATE= +# Default Encounter type +REACT_DEFAULT_ENCOUNTER_TYPE= + # Available languages to switch between (2 Digit language code seperated by comas. See src->Locale->config.ts for available codes) REACT_ALLOWED_LOCALES="en,hi,ta,ml,mr,kn" diff --git a/care.config.ts b/care.config.ts index bf1ae695061..15b8ae3501b 100644 --- a/care.config.ts +++ b/care.config.ts @@ -48,6 +48,8 @@ const careConfig = { .split(",") .map((l) => l.trim()), + defaultEncounterType: env.REACT_DEFAULT_ENCOUNTER_TYPE || "hh", + gmapsApiKey: env.REACT_GMAPS_API_KEY || "AIzaSyDsBAc3y7deI5ZO3NtK5GuzKwtUzQNJNUk", diff --git a/src/components/Encounter/CreateEncounterForm.tsx b/src/components/Encounter/CreateEncounterForm.tsx index 22d6a22ea6c..39a5e8363e2 100644 --- a/src/components/Encounter/CreateEncounterForm.tsx +++ b/src/components/Encounter/CreateEncounterForm.tsx @@ -1,3 +1,4 @@ +import careConfig from "@careConfig"; import { zodResolver } from "@hookform/resolvers/zod"; import { useMutation, useQueryClient } from "@tanstack/react-query"; import { @@ -139,7 +140,7 @@ export default function CreateEncounterForm({ resolver: zodResolver(encounterFormSchema), defaultValues: { status: "planned", - encounter_class: encounterClass || "hh", + encounter_class: encounterClass || careConfig.defaultEncounterType, priority: "routine", organizations: [], }, From 6780e4a56c37b8c35dbbb0b4c7aa63efbe4cef52 Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Tue, 7 Jan 2025 10:03:00 +0530 Subject: [PATCH 3/6] update the vite-envs --- src/components/Encounter/CreateEncounterForm.tsx | 3 ++- src/types/notes/messages.ts | 1 - src/vite-env.d.ts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Encounter/CreateEncounterForm.tsx b/src/components/Encounter/CreateEncounterForm.tsx index 39a5e8363e2..b40b32ba0e5 100644 --- a/src/components/Encounter/CreateEncounterForm.tsx +++ b/src/components/Encounter/CreateEncounterForm.tsx @@ -140,7 +140,8 @@ export default function CreateEncounterForm({ resolver: zodResolver(encounterFormSchema), defaultValues: { status: "planned", - encounter_class: encounterClass || careConfig.defaultEncounterType, + encounter_class: + encounterClass || (careConfig.defaultEncounterType as EncounterClass), priority: "routine", organizations: [], }, diff --git a/src/types/notes/messages.ts b/src/types/notes/messages.ts index 92a88107930..bca88676392 100644 --- a/src/types/notes/messages.ts +++ b/src/types/notes/messages.ts @@ -7,4 +7,3 @@ export interface Message { created_by: UserBase; updated_by: UserBase; } - diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index f9cf1f9d763..ab12271cd4b 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -27,6 +27,7 @@ interface ImportMetaEnv { readonly REACT_STILL_WATCHING_PROMPT_DURATION?: string; readonly REACT_JWT_TOKEN_REFRESH_INTERVAL?: string; readonly REACT_MIN_ENCOUNTER_DATE?: string; + readonly REACT_DEFAULT_ENCOUNTER_TYPE?: string, readonly REACT_ALLOWED_LOCALES?: string; readonly REACT_ENABLED_APPS?: string; From 8fb8deb3286a73f92c04bd52cd9373683e760e36 Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Tue, 7 Jan 2025 10:05:55 +0530 Subject: [PATCH 4/6] update the vite-envs --- src/vite-env.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index ab12271cd4b..bbaaef0c91d 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -27,7 +27,7 @@ interface ImportMetaEnv { readonly REACT_STILL_WATCHING_PROMPT_DURATION?: string; readonly REACT_JWT_TOKEN_REFRESH_INTERVAL?: string; readonly REACT_MIN_ENCOUNTER_DATE?: string; - readonly REACT_DEFAULT_ENCOUNTER_TYPE?: string, + readonly REACT_DEFAULT_ENCOUNTER_TYPE?: string; readonly REACT_ALLOWED_LOCALES?: string; readonly REACT_ENABLED_APPS?: string; From 62925aa82a3dd6a440035ae7660018a841c7d050 Mon Sep 17 00:00:00 2001 From: AdityaJ2305 Date: Tue, 7 Jan 2025 10:10:21 +0530 Subject: [PATCH 5/6] move type safety to config --- care.config.ts | 5 ++++- src/components/Encounter/CreateEncounterForm.tsx | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/care.config.ts b/care.config.ts index 15b8ae3501b..f48d842d262 100644 --- a/care.config.ts +++ b/care.config.ts @@ -1,3 +1,5 @@ +import { EncounterClass } from "@/types/emr/encounter"; + const env = import.meta.env; interface ILogo { @@ -48,7 +50,8 @@ const careConfig = { .split(",") .map((l) => l.trim()), - defaultEncounterType: env.REACT_DEFAULT_ENCOUNTER_TYPE || "hh", + defaultEncounterType: (env.REACT_DEFAULT_ENCOUNTER_TYPE || + "hh") as EncounterClass, gmapsApiKey: env.REACT_GMAPS_API_KEY || "AIzaSyDsBAc3y7deI5ZO3NtK5GuzKwtUzQNJNUk", diff --git a/src/components/Encounter/CreateEncounterForm.tsx b/src/components/Encounter/CreateEncounterForm.tsx index b40b32ba0e5..39a5e8363e2 100644 --- a/src/components/Encounter/CreateEncounterForm.tsx +++ b/src/components/Encounter/CreateEncounterForm.tsx @@ -140,8 +140,7 @@ export default function CreateEncounterForm({ resolver: zodResolver(encounterFormSchema), defaultValues: { status: "planned", - encounter_class: - encounterClass || (careConfig.defaultEncounterType as EncounterClass), + encounter_class: encounterClass || careConfig.defaultEncounterType, priority: "routine", organizations: [], }, From 7ae303a0869efef928d80790dc5f1c49fb6fb8c7 Mon Sep 17 00:00:00 2001 From: Rithvik Nishad Date: Tue, 7 Jan 2025 10:15:03 +0530 Subject: [PATCH 6/6] Update .example.env --- .example.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.example.env b/.example.env index 19bc6e6caa2..5466250e094 100644 --- a/.example.env +++ b/.example.env @@ -67,7 +67,7 @@ REACT_JWT_TOKEN_REFRESH_INTERVAL= # Minimum encounter date (default: 2020-01-01) REACT_MIN_ENCOUNTER_DATE= -# Default Encounter type +# Default Encounter Type (default: "hh" - Home Health) REACT_DEFAULT_ENCOUNTER_TYPE= # Available languages to switch between (2 Digit language code seperated by comas. See src->Locale->config.ts for available codes)