SQL
Find readings that need repair before feature building
BOTIE
Examples, experiments and workspace controls
Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.
Try your own inputs
Use a copy of the example to try your own data. Keep the problem's assumptions in mind, and predict the effect of a change before checking the output. You can also add another branch to compare two ways of doing the calculation.
Context for this challenge
Connect the raw rows, asset list and range to Check the reading contract. Inspect each valid flag before collecting failures.
A raw sensor batch contains malformed relationships and measurements.
Inspect the component calculation
Check the reading contract( Reading records: Raw reading records Known asset IDs: Registered asset IDs Permitted temperature range: Inclusive temperature range )
Examples and results
- Raw reading records
[ { "id": "R1", "asset_id": "P7", "value": 20, "event_seq": 1, "ingest_seq": 2 }, { "id": "R2", "asset_id": "P99", "value": 20, "event_seq": 1, "ingest_seq": 2 }, { "id": "R3", "asset_id": "P7", "value": null, "event_seq": 1, "ingest_seq": 2 } ]- Registered asset IDs
- 0P7
- Inclusive temperature range
{ "min": 0, "max": 100 }- Required result
[ { "id": "R1", "valid": true }, { "id": "R2", "valid": false }, { "id": "R3", "valid": false } ]
- Raw reading records
[ { "id": "R5", "asset_id": "P7", "value": 0, "event_seq": 1, "ingest_seq": 1 }, { "id": "R6", "asset_id": "P7", "value": 100, "event_seq": 1, "ingest_seq": 2 } ]- Registered asset IDs
- 0P7
- Inclusive temperature range
{ "min": 0, "max": 100 }- Required result
[ { "id": "R5", "valid": true }, { "id": "R6", "valid": true } ]
Try a fresh construction
This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.
Stuck? Inspect a worked construction
The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.
Assumptions and test precision
The toy contract assumes comparable clocks and a declared unit. It does not prove label truth, representativeness or freedom from leakage. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.
Your last tested pieces can start the full construction. An existing draft there keeps its own pieces.
A new accepted range changes which value needs review
This check uses the pieces from “Audit the raw reading contract”.
BOTIE
- Raw reading records
[ { "id": "R7", "asset_id": "P2", "value": 8, "event_seq": 1, "ingest_seq": 2 }, { "id": "R8", "asset_id": "P2", "value": 40, "event_seq": 2, "ingest_seq": 2 } ]- Registered asset IDs
- 0P2
- Inclusive temperature range
{ "min": 10, "max": 40 }
Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.
Build a construction in the workspace above first. This case will test those pieces.
Why can an empty batch have no row-level violations while still be an unhealthy sensor delivery?
Check completeness, freshness and source coverage separately from individual record validity.
The toy contract assumes comparable clocks and a declared unit. It does not prove label truth, representativeness or freedom from leakage.
Work through the SQL challenges →