Files
DP44/enriched-qwen3-coder-next/Common/DTS.Common.Import/ImportOptions.md

69 lines
4.9 KiB
Markdown
Raw Normal View History

2026-04-17 14:55:32 -04:00
---
source_files:
- Common/DTS.Common.Import/ImportOptions/EqxImportOptions.cs
- Common/DTS.Common.Import/ImportOptions/CsvImportOptions.cs
generated_at: "2026-04-16T02:06:34.717084+00:00"
model: "Qwen/Qwen3-Coder-Next-FP8"
schema_version: 1
sha256: "c231715b4e36a96d"
---
# ImportOptions
## Documentation: Import Options Module
### 1. Purpose
This module defines data structures for configuring import behavior in the DTS system, specifically for equipment (Eqx) and CSV-based sensor data ingestion. It centralizes user-controllable settings that dictate how imported data interacts with existing system state (e.g., overwriting sensors, importing sensor models) and how raw data files are interpreted (e.g., encoding, separators, cultural formatting, zeroing logic). The classes reside in the `DTS.Common.Import.ImportOptions` namespace and serve as configuration payloads passed to import pipelines.
### 2. Public Interface
#### `EqxImportOptions`
- **Namespace**: `DTS.Common.Import.ImportOptions`
- **Properties**:
- `bool OverwriteExistingSensors { get; set; } = true`
Controls whether imported equipment sensor definitions should replace existing sensors with matching identifiers. Defaults to `true`.
- `bool ImportSensorModels { get; set; } = true`
Determines whether sensor model metadata (e.g., calibration curves, physical specs) should be imported alongside sensor instances. Defaults to `true`.
#### `CsvImportOptions`
- **Namespace**: `DTS.Common.Import.ImportOptions`
- **Properties**:
- `string Encoding { get; set; }`
Specifies the text encoding used in the CSV file (e.g., `"utf-8"`, `"iso-8859-1"`). No default is set; must be provided by caller if non-default encoding is required.
- `string FieldSeparator { get; set; }`
Defines the character(s) used to delimit fields in the CSV (e.g., `","`, `";"`, `"\t"`). No default is set; must be provided by caller.
- `CultureInfo ImportCulture { get; set; }`
Specifies the culture used to parse numeric values (e.g., decimal separators, date formats). No default is set; must be provided by caller.
- `bool StripBackSlash { get; set; }`
Indicates whether leading/trailing backslashes (`\`) should be removed from field values during parsing. No default is set; defaults to `false` (C# default for `bool`).
#### `ZeroMethodOptions`
- **Namespace**: `DTS.Common.Import.ImportOptions`
- **Properties**:
- `ZeroMethodType ZeroMethodType { get; set; }`
Specifies the algorithm used to compute a zero offset (e.g., `Average`, `Median`, `Manual`). Type is defined in `DTS.Common.Enums.Sensors`.
- `double ZeroMethodStart { get; set; }`
Start index or time offset (in seconds or samples, depending on context) for the region used to calculate the zero offset.
- `double ZeroMethodEnd { get; set; }`
End index or time offset for the zero-calculation region. Must be ≥ `ZeroMethodStart`.
### 3. Invariants
- For `ZeroMethodOptions`: `ZeroMethodEnd ≥ ZeroMethodStart` must hold. Violation implies invalid configuration, though no runtime enforcement is visible in this file.
- `CsvImportOptions` properties (`Encoding`, `FieldSeparator`, `ImportCulture`) are nullable reference types (no `= null!` or default initialization), implying they are *optional* but may be required by consumers.
- `OverwriteExistingSensors` and `ImportSensorModels` in `EqxImportOptions` default to `true`; callers relying on default behavior will overwrite and import models unless explicitly disabled.
- `StripBackSlash` defaults to `false` (C# default for `bool`), meaning backslash stripping is opt-in.
### 4. Dependencies
- **Imports/References**:
- `System` (core types, LINQ, `CultureInfo`)
- `DTS.Common.Enums.Sensors` (for `ZeroMethodType` enum used in `ZeroMethodOptions`)
- **Consumers**:
- Import pipeline classes (e.g., `EqxImporter`, `CsvImporter`) in the `DTS.Common.Import` hierarchy are implied consumers, though not visible here.
- UI or configuration layers that serialize/deserialize these options for user input.
### 5. Gotchas
- **Missing validation**: No validation is performed in these classes (e.g., `ZeroMethodEnd ≥ ZeroMethodStart`, non-empty `FieldSeparator`). Consumers must enforce constraints.
- **Ambiguous defaults**: `Encoding`, `FieldSeparator`, and `ImportCulture` in `CsvImportOptions` have no defaults. If left `null`, behavior depends on downstream parsing logic (e.g., `Encoding` may default to UTF-8 via `StreamReader`, but this is not guaranteed here).
- **`ZeroMethodOptions` semantics**: The unit of `ZeroMethodStart`/`ZeroMethodEnd` (samples vs. seconds) is context-dependent and not encoded in the type. Consumers must interpret consistently.
- **No inheritance or interfaces**: These are plain POCOs; no polymorphic behavior or shared base is defined.
- **No XML comments**: Source lacks documentation comments; all descriptions are inferred from property names and types.