--- source_files: - Common/DTS.Common.Import/Interfaces/IPersistImport.cs - Common/DTS.Common.Import/Interfaces/IParseImport.cs - Common/DTS.Common.Import/Interfaces/IParseVariant.cs - Common/DTS.Common.Import/Interfaces/IParseCSVTest.cs - Common/DTS.Common.Import/Interfaces/IParseCSVSensor.cs - Common/DTS.Common.Import/Interfaces/ICalibrationImport.cs - Common/DTS.Common.Import/Interfaces/ILockImport.cs - Common/DTS.Common.Import/Interfaces/IGroupImport.cs generated_at: "2026-04-17T16:02:47.396088+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "78f079bf5483238e" --- # Interfaces ### Purpose This module defines the core abstraction layer for the import subsystem, providing interfaces for parsing, persisting, locking, and grouping imported data. It establishes contracts for handling CSV-based test and sensor imports, calibration records, and database locking mechanisms during import operations. The interfaces enable a separation between import orchestration and concrete implementations. ### Public Interface **IPersistImport** - `void Save()` - Persists the current import state. No parameters; returns void. **IParseImport** - `ImportObject Parse(IEnumerable importFiles)` - Parses a collection of file paths into an `ImportObject`. Accepts `IEnumerable` of file paths. **IParseVariant** - `string FileName { get; set; }` - Property for the file name being parsed. - `void Parse(ref ImportObject importObject)` - Parses variant data into the provided `ImportObject`. Note: `importObject` is passed by reference. **IParseCSVTest** - `int Version { get; }` - Read-only property indicating the parser version. - `void ParseVersion(CsvReader csvReader, TestSetupImportData tsid)` - Parses version-specific test data using a `CsvReader` into `TestSetupImportData`. **IParseCSVSensor** - `int Version { get; }` - Read-only property indicating the parser version. - `void Initialize(ICalibrationImport import, ZeroMethodOptions zmOptions, IImportNotification importNotification, bool importCreateDynamicGroups, bool useIsoCodeFilterMapping, bool useZeroForUnfiltered)` - Initializes the parser with calibration import, zero method options, notification handler, and various import flags. - `void ParseVersion(CSVImportTags.Tags field, string val, ParseParameters pp)` - Parses a specific field/value pair for the current version. **ICalibrationImport** - `SensorCalibration AddLinearCalRecordIfNeeded(SensorCalibration sc, bool savedIsProportional, bool savedRemoveOffset)` - Adds a linear calibration record if conditions are met. - `SensorCalibration AddLinearZeroMethodIfNeeded(SensorCalibration sc, ZeroMethodType zeroMethodType, double zeroMethodStart, double zeroMethodEnd)` - Adds a linear zero method to calibration if needed. - `SensorCalibration CheckForExcitationCalibration(SensorCalibration sc, double sensitivity, ExcitationVoltageOptions.ExcitationVoltageOption excitation, string EU)` - Checks and configures excitation calibration. **ILockImport** - `bool Contended { get; }` - Returns true if the collection of contended locks has any items. - `void SetLock(ref ImportObject importObject, ref StringBuilder message)` - Sets a database lock for the import object; errors populate the `StringBuilder` message. - `void FreeLock(ref ImportObject importObject)` - Releases the database lock for the import object. - `bool StealLock(bool proceed)` - Steals the database lock; returns success status. **IGroupImport** - `ParseParameters ParseParameters { get; set; }` - Property for parsing parameters. - `Tuple> CreateGroups(List sensors, Dictionary> groupSensorLookup, TestTemplate testTemplate, bool createDynamicGroups, List staticGroups, Action setProgress)` - Creates groups from sensor data with progress reporting. - `Dictionary> GetGroupSensorLookup(List sensors, Dictionary sensorGroupNameLookup, Dictionary> groupNameSensorListLookup)` - Builds a lookup dictionary mapping group names to sensor info. ### Invariants - `IParseVariant.Parse` modifies `ImportObject` via reference; the caller must expect mutation. - `ILockImport.SetLock` requires an empty `StringBuilder` to be passed in; it will be populated with errors if any occur. - `IParseCSVSensor.Initialize` must be called before `ParseVersion` (implied by initialization pattern). - `IUserDbRecord.UserName` must be unique (documented in interface comments, though this interface is in a different module). ### Dependencies **Depends on:** - `System.Collections.Generic` (IEnumerable, Dictionary, List) - `System.Text` (StringBuilder) - `CsvHelper` (CsvReader) - `DTS.Common.Classes` (TestSetupImportData) - `DTS.Common.Classes.Sensors` (SensorData) - `DTS.Common.Enums` (ZeroMethodType) - `DTS.Common.Enums.Sensors` (sensor-related enums) - `DTS.Common.Import.ImportOptions` (ZeroMethodOptions) - `DTS.Common.Interface.Groups.GroupList` (IGroup) - `DTS.SensorDB` (SensorCalibration) - `DataPROWin7.DataModel` (TestTemplate, TsetSetupImportSensorInfo) **Depended on by:** Not determinable from source alone; these are interfaces consumed by implementations. ### Gotchas - `IParseVariant.Parse` uses `ref ImportObject` while `IParseImport.Parse` returns a new `ImportObject`. This inconsistency suggests different ownership models. - `ILockImport` has a comment referencing "FB 36740" indicating a feature request/bug tracking reference. - The `ILockImport.StealLock` method's `proceed` parameter purpose is unclear from the signature alone. - `IParseCSVSensor.ParseVersion` takes a `string val` parameter, suggesting string-based field values rather than typed parsing. ---