mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 15:02:04 +00:00
style: apply prettier across the tree
One-shot prettier pass so the new format:check gate starts from a clean baseline. Formatting only — no behaviour change. Generator-owned and vendored artifacts stay untouched via .prettierignore.
This commit is contained in:
1 parent
b3fea2ef59
commit
1f4ba5939d
1000 files changed
+12130
-8385
No files matched your search
@@ -8,8 +8,7 @@ import {
|
||||
encryptContextToBytes,
|
||||
} from "../biomarker-store";
|
||||
|
||||
const KEY =
|
||||
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
|
||||
const KEY = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
|
||||
|
||||
describe("biomarker context codec", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -106,16 +106,14 @@ describe("resolveOrMintBiomarker", () => {
|
||||
it("adopts the race winner on a concurrent unique violation", async () => {
|
||||
// First lookup misses; create throws (the other writer won the unique
|
||||
// index); the re-lookup finds the winner.
|
||||
db.biomarker.findFirst
|
||||
.mockResolvedValueOnce(null)
|
||||
.mockResolvedValueOnce({
|
||||
id: "bm_winner",
|
||||
name: "TSH",
|
||||
unit: "mIU/L",
|
||||
lowerBound: 0.4,
|
||||
upperBound: 4,
|
||||
panel: "thyroid",
|
||||
});
|
||||
db.biomarker.findFirst.mockResolvedValueOnce(null).mockResolvedValueOnce({
|
||||
id: "bm_winner",
|
||||
name: "TSH",
|
||||
unit: "mIU/L",
|
||||
lowerBound: 0.4,
|
||||
upperBound: 4,
|
||||
panel: "thyroid",
|
||||
});
|
||||
db.biomarker.create.mockRejectedValue(new Error("unique constraint"));
|
||||
|
||||
const out = await resolveOrMintBiomarker("u1", {
|
||||
@@ -134,8 +132,8 @@ describe("resolveOrMintBiomarker", () => {
|
||||
db.biomarker.findFirst.mockResolvedValue(null);
|
||||
db.biomarker.create.mockRejectedValue(new Error("db down"));
|
||||
|
||||
await expect(
|
||||
resolveOrMintBiomarker("u1", baseInput),
|
||||
).rejects.toThrow(/Failed to resolve biomarker/);
|
||||
await expect(resolveOrMintBiomarker("u1", baseInput)).rejects.toThrow(
|
||||
/Failed to resolve biomarker/,
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -33,41 +33,197 @@ export interface BiomarkerSeed {
|
||||
|
||||
export const BIOMARKER_CATALOG: readonly BiomarkerSeed[] = [
|
||||
// Lipids
|
||||
{ slug: "total-cholesterol", panel: "lipids", unit: "mg/dL", lowerBound: null, upperBound: 200 },
|
||||
{ slug: "ldl", panel: "lipids", unit: "mg/dL", lowerBound: null, upperBound: 116 },
|
||||
{ slug: "hdl", panel: "lipids", unit: "mg/dL", lowerBound: 40, upperBound: null },
|
||||
{ slug: "triglycerides", panel: "lipids", unit: "mg/dL", lowerBound: null, upperBound: 150 },
|
||||
{
|
||||
slug: "total-cholesterol",
|
||||
panel: "lipids",
|
||||
unit: "mg/dL",
|
||||
lowerBound: null,
|
||||
upperBound: 200,
|
||||
},
|
||||
{
|
||||
slug: "ldl",
|
||||
panel: "lipids",
|
||||
unit: "mg/dL",
|
||||
lowerBound: null,
|
||||
upperBound: 116,
|
||||
},
|
||||
{
|
||||
slug: "hdl",
|
||||
panel: "lipids",
|
||||
unit: "mg/dL",
|
||||
lowerBound: 40,
|
||||
upperBound: null,
|
||||
},
|
||||
{
|
||||
slug: "triglycerides",
|
||||
panel: "lipids",
|
||||
unit: "mg/dL",
|
||||
lowerBound: null,
|
||||
upperBound: 150,
|
||||
},
|
||||
// Glucose metabolism
|
||||
{ slug: "fasting-glucose", panel: "glucose", unit: "mg/dL", lowerBound: 70, upperBound: 100 },
|
||||
{ slug: "hba1c", panel: "glucose", unit: "%", lowerBound: null, upperBound: 5.7 },
|
||||
{
|
||||
slug: "fasting-glucose",
|
||||
panel: "glucose",
|
||||
unit: "mg/dL",
|
||||
lowerBound: 70,
|
||||
upperBound: 100,
|
||||
},
|
||||
{
|
||||
slug: "hba1c",
|
||||
panel: "glucose",
|
||||
unit: "%",
|
||||
lowerBound: null,
|
||||
upperBound: 5.7,
|
||||
},
|
||||
// Thyroid
|
||||
{ slug: "tsh", panel: "thyroid", unit: "mIU/L", lowerBound: 0.4, upperBound: 4 },
|
||||
{ slug: "ft3", panel: "thyroid", unit: "pg/mL", lowerBound: 2.3, upperBound: 4.2 },
|
||||
{ slug: "ft4", panel: "thyroid", unit: "ng/dL", lowerBound: 0.8, upperBound: 1.8 },
|
||||
{
|
||||
slug: "tsh",
|
||||
panel: "thyroid",
|
||||
unit: "mIU/L",
|
||||
lowerBound: 0.4,
|
||||
upperBound: 4,
|
||||
},
|
||||
{
|
||||
slug: "ft3",
|
||||
panel: "thyroid",
|
||||
unit: "pg/mL",
|
||||
lowerBound: 2.3,
|
||||
upperBound: 4.2,
|
||||
},
|
||||
{
|
||||
slug: "ft4",
|
||||
panel: "thyroid",
|
||||
unit: "ng/dL",
|
||||
lowerBound: 0.8,
|
||||
upperBound: 1.8,
|
||||
},
|
||||
// Iron
|
||||
{ slug: "ferritin", panel: "iron", unit: "ng/mL", lowerBound: 30, upperBound: 400 },
|
||||
{ slug: "transferrin-saturation", panel: "iron", unit: "%", lowerBound: 20, upperBound: 50 },
|
||||
{
|
||||
slug: "ferritin",
|
||||
panel: "iron",
|
||||
unit: "ng/mL",
|
||||
lowerBound: 30,
|
||||
upperBound: 400,
|
||||
},
|
||||
{
|
||||
slug: "transferrin-saturation",
|
||||
panel: "iron",
|
||||
unit: "%",
|
||||
lowerBound: 20,
|
||||
upperBound: 50,
|
||||
},
|
||||
// Vitamins
|
||||
{ slug: "vitamin-d", panel: "vitamins", unit: "ng/mL", lowerBound: 30, upperBound: 100 },
|
||||
{ slug: "vitamin-b12", panel: "vitamins", unit: "pg/mL", lowerBound: 200, upperBound: 900 },
|
||||
{ slug: "folate", panel: "vitamins", unit: "ng/mL", lowerBound: 3, upperBound: 20 },
|
||||
{
|
||||
slug: "vitamin-d",
|
||||
panel: "vitamins",
|
||||
unit: "ng/mL",
|
||||
lowerBound: 30,
|
||||
upperBound: 100,
|
||||
},
|
||||
{
|
||||
slug: "vitamin-b12",
|
||||
panel: "vitamins",
|
||||
unit: "pg/mL",
|
||||
lowerBound: 200,
|
||||
upperBound: 900,
|
||||
},
|
||||
{
|
||||
slug: "folate",
|
||||
panel: "vitamins",
|
||||
unit: "ng/mL",
|
||||
lowerBound: 3,
|
||||
upperBound: 20,
|
||||
},
|
||||
// Inflammation
|
||||
{ slug: "hs-crp", panel: "inflammation", unit: "mg/L", lowerBound: null, upperBound: 3 },
|
||||
{
|
||||
slug: "hs-crp",
|
||||
panel: "inflammation",
|
||||
unit: "mg/L",
|
||||
lowerBound: null,
|
||||
upperBound: 3,
|
||||
},
|
||||
// Renal
|
||||
{ slug: "creatinine", panel: "renal", unit: "mg/dL", lowerBound: 0.6, upperBound: 1.3 },
|
||||
{ slug: "egfr", panel: "renal", unit: "mL/min/1.73m²", lowerBound: 90, upperBound: null },
|
||||
{
|
||||
slug: "creatinine",
|
||||
panel: "renal",
|
||||
unit: "mg/dL",
|
||||
lowerBound: 0.6,
|
||||
upperBound: 1.3,
|
||||
},
|
||||
{
|
||||
slug: "egfr",
|
||||
panel: "renal",
|
||||
unit: "mL/min/1.73m²",
|
||||
lowerBound: 90,
|
||||
upperBound: null,
|
||||
},
|
||||
// Liver
|
||||
{ slug: "alt", panel: "liver", unit: "U/L", lowerBound: null, upperBound: 40 },
|
||||
{ slug: "ast", panel: "liver", unit: "U/L", lowerBound: null, upperBound: 40 },
|
||||
{ slug: "ggt", panel: "liver", unit: "U/L", lowerBound: null, upperBound: 55 },
|
||||
{
|
||||
slug: "alt",
|
||||
panel: "liver",
|
||||
unit: "U/L",
|
||||
lowerBound: null,
|
||||
upperBound: 40,
|
||||
},
|
||||
{
|
||||
slug: "ast",
|
||||
panel: "liver",
|
||||
unit: "U/L",
|
||||
lowerBound: null,
|
||||
upperBound: 40,
|
||||
},
|
||||
{
|
||||
slug: "ggt",
|
||||
panel: "liver",
|
||||
unit: "U/L",
|
||||
lowerBound: null,
|
||||
upperBound: 55,
|
||||
},
|
||||
// Electrolytes
|
||||
{ slug: "sodium", panel: "electrolytes", unit: "mmol/L", lowerBound: 135, upperBound: 145 },
|
||||
{ slug: "potassium", panel: "electrolytes", unit: "mmol/L", lowerBound: 3.5, upperBound: 5.1 },
|
||||
{
|
||||
slug: "sodium",
|
||||
panel: "electrolytes",
|
||||
unit: "mmol/L",
|
||||
lowerBound: 135,
|
||||
upperBound: 145,
|
||||
},
|
||||
{
|
||||
slug: "potassium",
|
||||
panel: "electrolytes",
|
||||
unit: "mmol/L",
|
||||
lowerBound: 3.5,
|
||||
upperBound: 5.1,
|
||||
},
|
||||
// Blood count
|
||||
{ slug: "hemoglobin", panel: "bloodCount", unit: "g/dL", lowerBound: 12, upperBound: 17.5 },
|
||||
{ slug: "hematocrit", panel: "bloodCount", unit: "%", lowerBound: 36, upperBound: 50 },
|
||||
{ slug: "wbc", panel: "bloodCount", unit: "10³/µL", lowerBound: 4, upperBound: 11 },
|
||||
{ slug: "platelets", panel: "bloodCount", unit: "10³/µL", lowerBound: 150, upperBound: 400 },
|
||||
{
|
||||
slug: "hemoglobin",
|
||||
panel: "bloodCount",
|
||||
unit: "g/dL",
|
||||
lowerBound: 12,
|
||||
upperBound: 17.5,
|
||||
},
|
||||
{
|
||||
slug: "hematocrit",
|
||||
panel: "bloodCount",
|
||||
unit: "%",
|
||||
lowerBound: 36,
|
||||
upperBound: 50,
|
||||
},
|
||||
{
|
||||
slug: "wbc",
|
||||
panel: "bloodCount",
|
||||
unit: "10³/µL",
|
||||
lowerBound: 4,
|
||||
upperBound: 11,
|
||||
},
|
||||
{
|
||||
slug: "platelets",
|
||||
panel: "bloodCount",
|
||||
unit: "10³/µL",
|
||||
lowerBound: 150,
|
||||
upperBound: 400,
|
||||
},
|
||||
] as const;
|
||||
|
||||
/** The set of panel keys present in the catalog, in display order. */
|
||||
|
||||
Reference in new issue
Block a user