2026-01-06 22:59:58 +08:00

5.4 KiB
Raw Blame History

Requirements Document

Introduction

This document specifies the requirements for enhancing the temperature measurement data query functionality in the MeasuresTemperatureResultAppService.FindDatas method. The enhancement will enable the system to query infrared camera data from the OriginalInspectionStoreResult collection using intelligent camera identification, fuzzy equipment name matching, and structured temperature data parsing.

Glossary

  • System: The MeasuresTemperatureResultAppService
  • OriginalInspectionStoreResult: MongoDB collection containing original inspection results with temperature data
  • Infrared_Camera: A thermal imaging camera identified by specific naming patterns
  • Equipment: A physical device (EquipmentInfo entity) being monitored for temperature
  • Temperature_Point: A specific measurement location on equipment with a name and temperature value
  • Valid_Temperature_Data: Temperature data in the format "name:value" (e.g., "2BL_C相连接点-12.5℃")
  • Similarity_Score: A numeric value (0.0 to 1.0) representing how closely two strings match

Requirements

Requirement 1: Infrared Camera Identification

User Story: As a system operator, I want the system to identify infrared camera data from inspection results, so that temperature measurements from thermal imaging devices are correctly processed.

Acceptance Criteria

  1. WHEN querying OriginalInspectionStoreResult data, THE System SHALL filter records where CamName contains "热成像"
  2. WHEN querying OriginalInspectionStoreResult data, THE System SHALL filter records where CamName ends with the character 'B'
  3. WHEN both conditions are evaluated, THE System SHALL include records that match either condition (OR logic)

Requirement 2: Equipment Name Matching with Fuzzy Logic

User Story: As a system operator, I want the system to match equipment using fuzzy name comparison, so that minor naming variations do not prevent data association.

Acceptance Criteria

  1. WHEN an EquipmentInfoId is specified in the search condition, THE System SHALL retrieve the Equipment entity
  2. WHEN matching inspection data to equipment, THE System SHALL compare the data's EquipmentInfoName field against the Equipment's Name field
  3. WHEN matching inspection data to equipment, THE System SHALL compare the data's Name field against the Equipment's Name field
  4. WHEN calculating similarity, THE System SHALL use a similarity algorithm that returns a score between 0.0 and 1.0
  5. WHEN the similarity score is greater than or equal to 0.85, THE System SHALL consider the names as matching
  6. WHEN either EquipmentInfoName or Name matches with 85% similarity, THE System SHALL include the record in results

Requirement 3: Temperature Data Parsing and Validation

User Story: As a system operator, I want the system to extract valid temperature measurements from result strings, so that only properly formatted data is processed.

Acceptance Criteria

  1. WHEN processing a Result field, THE System SHALL split the string by delimiters (comma, Chinese comma, newline, carriage return)
  2. WHEN evaluating each split segment, THE System SHALL check if it contains a colon character (either ':' or '')
  3. WHEN a segment contains a colon, THE System SHALL split it into name and value parts
  4. WHEN a segment does not contain a colon, THE System SHALL skip that segment
  5. WHEN extracting temperature values, THE System SHALL use regex pattern matching to find numeric values (including decimals)
  6. WHEN a valid numeric temperature is extracted, THE System SHALL create a Temperature_Point record with the parsed name and value
  7. WHEN temperature value extraction fails, THE System SHALL skip that segment and continue processing remaining segments

Requirement 4: Query Integration and Data Flow

User Story: As a system operator, I want the enhanced query logic to integrate seamlessly with existing functionality, so that the system maintains backward compatibility.

Acceptance Criteria

  1. WHEN the FindDatas method is called, THE System SHALL apply infrared camera filtering to OriginalInspectionStoreResult queries
  2. WHEN equipment filtering is specified, THE System SHALL apply fuzzy name matching with 85% threshold
  3. WHEN processing query results, THE System SHALL parse temperature data from Result fields
  4. WHEN time range filters are specified, THE System SHALL apply them to the Time field in OriginalInspectionStoreResult
  5. WHEN name filters are specified, THE System SHALL apply them to parsed Temperature_Point names after extraction
  6. WHEN pagination parameters are provided, THE System SHALL apply them after all filtering and parsing is complete

Requirement 5: Error Handling and Logging

User Story: As a system administrator, I want comprehensive error handling and logging, so that I can diagnose issues with temperature data queries.

Acceptance Criteria

  1. WHEN parsing temperature data fails for a record, THE System SHALL log the error with the problematic Result string
  2. WHEN similarity calculation encounters null or empty strings, THE System SHALL return a similarity score of 0.0
  3. WHEN database queries fail, THE System SHALL log the exception and return an error response
  4. WHEN no infrared camera data is found, THE System SHALL return an empty result set with success status
  5. WHEN invalid temperature formats are encountered, THE System SHALL skip those entries and continue processing