Updated mock data and added contam reference images

This commit is contained in:
grove5_admin committed 2026-04-30 22:03:06 -07:00
1 parent 5f070523be
commit 6a77277357
19 files changed
+238 -95

No files matched your search

+50 -1
View File
@@ -1,8 +1,53 @@
import type { CultivarState, EnvironmentReading, TimeSeriesPoint, BagSnapshot } from './types';
import type { CultivarState, EnvironmentReading, TimeSeriesPoint, BagSnapshot, GasSweepPoint, SweepBaseline } from './types';
const NOW = Math.floor(Date.now() / 1000);
const HOUR = 3600;
// ── Gas Sweep Helpers ───────────────────────────────────────────────────────
const SWEEP_PROFILE = [
{ temp: 200, dur: 100, zone: 1 as const },
{ temp: 250, dur: 100, zone: 1 as const },
{ temp: 300, dur: 100, zone: 2 as const },
{ temp: 350, dur: 100, zone: 2 as const },
{ temp: 400, dur: 100, zone: 3 as const },
{ temp: 450, dur: 100, zone: 3 as const },
{ temp: 300, dur: 100, zone: 2 as const },
{ temp: 250, dur: 100, zone: 1 as const },
];
function genSweep(baselineR: number, drift: number, anomaly = false): GasSweepPoint[] {
return SWEEP_PROFILE.map((p, i) => {
const baseNoise = (Math.random() - 0.5) * 0.05;
const driftFactor = 1 + drift * (i / SWEEP_PROFILE.length);
const anomalySpike = anomaly && p.zone === 2 ? 0.15 : 0;
const raw = baselineR * driftFactor * (1 + baseNoise + anomalySpike);
return {
heater_temp_c: p.temp,
heater_dur_ms: p.dur,
zone: p.zone,
resistance_raw: Math.round(raw),
resistance_corr: Math.round(raw * 0.95),
resistance_norm: Math.round((raw / baselineR) * 100) / 100,
heater_stable: true,
valid: true,
};
});
}
function genBaseline(): SweepBaseline {
const R: Record<number, number> = {};
SWEEP_PROFILE.forEach(p => R[p.temp] = 150000 + Math.random() * 20000);
return {
established: true,
established_at: NOW - 3600 * 24,
n_samples: 480,
R,
humidity_ref: 87,
temp_ref: 22.5,
co2_ref: 1200,
};
}
function genEnvHistory(): EnvironmentReading[] {
const pts: EnvironmentReading[] = [];
for (let i = 200; i >= 0; i--) {
@@ -114,6 +159,8 @@ const fullMockState: CultivarState = {
co2e_ppm: 1380,
voc_ppb: 44,
},
latestSweep: genSweep(150000, 0.02, true),
baseline: genBaseline(),
slots: [
{
slot_id: 'A1',
@@ -245,6 +292,8 @@ const fullMockState: CultivarState = {
co2_ppm: 820,
voc_ppb: 61,
},
latestSweep: genSweep(145000, 0.01, false),
baseline: genBaseline(),
slots: [
{
slot_id: 'A1',
+17
View File
@@ -5,6 +5,8 @@ export interface ContaminantRef {
id: string;
name: string;
scientific: string;
/** Path to contamination photo (e.g., '/img/contam/green.webp') */
image?: string;
color: string;
smell: string;
texture: string;
@@ -22,6 +24,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-001',
name: 'Green Mold',
image: '/img/contam/green.webp',
scientific: 'Trichoderma harzianum',
color: 'White at first, rapidly turns green to dark green',
smell: 'Musty, earthy, coconut-like',
@@ -38,6 +41,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-002',
name: 'Cobweb Mold',
image: '/img/contam/cobweb.webp',
scientific: 'Cobweb mold',
color: 'White to light grey, wispy',
smell: 'Faint, damp',
@@ -54,6 +58,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-003',
name: 'Orange Bread Mold',
image: '/img/contam/orange.webp',
scientific: 'Neurospora crassa',
color: 'Orange to salmon pink, may appear powdery',
smell: 'Faintly sweet',
@@ -70,6 +75,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-004',
name: 'Bacterial Contamination',
image: '/img/contam/bacterial.webp',
scientific: 'Bacillus spp.',
color: 'Cream, yellow, or brown wet patches',
smell: 'Sour, rotten, or vomit-like',
@@ -86,6 +92,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-005',
name: 'Blue-Green Mold',
image: '/img/contam/bluegreen.webp',
scientific: 'Penicillium spp.',
color: 'Blue-green to grey-green with white edges',
smell: 'Musty, metallic',
@@ -102,6 +109,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-006',
name: 'Black Mold',
image: '/img/contam/black.webp',
scientific: 'Aspergillus niger',
color: 'Black to dark brown with white base',
smell: 'Musty, earthy',
@@ -118,6 +126,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-007',
name: 'Yellow-Green Mold',
image: '/img/contam/yellowgreen.webp',
scientific: 'Aspergillus flavus',
color: 'Yellow-green to olive',
smell: 'Musty',
@@ -134,6 +143,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-008',
name: 'Pin Mold',
image: '/img/contam/pin.webp',
scientific: 'Mucor / Rhizopus spp.',
color: 'White to grey, darkens to black as it sporulates',
smell: 'Faint, slightly sweet',
@@ -150,6 +160,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-009',
name: 'Pink Mold',
image: '/img/contam/pink.webp',
scientific: 'Fusarium oxysporum',
color: 'White to pink to purple',
smell: 'Faintly sweet or musty',
@@ -166,6 +177,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-010',
name: 'Lipstick Mold',
image: '/img/contam/lipstick.webp',
scientific: 'Sporendonema purpurascens',
color: 'Salmon to orange-red',
smell: 'Faint',
@@ -182,6 +194,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-011',
name: 'Bacterial Blotch',
image: '/img/contam/blotch.webp',
scientific: 'Pseudomonas tolaasii',
color: 'Yellow to brown wet spots on fruiting bodies',
smell: 'Off, slightly sour',
@@ -198,6 +211,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-012',
name: 'Dry Bubble',
image: '/img/contam/bubble.webp',
scientific: 'Lecanicillium fungicola',
color: 'White fluffy masses on distorted pins',
smell: 'Faint',
@@ -214,6 +228,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-013',
name: 'Grey Mold',
image: '/img/contam/grey.webp',
scientific: 'Botrytis cinerea',
color: 'Grey fluffy mold on fruiting bodies or substrate',
smell: 'Musty',
@@ -230,6 +245,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-014',
name: 'Yellow Mold',
image: '/img/contam/yellow.webp',
scientific: 'Chrysosporium / Sepedonium spp.',
color: 'Yellow to golden-yellow powder',
smell: 'Faint',
@@ -246,6 +262,7 @@ export const CONTAMINANTS: ContaminantRef[] = [
{
id: 'CONT-015',
name: 'Overlay',
image: '/img/contam/overlay.webp',
scientific: 'Overlay / Stroma',
color: 'Dense white mycelial seal, sometimes browning',
smell: 'Normal mycelium smell',
+4
View File
@@ -64,6 +64,10 @@ export type Chamber = {
type: 'colonization' | 'fruiting';
environment: ChamberEnvironment;
slots: ChamberSlot[];
/** Latest gas sweep data for radar chart (BME688) */
latestSweep?: GasSweepPoint[];
/** Baseline sweep profile for comparison (BME688) */
baseline?: SweepBaseline;
};
export type EnvironmentReading = {