Skip to content

[ENG-790] feat: enhance prescription print - #16594

Open
abhimanyurajeesh wants to merge 15 commits into
developfrom
ENG-790
Open

[ENG-790] feat: enhance prescription print#16594
abhimanyurajeesh wants to merge 15 commits into
developfrom
ENG-790

Conversation

@abhimanyurajeesh

@abhimanyurajeesh abhimanyurajeesh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Proposed Changes

Fixes ENG-790

image

Tagging: @ohcnetwork/care-fe-code-reviewers

Merge Checklist

  • Add specs that demonstrate the bug or test the new feature.
  • Update product documentation.
  • Ensure that UI text is placed in I18n files.
  • Prepare a screenshot or demo video for the changelog entry and attach it to the issue.
  • Request peer reviews.
  • Complete QA on mobile devices.
  • Complete QA on desktop devices.
  • Add or update Playwright tests for related changes

Summary by CodeRabbit

  • New Features

    • Enhanced prescription printouts with a redesigned patient header, context-based encounter/location visibility, smaller QR sizing, an “[x of y]” indicator, and improved medication instruction grouping.
    • Added an optional custom footer to print previews.
    • Expanded print table rendering with customizable table/header/cell styling and merged-row support.
  • Improvements

    • Updated dosage rounding/display consistency and tightened dosage highlight spacing.
    • Preserved line breaks in dispense order table cells.
  • Localization

    • Added new English UI strings for dosage/instruction labels and counters.
  • Tests

    • Updated Playwright assertions to match the updated UI formatting and row matching logic.

@github-actions

Copy link
Copy Markdown

⚠️ Merge Checklist Incomplete

Thank you for your contribution! To help us review your PR efficiently, please complete the merge checklist in your PR description.

Your PR will be reviewed once you have marked the appropriate checklist items.

To update the checklist:

  • Change - [ ] to - [x] for completed items
  • Only check items that are relevant to your PR
  • Leave items unchecked if they don't apply

The checklist helps ensure code quality, testing coverage, and documentation are properly addressed.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Changes

The print system gains custom footers and row-spanning tables. Prescription previews receive redesigned patient and medication layouts, prescription counters, location details, QR presentation, and updated dosage formatting. English translations and related test assertions are updated.

Prescription printing

Layer / File(s) Summary
Dosage display formatting
src/components/Medicine/utils.ts, src/components/Medicine/FormattedDosage.tsx, tests/facility/patient/encounter/medicine/prescriptionCreate.spec.ts, tests/facility/patient/encounter/structuredQuestions/medicationRequest.spec.ts
Rounded dosage values omit unnecessary fractional zeros, highlighted dosage styling is adjusted, and dosage-related assertions match rendered values and targeted rows.
Print layout and table primitives
src/CAREUI/misc/PrintPreview.tsx, src/components/Common/PrintTable.tsx, src/pages/Facility/services/pharmacy/PrintDispenseOrder.tsx
Print previews accept footer content, tables support custom classes and row spans, and the dispense order uses the renamed cell styling prop.
Prescription preview rendering
src/components/Prescription/PrescriptionPreview.tsx, public/locale/en.json, tests/facility/patient/encounter/structuredQuestions/diagnosis.spec.ts
Prescription output uses revised patient, medication, counter, QR, location, footer, and translation content; diagnosis assertions verify selected values and target matching rows.

Possibly related PRs

Suggested labels: Type Changes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and clearly summarizes the main change: prescription print enhancements.
Description check ✅ Passed The description matches the template structure closely, with issue reference, tagging, screenshot, and merge checklist items filled in.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ENG-790

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 23, 2026

Copy link
Copy Markdown

Deploying care-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: 744e32b
Status: ✅  Deploy successful!
Preview URL: https://d7ee157e.care-preview-a7w.pages.dev
Branch Preview URL: https://eng-790.care-preview-a7w.pages.dev

View logs

@greptile-apps

greptile-apps Bot commented Jul 23, 2026

Copy link
Copy Markdown

Greptile Summary

Enhanced prescription print layouts, medication instruction tables, dosage formatting, footer support, localization, and related Playwright assertions.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failures remain within the scope of the previous review threads.

