Dosage Constraints
Defines minimum and maximum dose limits plus step increments for medications to enforce safe prescribing ranges.
What this file does
Defines minimum and maximum dose limits plus step increments for medications to enforce safe prescribing ranges.
When to use it
- Adding dose validation to a medication form
- Implementing step-based dose adjustment in a prescription builder
- Storing dosage constraints alongside medication data
- Enforcing clinical safety limits during dose entry
Assumes this stack
Dosage Constraints
This document describes the dosage constraints feature in the Medication Signature Builder application.
Overview
The dosage constraints feature allows you to define minimum and maximum dose limits, as well as step increments for medications. This ensures that prescribed doses remain within safe and clinically appropriate ranges.
Configuration Options
When editing a medication in the Medication Form, you can define the following constraints:
-
Minimum Dose: The lowest acceptable dose value for the medication
- Value: Numeric value (e.g., 50)
- Unit: Unit of measure (e.g., mg, mcg, mL)
-
Maximum Dose: The highest acceptable dose value for the medication
- Value: Numeric value (e.g., 200)
- Unit: Unit of measure (e.g., mg, mcg, mL)
-
Step Size: The increment value for dosage adjustments
- Value: Numeric value (e.g., 25)
- This defines the granularity of dose changes (e.g., doses can only be 0, 25, 50, 75, etc.)
Example Use Cases
Testosterone Injections
For testosterone injections, you might set:
- Min Dose: 50 mg
- Max Dose: 200 mg
- Step Size: 50 mg
This ensures patients receive at least 50mg per dose, no more than 200mg, and doses are adjusted in 50mg increments.
Topical Creams with Dispensers
For creams dispensed with devices like Topiclick:
- Min Dose: 1 click
- Max Dose: 4 clicks
- Step Size: 1 click
How Constraints Are Applied
Dose constraints are applied in several ways:
-
In the Dose Input Component:
- Visual indicators show min/max/step values
- The number input has min/max/step attributes that restrict input values
- When a user enters a value outside the allowed range, it's automatically adjusted
-
In Dosage Calculations:
- The
buildDosage.tsutility enforces constraints during dose calculations - When converting between different units (e.g., mg to mL), constraints are preserved
- Step sizes are applied when rounding values
- The
Technical Implementation
The constraints are stored in the medication object structure:
dosageConstraints?: {
minDose?: {
value: number;
unit: string;
};
maxDose?: {
value: number;
unit: string;
};
step?: number;
}
These values are persisted to the database when you save a medication.
What's inside
3 configuration options, 2 example use cases, 2 application methods, 1 TypeScript interface
Change this for your project
- Replace
Medication Signature Builderwith your application name - Replace
buildDosage.tswith your dosage utility file path - Replace
Topiclickwith your dispenser device name
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Related Documents
Xilinx Constraints
Explains Xilinx XDC constraint ordering, compilation precedence, and key references for FPGA timing closure.
Technical Constraints & Requirements
Defines platform, performance, security, and deployment constraints for a Scottish mountain weather app with native iOS/Android and PWA fallback.
Token Constraints Implementation
Defines a token constraint system that counts tokens, truncates content, and streams responses to stay within an LLM's token limit.
Constraints
Explains how to model constraints as Ceres Solver cost functions in the fuse optimization framework, with a complete code example.