mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 21:10:59 +00:00
Merge branch 'wave/v1221-d' into release/v1.22.1
This commit is contained in:
commit
acf4941be8
8 files changed
+266
-51
No files matched your search
@@ -6842,6 +6842,34 @@
|
||||
"liver": "Leber",
|
||||
"electrolytes": "Elektrolyte",
|
||||
"bloodCount": "Blutbild"
|
||||
},
|
||||
"desc": {
|
||||
"total-cholesterol": "Gesamtmenge des im Blut transportierten Cholesterins, Summe aus LDL-, HDL- und weiteren Lipoproteinfraktionen.",
|
||||
"ldl": "Cholesterin in Lipoproteinen geringer Dichte, der Anteil, der sich in den Arterienwänden ablagert.",
|
||||
"hdl": "Cholesterin in Lipoproteinen hoher Dichte, die Cholesterin zurück zur Leber transportieren.",
|
||||
"triglycerides": "Das wichtigste Blutfett, aus der Nahrung aufgenommen und in der Leber gebildet.",
|
||||
"fasting-glucose": "Nüchtern gemessener Blutzucker, der die grundlegende Glukoseregulation widerspiegelt.",
|
||||
"hba1c": "Anteil des an Glukose gebundenen Hämoglobins, Spiegel des Blutzuckers der letzten zwei bis drei Monate.",
|
||||
"tsh": "Hypophysenhormon, das die Schilddrüse steuert; der wichtigste Suchtest der Schilddrüsenfunktion.",
|
||||
"ft3": "Die freie, aktive Form des Trijodthyronins, des stärker wirksamen Schilddrüsenhormons.",
|
||||
"ft4": "Die freie Form des Thyroxins, des Haupthormons, das die Schilddrüse ins Blut abgibt.",
|
||||
"ferritin": "Das wichtigste Eisenspeicherprotein des Körpers, Maß für die Eisenreserven.",
|
||||
"transferrin-saturation": "Anteil des Eisentransportproteins Transferrin, der aktuell Eisen trägt.",
|
||||
"vitamin-d": "Zirkulierendes 25-Hydroxy-Vitamin-D, der Standardmarker für den Vitamin-D-Status.",
|
||||
"vitamin-b12": "Vitamin, das für die Bildung roter Blutkörperchen und die Nervenfunktion notwendig ist.",
|
||||
"folate": "B-Vitamin, das für die Bildung roter Blutkörperchen und die DNA-Synthese benötigt wird.",
|
||||
"hs-crp": "Ein Leberprotein, das bei Entzündungen ansteigt, hochempfindlich gemessen.",
|
||||
"creatinine": "Abbauprodukt der Muskulatur, das über die Nieren ausgeschieden wird; Maß der Nierenfunktion.",
|
||||
"egfr": "Geschätzte Filtrationsrate der Nieren, aus dem Kreatinin berechnet.",
|
||||
"alt": "Leberenzym, das bei Schädigung der Leberzellen ins Blut freigesetzt wird.",
|
||||
"ast": "Enzym aus Leber und Muskulatur, das bei Schädigung dieser Gewebe ansteigt.",
|
||||
"ggt": "Enzym aus Leber und Gallenwegen, das bei Gallenstau oder Alkoholbelastung ansteigt.",
|
||||
"sodium": "Wichtigster Elektrolyt für den Flüssigkeitshaushalt und das Blutvolumen.",
|
||||
"potassium": "Elektrolyt, der für die Nervenleitung und die Herzmuskelfunktion unentbehrlich ist.",
|
||||
"hemoglobin": "Das sauerstofftransportierende Protein in den roten Blutkörperchen.",
|
||||
"hematocrit": "Der Anteil der roten Blutkörperchen am Blutvolumen.",
|
||||
"wbc": "Gesamtzahl der weißen Blutkörperchen, der zirkulierenden Abwehr des Immunsystems.",
|
||||
"platelets": "Zellfragmente, die sich zusammenlagern und die Blutgerinnung bewirken."
|
||||
}
|
||||
},
|
||||
"noteLoadFailed": "Notiz konnte nicht geladen werden; sie bleibt beim Speichern unverändert.",
|
||||
|
||||
@@ -6842,6 +6842,34 @@
|
||||
"liver": "Liver",
|
||||
"electrolytes": "Electrolytes",
|
||||
"bloodCount": "Blood count"
|
||||
},
|
||||
"desc": {
|
||||
"total-cholesterol": "Total amount of cholesterol carried in the blood, summing the LDL, HDL, and other lipoprotein fractions.",
|
||||
"ldl": "Cholesterol carried by low-density lipoproteins, the fraction that deposits in artery walls.",
|
||||
"hdl": "Cholesterol carried by high-density lipoproteins, which transport cholesterol back to the liver.",
|
||||
"triglycerides": "The main fat circulating in the blood, drawn from diet and produced by the liver.",
|
||||
"fasting-glucose": "Blood sugar measured after an overnight fast, reflecting baseline glucose regulation.",
|
||||
"hba1c": "The share of haemoglobin bound to glucose, reflecting average blood sugar over the past two to three months.",
|
||||
"tsh": "Pituitary hormone that signals the thyroid; the primary screen of thyroid function.",
|
||||
"ft3": "The unbound, active form of triiodothyronine, the more potent thyroid hormone.",
|
||||
"ft4": "The unbound form of thyroxine, the main hormone the thyroid releases into the blood.",
|
||||
"ferritin": "The body's main iron-storage protein, reflecting total iron reserves.",
|
||||
"transferrin-saturation": "Share of the iron-transport protein transferrin that is currently carrying iron.",
|
||||
"vitamin-d": "Circulating 25-hydroxyvitamin D, the standard marker of vitamin D status.",
|
||||
"vitamin-b12": "Vitamin essential for red blood cell formation and nerve function.",
|
||||
"folate": "B-vitamin needed for red blood cell formation and DNA synthesis.",
|
||||
"hs-crp": "A liver protein that rises with inflammation, measured at high sensitivity.",
|
||||
"creatinine": "Muscle waste product cleared by the kidneys, used to gauge kidney function.",
|
||||
"egfr": "Estimated rate at which the kidneys filter blood, derived from creatinine.",
|
||||
"alt": "Liver enzyme released into the blood when liver cells are damaged.",
|
||||
"ast": "Enzyme found in liver and muscle that rises when those tissues are injured.",
|
||||
"ggt": "Liver and bile-duct enzyme that rises with bile-flow obstruction or alcohol exposure.",
|
||||
"sodium": "Principal electrolyte governing the body's fluid balance and blood volume.",
|
||||
"potassium": "Electrolyte essential for nerve signalling and heart-muscle function.",
|
||||
"hemoglobin": "The oxygen-carrying protein in red blood cells.",
|
||||
"hematocrit": "The fraction of blood volume made up of red blood cells.",
|
||||
"wbc": "Total count of white blood cells, the immune system's circulating defence.",
|
||||
"platelets": "Cell fragments that clump together to form blood clots."
|
||||
}
|
||||
},
|
||||
"noteLoadFailed": "Note could not be loaded; it will be kept unchanged when you save.",
|
||||
|
||||
@@ -6842,6 +6842,34 @@
|
||||
"liver": "Hígado",
|
||||
"electrolytes": "Electrolitos",
|
||||
"bloodCount": "Hemograma"
|
||||
},
|
||||
"desc": {
|
||||
"total-cholesterol": "Cantidad total de colesterol transportado en la sangre, suma de las fracciones LDL, HDL y otras lipoproteínas.",
|
||||
"ldl": "Colesterol transportado por lipoproteínas de baja densidad, la fracción que se deposita en las paredes arteriales.",
|
||||
"hdl": "Colesterol transportado por lipoproteínas de alta densidad, que lo devuelven al hígado.",
|
||||
"triglycerides": "La principal grasa que circula en la sangre, procedente de la dieta y producida por el hígado.",
|
||||
"fasting-glucose": "Azúcar en sangre medido en ayunas, refleja la regulación basal de la glucosa.",
|
||||
"hba1c": "Proporción de hemoglobina unida a glucosa, refleja el azúcar en sangre de los últimos dos o tres meses.",
|
||||
"tsh": "Hormona hipofisaria que regula la tiroides; la prueba principal de la función tiroidea.",
|
||||
"ft3": "La forma libre y activa de la triyodotironina, la hormona tiroidea más potente.",
|
||||
"ft4": "La forma libre de la tiroxina, la principal hormona que la tiroides libera a la sangre.",
|
||||
"ferritin": "La principal proteína de almacenamiento de hierro del cuerpo, refleja las reservas de hierro.",
|
||||
"transferrin-saturation": "Proporción de la proteína transportadora transferrina que lleva hierro en ese momento.",
|
||||
"vitamin-d": "25-hidroxivitamina D circulante, el marcador estándar del estado de vitamina D.",
|
||||
"vitamin-b12": "Vitamina esencial para la formación de glóbulos rojos y la función nerviosa.",
|
||||
"folate": "Vitamina B necesaria para la formación de glóbulos rojos y la síntesis de ADN.",
|
||||
"hs-crp": "Una proteína hepática que aumenta con la inflamación, medida con alta sensibilidad.",
|
||||
"creatinine": "Producto de desecho muscular eliminado por los riñones, usado para evaluar la función renal.",
|
||||
"egfr": "Tasa estimada de filtración de los riñones, calculada a partir de la creatinina.",
|
||||
"alt": "Enzima hepática liberada a la sangre cuando se dañan las células del hígado.",
|
||||
"ast": "Enzima del hígado y el músculo que aumenta cuando esos tejidos se lesionan.",
|
||||
"ggt": "Enzima del hígado y las vías biliares que aumenta con la obstrucción biliar o el alcohol.",
|
||||
"sodium": "Principal electrolito que regula el equilibrio de líquidos y el volumen sanguíneo.",
|
||||
"potassium": "Electrolito esencial para la transmisión nerviosa y la función del músculo cardíaco.",
|
||||
"hemoglobin": "La proteína de los glóbulos rojos que transporta el oxígeno.",
|
||||
"hematocrit": "La fracción del volumen sanguíneo formada por glóbulos rojos.",
|
||||
"wbc": "Recuento total de glóbulos blancos, la defensa circulante del sistema inmunitario.",
|
||||
"platelets": "Fragmentos celulares que se agregan para formar coágulos sanguíneos."
|
||||
}
|
||||
},
|
||||
"noteLoadFailed": "No se pudo cargar la nota; se mantendrá sin cambios al guardar.",
|
||||
|
||||
@@ -6842,6 +6842,34 @@
|
||||
"liver": "Foie",
|
||||
"electrolytes": "Électrolytes",
|
||||
"bloodCount": "Numération sanguine"
|
||||
},
|
||||
"desc": {
|
||||
"total-cholesterol": "Quantité totale de cholestérol transporté dans le sang, somme des fractions LDL, HDL et autres lipoprotéines.",
|
||||
"ldl": "Cholestérol transporté par les lipoprotéines de basse densité, la fraction qui se dépose dans les parois artérielles.",
|
||||
"hdl": "Cholestérol transporté par les lipoprotéines de haute densité, qui le ramènent vers le foie.",
|
||||
"triglycerides": "La principale graisse circulant dans le sang, issue de l'alimentation et produite par le foie.",
|
||||
"fasting-glucose": "Glycémie mesurée à jeun, reflétant la régulation de base du glucose.",
|
||||
"hba1c": "Part de l'hémoglobine liée au glucose, reflet de la glycémie des deux à trois derniers mois.",
|
||||
"tsh": "Hormone hypophysaire qui régule la thyroïde ; le principal test de la fonction thyroïdienne.",
|
||||
"ft3": "La forme libre et active de la triiodothyronine, l'hormone thyroïdienne la plus puissante.",
|
||||
"ft4": "La forme libre de la thyroxine, la principale hormone que la thyroïde libère dans le sang.",
|
||||
"ferritin": "La principale protéine de stockage du fer, reflet des réserves en fer.",
|
||||
"transferrin-saturation": "Part de la transferrine, protéine de transport du fer, qui porte du fer à un instant donné.",
|
||||
"vitamin-d": "25-hydroxyvitamine D circulante, le marqueur de référence du statut en vitamine D.",
|
||||
"vitamin-b12": "Vitamine essentielle à la formation des globules rouges et à la fonction nerveuse.",
|
||||
"folate": "Vitamine B nécessaire à la formation des globules rouges et à la synthèse de l'ADN.",
|
||||
"hs-crp": "Une protéine hépatique qui s'élève avec l'inflammation, mesurée à haute sensibilité.",
|
||||
"creatinine": "Déchet musculaire éliminé par les reins, utilisé pour évaluer la fonction rénale.",
|
||||
"egfr": "Débit de filtration estimé des reins, calculé à partir de la créatinine.",
|
||||
"alt": "Enzyme hépatique libérée dans le sang lorsque les cellules du foie sont endommagées.",
|
||||
"ast": "Enzyme du foie et du muscle qui s'élève lorsque ces tissus sont lésés.",
|
||||
"ggt": "Enzyme du foie et des voies biliaires qui s'élève en cas d'obstruction biliaire ou d'alcool.",
|
||||
"sodium": "Principal électrolyte régulant l'équilibre hydrique et le volume sanguin.",
|
||||
"potassium": "Électrolyte essentiel à la conduction nerveuse et à la fonction du muscle cardiaque.",
|
||||
"hemoglobin": "La protéine des globules rouges qui transporte l'oxygène.",
|
||||
"hematocrit": "La fraction du volume sanguin constituée de globules rouges.",
|
||||
"wbc": "Nombre total de globules blancs, la défense circulante du système immunitaire.",
|
||||
"platelets": "Fragments cellulaires qui s'agrègent pour former des caillots sanguins."
|
||||
}
|
||||
},
|
||||
"noteLoadFailed": "La note n’a pas pu être chargée ; elle restera inchangée à l’enregistrement.",
|
||||
|
||||
@@ -6842,6 +6842,34 @@
|
||||
"liver": "Fegato",
|
||||
"electrolytes": "Elettroliti",
|
||||
"bloodCount": "Emocromo"
|
||||
},
|
||||
"desc": {
|
||||
"total-cholesterol": "Quantità totale di colesterolo trasportato nel sangue, somma delle frazioni LDL, HDL e altre lipoproteine.",
|
||||
"ldl": "Colesterolo trasportato dalle lipoproteine a bassa densità, la frazione che si deposita nelle pareti arteriose.",
|
||||
"hdl": "Colesterolo trasportato dalle lipoproteine ad alta densità, che lo riportano al fegato.",
|
||||
"triglycerides": "Il principale grasso circolante nel sangue, assunto con la dieta e prodotto dal fegato.",
|
||||
"fasting-glucose": "Glicemia misurata a digiuno, riflette la regolazione di base del glucosio.",
|
||||
"hba1c": "Quota di emoglobina legata al glucosio, riflette la glicemia degli ultimi due o tre mesi.",
|
||||
"tsh": "Ormone ipofisario che regola la tiroide; il principale test della funzione tiroidea.",
|
||||
"ft3": "La forma libera e attiva della triiodotironina, l'ormone tiroideo più potente.",
|
||||
"ft4": "La forma libera della tiroxina, il principale ormone che la tiroide rilascia nel sangue.",
|
||||
"ferritin": "La principale proteina di deposito del ferro, riflette le riserve di ferro.",
|
||||
"transferrin-saturation": "Quota della transferrina, proteina di trasporto del ferro, che trasporta ferro in quel momento.",
|
||||
"vitamin-d": "25-idrossivitamina D circolante, il marcatore standard dello stato di vitamina D.",
|
||||
"vitamin-b12": "Vitamina essenziale per la formazione dei globuli rossi e la funzione nervosa.",
|
||||
"folate": "Vitamina B necessaria per la formazione dei globuli rossi e la sintesi del DNA.",
|
||||
"hs-crp": "Una proteina epatica che aumenta con l'infiammazione, misurata ad alta sensibilità.",
|
||||
"creatinine": "Prodotto di scarto muscolare eliminato dai reni, usato per valutare la funzione renale.",
|
||||
"egfr": "Velocità di filtrazione stimata dei reni, calcolata a partire dalla creatinina.",
|
||||
"alt": "Enzima epatico rilasciato nel sangue quando le cellule del fegato sono danneggiate.",
|
||||
"ast": "Enzima di fegato e muscolo che aumenta quando questi tessuti sono lesi.",
|
||||
"ggt": "Enzima di fegato e vie biliari che aumenta con l'ostruzione biliare o l'alcol.",
|
||||
"sodium": "Principale elettrolita che regola l'equilibrio dei liquidi e il volume del sangue.",
|
||||
"potassium": "Elettrolita essenziale per la conduzione nervosa e la funzione del muscolo cardiaco.",
|
||||
"hemoglobin": "La proteina dei globuli rossi che trasporta l'ossigeno.",
|
||||
"hematocrit": "La frazione del volume sanguigno costituita da globuli rossi.",
|
||||
"wbc": "Conteggio totale dei globuli bianchi, la difesa circolante del sistema immunitario.",
|
||||
"platelets": "Frammenti cellulari che si aggregano per formare coaguli di sangue."
|
||||
}
|
||||
},
|
||||
"noteLoadFailed": "Impossibile caricare la nota; resterà invariata al salvataggio.",
|
||||
|
||||
@@ -6842,6 +6842,34 @@
|
||||
"liver": "Wątroba",
|
||||
"electrolytes": "Elektrolity",
|
||||
"bloodCount": "Morfologia krwi"
|
||||
},
|
||||
"desc": {
|
||||
"total-cholesterol": "Całkowita ilość cholesterolu transportowanego we krwi, suma frakcji LDL, HDL i pozostałych lipoprotein.",
|
||||
"ldl": "Cholesterol transportowany przez lipoproteiny o niskiej gęstości, frakcja odkładająca się w ścianach tętnic.",
|
||||
"hdl": "Cholesterol transportowany przez lipoproteiny o wysokiej gęstości, które odprowadzają go do wątroby.",
|
||||
"triglycerides": "Główny tłuszcz krążący we krwi, pochodzący z diety i wytwarzany przez wątrobę.",
|
||||
"fasting-glucose": "Poziom cukru we krwi mierzony na czczo, odzwierciedla podstawową regulację glukozy.",
|
||||
"hba1c": "Odsetek hemoglobiny związanej z glukozą, odzwierciedla poziom cukru z ostatnich dwóch–trzech miesięcy.",
|
||||
"tsh": "Hormon przysadki sterujący tarczycą; podstawowy test czynności tarczycy.",
|
||||
"ft3": "Wolna, aktywna postać trijodotyroniny, silniejszego hormonu tarczycy.",
|
||||
"ft4": "Wolna postać tyroksyny, głównego hormonu uwalnianego przez tarczycę do krwi.",
|
||||
"ferritin": "Główne białko magazynujące żelazo, odzwierciedla zapasy żelaza w organizmie.",
|
||||
"transferrin-saturation": "Odsetek transferyny, białka transportującego żelazo, które w danym momencie przenosi żelazo.",
|
||||
"vitamin-d": "Krążąca 25-hydroksywitamina D, standardowy wskaźnik stanu witaminy D.",
|
||||
"vitamin-b12": "Witamina niezbędna do tworzenia czerwonych krwinek i funkcji nerwów.",
|
||||
"folate": "Witamina z grupy B potrzebna do tworzenia czerwonych krwinek i syntezy DNA.",
|
||||
"hs-crp": "Białko wątrobowe rosnące w stanach zapalnych, mierzone z wysoką czułością.",
|
||||
"creatinine": "Produkt przemiany mięśni usuwany przez nerki, służy do oceny czynności nerek.",
|
||||
"egfr": "Szacowany współczynnik filtracji nerek, obliczany na podstawie kreatyniny.",
|
||||
"alt": "Enzym wątrobowy uwalniany do krwi przy uszkodzeniu komórek wątroby.",
|
||||
"ast": "Enzym wątroby i mięśni rosnący przy uszkodzeniu tych tkanek.",
|
||||
"ggt": "Enzym wątroby i dróg żółciowych rosnący przy zastoju żółci lub spożyciu alkoholu.",
|
||||
"sodium": "Główny elektrolit regulujący gospodarkę wodną i objętość krwi.",
|
||||
"potassium": "Elektrolit niezbędny do przewodzenia nerwowego i pracy mięśnia sercowego.",
|
||||
"hemoglobin": "Białko czerwonych krwinek transportujące tlen.",
|
||||
"hematocrit": "Udział czerwonych krwinek w objętości krwi.",
|
||||
"wbc": "Całkowita liczba białych krwinek, krążącej obrony układu odpornościowego.",
|
||||
"platelets": "Fragmenty komórkowe, które zlepiają się, tworząc skrzepy krwi."
|
||||
}
|
||||
},
|
||||
"noteLoadFailed": "Nie udało się wczytać notatki; pozostanie niezmieniona po zapisaniu.",
|
||||
|
||||
@@ -11,6 +11,7 @@ import { Card, CardContent } from "@/components/ui/card";
|
||||
import { EmptyState } from "@/components/ui/empty-state";
|
||||
import { Skeleton } from "@/components/ui/skeleton";
|
||||
import { apiGet } from "@/lib/api/api-fetch";
|
||||
import { resolveCatalogSlug } from "@/lib/labs/biomarker-catalog";
|
||||
import { formatDate } from "@/lib/format";
|
||||
import { formatReferenceRange } from "@/lib/labs/reference-range";
|
||||
import { formatLabReading, formatLabValue } from "@/lib/labs/format-value";
|
||||
@@ -77,6 +78,14 @@ export function LabList({ onAddFirst }: { onAddFirst?: () => void } = {}) {
|
||||
const { t } = useTranslations();
|
||||
const { prefs } = useModuleListPrefs("labs");
|
||||
|
||||
// v1.22 — a short, factual line under each marker heading describing what the
|
||||
// biomarker measures, sourced from the catalog via i18n. Free-text markers
|
||||
// (no catalog match) carry no subtitle rather than a fabricated one.
|
||||
const describeMarker = (analyte: string): string | null => {
|
||||
const slug = resolveCatalogSlug(analyte, (s) => t(`labs.catalog.${s}`));
|
||||
return slug ? t(`labs.catalog.desc.${slug}`) : null;
|
||||
};
|
||||
|
||||
const listKey = queryKeys.labResultsList({
|
||||
biomarkerId: undefined,
|
||||
analyte: undefined,
|
||||
@@ -183,6 +192,7 @@ export function LabList({ onAddFirst }: { onAddFirst?: () => void } = {}) {
|
||||
<Card>
|
||||
<CardContent className="divide-border divide-y p-0">
|
||||
{groups.map((group) => {
|
||||
const description = describeMarker(group.analyte);
|
||||
const inner = (
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="flex flex-wrap items-baseline gap-x-2 text-sm">
|
||||
@@ -194,6 +204,11 @@ export function LabList({ onAddFirst }: { onAddFirst?: () => void } = {}) {
|
||||
compact
|
||||
/>
|
||||
</div>
|
||||
{description ? (
|
||||
<p className="text-muted-foreground text-xs">
|
||||
{description}
|
||||
</p>
|
||||
) : null}
|
||||
<div className="text-muted-foreground flex flex-wrap items-center gap-x-2 text-xs">
|
||||
<span className="text-foreground font-semibold tabular-nums">
|
||||
{formatLabReading(group.latest)}
|
||||
@@ -250,61 +265,69 @@ export function LabList({ onAddFirst }: { onAddFirst?: () => void } = {}) {
|
||||
</p>
|
||||
</li>
|
||||
) : null}
|
||||
{groups.map((group) => (
|
||||
<li key={group.key} className="contents">
|
||||
<Card className="h-full gap-3">
|
||||
<MedicationCardHeader
|
||||
name={group.analyte}
|
||||
dose=""
|
||||
categoryLabel={group.panel ?? group.unit}
|
||||
nameChip={
|
||||
<ReferenceRangeBadge
|
||||
status={group.latest.rangeStatus}
|
||||
compact
|
||||
/>
|
||||
}
|
||||
href={
|
||||
group.biomarkerId ? `/labs/${group.biomarkerId}` : undefined
|
||||
}
|
||||
linkLabel={group.analyte}
|
||||
/>
|
||||
<CardContent>
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div className="text-muted-foreground flex flex-wrap items-center gap-x-2 text-sm">
|
||||
<span className="text-foreground font-semibold tabular-nums">
|
||||
{formatLabReading(group.latest)}
|
||||
</span>
|
||||
{group.latest.value !== null &&
|
||||
(group.latest.referenceLow !== null ||
|
||||
group.latest.referenceHigh !== null) ? (
|
||||
<span className="text-xs">
|
||||
{t("labs.referenceLabel")}{" "}
|
||||
{formatReferenceRange(
|
||||
group.latest.referenceLow,
|
||||
group.latest.referenceHigh,
|
||||
formatLabValue,
|
||||
)}
|
||||
{groups.map((group) => {
|
||||
const description = describeMarker(group.analyte);
|
||||
return (
|
||||
<li key={group.key} className="contents">
|
||||
<Card className="h-full gap-3">
|
||||
<MedicationCardHeader
|
||||
name={group.analyte}
|
||||
dose=""
|
||||
categoryLabel={group.panel ?? group.unit}
|
||||
nameChip={
|
||||
<ReferenceRangeBadge
|
||||
status={group.latest.rangeStatus}
|
||||
compact
|
||||
/>
|
||||
}
|
||||
href={
|
||||
group.biomarkerId ? `/labs/${group.biomarkerId}` : undefined
|
||||
}
|
||||
linkLabel={group.analyte}
|
||||
/>
|
||||
<CardContent>
|
||||
{description ? (
|
||||
<p className="text-muted-foreground mb-2 text-sm">
|
||||
{description}
|
||||
</p>
|
||||
) : null}
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<div className="text-muted-foreground flex flex-wrap items-center gap-x-2 text-sm">
|
||||
<span className="text-foreground font-semibold tabular-nums">
|
||||
{formatLabReading(group.latest)}
|
||||
</span>
|
||||
) : null}
|
||||
<span className="text-xs">
|
||||
{formatDate(group.latest.takenAt)}
|
||||
</span>
|
||||
{group.readings.length > 1 ? (
|
||||
{group.latest.value !== null &&
|
||||
(group.latest.referenceLow !== null ||
|
||||
group.latest.referenceHigh !== null) ? (
|
||||
<span className="text-xs">
|
||||
{t("labs.referenceLabel")}{" "}
|
||||
{formatReferenceRange(
|
||||
group.latest.referenceLow,
|
||||
group.latest.referenceHigh,
|
||||
formatLabValue,
|
||||
)}
|
||||
</span>
|
||||
) : null}
|
||||
<span className="text-xs">
|
||||
{t("labs.readingsCount", {
|
||||
count: group.readings.length,
|
||||
})}
|
||||
{formatDate(group.latest.takenAt)}
|
||||
</span>
|
||||
) : null}
|
||||
{group.readings.length > 1 ? (
|
||||
<span className="text-xs">
|
||||
{t("labs.readingsCount", {
|
||||
count: group.readings.length,
|
||||
})}
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<LabTrendSparkline
|
||||
values={group.readings.map((r) => r.value)}
|
||||
/>
|
||||
</div>
|
||||
<LabTrendSparkline
|
||||
values={group.readings.map((r) => r.value)}
|
||||
/>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</li>
|
||||
))}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
@@ -226,6 +226,30 @@ export const BIOMARKER_CATALOG: readonly BiomarkerSeed[] = [
|
||||
},
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* v1.22 — resolve a reading's `analyte` (a display name) back to its catalog
|
||||
* slug so the Labs page can surface the marker's descriptive subtitle.
|
||||
*
|
||||
* The lab row stores the localised name the marker was created under, not the
|
||||
* slug. `localizedName(slug)` resolves the catalog name for the active locale
|
||||
* (`t("labs.catalog.<slug>")`); a case- and whitespace-insensitive match maps
|
||||
* the analyte to its slug. Free-text markers (and markers created under a
|
||||
* different locale than the one in view) return null, and the caller shows no
|
||||
* subtitle rather than a fabricated one.
|
||||
*/
|
||||
export function resolveCatalogSlug(
|
||||
analyte: string,
|
||||
localizedName: (slug: string) => string,
|
||||
): string | null {
|
||||
const norm = analyte.trim().toLowerCase();
|
||||
if (!norm) return null;
|
||||
for (const seed of BIOMARKER_CATALOG) {
|
||||
if (localizedName(seed.slug).trim().toLowerCase() === norm)
|
||||
return seed.slug;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** The set of panel keys present in the catalog, in display order. */
|
||||
export const BIOMARKER_PANELS = [
|
||||
"lipids",
|
||||
|
||||
Reference in new issue
Block a user