Files
Bkk1234 dd65e9061f Add Julia+Postgres calculation service with shared golden vectors
- service/: Julia HTTP API (HTTP.jl + LibPQ), formulas.jl as source of truth
- service/db/001_init.sql: calculation_runs (append-only), provinces, eto_monthly
- tests/golden/vectors.json: single fixture set enforced on both JS and Julia
- .gitignore: keep secrets (DB env, contracts, financial records, ransomware note) out
- AGENTS.md: document service commands and formula-change rule
2026-11-16 01:59:22 +07:00

79 lines
2.0 KiB
JSON

{
"schema_version": "1.0",
"description_th": "ชุดทดสอบร่วม (golden vectors) — ผลลัพธ์ต้องตรงกันทั้ง core/*.js และ service/src/formulas.jl",
"tolerance": 0.01,
"cases": [
{
"id": "crop_water_reference_crop",
"kind": "crop_water",
"input": {
"eto_mm_per_day": 3.71,
"crop_coefficient": 1.0,
"area_rai": 10,
"irrigation_efficiency_percent": 75
},
"expected": {
"value": 79.15,
"etc_mm_per_day": 3.71,
"net_m3_per_day": 59.36,
"gross_m3_per_week": 554.03
}
},
{
"id": "crop_water_drip_efficiency",
"kind": "crop_water",
"input": {
"eto_mm_per_day": 5.22,
"crop_coefficient": 0.85,
"area_rai": 25,
"irrigation_efficiency_percent": 60
},
"expected": {
"value": 295.8,
"etc_mm_per_day": 4.44,
"net_m3_per_day": 177.48,
"gross_m3_per_month": 8874.0
}
},
{
"id": "pond_box_with_rain",
"kind": "reservoir",
"input": {
"shape": "box",
"top_length_m": 40,
"top_width_m": 30,
"depth_m": 4,
"usable_depth_percent": 80,
"catchment_rai": 10,
"rainfall_mm": 60,
"runoff_coefficient": 0.8
},
"expected": {
"value": 4608.0,
"excavated_volume_m3": 4800.0,
"usable_volume_m3": 3840.0,
"rain_harvest_m3": 768.0
}
},
{
"id": "pond_trapezoid_slope",
"kind": "reservoir",
"input": {
"shape": "trapezoid",
"top_length_m": 40,
"top_width_m": 30,
"depth_m": 4,
"side_slope_horizontal_per_vertical": 1.5,
"usable_depth_percent": 80
},
"expected": {
"value": 2415.97,
"excavated_volume_m3": 3308.92,
"usable_volume_m3": 2415.97,
"bottom_length_m": 28.0,
"bottom_width_m": 18.0
}
}
]
}