Skip to content
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

Medication Request redesign #9848

Merged
merged 32 commits into from
Jan 11, 2025
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d77de80
Medication Request UI from Figma
amjithtitus09 Jan 8, 2025
b73dc37
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Jan 8, 2025
394acc6
i18n changes
amjithtitus09 Jan 8, 2025
756662a
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Jan 8, 2025
9021813
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Jan 9, 2025
5db116c
Dosage auto focus on medicine select
amjithtitus09 Jan 9, 2025
c3b9e63
Move search bar outside
amjithtitus09 Jan 9, 2025
8e940a9
Move search bar outside | Flex when remove button exists
amjithtitus09 Jan 9, 2025
f1364c9
Sticky Remove button
amjithtitus09 Jan 9, 2025
bebf944
Sticky Remove button width issue
amjithtitus09 Jan 9, 2025
5d6752f
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Jan 9, 2025
0c4cfbe
Frequency & Days -> Duration changes
amjithtitus09 Jan 9, 2025
40e4570
Full width check function, bounds duration type
amjithtitus09 Jan 9, 2025
d76f6b3
Bounds duration undefined bug
amjithtitus09 Jan 9, 2025
9cf14d6
Merge branch 'develop' into medication-request-figma
amjithtitus09 Jan 9, 2025
ad111dd
Merge branch 'develop' into medication-request-figma
amjithtitus09 Jan 9, 2025
cb26760
Remove unitLabels, code cleanup
amjithtitus09 Jan 9, 2025
fd5c953
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Jan 9, 2025
ecddf46
Merge branch 'develop' into medication-request-figma
amjithtitus09 Jan 10, 2025
3c88ebd
Remove extra padding, uncomment QuestionnaireForm preview for DEV
amjithtitus09 Jan 10, 2025
04815ba
Merge branch 'develop' into medication-request-figma
amjithtitus09 Jan 10, 2025
368f60b
Merge branch 'develop' into medication-request-figma
amjithtitus09 Jan 10, 2025
6dac578
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Jan 10, 2025
c50b070
Frequency & preiod non null, i18n, Unit changes
amjithtitus09 Jan 10, 2025
63694ea
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Jan 10, 2025
e0906a1
Mobile View - Collapse Medications
amjithtitus09 Jan 10, 2025
90e8214
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Jan 10, 2025
4838f4f
Bounds Duration as not null and handle its update
amjithtitus09 Jan 10, 2025
9685267
Merge branch 'develop' of https://github.com/ohcnetwork/care_fe into …
amjithtitus09 Jan 10, 2025
fbba385
Conditional class readable pattern
amjithtitus09 Jan 10, 2025
72e8e64
Update src/components/Questionnaire/QuestionnaireForm.tsx
amjithtitus09 Jan 10, 2025
31a8f82
Merge branch 'develop' into medication-request-figma
amjithtitus09 Jan 11, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions public/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@
"add_skill": "Add Skill",
"add_spoke": "Add Spoke Facility",
"additional_information": "Additional Information",
"additional_instructions": "Additional Instructions",
"address": "Address",
"administer": "Administer",
"administer_medicine": "Administer Medicine",
Expand Down Expand Up @@ -395,6 +396,7 @@
"are_you_sure_want_to_remove": "Are you sure you want to remove {{name}} from the patient? This action cannot be undone",
"ari": "ARI - Acute Respiratory illness",
"arrived": "Arrived",
"as_needed_prn": "As Needed / PRN",
"asset_class": "Asset Class",
"asset_location": "Asset Location",
"asset_name": "Asset Name",
Expand Down Expand Up @@ -1046,12 +1048,14 @@
"information_source_user": "Hospital Staff",
"inidcator_event": "Indicator Event",
"instruction_on_titration": "Instruction on titration",
"instructions": "Instructions",
"insurance__insurer_id": "Insurer ID",
"insurance__insurer_name": "Insurer Name",
"insurance__member_id": "Member ID",
"insurance__policy_name": "Policy ID / Policy Name",
"insurance_details_detail": "Include details of all the Insurance Policies held by the Patient for smooth insurance processing",
"insurer_name_required": "Insurer Name is required",
"intent": "Intent",
"international_mobile": "International Mobile",
"invalid_asset_id_msg": "Oops! The asset ID you entered does not appear to be valid.",
"invalid_date_format": "Invalid date format, expected {{format}}",
Expand Down Expand Up @@ -1192,6 +1196,7 @@
"medicines_administered": "Medicine(s) administered",
"medicines_administered_error": "Error administering medicine(s)",
"member_id_required": "Member Id is required",
"method": "Method",
"middleware_hostname": "Middleware Hostname",
"middleware_hostname_example": "e.g. example.ohc.network",
"middleware_hostname_sourced_from": "Middleware hostname sourced from {{ source }}",
Expand Down Expand Up @@ -1624,31 +1629,39 @@
"search_icd11_placeholder": "Search for ICD-11 Diagnoses",
"search_investigation_placeholder": "Search Investigation & Groups",
"search_medication": "Search Medication",
"search_medications": "Search for medications to add",
"search_patients": "Search Patients",
"search_resource": "Search Resource",
"search_user": "Search User",
"search_user_description": "Search for a user and assign a role to add them to the patient.",
"searching": "Searching...",
"see_attachments": "See Attachments",
"select": "Select",
"select_additional_instructions": "Select additional instructions",
"select_all": "Select All",
"select_date": "Select date",
"select_department": "Select Department",
"select_eligible_policy": "Select an Eligible Insurance Policy",
"select_facility_for_discharged_patients_warning": "Facility needs to be selected to view discharged patients.",
"select_for_administration": "Select for Administration",
"select_frequency": "Select frequency",
"select_groups": "Select Groups",
"select_intent": "Select intent",
"select_investigation": "Select Investigations (all investigations will be selected by default)",
"select_investigation_groups": "Select Investigation Groups",
"select_investigations": "Select Investigations",
"select_local_body": "Select Local Body",
"select_method": "Select method",
"select_patient": "Select Patient",
"select_policy": "Select an Insurance Policy",
"select_policy_to_add_items": "Select a Policy to Add Items",
"select_practitioner": "Select Practicioner",
"select_prn_reason": "Select reason for PRN",
"select_register_patient": "Select/Register Patient",
"select_role": "Select Role",
"select_route": "Select route",
"select_seven_day_period": "Select a seven day period",
"select_site": "Select site",
"select_skills": "Select and add some skills",
"select_time": "Select time",
"select_time_slot": "Select time slot",
Expand Down Expand Up @@ -1693,6 +1706,7 @@
"show_unread_notifications": "Show Unread",
"sign_in": "Sign in",
"sign_out": "Sign out",
"site": "Site",
"skill_add_error": "Error while adding skill",
"skill_added_successfully": "Skill added successfully",
"skills": "Skills",
Expand Down
7 changes: 6 additions & 1 deletion src/components/Common/QuantityInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ interface Props<TUnit extends string> {
units: readonly TUnit[];
disabled?: boolean;
placeholder?: string;
autoFocus?: boolean;
unitLabels?: Record<TUnit, string>;
}

