root_cause stringclasses 3
values | source_code stringclasses 3
values | defect_category stringclasses 3
values | validation_result stringclasses 3
values | validation_explanation stringclasses 3
values |
|---|---|---|---|---|
The comparison uses age_seconds < max_age_seconds to raise the stale-reading error; the condition is reversed for detecting readings that exceed the maximum permitted age. | def validate_reading_time(timestamp, now, max_age_seconds):
age_seconds = (now - timestamp).total_seconds()
if age_seconds < max_age_seconds:
raise ValueError("reading is stale")
return age_seconds
| Stale-reading validation | Invalid: the age check rejects fresh readings and accepts readings older than the limit. | For a reading younger than the configured limit, the condition is true and the function raises an error. For a reading older than the limit, the condition is false and the age is returned, allowing the stale reading through. |
payload.get("value", 0.0) substitutes a numeric default when the value key is absent, and the function returns that value as a parsed reading without indicating that the measurement was missing. | def parse_reading(payload):
value = float(payload.get("value", 0.0))
timestamp = int(payload["timestamp"])
return {"value": value, "timestamp": timestamp}
| Missing-value handling | Invalid: a reading with a missing value is accepted as 0.0. | When payload has a timestamp but no value key, the lookup returns 0.0 and float conversion succeeds. The function then returns a normal reading, so downstream checks cannot distinguish the absent measurement from an actual zero. |
The function checks only whether the value is below lower_bound; it never compares the value with upper_bound. | def validate_reading(reading, lower_bound, upper_bound):
value = float(reading["value"])
if value < lower_bound:
raise ValueError("reading is below the permitted range")
return value
| Out-of-range validation | Invalid: values above upper_bound are accepted. | A value greater than upper_bound does not satisfy the sole rejection condition, so the function returns it as valid. The range check is incomplete and permits readings above the configured limit. |
Mine Safety Monitoring Sensor Integration Code Verification Dataset
This dataset contains source code examples for sensor data ingestion, parsing, and validity checks in mine safety monitoring systems. Each example includes a validation result, defect category, root-cause annotation, and explanation, covering issues such as missing values, out-of-range values, and stale readings. It supports code correctness checks, defect identification, root-cause analysis, and quality evaluation for mining monitoring software.
Technical Specifications
| Field | Type | Description |
|---|---|---|
| root_cause | string | The code logic or implementation reason that caused the verification issue. |
| source_code | string | Source code for sensor data ingestion, parsing, or validity checks to be verified. |
| defect_category | string | The identified code issue category, such as missing-value handling, out-of-range checks, or stale-reading validation. |
| validation_result | string | The verification conclusion regarding code correctness and its sensor data processing behavior. |
| validation_explanation | string | The verification evidence, relevant code behavior, and impact of the issue. |
Compliance Statement
| Authorization Type | CC-BY-NC-SA 4.0 (Attribution–NonCommercial–ShareAlike) |
| Commercial Use | Requires exclusive subscription or authorization contract (monthly or per-invocation charging) |
| Privacy and Anonymization | No PII, no real company names, simulated scenarios follow industry standards |
| Compliance System | Compliant with China's Data Security Law / EU GDPR / supports enterprise data access logs |
Source & Contact
- Downloads last month
- 21