To identify inconsistencies in a "Fake QC Report," we need to analyze the data for logical errors, deviations from standards, or impossible values. Below is a step-by-step approach to detect such issues, followed by an example and a Python solution.
Key Inconsistencies to Check:
-
Tolerance Violations:
- Measurements outside the specified tolerance range should be marked as "Fail," not "Pass."
- Measurements within tolerance should be marked as "Pass," not "Fail."
-
Impossible Values:
- Negative measurements (unless allowed by context).
- Temperatures below absolute zero (-273.15°C).
- Zero or negative time/duration values.
- Measurements exceeding physical limits (e.g., length > 1000mm for a 100mm component).
-
Data Integrity Issues:
- Missing critical fields (e.g.,
Measurement,Tolerance,Status). - Non-numeric values in numeric fields.
- Duplicate or invalid Product IDs.
- Inconsistent units (e.g., mixing mm and cm without conversion).
- Missing critical fields (e.g.,
-
Logical Errors:
- All products passing/failing without reason.
- Measurements clustered exactly at tolerance limits (suggests fabrication).
- Statuses contradicting tolerance rules.
Example Fake QC Report:
| Product ID | Measurement (mm) | Tolerance (mm) | Status | Notes |
|---|---|---|---|---|
| P001 | 5 | ±0.2 | Pass | Within [10.3, 10.7] |
| P002 | 7 | ±0.2 | Pass | Within [10.3, 10.7] |
| P003 | 3 | ±0.2 | Fail | Should be Pass (at limit) |
| P004 | 8 | ±0.2 | Pass | Should be Fail (outside) |
| P005 | -5.0 | ±0.2 | Fail | Impossible negative value |
| P006 | 4 | ±0.2 | Pass | Valid |
| P007 | 5 | ±0.2 | Pass | Valid |
Inconsistencies:
- P003: Measurement
3is within tolerance (5 ± 0.2) but marked "Fail." - P004: Measurement
8exceeds tolerance (>10.7) but marked "Pass." - P005: Negative measurement (
-5.0) is physically impossible.
Python Solution:
def detect_fake_qc(report):
fake_ids = []
tolerance_range = 0.2 # ±0.2 mm
nominal = 10.5 # Nominal value from the report
for record in report:
id = record['id']
measurement = record['measurement']
status = record['status']
# Check for impossible values
if measurement < 0:
fake_ids.append(id)
continue
# Check tolerance compliance
lower_bound = nominal - tolerance_range
upper_bound = nominal + tolerance_range
if lower_bound <= measurement <= upper_bound:
expected_status = "Pass"
else:
expected_status = "Fail"
# Compare with reported status
if status != expected_status:
fake_ids.append(id)
return fake_ids
qc_report = [
{'id': 'P001', 'measurement': 10.5, 'status': 'Pass'},
{'id': 'P002', 'measurement': 10.7, 'status': 'Pass'},
{'id': 'P003', 'measurement': 10.3, 'status': 'Fail'}, # Should be Pass
{'id': 'P004', 'measurement': 10.8, 'status': 'Pass'}, # Should be Fail
{'id': 'P005', 'measurement': -5.0, 'status': 'Fail'}, # Impossible value
{'id': 'P006', 'measurement': 10.4, 'status': 'Pass'},
{'id': 'P007', 'measurement': 10.5, 'status': 'Pass'}
]
fake_products = detect_fake_qc(qc_report)
print("Fake Product IDs:", fake_products) # Output: ['P003', 'P004', 'P005']
Output:
Fake Product IDs: ['P003', 'P004', 'P005']
Explanation:
- P003: Fails because
3is within tolerance but marked "Fail." - P004: Fails because
8exceeds tolerance but marked "Pass." - P005: Fails due to the impossible negative measurement.
This solution systematically checks for tolerance violations and impossible values. For real-world
Request an On-site Audit / Inquiry