@deepintel-ltd/farmpro-contracts 1.7.6 → 1.7.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/routes/crop-profile.routes.d.ts +556 -0
- package/dist/routes/crop-profile.routes.d.ts.map +1 -0
- package/dist/routes/crop-profile.routes.js +55 -0
- package/dist/routes/geofences.routes.d.ts +1913 -0
- package/dist/routes/geofences.routes.d.ts.map +1 -0
- package/dist/routes/geofences.routes.js +105 -0
- package/dist/routes/index.d.ts +15 -0
- package/dist/routes/index.d.ts.map +1 -1
- package/dist/routes/index.js +10 -0
- package/dist/routes/livestock-map.routes.d.ts +1319 -0
- package/dist/routes/livestock-map.routes.d.ts.map +1 -0
- package/dist/routes/livestock-map.routes.js +83 -0
- package/dist/routes/measurements.routes.d.ts +1081 -0
- package/dist/routes/measurements.routes.d.ts.map +1 -0
- package/dist/routes/measurements.routes.js +69 -0
- package/dist/routes/monitoring-visualization.routes.d.ts +1637 -0
- package/dist/routes/monitoring-visualization.routes.d.ts.map +1 -1
- package/dist/routes/monitoring-visualization.routes.js +153 -0
- package/dist/routes/prescription-maps.routes.d.ts +3092 -0
- package/dist/routes/prescription-maps.routes.d.ts.map +1 -0
- package/dist/routes/prescription-maps.routes.js +143 -0
- package/dist/schemas/crop-profile.schemas.d.ts +724 -0
- package/dist/schemas/crop-profile.schemas.d.ts.map +1 -0
- package/dist/schemas/crop-profile.schemas.js +84 -0
- package/dist/schemas/geofences.schemas.d.ts +358 -0
- package/dist/schemas/geofences.schemas.d.ts.map +1 -0
- package/dist/schemas/geofences.schemas.js +44 -0
- package/dist/schemas/livestock-map.schemas.d.ts +328 -0
- package/dist/schemas/livestock-map.schemas.d.ts.map +1 -0
- package/dist/schemas/livestock-map.schemas.js +52 -0
- package/dist/schemas/measurements.schemas.d.ts +234 -0
- package/dist/schemas/measurements.schemas.d.ts.map +1 -0
- package/dist/schemas/measurements.schemas.js +57 -0
- package/dist/schemas/monitoring-visualization.schemas.d.ts +1703 -0
- package/dist/schemas/monitoring-visualization.schemas.d.ts.map +1 -1
- package/dist/schemas/monitoring-visualization.schemas.js +338 -0
- package/dist/schemas/prescription-maps.schemas.d.ts +974 -0
- package/dist/schemas/prescription-maps.schemas.d.ts.map +1 -0
- package/dist/schemas/prescription-maps.schemas.js +132 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prescription-maps.schemas.d.ts","sourceRoot":"","sources":["../../src/schemas/prescription-maps.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYjC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBhC,CAAC;AAEH,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK1C,CAAC;AAEH,eAAO,MAAM,kCAAkC;;;;;;EAE7C,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;WAAiC,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AC,CAAC;AAC9E,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AACxF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAC9F,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AACxD,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { geoJSONGeometrySchema } from './common.schemas';
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Existing Schemas
|
|
5
|
+
// =============================================================================
|
|
6
|
+
export const prescriptionZoneSchema = z.object({
|
|
7
|
+
id: z.string().uuid(),
|
|
8
|
+
geometry: geoJSONGeometrySchema,
|
|
9
|
+
zoneType: z.enum(['high', 'medium', 'low', 'skip']),
|
|
10
|
+
ndviRange: z.object({ min: z.number(), max: z.number() }),
|
|
11
|
+
areaHectares: z.number(),
|
|
12
|
+
recommendedRate: z.number(),
|
|
13
|
+
rateUnit: z.string(),
|
|
14
|
+
inputType: z.enum(['fertilizer', 'pesticide', 'seed', 'water']),
|
|
15
|
+
inputProduct: z.string().optional(),
|
|
16
|
+
costPerHectare: z.number().optional(),
|
|
17
|
+
totalCost: z.number().optional(),
|
|
18
|
+
});
|
|
19
|
+
export const prescriptionMapSchema = z.object({
|
|
20
|
+
id: z.string().uuid(),
|
|
21
|
+
fieldId: z.string().uuid(),
|
|
22
|
+
name: z.string(),
|
|
23
|
+
createdAt: z.string().datetime(),
|
|
24
|
+
sourceDataType: z.enum(['ndvi', 'soil_moisture', 'manual', 'multi_layer']),
|
|
25
|
+
sourceDate: z.string().datetime(),
|
|
26
|
+
zones: z.array(prescriptionZoneSchema),
|
|
27
|
+
totalArea: z.number(),
|
|
28
|
+
totalCost: z.number(),
|
|
29
|
+
exportFormats: z.array(z.enum(['shapefile', 'geojson', 'iso-xml', 'isoxml', 'kml', 'csv'])),
|
|
30
|
+
status: z.enum(['draft', 'approved', 'exported', 'applied']),
|
|
31
|
+
// Zone generation metadata
|
|
32
|
+
interpolationMethod: z.enum(['equal_interval', 'quantiles', 'natural_breaks', 'kmeans']).optional(),
|
|
33
|
+
zoneCount: z.number().optional(),
|
|
34
|
+
layerWeights: z.record(z.string(), z.number()).optional(),
|
|
35
|
+
});
|
|
36
|
+
export const createPrescriptionMapBodySchema = z.object({
|
|
37
|
+
name: z.string().min(1).max(200),
|
|
38
|
+
sourceDataType: z.enum(['ndvi', 'soil_moisture', 'manual']),
|
|
39
|
+
sourceDate: z.string().datetime(),
|
|
40
|
+
zones: z.array(prescriptionZoneSchema),
|
|
41
|
+
});
|
|
42
|
+
export const updatePrescriptionStatusBodySchema = z.object({
|
|
43
|
+
status: z.enum(['draft', 'approved', 'exported', 'applied']),
|
|
44
|
+
});
|
|
45
|
+
export const prescriptionMapListResponseSchema = z.array(prescriptionMapSchema);
|
|
46
|
+
export const prescriptionMapSingleResponseSchema = prescriptionMapSchema;
|
|
47
|
+
// =============================================================================
|
|
48
|
+
// Zone Generation Schemas
|
|
49
|
+
// =============================================================================
|
|
50
|
+
/** Data layer configuration for zone generation */
|
|
51
|
+
export const zoneLayerSchema = z.object({
|
|
52
|
+
type: z.enum(['ndvi', 'yield', 'soil_ec', 'elevation', 'soil_moisture']),
|
|
53
|
+
weight: z.number().min(0).max(1),
|
|
54
|
+
date: z.string().datetime().optional(),
|
|
55
|
+
});
|
|
56
|
+
/** Zone generation request body */
|
|
57
|
+
export const generateZonesRequestSchema = z.object({
|
|
58
|
+
name: z.string().min(1).max(200),
|
|
59
|
+
layers: z.array(zoneLayerSchema).min(1),
|
|
60
|
+
interpolation: z.enum(['equal_interval', 'quantiles', 'natural_breaks', 'kmeans']),
|
|
61
|
+
zoneCount: z.number().min(2).max(10).default(5),
|
|
62
|
+
inputType: z.enum(['fertilizer', 'pesticide', 'seed', 'water']),
|
|
63
|
+
inputProduct: z.string().optional(),
|
|
64
|
+
baseRate: z.number(), // Base application rate
|
|
65
|
+
rateUnit: z.string(),
|
|
66
|
+
rateVariation: z.number().min(0).max(1).default(0.3), // 30% variation between zones
|
|
67
|
+
costPerUnit: z.number().optional(), // Cost per unit of input for estimation
|
|
68
|
+
});
|
|
69
|
+
/** Individual zone statistics */
|
|
70
|
+
export const zoneStatisticsSchema = z.object({
|
|
71
|
+
zoneId: z.string().uuid(),
|
|
72
|
+
zoneNumber: z.number(),
|
|
73
|
+
classification: z.enum(['high', 'medium_high', 'medium', 'medium_low', 'low']),
|
|
74
|
+
areaHectares: z.number(),
|
|
75
|
+
areaPercent: z.number(),
|
|
76
|
+
sourceValueMean: z.number(),
|
|
77
|
+
sourceValueMin: z.number(),
|
|
78
|
+
sourceValueMax: z.number(),
|
|
79
|
+
recommendedRate: z.number(),
|
|
80
|
+
rateUnit: z.string(),
|
|
81
|
+
estimatedCost: z.number(),
|
|
82
|
+
estimatedQuantity: z.number(),
|
|
83
|
+
});
|
|
84
|
+
/** Zone statistics summary */
|
|
85
|
+
export const zoneSummarySchema = z.object({
|
|
86
|
+
averageRate: z.number(),
|
|
87
|
+
minRate: z.number(),
|
|
88
|
+
maxRate: z.number(),
|
|
89
|
+
potentialSavings: z.number(), // vs. uniform application
|
|
90
|
+
uniformCost: z.number(), // Cost if applying uniform rate everywhere
|
|
91
|
+
variableRateCost: z.number(), // Cost with variable rate application
|
|
92
|
+
});
|
|
93
|
+
/** Zone statistics response */
|
|
94
|
+
export const zoneStatsResponseSchema = z.object({
|
|
95
|
+
prescriptionId: z.string().uuid(),
|
|
96
|
+
fieldName: z.string(),
|
|
97
|
+
totalArea: z.number(),
|
|
98
|
+
totalCost: z.number(),
|
|
99
|
+
totalQuantity: z.number(),
|
|
100
|
+
zones: z.array(zoneStatisticsSchema),
|
|
101
|
+
summary: zoneSummarySchema,
|
|
102
|
+
});
|
|
103
|
+
// =============================================================================
|
|
104
|
+
// Export Schemas
|
|
105
|
+
// =============================================================================
|
|
106
|
+
/** Export format enum matching Prisma */
|
|
107
|
+
export const exportFormatSchema = z.enum(['shapefile', 'geojson', 'isoxml', 'kml', 'csv']);
|
|
108
|
+
/** Export request body */
|
|
109
|
+
export const exportRequestSchema = z.object({
|
|
110
|
+
format: exportFormatSchema,
|
|
111
|
+
machinery: z.array(z.string()).optional(), // Compatible machinery brands
|
|
112
|
+
includeMetadata: z.boolean().default(true),
|
|
113
|
+
});
|
|
114
|
+
/** Export response */
|
|
115
|
+
export const exportResponseSchema = z.object({
|
|
116
|
+
exportId: z.string().uuid(),
|
|
117
|
+
format: z.string(),
|
|
118
|
+
fileName: z.string(),
|
|
119
|
+
downloadUrl: z.string().url(),
|
|
120
|
+
fileSize: z.number().nullable(),
|
|
121
|
+
expiresAt: z.string().datetime(),
|
|
122
|
+
});
|
|
123
|
+
/** List exports response */
|
|
124
|
+
export const exportListResponseSchema = z.array(z.object({
|
|
125
|
+
id: z.string().uuid(),
|
|
126
|
+
format: z.string(),
|
|
127
|
+
fileName: z.string(),
|
|
128
|
+
downloadUrl: z.string().url(),
|
|
129
|
+
fileSize: z.number().nullable(),
|
|
130
|
+
exportedAt: z.string().datetime(),
|
|
131
|
+
machinery: z.array(z.string()).nullable(),
|
|
132
|
+
}));
|