diff --git a/cypress/e2e/users_spec/user_manage.cy.ts b/cypress/e2e/users_spec/user_manage.cy.ts index 9c339f4b8e3..c2116954354 100644 --- a/cypress/e2e/users_spec/user_manage.cy.ts +++ b/cypress/e2e/users_spec/user_manage.cy.ts @@ -26,9 +26,7 @@ describe("Manage User", () => { beforeEach(() => { cy.restoreLocalStorage(); - console.log(localStorage); cy.clearLocalStorage(/filters--.+/); - console.log(localStorage); cy.awaitUrl("/users"); }); diff --git a/cypress/e2e/users_spec/user_profile.cy.ts b/cypress/e2e/users_spec/user_profile.cy.ts index 2672cccad7e..40880d95edb 100644 --- a/cypress/e2e/users_spec/user_profile.cy.ts +++ b/cypress/e2e/users_spec/user_profile.cy.ts @@ -25,9 +25,7 @@ describe("Manage User Profile", () => { beforeEach(() => { cy.restoreLocalStorage(); - console.log(localStorage); cy.clearLocalStorage(/filters--.+/); - console.log(localStorage); cy.awaitUrl("/user/profile"); }); diff --git a/src/Components/ABDM/ABHAProfileModal.tsx b/src/Components/ABDM/ABHAProfileModal.tsx index 4853626f1ef..99b888cc1ef 100644 --- a/src/Components/ABDM/ABHAProfileModal.tsx +++ b/src/Components/ABDM/ABHAProfileModal.tsx @@ -1,6 +1,5 @@ import * as Notify from "../../Utils/Notifications"; -import { AbhaObject } from "../Patient/models"; import CareIcon from "../../CAREUI/icons/CareIcon"; import DialogModal from "../Common/Dialog"; import QRCode from "qrcode.react"; @@ -8,10 +7,11 @@ import { formatDateTime } from "../../Utils/utils"; import { useRef } from "react"; import request from "../../Utils/request/request"; import routes from "../../Redux/api"; +import { AbhaNumberModel } from "./types/abha"; interface IProps { patientId?: string; - abha?: AbhaObject; + abha?: AbhaNumberModel; show: boolean; onClose: () => void; } diff --git a/src/Components/ABDM/FetchRecordsModal.tsx b/src/Components/ABDM/FetchRecordsModal.tsx index b457ccc453a..cc7c72474d1 100644 --- a/src/Components/ABDM/FetchRecordsModal.tsx +++ b/src/Components/ABDM/FetchRecordsModal.tsx @@ -2,7 +2,6 @@ import * as Notification from "../../Utils/Notifications.js"; import ButtonV2 from "../Common/components/ButtonV2"; import DialogModal from "../Common/Dialog"; -import { PatientModel } from "../Patient/models"; import TextFormField from "../Form/FormFields/TextFormField"; import { useState } from "react"; import { @@ -20,6 +19,7 @@ import { useMessageListener } from "../../Common/hooks/useMessageListener.js"; import CircularProgress from "../Common/components/CircularProgress.js"; import CareIcon from "../../CAREUI/icons/CareIcon.js"; import { classNames } from "../../Utils/utils.js"; +import { AbhaNumberModel } from "./types/abha.js"; import { ConsentHIType, ConsentPurpose } from "./types/consent.js"; import useNotificationSubscriptionState from "../../Common/hooks/useNotificationSubscriptionState.js"; @@ -27,12 +27,12 @@ const getDate = (value: any) => value && dayjs(value).isValid() && dayjs(value).toDate(); interface IProps { - patient: PatientModel; + abha?: AbhaNumberModel; show: boolean; onClose: () => void; } -export default function FetchRecordsModal({ patient, show, onClose }: IProps) { +export default function FetchRecordsModal({ abha, show, onClose }: IProps) { const [idVerificationStatus, setIdVerificationStatus] = useState< "pending" | "in-progress" | "verified" | "failed" >("pending"); @@ -53,9 +53,7 @@ export default function FetchRecordsModal({ patient, show, onClose }: IProps) { useMessageListener((data) => { if (data.type === "MESSAGE" && data.from === "patients/on_find") { - if ( - data.message?.patient?.id === patient?.abha_number_object?.health_id - ) { + if (data.message?.patient?.id === abha?.health_id) { setIdVerificationStatus("verified"); setErrors({ ...errors, @@ -85,7 +83,7 @@ export default function FetchRecordsModal({ patient, show, onClose }: IProps) {
null} disabled label="Patient Identifier" @@ -98,7 +96,7 @@ export default function FetchRecordsModal({ patient, show, onClose }: IProps) { onClick={async () => { const { res } = await request(routes.abha.findPatient, { body: { - id: patient?.abha_number_object?.health_id, + id: abha?.health_id, }, reattempts: 0, }); @@ -214,7 +212,7 @@ export default function FetchRecordsModal({ patient, show, onClose }: IProps) { setIsMakingConsentRequest(true); const { res } = await request(routes.abha.createConsent, { body: { - patient_abha: patient?.abha_number_object?.health_id as string, + patient_abha: abha?.health_id as string, hi_types: hiTypes, purpose, from_time: fromDate, @@ -229,8 +227,8 @@ export default function FetchRecordsModal({ patient, show, onClose }: IProps) { }); navigate( - `/facility/${patient.facility}/abdm` ?? - `/facility/${patient.facility}/patient/${patient.id}/consultation/${patient.last_consultation?.id}/abdm`, + `/facility/${abha?.patient_object?.facility}/abdm` ?? + `/facility/${abha?.patient_object?.facility}/patient/${abha?.patient_object?.id}/consultation/${abha?.patient_object?.last_consultation?.id}/abdm`, ); } else { Notification.Error({ diff --git a/src/Components/ABDM/LinkABHANumberModal.tsx b/src/Components/ABDM/LinkABHANumberModal.tsx index ea996ddd1da..8d6365387cd 100644 --- a/src/Components/ABDM/LinkABHANumberModal.tsx +++ b/src/Components/ABDM/LinkABHANumberModal.tsx @@ -202,7 +202,7 @@ const ScanABHAQRSection = ({ dob: abha?.dob.replace(/\//g, "-"), address: abha?.address, "dist name": abha?.["dist name"] ?? abha?.district_name, - "state name": abha?.["state name"], + "state name": abha?.["state name"] ?? abha?.state_name, }, }); diff --git a/src/Components/ABDM/LinkCareContextModal.tsx b/src/Components/ABDM/LinkCareContextModal.tsx index b22189c9f2f..9ec9885bbca 100644 --- a/src/Components/ABDM/LinkCareContextModal.tsx +++ b/src/Components/ABDM/LinkCareContextModal.tsx @@ -3,22 +3,22 @@ import * as Notification from "../../Utils/Notifications.js"; import ButtonV2 from "../Common/components/ButtonV2"; import DateFormField from "../Form/FormFields/DateFormField"; import DialogModal from "../Common/Dialog"; -import { PatientModel } from "../Patient/models"; import TextFormField from "../Form/FormFields/TextFormField"; import { useState } from "react"; import routes from "../../Redux/api.js"; import request from "../../Utils/request/request.js"; +import { AbhaNumberModel } from "./types/abha.js"; interface IProps { consultationId: string; - patient: PatientModel; + abha?: AbhaNumberModel; show: boolean; onClose: () => void; } const LinkCareContextModal = ({ consultationId, - patient, + abha, show, onClose, }: IProps) => { @@ -33,7 +33,7 @@ const LinkCareContextModal = ({ >
null} disabled label="Name" @@ -41,7 +41,7 @@ const LinkCareContextModal = ({ error="" /> null} disabled label="Gender" @@ -52,11 +52,7 @@ const LinkCareContextModal = ({ null} disabled required @@ -84,9 +80,9 @@ const LinkCareContextModal = ({ const { res } = await request(routes.abha.linkCareContext, { body: { consultation: consultationId, - name: patient?.abha_number_object?.name, - gender: patient?.abha_number_object?.gender, - dob: patient?.abha_number_object?.date_of_birth, + name: abha?.name, + gender: abha?.gender, + dob: abha?.date_of_birth, }, reattempts: 0, }); @@ -94,10 +90,6 @@ const LinkCareContextModal = ({ Notification.Success({ msg: "Care Context sucessfully linked!", }); - } else { - Notification.Error({ - msg: "Error in linking Care Context!", - }); } setIsLinkingCareContext(false); onClose(); diff --git a/src/Components/ABDM/models.ts b/src/Components/ABDM/models.ts index 9dc362f5cac..899ec948777 100644 --- a/src/Components/ABDM/models.ts +++ b/src/Components/ABDM/models.ts @@ -124,6 +124,7 @@ export interface ABHAQRContent { address: string; distlgd: string; district_name?: string; + state_name?: string; dob: string; gender: "M" | "F" | "O"; hid?: string; @@ -132,6 +133,6 @@ export interface ABHAQRContent { hidn: string; mobile: string; name: string; - "state name": string; + "state name"?: string; statelgd: string; } diff --git a/src/Components/ABDM/types/abha.ts b/src/Components/ABDM/types/abha.ts index d45986e8f8f..fd03b30cdc4 100644 --- a/src/Components/ABDM/types/abha.ts +++ b/src/Components/ABDM/types/abha.ts @@ -1,3 +1,5 @@ +import { PatientModel } from "../../Patient/models"; + export type AbhaNumberModel = { id: number; external_id: string; @@ -18,4 +20,6 @@ export type AbhaNumberModel = { email: string | null; profile_photo: string | null; new: boolean; + patient: string | null; + patient_object: PatientModel | null; }; diff --git a/src/Components/Facility/ConsultationDetails/index.tsx b/src/Components/Facility/ConsultationDetails/index.tsx index adb18e804c9..f2c2644afda 100644 --- a/src/Components/Facility/ConsultationDetails/index.tsx +++ b/src/Components/Facility/ConsultationDetails/index.tsx @@ -39,6 +39,9 @@ import { AssetBedModel } from "../../Assets/AssetTypes"; import PatientInfoCard from "../../Patient/PatientInfoCard"; import RelativeDateUserMention from "../../Common/RelativeDateUserMention"; import DiagnosesListAccordion from "../../Diagnosis/DiagnosesListAccordion"; +import { AbhaNumberModel } from "../../ABDM/types/abha"; +import routes from "../../../Redux/api"; +import request from "../../../Utils/request/request"; import { CameraFeedPermittedUserTypes } from "../../../Utils/permissions"; import Error404 from "../../ErrorPages/404"; @@ -85,6 +88,7 @@ export const ConsultationDetails = (props: any) => { {} as ConsultationModel, ); const [patientData, setPatientData] = useState({}); + const [abhaNumberData, setAbhaNumberData] = useState(); const [activeShiftingData, setActiveShiftingData] = useState>([]); const [isCameraAttached, setIsCameraAttached] = useState(false); @@ -137,6 +141,8 @@ export const ConsultationDetails = (props: any) => { }) : false; setIsCameraAttached(isCameraAttachedRes); + + // Get patient data const id = res.data.patient; const patientRes = await dispatch(getPatient({ id })); if (patientRes?.data) { @@ -159,6 +165,16 @@ export const ConsultationDetails = (props: any) => { setPatientData(data); } + // Get abha number data + const { data: abhaNumberData } = await request( + routes.abha.getAbhaNumber, + { + pathParams: { abhaNumberId: id ?? "" }, + silent: true, + }, + ); + setAbhaNumberData(abhaNumberData); + // Get shifting data const shiftingRes = await dispatch( listShiftRequests({ patient: id }, "shift-list-call"), @@ -290,6 +306,7 @@ export const ConsultationDetails = (props: any) => {
{ return null; // Hide feed tab } - if (p.text === "ABDM" && !patientData.abha_number) { + if (p.text === "ABDM" && !abhaNumberData?.abha_number) { return null; } diff --git a/src/Components/Facility/Consultations/LiveFeed.tsx b/src/Components/Facility/Consultations/LiveFeed.tsx index 55f22a5d3d9..e4f6a49bbfd 100644 --- a/src/Components/Facility/Consultations/LiveFeed.tsx +++ b/src/Components/Facility/Consultations/LiveFeed.tsx @@ -258,7 +258,6 @@ const LiveFeed = (props: any) => { updatePreset: (option) => { getCameraStatus({ onSuccess: async (data) => { - console.log({ currentPreset, data }); if (currentPreset?.asset_object?.id && data?.position) { setLoading(option.loadingLabel); console.log("Updating Preset"); diff --git a/src/Components/Facility/Consultations/NeurologicalTables.tsx b/src/Components/Facility/Consultations/NeurologicalTables.tsx index c5c05f0dd17..5a1abe3e189 100644 --- a/src/Components/Facility/Consultations/NeurologicalTables.tsx +++ b/src/Components/Facility/Consultations/NeurologicalTables.tsx @@ -60,7 +60,6 @@ const DataTable = (props: any) => { const DataDescription = (props: any) => { const { title, data } = props; - console.log("Data Description", title, data); return (
diff --git a/src/Components/Facility/Consultations/VentilatorPlot.tsx b/src/Components/Facility/Consultations/VentilatorPlot.tsx index 5502c4c5bb2..aa07b639f88 100644 --- a/src/Components/Facility/Consultations/VentilatorPlot.tsx +++ b/src/Components/Facility/Consultations/VentilatorPlot.tsx @@ -92,10 +92,6 @@ export const VentilatorPlot = (props: any) => { }) .filter((p) => p.value !== null); - useEffect(() => { - console.log(bilateral); - }, [bilateral]); - return (
diff --git a/src/Components/Facility/FacilityCreate.tsx b/src/Components/Facility/FacilityCreate.tsx index a2ef08b7679..2f14bcc26bf 100644 --- a/src/Components/Facility/FacilityCreate.tsx +++ b/src/Components/Facility/FacilityCreate.tsx @@ -454,7 +454,6 @@ export const FacilityCreate = (props: FacilityProps) => { const handleSubmit = async (e: any) => { e.preventDefault(); const validated = validateForm(); - console.log(state.form); if (validated) { setIsLoading(true); const data: FacilityRequest = { diff --git a/src/Components/Facility/FacilityHome.tsx b/src/Components/Facility/FacilityHome.tsx index a0dcf06026f..f1322e4d20e 100644 --- a/src/Components/Facility/FacilityHome.tsx +++ b/src/Components/Facility/FacilityHome.tsx @@ -18,7 +18,6 @@ import RecordMeta from "../../CAREUI/display/RecordMeta"; import Table from "../Common/components/Table"; import { navigate } from "raviger"; -import { useMessageListener } from "../../Common/hooks/useMessageListener"; import { useTranslation } from "react-i18next"; import useAuthUser from "../../Common/hooks/useAuthUser.js"; import request from "../../Utils/request/request.js"; @@ -61,8 +60,6 @@ export const FacilityHome = ({ facilityId }: Props) => { const [coverImageEdited, setCoverImageEdited] = useState(false); const authUser = useAuthUser(); - useMessageListener((data) => console.log(data)); - const { data: facilityData, loading: isLoading, diff --git a/src/Components/Facility/Investigations/InvestigationSuggestions.tsx b/src/Components/Facility/Investigations/InvestigationSuggestions.tsx index 52416cc1e4a..4a5882678c4 100644 --- a/src/Components/Facility/Investigations/InvestigationSuggestions.tsx +++ b/src/Components/Facility/Investigations/InvestigationSuggestions.tsx @@ -29,8 +29,6 @@ export default function ViewInvestigationSuggestions(props: { return ; } - console.log("Investigations: ", investigations); - return (

{t("investigations_suggested")}

@@ -110,11 +108,6 @@ export default function ViewInvestigationSuggestions(props: { const investigationMissed = nextInvestigationTime && dayjs().isAfter(nextInvestigationTime); - console.log( - type, - nextFurthestInvestigation, - nextInvestigationTime, - ); return (
  • { selectedInvestigations, } = state as InitialState; - console.log("state", state); - const fetchInvestigationsData = useCallback( async ( onSuccess: ( diff --git a/src/Components/HCX/CreateClaimCard.tsx b/src/Components/HCX/CreateClaimCard.tsx index 2ce866d261d..46a02cf7f86 100644 --- a/src/Components/HCX/CreateClaimCard.tsx +++ b/src/Components/HCX/CreateClaimCard.tsx @@ -37,8 +37,6 @@ export default function CreateClaimCard({ const [createdClaim, setCreatedClaim] = useState(); const [use_, setUse_] = useState(use); - console.log(items); - useEffect(() => { async function autoFill() { const latestApprovedPreAuthsRes = await dispatch( diff --git a/src/Components/Patient/PatientInfoCard.tsx b/src/Components/Patient/PatientInfoCard.tsx index f301db6333e..300c2190a60 100644 --- a/src/Components/Patient/PatientInfoCard.tsx +++ b/src/Components/Patient/PatientInfoCard.tsx @@ -40,6 +40,7 @@ import DischargeModal from "../Facility/DischargeModal.js"; import { useTranslation } from "react-i18next"; import useQuery from "../../Utils/request/useQuery.js"; import FetchRecordsModal from "../ABDM/FetchRecordsModal.js"; +import { AbhaNumberModel } from "../ABDM/types/abha.js"; import { SkillModel } from "../Users/models.js"; import { AuthorizedForConsultationRelatedActions } from "../../CAREUI/misc/AuthorizedChild.js"; import careConfig from "@careConfig"; @@ -57,6 +58,7 @@ const formatSkills = (arr: SkillModel[]) => { export default function PatientInfoCard(props: { patient: PatientModel; consultation?: ConsultationModel; + abhaNumber?: AbhaNumberModel; fetchPatientData?: (state: { aborted: boolean }) => void; activeShiftingData: any; consultationId: string; @@ -734,7 +736,7 @@ export default function PatientInfoCard(props: {
    {careConfig.abdm.enabled && - (patient.abha_number ? ( + (props.abhaNumber ? ( <> {({ close }) => ( @@ -964,18 +966,18 @@ export default function PatientInfoCard(props: { /> setShowABHAProfile(false)} /> setShowLinkCareContext(false)} /> setShowFetchABDMRecords(false)} /> diff --git a/src/Components/Patient/PatientRegister.tsx b/src/Components/Patient/PatientRegister.tsx index c25a6365e70..708c2e1b072 100644 --- a/src/Components/Patient/PatientRegister.tsx +++ b/src/Components/Patient/PatientRegister.tsx @@ -371,6 +371,14 @@ export const PatientRegister = (props: PatientRegisterProps) => { const { res, data } = await request(routes.getPatient, { pathParams: { id: id ? id : 0 }, }); + const { data: abhaNumberData } = await request( + routes.abha.getAbhaNumber, + { + pathParams: { abhaNumberId: id ?? "" }, + silent: true, + }, + ); + if (!status.aborted) { if (res?.ok && data) { setPatientName(data.name || ""); @@ -382,8 +390,8 @@ export const PatientRegister = (props: PatientRegisterProps) => { age: data.year_of_birth ? new Date().getFullYear() - data.year_of_birth : "", - health_id_number: data.abha_number_object?.abha_number || "", - health_id: data.abha_number_object?.health_id || "", + health_id_number: abhaNumberData?.abha_number || "", + health_id: abhaNumberData?.health_id || "", nationality: data.nationality ? data.nationality : "India", gender: data.gender ? data.gender : undefined, state: data.state ? data.state : "", diff --git a/src/Components/Patient/models.tsx b/src/Components/Patient/models.tsx index 7676d294b4c..343c80a60bf 100644 --- a/src/Components/Patient/models.tsx +++ b/src/Components/Patient/models.tsx @@ -39,25 +39,6 @@ export interface AssignedToObjectModel { user_type: string; } -export interface AbhaObject { - id: number; - created_date: string; - modified_date: string; - abha_number: string; - email: string | null; - first_name: string; - date_of_birth: string; - gender: "M" | "F" | "O"; - address: string; - district: string; - state: string; - health_id: string | null; - name: string; - last_name: string; - middle_name: string; - profile_photo: string; -} - export interface PatientModel { id?: string; action?: number; @@ -141,10 +122,6 @@ export interface PatientModel { id: number; occupation: Occupation; }; - - // ABDM related - abha_number?: string; - abha_number_object?: AbhaObject; } export interface SampleTestModel { diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx index e72f7766bbe..b7785d74b98 100644 --- a/src/Redux/api.tsx +++ b/src/Redux/api.tsx @@ -110,6 +110,7 @@ import { Investigation } from "../Components/Facility/Investigations/Reports/typ import { HCXPolicyModel } from "../Components/HCX/models"; import { IComment, IResource } from "../Components/Resource/models"; import { IShift } from "../Components/Shifting/models"; +import { AbhaNumberModel } from "../Components/ABDM/types/abha"; import { ScribeModel } from "../Components/Scribe/Scribe"; /** @@ -1342,6 +1343,12 @@ const routes = { }, abha: { + getAbhaNumber: { + path: "/api/v1/abdm/abha_numbers/{abhaNumberId}/", + method: "GET", + TRes: Type(), + }, + // ABDM HealthID endpoints generateAadhaarOtp: { path: "/api/v1/abdm/healthid/generate_aadhaar_otp/",