const QuantityInput = <TUnit extends string>({
Expand All @@ -26,6 +28,8 @@ const QuantityInput = <TUnit extends string>({
onChange,
disabled,
placeholder,
autoFocus,
unitLabels,
}: Props<TUnit>) => {
const handleChange = (update: Partial<QuantityValue<TUnit>>) => {
onChange({ ...quantity, ...update });
Expand All @@ -44,6 +48,7 @@ const QuantityInput = <TUnit extends string>({
value: e.target.value ? Number(e.target.value) : undefined,
})
}
autoFocus={autoFocus}
/>
<Select
disabled={disabled}
Expand All @@ -57,7 +62,7 @@ const QuantityInput = <TUnit extends string>({
<SelectContent>
{units.map((unit) => (
<SelectItem key={unit} value={unit}>
{unit}
{unitLabels?.[unit] ?? unit}
</SelectItem>
))}
</SelectContent>
Expand Down
15 changes: 14 additions & 1 deletion src/components/Medicine/MedicineAdministrationSheet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import useSlug from "@/hooks/useSlug";
import routes from "@/Utils/request/api";
import useTanStackQueryInstead from "@/Utils/request/useQuery";
import { classNames } from "@/Utils/utils";
import { MedicationRequest } from "@/types/emr/medicationRequest";
import {
BOUNDS_DURATION_UNITS,
MedicationRequest,
} from "@/types/emr/medicationRequest";

interface Props {
readonly?: boolean;
Expand Down Expand Up @@ -324,6 +327,16 @@ const PrescriptionEntry = ({
</span>
)}
</div>
{instruction.timing?.repeat?.bounds_duration && (
<div className="mt-1 text-xs text-muted-foreground">
<span className="text-muted-foreground">Duration:</span>{" "}
amjithtitus09 marked this conversation as resolved.
Show resolved Hide resolved
{instruction.timing.repeat.bounds_duration.value}{" "}
{instruction.timing.repeat.bounds_duration.unit &&
BOUNDS_DURATION_UNITS[
instruction.timing.repeat.bounds_duration.unit
]?.label}
</div>
)}

{/* Additional Instructions */}
{additionalInstructions && additionalInstructions.length > 0 && (
Expand Down
22 changes: 21 additions & 1 deletion src/components/Questionnaire/QuestionRenderer.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import { useEffect, useRef } from "react";

import { cn } from "@/lib/utils";

import { QuestionValidationError } from "@/types/questionnaire/batch";
import { QuestionnaireResponse } from "@/types/questionnaire/form";
import { Question } from "@/types/questionnaire/question";
import {
Question,
StructuredQuestionType,
} from "@/types/questionnaire/question";

import { QuestionGroup } from "./QuestionTypes/QuestionGroup";

// Questions that should be rendered full width
const FULL_WIDTH_QUESTION_TYPES: StructuredQuestionType[] = [
"medication_request",
];

interface QuestionRendererProps {
questions: Question[];
responses: QuestionnaireResponse[];
Expand Down Expand Up @@ -55,12 +65,22 @@ export function QuestionRenderer({
onResponseChange(newResponses);
};

const shouldBeFullWidth = (question: Question): boolean => {
if (question.type !== "structured" || !question.structured_type) {
return false;
}
return FULL_WIDTH_QUESTION_TYPES.includes(question.structured_type);
};

return (
<div className="space-y-4">
{questions.map((question) => (
<div
key={question.id}
ref={(el) => (questionRefs.current[question.id] = el)}
className={cn(
shouldBeFullWidth(question) ? "md:w-auto" : "max-w-4xl",
)}
>
<QuestionGroup
facilityId={facilityId}
Expand Down
Loading
Loading