Important Files Changed

Filename Overview
src/CAREUI/misc/PrintPreview.tsx Adds optional footer rendering to facility and facility-less print layouts, resolving the previously reported missing-footer path.
src/components/Common/PrintTable.tsx Adds customizable table styling and support for row-spanning and full-width rows.
src/components/Medicine/utils.ts Centralizes dosage rounding while omitting decimal portions composed entirely of zeros.
src/components/Prescription/PrescriptionPreview.tsx Redesigns prescription print content, patient details, medication grouping, location display, and footer presentation.

Reviews (13): Last reviewed commit: "refactor: rename key from '#' to 'hash_t..." | Re-trigger Greptile

Comment thread src/CAREUI/misc/PrintPreview.tsx
Comment thread src/components/Prescription/PrescriptionPreview.tsx

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enhances the prescription print layout and supporting print components to improve readability and add richer print metadata (footer, table styling, and multi-prescription context).

Changes:

  • Refined PrescriptionPreview print layout (patient header, numbered meds table, multi-prescription indicator, footer timestamp, and optional IP location line).
  • Extended PrintTable to support per-table header/cell/container styling and row-spanning cells.
  • Added helper roundDosage() to avoid displaying trailing “.00” in dosage/total-unit formatting.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/pages/Facility/services/pharmacy/PrintDispenseOrder.tsx Updates PrintTable prop name for cell styling.
src/components/Prescription/PrescriptionPreview.tsx Reworks prescription print UI, table columns, grouping, and adds footer + location path.
src/components/Medicine/utils.ts Adds roundDosage() and applies it to dosage/unit formatting.
src/components/Medicine/FormattedDosage.tsx Adjusts styling to improve highlighted dosage pill spacing.
src/components/Common/PrintTable.tsx Adds cellClassName/headerClassName/tableClassName and rowspan support for grouped rows.
src/CAREUI/misc/PrintPreview.tsx Adds optional footer support to the print layout.
public/locale/en.json Adds i18n keys used by the updated print UI.
Comments suppressed due to low confidence (1)

