noon-report-checker / sample_reports.py
tarunagarwal1981's picture
Enhance app functionality with JSON input handling and improved findings rendering. Added new sample reports and updated existing ones for better testing coverage. Refactored findings display to an HTML panel for clarity.
2b7e0fd
Raw
History Blame Contribute Delete
6.15 kB
"""Example noon reports for the demo and the test suite.
Two kinds of fixtures live here:
1. RAW_SAMPLE_1..6 — full free-text reports wired to the app's "Sample"
buttons. Modelled on a handysize bulk carrier, laden, at sea. Internally
consistent so they behave predictably in a demo:
Sample 1 — clean day -> 0 findings
Sample 2 — fuel ROB typo -> 1 CRITICAL (FO ROB reconciliation)
Sample 3 — speed/distance clash -> 1 ERROR (avg speed vs distance/hours)
Sample 4 — out-of-range values -> 3 ERRORs (RPM, wind, sea state)
Sample 5 — heavy-weather speed -> 1 WARNING (plausibility)
Sample 6 — officer shorthand -> 1 CRITICAL via LLM parse (fuel typo)
2. CLEAN / BROKEN — pre-parsed dicts used by the test suite.
BROKEN plants: speed/distance mismatch, FO ROB drift, wind out of range.
"""
# --- Raw free-text reports (the app's Sample buttons) ----------------------
RAW_SAMPLE_1 = """Vessel: MV Backyard IMO: 9876543 Voyage: 14 (Singapore -> Fujairah)
Date: 2026-06-06 1200 UTC
Position: 04 12 N 098 45 E Course: 287 T
Steaming hours: 24.0 Distance run (obs): 298 nm Avg speed: 12.4 kn
RPM: 98 Slip: 3.8 % ME power: 6200 kW ME load: 72 %
ME FO cons: 24.6 mt AE FO cons: 2.3 mt Boiler FO cons: 0.4 mt Cyl oil cons: 118 L
FO ROB prev: 1142.0 mt FO ROB: 1115.1 mt Bunkered: 0 mt
DO ROB: 88.5 mt FW ROB: 312 mt FW produced: 18 mt
Draft fwd: 10.30 m Draft aft: 10.55 m
Wind: BF4 Sea: DS3 Swell: 1.5 m Air temp: 29 C Sea temp: 30 C"""
RAW_SAMPLE_2 = """Vessel: MV Backyard IMO: 9876543 Voyage: 14 (Singapore -> Fujairah)
Date: 2026-06-07 1200 UTC
Position: 06 38 N 095 02 E Course: 291 T
Steaming hours: 24.0 Distance run (obs): 305 nm Avg speed: 12.7 kn
RPM: 99 Slip: 4.1 % ME power: 6350 kW ME load: 74 %
ME FO cons: 25.1 mt AE FO cons: 2.4 mt Boiler FO cons: 0.4 mt Cyl oil cons: 121 L
FO ROB prev: 1115.1 mt FO ROB: 1097.6 mt Bunkered: 0 mt
DO ROB: 86.0 mt FW ROB: 305 mt FW produced: 17 mt
Draft fwd: 10.28 m Draft aft: 10.53 m
Wind: BF5 Sea: DS4 Swell: 2.0 m Air temp: 28 C Sea temp: 30 C"""
RAW_SAMPLE_3 = """Vessel: MV Backyard IMO: 9876543 Voyage: 14 (Singapore -> Fujairah)
Date: 2026-06-08 1200 UTC
Position: 09 05 N 092 40 E Course: 292 T
Steaming hours: 24.0 Distance run (obs): 360 nm Avg speed: 13.0 kn
RPM: 101 Slip: 4.2 % ME power: 6400 kW ME load: 75 %
ME FO cons: 25.0 mt AE FO cons: 2.4 mt Boiler FO cons: 0.4 mt Cyl oil cons: 120 L
FO ROB prev: 1100.0 mt FO ROB: 1072.6 mt Bunkered: 0 mt
DO ROB: 84.0 mt FW ROB: 300 mt FW produced: 17 mt
Draft fwd: 10.25 m Draft aft: 10.50 m
Wind: BF4 Sea: DS3 Swell: 1.4 m Air temp: 29 C Sea temp: 30 C"""
RAW_SAMPLE_4 = """Vessel: MV Backyard IMO: 9876543 Voyage: 14 (Singapore -> Fujairah)
Date: 2026-06-09 1200 UTC
Position: 10 30 N 090 15 E Course: 295 T
Steaming hours: 24.0 Distance run (obs): 300 nm Avg speed: 12.5 kn
RPM: 148 Slip: 4.0 % ME power: 6300 kW ME load: 73 %
ME FO cons: 24.0 mt AE FO cons: 2.3 mt Boiler FO cons: 0.4 mt Cyl oil cons: 119 L
FO ROB prev: 1080.0 mt FO ROB: 1053.7 mt Bunkered: 0 mt
DO ROB: 82.0 mt FW ROB: 295 mt FW produced: 16 mt
Draft fwd: 10.20 m Draft aft: 10.45 m
Wind: BF13 Sea: DS11 Swell: 6.0 m Air temp: 28 C Sea temp: 29 C"""
RAW_SAMPLE_5 = """Vessel: MV Backyard IMO: 9876543 Voyage: 14 (Singapore -> Fujairah)
Date: 2026-06-10 1200 UTC
Position: 12 10 N 088 05 E Course: 298 T
Steaming hours: 24.0 Distance run (obs): 372 nm Avg speed: 15.5 kn
RPM: 108 Slip: 4.5 % ME power: 7000 kW ME load: 82 %
ME FO cons: 31.0 mt AE FO cons: 2.6 mt Boiler FO cons: 0.4 mt Cyl oil cons: 124 L
FO ROB prev: 1200.0 mt FO ROB: 1166.0 mt Bunkered: 0 mt
DO ROB: 78.0 mt FW ROB: 288 mt FW produced: 16 mt
Draft fwd: 10.18 m Draft aft: 10.43 m
Wind: BF9 Sea: DS6 Swell: 4.5 m Air temp: 27 C Sea temp: 29 C"""
RAW_SAMPLE_6 = """NR 11/0800Z MV Backyard v.14. Pos 13 40N 086 20E, co 299T.
Stmg 24h, dist 300 obs, spd 12.5k, me 96rpm slip 3.9, load ~74%.
Bunkers used: ME HFO 25.0mt, AE 2.5mt, blr 0.3, cyl oil 118L.
ROB FO 1042.5 (was 1080), DO 79, FW 285 (made 15).
Drafts F10.18 / A10.44. Wx NE'ly F5, sea 4, swell 1.8m, air 28 sea 29."""
# Structured JSON input — the app accepts this directly (no parsing step).
# Planted issue: FO ROB doesn't reconcile (prev 1100 - cons 28.5 = 1071.5,
# reported 1085.0 -> CRITICAL drift +13.5 mt).
RAW_SAMPLE_JSON = """{
"vessel_name": "MV Backyard",
"report_date": "2026-06-12",
"position": "15 20 N 084 10 E",
"course_deg": 301,
"steaming_hours": 24.0,
"distance_run": 300,
"avg_speed": 12.5,
"rpm_avg": 98,
"slip_pct": 4.0,
"me_power_kw": 6300,
"me_load_pct": 73,
"me_fo_cons": 26.0,
"ae_fo_cons": 2.5,
"fo_rob_prev": 1100.0,
"fo_rob": 1085.0,
"fo_bunkered": 0,
"do_rob": 80,
"fw_rob": 280,
"draft_fwd": 10.15,
"draft_aft": 10.40,
"wind_force": 5,
"sea_state": 4
}"""
# --- Pre-parsed structured fixtures (used by the test suite) ----------------
CLEAN = {
"vessel_name": "MV Backyard",
"report_date": "2026-06-06",
"position": "04 12 N 098 45 E",
"course_deg": 287.0,
"steaming_hours": 24.0,
"distance_run": 336.0,
"avg_speed": 14.0,
"rpm_avg": 78.0,
"slip_pct": 4.0,
"me_power_kw": 6200.0,
"me_load_pct": 72.0,
"me_fo_cons": 38.5,
"ae_fo_cons": 3.2,
"boiler_fo_cons": 0.4,
"cyl_oil_cons": 118.0,
"fo_rob_prev": 980.0,
"fo_rob": 938.3,
"fo_bunkered": 0.0,
"do_rob": 210.0,
"fw_rob": 312.0,
"fw_produced": 18.0,
"draft_fwd": 8.1,
"draft_aft": 8.9,
"wind_force": 5.0,
"sea_state": 4.0,
"swell_m": 1.5,
"air_temp": 29.0,
"sea_temp": 30.0,
}
# distance/hours = 14.0 kn but avg_speed reported 18.0 -> speed mismatch
# prev 980 - cons 41.7 + 0 = 938.3 but ROB reported 950 -> ROB drift
# wind_force 14 > Beaufort max 12 -> out of range
BROKEN = {
**CLEAN,
"avg_speed": 18.0,
"fo_rob": 950.0,
"wind_force": 14.0,
}