Assessor_2.0/src/domain/dataset.ts

102 lines
3.0 KiB
TypeScript

import type { CandidateMappingResult } from './candidate-mapping';
import type { FindingRecord } from './finding';
import type { ImportDocument } from './import-intermediate';
import type { ImportRecognitionResult } from './import-recognition';
import type { SourceExtractionResult } from './source-extraction';
import type { SecurityScoreContext } from './security-scoring';
export type ColumnType = 'leer' | 'Datum' | 'Zahl' | 'Kategorie' | 'Text' | 'Text kurz';
export interface ColumnProfile {
header: string;
type: ColumnType;
filled: number;
total: number;
fillRate: number;
unique: number;
topValues: Array<{ value: string; count: number }>;
}
export interface SheetAnalysis {
headerIndex: number;
headers: string[];
records: FindingRecord[];
columns: ColumnProfile[];
signals: string[];
title: string;
}
export interface ResultVariantSource {
label: string;
sourcePath: string;
backupId: string;
recordId: string;
}
export interface ResultVariant {
label: string;
value: string;
typeLabel: string;
sources: ResultVariantSource[];
/** Proven only when every source of the variant has the same retained current baseline relation. */
baselineState?: 'deviating' | 'aligned';
}
export interface ResultVariantComparison {
kind: 'variant-comparison';
mode: 'conflict' | 'duplicate';
title: string;
scope: string;
registryPath?: string;
valueName?: string;
variants: ResultVariant[];
sourceCount: number;
}
export interface DatasetSheet {
id: string;
name: string;
rows: string[][];
raw: string;
analysis: SheetAnalysis;
sourceFile?: string;
sourceSheet?: string;
/** Erklaerender Quelltext, der im Results-Fenster direkt vor diesem Blatt steht. */
resultPreamble?: string;
/** Columns whose differing evidence should be emphasized in Results. */
resultEmphasisColumns?: string[];
/** Structured, presentation-only comparison of conflicting evidence. */
resultVariantComparison?: ResultVariantComparison;
/** Stabiler Index der Quelltabelle innerhalb der Importdatei. */
sourceTableIndex?: number;
workbookIndex?: number;
hidden?: number;
isProjectSheet?: boolean;
/**
* Werkzeug, das dieses Blatt erzeugt hat. Fehlt bei gemischten Blaettern wie
* der Projektaggregation; dort steht die Herkunft je Datensatz in der Spalte
* "Quelle: Scan".
*/
toolId?: string;
}
export interface ImportedDataset {
/** Run-bound scoring evidence, prepared once while projecting the canonical workspace. */
securityScoring?: SecurityScoreContext;
/** Benchmark section titles per scan run and section number, read from retained report tables. */
benchmarkSectionTitles?: Map<string, Map<string, string>>;
fileName: string;
fileSize: number;
lastModified: number;
format: string;
rawText: string;
sheets: DatasetSheet[];
profileId: string;
profileVersion?: string;
scanTool: string;
intermediate?: ImportDocument;
extraction?: SourceExtractionResult;
mapping?: CandidateMappingResult;
recognition?: ImportRecognitionResult;
}