src/components/Common/PrintTable.tsx:132

  • rowSpan is derived via parseInt(spanVal) without validation. If the value is non-numeric (or 0), React can end up rendering an invalid rowspan attribute. Parse base-10 and only pass rowSpan for finite spans > 1.
                  const spanVal = row[`_span_${key}`];
                  const rowSpan = spanVal ? parseInt(spanVal) : undefined;
                  return (
                    <TableCell
                      rowSpan={rowSpan}

Comment thread src/components/Medicine/utils.ts
Comment thread src/components/Common/PrintTable.tsx Outdated
Comment thread src/components/Common/PrintTable.tsx
Comment thread src/components/Prescription/PrescriptionPreview.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/CAREUI/misc/PrintPreview.tsx`:
- Line 390: Move the footer rendering in the PrintPreview component outside the
facility-gated FacilityPrintLayout path so it renders even when facility is
undefined. Preserve the existing footer content and ensure PrescriptionPreview’s
generated footer remains visible on that fallback path.

In `@src/components/Common/PrintTable.tsx`:
- Line 134: Update the base table cell class string in PrintTable to replace the
unsupported wrap-break-words utility with Tailwind v4’s wrap-break-word class,
while preserving the existing whitespace-normal and text-center classes.

In `@src/components/Prescription/PrescriptionPreview.tsx`:
- Around line 119-131: Update the remarks construction in the prescription row
mapping so the row-spanned first row includes the formatted sigs from every
instruction, not only the current di; preserve the medication note and existing
filtering/join behavior while ensuring tapered prescriptions retain all route,
method, and site details.
- Around line 252-257: Update the footer timestamp rendering in
PrescriptionPreview to use the active locale for all three date renderings
instead of fixed format strings. Reuse the existing
translation/date-localization setup and preserve the current labels and layout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 96d002a5-387c-4594-9fd7-682cafb3dfc4

📥 Commits

Reviewing files that changed from the base of the PR and between e67ba29 and a5bd401.

📒 Files selected for processing (7)
  • public/locale/en.json
  • src/CAREUI/misc/PrintPreview.tsx
  • src/components/Common/PrintTable.tsx
  • src/components/Medicine/FormattedDosage.tsx
  • src/components/Medicine/utils.ts
  • src/components/Prescription/PrescriptionPreview.tsx
  • src/pages/Facility/services/pharmacy/PrintDispenseOrder.tsx

Comment thread src/CAREUI/misc/PrintPreview.tsx
Comment thread src/components/Common/PrintTable.tsx Outdated
Comment thread src/components/Prescription/PrescriptionPreview.tsx Outdated
Comment thread src/components/Prescription/PrescriptionPreview.tsx
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown

🎭 Playwright Test Results

Status: ✅ Passed
Test Shards: 3

Metric Count
Total Tests 334
✅ Passed 334
❌ Failed 0
⏭️ Skipped 0

📊 Detailed results are available in the playwright-final-report artifact.

Run: #10498

Copilot AI review requested due to automatic review settings July 23, 2026 13:24

@yash-learner yash-learner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like specs are falling because of the new dosage format. please check


Can you also match the styles - font weights and styles of print with the figma design

one example -> medicine name

Figma ->

font-family: font-family/Figtree;
font-weight: font-weight/semibold;
font-style: SemiBold;    <- this one
font-size: font-size/10;
leading-trim: NONE;
line-height: line-height/9;
letter-spacing: 0%;

Current

p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] wrap-break-words text-sm print:text-xs wrap-break-word whitespace-break-spaces text-gray-950 text-left font-medium max-w-56 min-w-32

Comment thread public/locale/en.json Outdated
Comment thread src/components/Prescription/PrescriptionPreview.tsx

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread src/components/Prescription/PrescriptionPreview.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/components/Prescription/PrescriptionPreview.tsx (2)

36-44: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Define PrescriptionContent props with an interface.

Replace the inline object type with a named PrescriptionContentProps interface to follow the repository’s TypeScript component-prop convention.

As per coding guidelines, component props must be defined with TypeScript interfaces.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Prescription/PrescriptionPreview.tsx` around lines 36 - 44,
Define a named PrescriptionContentProps interface for the prescription,
prescriptionIndex, and totalCount props, then update the PrescriptionContent
component to use that interface instead of its inline object type.

Source: Coding guidelines


121-132: ⚠️ Potential issue | 🟠 Major

Preserve all instruction sigs in row-spanned remarks.

_span_remarks skips later rows, but the first row stores only formatSig(di). Multi-instruction prescriptions therefore omit later instruction details from the printed remarks. Aggregate all sigs or remove the remarks rowspan.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Prescription/PrescriptionPreview.tsx` around lines 121 - 132,
Update the row construction in PrescriptionPreview so the first row’s
row-spanned remarks include sigs from every instruction in a multi-instruction
prescription, not only formatSig(di) for the current instruction. Aggregate the
instruction sigs for the first row while preserving the existing medication note
and non-first-row behavior, or remove _span_remarks if spanning is no longer
appropriate.
♻️ Duplicate comments (1)
src/components/Prescription/PrescriptionPreview.tsx (1)

254-258: ⚠️ Potential issue | 🟡 Minor

Localize the generated prescription timestamp.

format(new Date(), "PP 'at' p") does not receive the active locale and hardcodes the English "at" literal. Reuse the project’s locale-aware date/time formatting.

As per coding guidelines, localized medical timestamps must use localized date/time formatting.

#!/bin/bash
set -euo pipefail

rg -n 'formatDateTime|date-fns/locale|format\(' src/components src/Utils
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Prescription/PrescriptionPreview.tsx` around lines 254 - 258,
Update the timestamp rendering in PrescriptionPreview’s footer to use the
project’s existing locale-aware date/time formatting utility, passing the active
locale as required. Remove the hardcoded date-fns format string and English “at”
literal while preserving the current generated timestamp content.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/components/Prescription/PrescriptionPreview.tsx`:
- Around line 89-92: Update the prescription note markup in PrescriptionPreview
so the block-level Markdown component is not nested inside the existing
paragraph. Replace the paragraph with a suitable block-level wrapper, render the
translated note label in a separate element, and keep Markdown
content={prescription.note} with prose={false} and the existing styling/layout
behavior.

---

Outside diff comments:
In `@src/components/Prescription/PrescriptionPreview.tsx`:
- Around line 36-44: Define a named PrescriptionContentProps interface for the
prescription, prescriptionIndex, and totalCount props, then update the
PrescriptionContent component to use that interface instead of its inline object
type.
- Around line 121-132: Update the row construction in PrescriptionPreview so the
first row’s row-spanned remarks include sigs from every instruction in a
multi-instruction prescription, not only formatSig(di) for the current
instruction. Aggregate the instruction sigs for the first row while preserving
the existing medication note and non-first-row behavior, or remove _span_remarks
if spanning is no longer appropriate.

---

Duplicate comments:
In `@src/components/Prescription/PrescriptionPreview.tsx`:
- Around line 254-258: Update the timestamp rendering in PrescriptionPreview’s
footer to use the project’s existing locale-aware date/time formatting utility,
passing the active locale as required. Remove the hardcoded date-fns format
string and English “at” literal while preserving the current generated timestamp
content.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 4c8207c7-69e2-4715-96ae-85aeca29c4b4

📥 Commits

Reviewing files that changed from the base of the PR and between a5bd401 and 75c8c6a.

📒 Files selected for processing (3)
  • src/CAREUI/misc/PrintPreview.tsx
  • src/components/Common/PrintTable.tsx
  • src/components/Prescription/PrescriptionPreview.tsx

Comment thread src/components/Prescription/PrescriptionPreview.tsx Outdated
Copilot AI review requested due to automatic review settings July 23, 2026 13:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread src/components/Medicine/utils.ts
Comment thread src/components/Prescription/PrescriptionPreview.tsx

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/components/Prescription/PrescriptionPreview.tsx (2)

127-129: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Localize missing-value placeholders.

"-" is rendered directly to users for missing dosage, schedule, and duration values. Replace it with an i18next translation key.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Prescription/PrescriptionPreview.tsx` around lines 127 - 129,
Update the dosage, schedule, and duration fallback values in PrescriptionPreview
to use the existing i18next translation mechanism instead of the hardcoded "-"
placeholder. Add or reuse an appropriate translation key for the localized
missing-value label while preserving the current formatted values when present.

Source: Coding guidelines


69-72: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use a locale-aware timestamp format here. formatDateTime currently forwards this fixed DD MMM YYYY, ddd, hh:mm A pattern directly to Day.js, so month/day names and ordering stay hard-coded instead of following the active locale. Prefer the repository’s localized date/time formatter for this medical timestamp.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/Prescription/PrescriptionPreview.tsx` around lines 69 - 72,
Update the PrescriptionPreview timestamp rendering around formatDateTime to use
the repository’s locale-aware date/time formatter instead of the hard-coded “DD
MMM YYYY, ddd, hh:mm A” pattern, while preserving use of
prescription.created_date.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/components/Prescription/PrescriptionPreview.tsx`:
- Around line 127-129: Update the dosage, schedule, and duration fallback values
in PrescriptionPreview to use the existing i18next translation mechanism instead
of the hardcoded "-" placeholder. Add or reuse an appropriate translation key
for the localized missing-value label while preserving the current formatted
values when present.
- Around line 69-72: Update the PrescriptionPreview timestamp rendering around
formatDateTime to use the repository’s locale-aware date/time formatter instead
of the hard-coded “DD MMM YYYY, ddd, hh:mm A” pattern, while preserving use of
prescription.created_date.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3d72d931-a45b-4b8c-aa50-fd87f3c10cc5

📥 Commits

Reviewing files that changed from the base of the PR and between 75c8c6a and 09d582f.

📒 Files selected for processing (1)
  • src/components/Prescription/PrescriptionPreview.tsx

@abhimanyurajeesh

abhimanyurajeesh commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

Can you also match the styles - font weights and styles of print with the figma design

one example -> medicine name

Figma ->

font-family: font-family/Figtree;
font-weight: font-weight/semibold;
font-style: SemiBold;    <- this one
font-size: font-size/10;
leading-trim: NONE;
line-height: line-height/9;
letter-spacing: 0%;

Current

p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] wrap-break-words text-sm print:text-xs wrap-break-word whitespace-break-spaces text-gray-950 text-left font-medium max-w-56 min-w-32

