Skip to content

Commit

Permalink
Merge pull request #7655 from coronasafe/develop
Browse files Browse the repository at this point in the history
Merge develop to staging v24.16.0
  • Loading branch information
gigincg authored Apr 18, 2024
2 parents 21387c0 + 48db450 commit efdd076
Show file tree
Hide file tree
Showing 17 changed files with 130 additions and 26 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/combine.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Combine Dependencies

on: workflow_dispatch

# The minimum permissions required to run this Action
permissions:
contents: write
pull-requests: write
checks: read

jobs:
combine-prs:
runs-on: ubuntu-latest

steps:
- name: Combine dependencies
id: combine-dependencies
uses: github/[email protected]
with:
pr_title: Combined dependencies # The title of the pull request to create
select_label: dependencies # The label which marks PRs that should be combined.
labels: combined-dependencies # Add a label to the combined PR
ci_required: "false" # Whether or not CI should be passing to combine the PR
4 changes: 2 additions & 2 deletions src/Components/ABDM/LinkABHANumberModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ const ScanABHAQRSection = ({
body: {
patientId,
hidn: abha?.hidn,
phr: abha?.hid,
phr: (abha?.phr ?? abha?.hid) as string,
name: abha?.name,
gender: abha?.gender,
dob: abha?.dob.replace(/\//g, "-"),
address: abha?.address,
"dist name": abha?.district_name,
"dist name": abha?.["dist name"] ?? abha?.district_name,
"state name": abha?.["state name"],
},
});
Expand Down
8 changes: 5 additions & 3 deletions src/Components/ABDM/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,12 @@ export interface ILinkViaQRBody {
export interface ABHAQRContent {
address: string;
distlgd: string;
district_name: string;
district_name?: string;
dob: string;
gender: "M";
hid: string;
gender: "M" | "F" | "O";
hid?: string;
phr?: string;
"dist name"?: string;
hidn: string;
mobile: string;
name: string;
Expand Down
18 changes: 17 additions & 1 deletion src/Components/Facility/FacilityCreate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
SelectFormField,
} from "../Form/FormFields/SelectFormField";
import { Popover, Transition } from "@headlessui/react";
import { Fragment, lazy, useState } from "react";
import { Fragment, lazy, useEffect, useState } from "react";
import Steps, { Step } from "../Common/Steps";
import {
getPincodeDetails,
Expand Down Expand Up @@ -57,6 +57,7 @@ import request from "../../Utils/request/request.js";
import routes from "../../Redux/api.js";
import useQuery from "../../Utils/request/useQuery.js";
import { RequestResult } from "../../Utils/request/types.js";
import useAuthUser from "../../Common/hooks/useAuthUser";

const Loading = lazy(() => import("../Common/Loading"));

Expand Down Expand Up @@ -159,6 +160,21 @@ export const FacilityCreate = (props: FacilityProps) => {
const headerText = !facilityId ? "Create Facility" : "Update Facility";
const buttonText = !facilityId ? "Save Facility" : "Update Facility";

const authUser = useAuthUser();
useEffect(() => {
if (
authUser &&
authUser.user_type !== "StateAdmin" &&
authUser.user_type !== "DistrictAdmin" &&
authUser.user_type !== "DistrictLabAdmin"
) {
navigate("/facility");
Notification.Error({
msg: "You don't have permission to perform this action. Contact the admin",
});
}
}, [authUser]);

const {
data: districtData,
refetch: districtFetch,
Expand Down
8 changes: 6 additions & 2 deletions src/Components/Facility/TreatmentSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,13 @@ const TreatmentSummary = (props: any) => {
</div>

<div className="col-span-1 px-3 py-2">
<b>Date of admission : </b>
{consultationData?.suggestion === "DC" ? (
<b>Date of domiciliary care commenced : </b>
) : (
<b>Date of admission : </b>
)}
<span>
{consultationData?.admitted
{consultationData?.encounter_date
? formatDateTime(consultationData.encounter_date)
: " --/--/----"}
</span>
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Form/FormFields/TextFormField.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const TextFormField = forwardRef((props: TextFormFieldProps, ref) => {
);
const _trailing =
trailing === trailingFocused ? (
<div className="absolute inset-y-0 right-0 flex items-center pr-3">
<div className="relative inset-y-0 right-0 flex items-center pr-3">
{trailing}
</div>
) : (
Expand Down
33 changes: 26 additions & 7 deletions src/Components/Notifications/NotificationsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ const NotificationTile = ({
setIsMarkingAsRead(false);
};

const handleMarkAsUnRead = async () => {
setIsMarkingAsRead(true);
await request(routes.markNotificationAsUnRead, {
pathParams: { id: result.id },
body: { read_at: null },
});
setResult({ ...result, read_at: null });
setIsMarkingAsRead(false);
};

const resultUrl = (event: string, data: any) => {
switch (event) {
case "PATIENT_CREATED":
Expand Down Expand Up @@ -107,24 +117,33 @@ const NotificationTile = ({
</div>
<div className="flex justify-end gap-2">
<ButtonV2
className={classNames(
"bg-white px-2 py-1 font-semibold hover:bg-secondary-300",
result.read_at && "invisible",
)}
className="bg-white px-2 py-1 font-semibold hover:bg-secondary-300"
variant="secondary"
border
ghost
disabled={isMarkingAsRead}
onClick={(event) => {
event.stopPropagation();
handleMarkAsRead();
if (result.read_at) {
handleMarkAsUnRead();
} else {
handleMarkAsRead();
}
}}
>
<CareIcon
icon={isMarkingAsRead ? "l-spinner" : "l-envelope-check"}
icon={
isMarkingAsRead
? "l-spinner"
: result.read_at
? "l-envelope"
: "l-envelope-check"
}
className={isMarkingAsRead ? "animate-spin" : ""}
/>
<span className="text-xs">{t("mark_as_read")}</span>
<span className="text-xs">
{result.read_at ? t("mark_as_unread") : t("mark_as_read")}
</span>
</ButtonV2>
<ButtonV2
border
Expand Down
2 changes: 2 additions & 0 deletions src/Components/Patient/ManagePatients.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export const PatientManager = () => {
diagnoses_provisional: qParams.diagnoses_provisional || undefined,
diagnoses_unconfirmed: qParams.diagnoses_unconfirmed || undefined,
diagnoses_differential: qParams.diagnoses_differential || undefined,
review_missed: qParams.review_missed || undefined,
};

useEffect(() => {
Expand Down Expand Up @@ -944,6 +945,7 @@ export const PatientManager = () => {
kasp(),
badge("COWIN ID", "covin_id"),
badge("Is Antenatal", "is_antenatal"),
badge("Review Missed", "review_missed"),
badge(
"Is Medico-Legal Case",
"last_consultation_medico_legal_case",
Expand Down
15 changes: 15 additions & 0 deletions src/Components/Patient/PatientFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default function PatientFilter(props: any) {
diagnoses_provisional: filter.diagnoses_provisional || null,
diagnoses_unconfirmed: filter.diagnoses_unconfirmed || null,
diagnoses_differential: filter.diagnoses_differential || null,
review_missed: filter.review_missed || null,
});

useQuery(routes.getAnyFacility, {
Expand Down Expand Up @@ -203,6 +204,7 @@ export default function PatientFilter(props: any) {
diagnoses_provisional,
diagnoses_unconfirmed,
diagnoses_differential,
review_missed,
} = filterState;
const data = {
district: district || "",
Expand Down Expand Up @@ -270,6 +272,7 @@ export default function PatientFilter(props: any) {
diagnoses_provisional: diagnoses_provisional || "",
diagnoses_unconfirmed: diagnoses_unconfirmed || "",
diagnoses_differential: diagnoses_differential || "",
review_missed: review_missed || "",
};
onChange(data);
};
Expand Down Expand Up @@ -437,6 +440,18 @@ export default function PatientFilter(props: any) {
}
/>
</div>
<div className="w-full flex-none">
<FieldLabel className="text-sm">Review Missed</FieldLabel>
<SelectMenuV2
placeholder="Show all"
options={["true", "false"]}
optionLabel={(o) => (o === "true" ? "Yes" : "No")}
value={filterState.review_missed}
onChange={(v) =>
setFilterState({ ...filterState, review_missed: v })
}
/>
</div>
<div className="w-full flex-none">
<FieldLabel className="text-sm">Is Medico-Legal Case</FieldLabel>
<SelectMenuV2
Expand Down
4 changes: 3 additions & 1 deletion src/Components/Patient/PatientInfoCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,9 @@ export default function PatientInfoCard(props: {
<span className="flex">
{consultation?.encounter_date && (
<div>
Admission on:{" "}
{consultation.suggestion === "DC"
? "Commenced on: "
: "Admitted on: "}
{formatDateTime(consultation?.encounter_date)}
</div>
)}
Expand Down
6 changes: 3 additions & 3 deletions src/Components/Patient/PatientRegister.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1382,10 +1382,10 @@ export const PatientRegister = (props: PatientRegisterProps) => {
{...field("age")}
errorClassName="hidden"
trailing={
<p className="absolute right-16 text-xs text-gray-700 sm:text-sm">
<p className="hidden sm:inline min-[768px]:hidden lg:inline">
<p className="absolute right-16 mb-11 text-xs text-gray-700 sm:text-sm">
<p className="hidden sm:inline min-[768px]:hidden lg:inline">
{field("age").value !== "" &&
"Year_of_Birth:"}
"Year of Birth:"}
</p>
<span className="font-bold">
{field("age").value !== "" &&
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Patient/SampleDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export const SampleDetails = ({ id }: DetailRoute) => {
);
};

if (isLoading) {
if (isLoading || !sampleDetails) {
return <Loading />;
}

Expand Down
6 changes: 4 additions & 2 deletions src/Components/VitalsMonitor/HL7PatientVitalsMonitor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ export default function HL7PatientVitalsMonitor(props: IVitalsComponentProps) {
>
<CareIcon
icon="l-cloud-times"
className="mb-2 animate-pulse text-4xl"
className="mb-2 animate-pulse text-4xl md:mr-36 "
/>
<span className="font-bold">No incoming data from HL7 Monitor</span>
<span className="font-bold md:mr-36">
No incoming data from HL7 Monitor
</span>
</div>
<div
className={classNames("relative", !isOnline && "hidden")}
Expand Down
1 change: 1 addition & 0 deletions src/Locale/en/Notifications.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"no_notices_for_you": "No notices for you.",
"mark_as_read": "Mark as Read",
"mark_as_unread": "Mark as Unread",
"subscribe": "Subscribe",
"subscribe_on_this_device": "Subscribe on this device",
"show_unread_notifications": "Show Unread",
Expand Down
5 changes: 5 additions & 0 deletions src/Redux/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1062,6 +1062,11 @@ const routes = {
method: "PATCH",
TRes: Type<NotificationData>(),
},
markNotificationAsUnRead: {
path: "/api/v1/notification/{id}/",
method: "PATCH",
TRes: Type<NotificationData>(),
},
getPublicKey: {
path: "/api/v1/notification/public_key/",
method: "GET",
Expand Down
7 changes: 7 additions & 0 deletions src/Utils/useRecorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ const useRecorder = (handleMicPermission) => {
const [recorder, setRecorder] = useState(null);
const [newBlob, setNewBlob] = useState(null);

useEffect(() => {
if (!isRecording && recorder && audioURL) {
setRecorder(null);
}
}, [isRecording, recorder, audioURL]);

useEffect(() => {
// Lazily obtain recorder first time we're recording.
if (recorder === null) {
Expand All @@ -32,6 +38,7 @@ const useRecorder = (handleMicPermission) => {
if (isRecording) {
recorder.start();
} else {
recorder.stream.getTracks().forEach((i) => i.stop());
recorder.stop();
}

Expand Down
12 changes: 9 additions & 3 deletions src/Utils/useSegmentedRecorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { useState, useEffect } from "react";
import * as Notify from "./Notifications";

const useSegmentedRecording = () => {
const [audioURL, setAudioURL] = useState("");
const [isRecording, setIsRecording] = useState(false);
const [recorder, setRecorder] = useState<MediaRecorder | null>(null);
const [audioBlobs, setAudioBlobs] = useState<Blob[]>([]);
Expand All @@ -11,6 +10,12 @@ const useSegmentedRecording = () => {
const bufferInterval = 1 * 1000;
const splitSizeLimit = 20 * 1000000; // 20MB

useEffect(() => {
if (!isRecording && recorder && audioBlobs.length > 0) {
setRecorder(null);
}
}, [isRecording, recorder, audioBlobs]);

useEffect(() => {
if (recorder === null) {
if (isRecording || restart) {
Expand All @@ -37,6 +42,9 @@ const useSegmentedRecording = () => {
} else {
if (restart) {
setIsRecording(true);
} else {
recorder?.stream?.getTracks()?.forEach((i) => i?.stop());
recorder.stop();
}
recorder.state === "recording" && recorder.stop();
}
Expand Down Expand Up @@ -96,12 +104,10 @@ const useSegmentedRecording = () => {
};

const resetRecording = () => {
setAudioURL("");
setAudioBlobs([]);
};

return {
audioURL,
isRecording,
startRecording,
stopRecording,
Expand Down

0 comments on commit efdd076

Please sign in to comment.