Skip to content

Commit

Permalink
Merge branch 'develop' into fix#7505
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevildude authored Apr 17, 2024
2 parents e988ed9 + 997a714 commit 1847dee
Show file tree
Hide file tree
Showing 13 changed files with 93 additions and 16 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
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,5 @@ jobs:
run: |
COMMIT_SHA=${{ github.sha }}
JSON='{ "substitutions": { "care_be_tag":"", "care_fe_tag": "'"$COMMIT_SHA"'", "metabase_tag": "" } }'
curl --location ${{ secrets.STAGING_GCP_DEPLOY_URL }} \
curl --location "${{ secrets.STAGING_GCP_DEPLOY_URL }}" \
--header 'Content-Type: application/json' --data "$JSON"
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
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
4 changes: 2 additions & 2 deletions src/Components/Scribe/Scribe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const Scribe: React.FC<ScribeProps> = ({ fields, onFormUpdate }) => {
const newFile = new File([f], `${internal_name}`, { type: f.type });
const config = {
headers: {
"Content-type": newFile?.type,
"Content-type": newFile?.type?.split(";")?.[0],
"Content-disposition": "inline",
},
};
Expand Down Expand Up @@ -120,7 +120,7 @@ export const Scribe: React.FC<ScribeProps> = ({ fields, onFormUpdate }) => {
name: filename,
associating_id: associatingId,
file_category: category,
mime_type: audioBlob?.type.split(";")[0],
mime_type: audioBlob?.type?.split(";")?.[0],
},
})
.then((response) => {
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
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 1847dee

Please sign in to comment.