intended, discussed with @amjithtitus09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings July 28, 2026 12:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

src/components/Prescription/PrescriptionPreview.tsx:265

  • The footer date format includes a hard-coded English literal ("at") inside the date-fns format string, which bypasses i18n and will show "at" even in non-English locales. Also, the | divider is currently a raw text node; making it its own element is clearer and ensures spacing is controlled by flex gap.
      footer={
        <div className="mt-2 text-xs print:text-[10px] text-gray-900 text-center flex gap-2 justify-center">
          <span>{t("computer_generated_prescription")}</span>|
          <span>{format(new Date(), "PP 'at' p")}</span>
        </div>

src/components/Medicine/utils.ts:11

  • Decimal is only used as a type in this file (in the roundDosage parameter). Using a value import can unnecessarily keep the import in the emitted JS depending on TS settings; prefer a type-only import here.
import { round } from "@/Utils/decimal";
import Decimal from "decimal.js";

src/components/Prescription/PrescriptionPreview.tsx:123

  • Rowspan metadata for the "#" column won’t work: PrintTable looks for _span_${key} and the header key is "#", but the row data sets _span_num. This means the numbering column won’t actually rowspan and skipCells["#"] will never be populated.
                        ? "true"
                        : undefined,
                    _span_num:
                      idx === 0 && shouldSpan ? String(totalRows) : undefined,
                    _span_medicine:
                      idx === 0 && shouldSpan ? String(totalRows) : undefined,

@amjithtitus09

Copy link
Copy Markdown
Member

@abhimanyurajeesh

image
{
    "medications": [
        {
            "status": "active",
            "status_reason": null,
            "intent": "order",
            "category": "inpatient",
            "priority": "routine",
            "do_not_perform": false,
            "medication": {},
            "dosage_instruction": [
                {
                    "text": "1-0-0",
                    "timing": {
                        "code": {
                            "code": "AM",
                            "system": "http://terminology.hl7.org/CodeSystem/v3-GTSAbbreviation",
                            "display": "Every morning"
                        },
                        "repeat": {
                            "period": "1",
                            "frequency": 1,
                            "period_unit": "d",
                            "bounds_duration": {
                                "unit": "d",
                                "value": "1"
                            }
                        }
                    },
                    "dose_and_rate": {
                        "type": "ordered",
                        "dose_quantity": {
                            "unit": {
                                "code": "g",
                                "system": "http://unitsofmeasure.org",
                                "display": "gram"
                            },
                            "value": "1"
                        }
                    },
                    "as_needed_boolean": false
                }
            ],
            "authored_on": "2026-07-28T06:23:03.697000Z",
            "note": null,
            "dispense_status": null,
            "id": "46ed7780-4f81-41c3-b636-31384e9f416d",
            "created_by": {
                "meta": {},
                "id": "e18888e3-04ec-45e4-acaa-18a901758c4d",
                "first_name": "",
                "last_name": "",
                "phone_number": "+919696969696",
                "prefix": null,
                "suffix": null,
                "last_login": "2026-07-28T14:06:55.275452Z",
                "profile_picture_url": null,
                "gender": "3",
                "username": "caresuperadmin",
                "mfa_enabled": false,
                "deleted": false,
                "role_orgs": []
            },
            "updated_by": {
                "meta": {},
                "id": "e18888e3-04ec-45e4-acaa-18a901758c4d",
                "first_name": "",
                "last_name": "",
                "phone_number": "+919696969696",
                "prefix": null,
                "suffix": null,
                "last_login": "2026-07-28T14:06:55.275452Z",
                "profile_picture_url": null,
                "gender": "3",
                "username": "caresuperadmin",
                "mfa_enabled": false,
                "deleted": false,
                "role_orgs": []
            },
            "created_date": "2026-07-28T06:24:32.212363Z",
            "modified_date": "2026-07-28T06:24:32.212374Z",
            "requested_product": {
                "id": "e53ce23e-884e-4be8-9d61-d295933160bc",
                "alternate_identifier": null,
                "status": "active",
                "product_type": "medication",
                "code": {},
                "base_unit": {
                    "code": "g",
                    "system": "http://unitsofmeasure.org",
                    "display": "gram"
                },
                "name": "paracetamol13",
                "names": [],
                "storage_guidelines": [],
                "definitional": {},
                "is_instance_level": false,
                "category": {
                    "id": "729852e7-166c-4ad9-940b-8f1c59c33a4e",
                    "title": "Medicine - Instock",
                    "description": null,
                    "resource_type": "product_knowledge",
                    "resource_sub_type": "other",
                    "parent": {},
                    "has_children": false,
                    "level_cache": 0,
                    "is_child": false,
                    "slug_config": {
                        "facility": "f0dbe5f5-58f1-47ed-9133-d34610cc2806",
                        "slug_value": "medicine-instock"
                    },
                    "slug": "f-f0dbe5f5-58f1-47ed-9133-d34610cc2806-medicine-instock",
                    "calculated_monetary_components": [],
                    "configured_monetary_components": []
                },
                "slug_config": {
                    "facility": "f0dbe5f5-58f1-47ed-9133-d34610cc2806",
                    "slug_value": "paracetamol13"
                },
                "slug": "f-f0dbe5f5-58f1-47ed-9133-d34610cc2806-paracetamol13"
            },
            "requester": {
                "meta": {},
                "id": "e18888e3-04ec-45e4-acaa-18a901758c4d",
                "first_name": "",
                "last_name": "",
                "phone_number": "+919696969696",
                "prefix": null,
                "suffix": null,
                "last_login": "2026-07-28T14:06:55.275452Z",
                "profile_picture_url": null,
                "gender": "3",
                "username": "caresuperadmin",
                "mfa_enabled": false,
                "deleted": false,
                "role_orgs": []
            }
        },
        {
            "status": "active",
            "status_reason": null,
            "intent": "order",
            "category": "inpatient",
            "priority": "routine",
            "do_not_perform": false,
            "medication": {},
            "dosage_instruction": [
                {
                    "site": {
                        "code": "63370004",
                        "system": "http://snomed.info/sct",
                        "display": "Blood cell"
                    },
                    "text": "1-0-0",
                    "route": {
                        "code": "58761000052107",
                        "system": "http://snomed.info/sct",
                        "display": "Intracholangiopancreatic route"
                    },
                    "method": {
                        "code": "736665006",
                        "system": "http://snomed.info/sct",
                        "display": "Dose form administration method"
                    },
                    "timing": {
                        "code": {
                            "code": "AM",
                            "system": "http://terminology.hl7.org/CodeSystem/v3-GTSAbbreviation",
                            "display": "Every morning"
                        },
                        "repeat": {
                            "period": "1",
                            "frequency": 1,
                            "period_unit": "d",
                            "bounds_range": {
                                "low": {
                                    "unit": "d",
                                    "value": "5"
                                },
                                "high": {
                                    "unit": "d",
                                    "value": "7"
                                }
                            }
                        }
                    },
                    "dose_and_rate": {
                        "type": "ordered",
                        "dose_quantity": {
                            "unit": {
                                "code": "g",
                                "system": "http://unitsofmeasure.org",
                                "display": "gram"
                            },
                            "value": "1"
                        }
                    },
                    "as_needed_boolean": false,
                    "additional_instruction": [
                        {
                            "code": "311504000",
                            "system": "http://snomed.info/sct",
                            "display": "With or after food"
                        }
                    ]
                },
                {
                    "site": {
                        "code": "1054731000004100",
                        "system": "http://snomed.info/sct",
                        "display": "Structure of colonic submucosa and/or colonic muscularis propria"
                    },
                    "text": "0-1-0",
                    "route": {
                        "code": "26643006",
                        "system": "http://snomed.info/sct",
                        "display": "Oral route"
                    },
                    "method": {
                        "code": "823034001",
                        "system": "http://snomed.info/sct",
                        "display": "Orodisperse"
                    },
                    "timing": {
                        "code": {
                            "code": "NOON",
                            "system": "http://terminology.hl7.org/CodeSystem/v3-GTSAbbreviation",
                            "display": "At noon"
                        },
                        "repeat": {
                            "period": "1",
                            "frequency": 1,
                            "period_unit": "d",
                            "bounds_duration": {
                                "unit": "d",
                                "value": "1"
                            }
                        }
                    },
                    "dose_and_rate": {
                        "type": "ordered",
                        "dose_quantity": {
                            "unit": {
                                "code": "mL",
                                "system": "http://unitsofmeasure.org",
                                "display": "milliliter"
                            },
                            "value": "4"
                        }
                    },
                    "as_needed_boolean": false,
                    "additional_instruction": [
                        {
                            "code": "420162004",
                            "system": "http://snomed.info/sct",
                            "display": "To be spread thinly"
                        }
                    ]
                }
            ],
            "authored_on": "2026-07-28T06:23:05.866000Z",
            "note": "This is a note",
            "dispense_status": null,
            "id": "a654eed0-f6ee-4153-acbc-1ce39e022ab9",
            "created_by": {
                "meta": {},
                "id": "e18888e3-04ec-45e4-acaa-18a901758c4d",
                "first_name": "",
                "last_name": "",
                "phone_number": "+919696969696",
                "prefix": null,
                "suffix": null,
                "last_login": "2026-07-28T14:06:55.275452Z",
                "profile_picture_url": null,
                "gender": "3",
                "username": "caresuperadmin",
                "mfa_enabled": false,
                "deleted": false,
                "role_orgs": []
            },
            "updated_by": {
                "meta": {},
                "id": "e18888e3-04ec-45e4-acaa-18a901758c4d",
                "first_name": "",
                "last_name": "",
                "phone_number": "+919696969696",
                "prefix": null,
                "suffix": null,
                "last_login": "2026-07-28T14:06:55.275452Z",
                "profile_picture_url": null,
                "gender": "3",
                "username": "caresuperadmin",
                "mfa_enabled": false,
                "deleted": false,
                "role_orgs": []
            },
            "created_date": "2026-07-28T06:24:32.702518Z",
            "modified_date": "2026-07-28T06:24:32.702535Z",
            "requested_product": {
                "id": "f144e905-33d1-41a7-b1cb-d579b148d60a",
                "alternate_identifier": null,
                "status": "active",
                "product_type": "medication",
                "code": {},
                "base_unit": {
                    "code": "g",
                    "system": "http://unitsofmeasure.org",
                    "display": "gram"
                },
                "name": "paracetamol10",
                "names": [],
                "storage_guidelines": [],
                "definitional": {},
                "is_instance_level": false,
                "category": {
                    "id": "729852e7-166c-4ad9-940b-8f1c59c33a4e",
                    "title": "Medicine - Instock",
                    "description": null,
                    "resource_type": "product_knowledge",
                    "resource_sub_type": "other",
                    "parent": {},
                    "has_children": false,
                    "level_cache": 0,
                    "is_child": false,
                    "slug_config": {
                        "facility": "f0dbe5f5-58f1-47ed-9133-d34610cc2806",
                        "slug_value": "medicine-instock"
                    },
                    "slug": "f-f0dbe5f5-58f1-47ed-9133-d34610cc2806-medicine-instock",
                    "calculated_monetary_components": [],
                    "configured_monetary_components": []
                },
                "slug_config": {
                    "facility": "f0dbe5f5-58f1-47ed-9133-d34610cc2806",
                    "slug_value": "paracetamol10"
                },
                "slug": "f-f0dbe5f5-58f1-47ed-9133-d34610cc2806-paracetamol10"
            },
            "requester": {
                "meta": {},
                "id": "e18888e3-04ec-45e4-acaa-18a901758c4d",
                "first_name": "",
                "last_name": "",
                "phone_number": "+919696969696",
                "prefix": null,
                "suffix": null,
                "last_login": "2026-07-28T14:06:55.275452Z",
                "profile_picture_url": null,
                "gender": "3",
                "username": "caresuperadmin",
                "mfa_enabled": false,
                "deleted": false,
                "role_orgs": []
            }
        }
    ]
}

Copilot AI review requested due to automatic review settings July 28, 2026 14:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

src/components/Prescription/PrescriptionPreview.tsx:266

  • The footer currently renders a raw | text node inside a flex container, so gap-* won’t apply to it (only to element children). Also, the date format string contains a hardcoded English word ("PP 'at' p"), which won’t localize for non-English locales. Wrap the separator in an element and avoid the hardcoded "at" in the formatted string.
      footer={
        <div className="mt-2 text-xs print:text-[10px] text-gray-900 text-center flex gap-2 justify-center">
          <span>{t("computer_generated_prescription")}</span>|
          <span>{format(new Date(), "PP 'at' p")}</span>
        </div>
      }

src/components/Prescription/PrescriptionPreview.tsx:66

  • The [ and ] are on their own lines around the x_of_y label, which can introduce unintended whitespace in the rendered output (e.g., "[ 1 of 2 ]") depending on how React collapses the text nodes. Keeping the bracketed counter as a single text node avoids formatting differences in print.
            <span className="text-sm print:text-xs text-gray-700 font-medium">
              [
              {t("x_of_y", {
                current: prescriptionIndex + 1,
                total: totalCount,

src/components/Prescription/PrescriptionPreview.tsx:339

  • PR description mentions “smaller QR sizing”, but this change increases the QR size from 70 to 85. Either update the description (if the larger QR is intentional) or adjust the size here to match the intended output.
              <QRCodeSVG
                value={patient.id}
                size={85}
                level="Q"

@abhimanyurajeesh

Copy link
Copy Markdown
Contributor Author

caresuperadmin

@amjithtitus09

image this is the issue, naming the key as hash_tag

Copilot AI review requested due to automatic review settings July 28, 2026 14:48
@abhimanyurajeesh

Copy link
Copy Markdown
Contributor Author

@amjithtitus09 fix via d6a0290
image

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (3)

src/components/Prescription/PrescriptionPreview.tsx:265

  • The footer date format includes a hardcoded English word ('at') inside the date-fns format string, which bypasses i18n and will always render in English. Prefer either removing it or composing the string with translated pieces.
      footer={
        <div className="mt-2 text-xs print:text-[10px] text-gray-900 text-center flex gap-2 justify-center">
          <span>{t("computer_generated_prescription")}</span>|
          <span>{format(new Date(), "PP 'at' p")}</span>
        </div>

src/components/Medicine/utils.ts:10

  • Decimal is only used as a TypeScript type in this file. Import it as a type-only import to avoid pulling a runtime dependency into the bundle from this module.
import Decimal from "decimal.js";

src/components/Common/PrintTable.tsx:121

  • For _fullspan rows, colSpan={headers.length - skippedCount} assumes that all row-spanned (skipped) columns are a leftmost prefix. If a rowspan exists in a non-leading column, subtracting the total skipped count will place the spanning cell in the wrong grid position and can break table layout. Consider only allowing prefix-skipped columns for _fullspan, and fall back to a safe layout otherwise.
              if (row["_fullspan"]) {
                const skippedCount = headers.filter(({ key }) =>
                  skipCells[key]?.has(index),
                ).length;

Copilot AI review requested due to automatic review settings July 29, 2026 09:02

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

src/components/Medicine/utils.ts:10

  • Decimal is only used in a type position (roundDosage parameter union). Importing it as a value can unnecessarily keep a runtime import (depending on TS/esbuild settings). Prefer a type-only import here.
import Decimal from "decimal.js";

@yash-learner yash-learner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copilot AI review requested due to automatic review settings July 30, 2026 11:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (2)

src/components/Medicine/utils.ts:10

  • Decimal is only used as a type (in the roundDosage signature). Importing it as a value can introduce an unnecessary runtime dependency/side effects and may prevent the import from being tree-shaken. Prefer a type-only import here.
import Decimal from "decimal.js";

src/components/Prescription/PrescriptionPreview.tsx:339

  • PR description (and CodeRabbit summary) mentions smaller QR sizing, but this change increases the QR code size from 70 to 85. Please confirm the intended QR size for the print layout and adjust either the code or the PR description accordingly.
              <QRCodeSVG
                value={patient.id}
                size={85}
                level="Q"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants