feat: add inhaler and injection package types
Closes #558 - add inhaler and injection as supported medication package types - align refill, planner, dashboard, report, export, and notification wording for the new discrete package types - include the validated CI repair for formatting and dashboard label parity
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export const PACKAGE_TYPES = ["blister", "bottle", "tube", "liquid_container"] as const;
|
||||
export const PACKAGE_TYPES = ["blister", "bottle", "tube", "liquid_container", "inhaler", "injection"] as const;
|
||||
|
||||
export type PackageType = (typeof PACKAGE_TYPES)[number];
|
||||
|
||||
@@ -19,14 +19,25 @@ export function isLiquidContainerPackageType(packageType?: string | null): boole
|
||||
return normalizePackageType(packageType) === "liquid_container";
|
||||
}
|
||||
|
||||
export function isAmountBasedPackageType(packageType?: string | null): boolean {
|
||||
export function isPackageAmountPackageType(packageType?: string | null): boolean {
|
||||
const normalized = normalizePackageType(packageType);
|
||||
return normalized === "bottle" || normalized === "tube" || normalized === "liquid_container";
|
||||
return normalized === "tube" || normalized === "liquid_container";
|
||||
}
|
||||
|
||||
export function getPlannerUnitKind(packageType?: string | null): "pills" | "ml" | "units" {
|
||||
export function isDiscreteCountPackageType(packageType?: string | null): boolean {
|
||||
const normalized = normalizePackageType(packageType);
|
||||
return normalized === "bottle" || normalized === "inhaler" || normalized === "injection";
|
||||
}
|
||||
|
||||
export function isAmountBasedPackageType(packageType?: string | null): boolean {
|
||||
return isPackageAmountPackageType(packageType) || isDiscreteCountPackageType(packageType);
|
||||
}
|
||||
|
||||
export function getPlannerUnitKind(packageType?: string | null): "pills" | "ml" | "units" | "puffs" | "injections" {
|
||||
const normalized = normalizePackageType(packageType);
|
||||
if (normalized === "tube") return "units";
|
||||
if (normalized === "liquid_container") return "ml";
|
||||
if (normalized === "inhaler") return "puffs";
|
||||
if (normalized === "injection") return "injections";
|
||||
return "pills";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user