Implements detailed tracking of soil composition, nutrients, climate, lighting, and surrounding environment to help understand plant success and optimize growing conditions. Environmental Data Types (lib/environment/types.ts): - Soil composition (type, pH, texture, drainage, organic matter) - Soil amendments (compost, perlite, amendments tracking) - Nutrient profiles (NPK, secondary nutrients, micronutrients, EC, TDS) - Fertilizer applications (type, schedule, NPK values) - Lighting conditions (natural/artificial, hours, spectrum, PPFD/DLI) - Climate tracking (temperature, humidity, airflow, CO2, USDA zones) - Growing location (indoor/outdoor/greenhouse with details) - Container information (type, material, size, drainage) - Watering schedule (method, frequency, water quality/pH) - Surrounding environment (companion plants, pests, diseases, ecosystem) - Growth metrics (measurements, health scores, vigor tracking) Environmental Analysis (lib/environment/analysis.ts): - Compare environments with similarity scoring (0-100) - Generate personalized growing recommendations - Calculate environmental health scores - Find plants with similar conditions - Analyze growth correlations across network - Identify optimal growing conditions API Endpoints: - /api/environment/recommendations - Get plant-specific advice - /api/environment/similar - Find plants with similar conditions - /api/environment/compare - Compare two plants environments - /api/environment/analysis - Network-wide growth correlation Features: - Comprehensive soil tracking (pH, texture, drainage, amendments) - Full NPK and micronutrient monitoring - Sunlight exposure and artificial light tracking - Temperature and humidity ranges - Water quality monitoring (pH, TDS, chlorine) - Pest and disease tracking - Companion planting recommendations - Environmental health scoring with priority-based recommendations - Growth success analysis across similar environments Integration: - Updated PlantData type to include environment and growthMetrics - Compatible with existing blockchain structure - Optional environmental data (backward compatible) Use Cases: - Track what works for your plants - Learn from successful growers with similar conditions - Get personalized recommendations based on your setup - Compare your environment with thriving plants - Optimize conditions for better yield/health - Share growing knowledge with the community - Research optimal conditions by species This enables growers to: - Understand why plants thrive or struggle - Replicate successful growing conditions - Make data-driven decisions - Learn from the collective experience - Improve propagation success rates
87 lines
1.9 KiB
TypeScript
87 lines
1.9 KiB
TypeScript
// Plant Blockchain Types
|
|
|
|
import { GrowingEnvironment, GrowthMetrics } from '../environment/types';
|
|
|
|
export interface PlantLocation {
|
|
latitude: number;
|
|
longitude: number;
|
|
address?: string;
|
|
city?: string;
|
|
country?: string;
|
|
}
|
|
|
|
export interface PlantOwner {
|
|
id: string;
|
|
name: string;
|
|
email: string;
|
|
walletAddress?: string;
|
|
}
|
|
|
|
export interface PlantData {
|
|
id: string;
|
|
commonName: string;
|
|
scientificName?: string;
|
|
species?: string;
|
|
genus?: string;
|
|
family?: string;
|
|
|
|
// Lineage tracking
|
|
parentPlantId?: string; // Original plant this came from
|
|
propagationType?: 'seed' | 'clone' | 'cutting' | 'division' | 'grafting' | 'original';
|
|
generation: number; // How many generations from the original
|
|
|
|
// Plant lifecycle
|
|
plantedDate: string;
|
|
harvestedDate?: string;
|
|
status: 'sprouted' | 'growing' | 'mature' | 'flowering' | 'fruiting' | 'dormant' | 'deceased';
|
|
|
|
// Location and ownership
|
|
location: PlantLocation;
|
|
owner: PlantOwner;
|
|
|
|
// Plant network
|
|
childPlants: string[]; // IDs of clones and seeds from this plant
|
|
|
|
// Environmental data
|
|
environment?: GrowingEnvironment;
|
|
growthMetrics?: GrowthMetrics;
|
|
|
|
// Additional metadata
|
|
notes?: string;
|
|
images?: string[];
|
|
plantsNetId?: string; // ID from plants.net API
|
|
|
|
// Timestamps
|
|
registeredAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface BlockData {
|
|
index: number;
|
|
timestamp: string;
|
|
plant: PlantData;
|
|
previousHash: string;
|
|
hash: string;
|
|
nonce: number;
|
|
}
|
|
|
|
export interface PlantLineage {
|
|
plantId: string;
|
|
ancestors: PlantData[];
|
|
descendants: PlantData[];
|
|
siblings: PlantData[]; // Other plants from the same parent
|
|
generation: number;
|
|
}
|
|
|
|
export interface NearbyPlant {
|
|
plant: PlantData;
|
|
distance: number; // in kilometers
|
|
owner: PlantOwner;
|
|
}
|
|
|
|
export interface PlantNetwork {
|
|
totalPlants: number;
|
|
totalOwners: number;
|
|
species: { [key: string]: number };
|
|
globalDistribution: { [country: string]: number };
|
|
}
|