Add daily report day picker and cumulative insights for mortality data. Updated AiInsightCard and related components to support daily and weekly reporting, ensuring accurate data representation. Introduced new utility functions for water consumption standards and enhanced context management for insights.
CI / lint-and-test (push) Canceled after 0s
CI / lint-and-test (push) Canceled after 0s
This commit is contained in:
1 parent
172ea3a148
commit
427cac54a1
18 files changed
+1055
-205
No files matched your search
@@ -32,6 +32,31 @@ export const AIR_QUALITY = {
|
||||
co2Ideal_ppm: 3000,
|
||||
};
|
||||
|
||||
/**
|
||||
* Standar konsumsi air per 1000 ekor per hari pada suhu 21°C (buku CP 707).
|
||||
* Di atas 21°C kebutuhan naik rata-rata 6.5% per derajat.
|
||||
*/
|
||||
const WATER_CONSUMPTION_STANDARD: { week: number; minLiter: number; maxLiter: number }[] = [
|
||||
{ week: 1, minLiter: 58, maxLiter: 65 },
|
||||
{ week: 2, minLiter: 102, maxLiter: 115 },
|
||||
{ week: 3, minLiter: 149, maxLiter: 167 },
|
||||
{ week: 4, minLiter: 192, maxLiter: 216 },
|
||||
{ week: 5, minLiter: 232, maxLiter: 261 },
|
||||
{ week: 6, minLiter: 274, maxLiter: 308 },
|
||||
{ week: 7, minLiter: 309, maxLiter: 347 },
|
||||
{ week: 8, minLiter: 342, maxLiter: 385 },
|
||||
];
|
||||
|
||||
/** Standar konsumsi air (rata-rata min–max) untuk umur hari tertentu, atau null. */
|
||||
export const getWaterStandardByDay = (
|
||||
dayAge: number | null | undefined
|
||||
): { min: number; max: number } | null => {
|
||||
if (typeof dayAge !== 'number' || !Number.isFinite(dayAge) || dayAge <= 0) return null;
|
||||
const week = Math.min(Math.ceil(dayAge / 7), WATER_CONSUMPTION_STANDARD.length);
|
||||
const row = WATER_CONSUMPTION_STANDARD.find((r) => r.week === week);
|
||||
return row ? { min: row.minLiter, max: row.maxLiter } : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Suhu target untuk umur tertentu, atau null bila umurnya tidak masuk akal.
|
||||
* Umur di luar tabel jatuh ke baris terakhir (36+ hari), sesuai isi buku.
|
||||
|
||||
Reference in new issue
Block a user