harbor run -t openthoughts/tasktrove-exp-rpt-scaffold-v2-scaffold-1816harbor download openthoughts/tasktrove-exp-rpt-scaffold-v2-scaffold-1816You are given scaffolded code with several NotImplementedError stubs. Your job is to implement all of these functions so the module can read an HTML page, extract metadata and measurements, build a payload, and expose a simple CLI interface. Implementations should follow the documented behavior described in the docstrings and align with the intended tests (pytest will run against this code).
What you need to implement (per function/class)
SensorMetadata and SensorPayload (data models)
read_html_file(path: str) -> str
extract_metadata(html: str) -> SensorMetadata
extract_measures(html: str) -> List[Tuple[int, Optional[float]]]
select_recent_measures(measures: List[Tuple[int, Optional[float]]], rows: int) -> List[Tuple[int, Optional[float]]]
rows measurements by timestamp.rows measurements, return all of them.build_payload(metadata: SensorMetadata, measures: List[Tuple[int, Optional[float]]]) -> SensorPayload
payload_to_json(payload: SensorPayload) -> str
parse_sensor_html(html_path: str, rows: int) -> SensorPayload
rows measurements using select_recent_measures.main(argv: Optional[List[str]] = None) -> int
How these pieces fit together (high-level workflow)
Notes and expectations
Files to modify
Testing note
Please implement all NotImplementedError stubs according to the behavior described above.
Important: place your implementation at /app/app.py so the tests can import app.