@auditcore/ui-core 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1326 -0
  3. package/dist/account/camera.d.ts +8 -0
  4. package/dist/account/controller.d.ts +30 -0
  5. package/dist/account/index.d.ts +7 -0
  6. package/dist/account/messages.d.ts +2 -0
  7. package/dist/account/port.d.ts +10 -0
  8. package/dist/account/presentation.d.ts +9 -0
  9. package/dist/account/types.d.ts +42 -0
  10. package/dist/account/view.d.ts +12 -0
  11. package/dist/attributes/controller.d.ts +26 -0
  12. package/dist/attributes/index.d.ts +5 -0
  13. package/dist/attributes/messages.d.ts +3 -0
  14. package/dist/attributes/port.d.ts +4 -0
  15. package/dist/attributes/types.d.ts +60 -0
  16. package/dist/attributes/view.d.ts +49 -0
  17. package/dist/base/icons.d.ts +38 -0
  18. package/dist/base/index.d.ts +3 -0
  19. package/dist/base/types.d.ts +3 -0
  20. package/dist/batchchecks/controller.d.ts +60 -0
  21. package/dist/batchchecks/index.d.ts +7 -0
  22. package/dist/batchchecks/messages.d.ts +3 -0
  23. package/dist/batchchecks/model.d.ts +38 -0
  24. package/dist/batchchecks/port.d.ts +6 -0
  25. package/dist/batchchecks/rest-port.d.ts +4 -0
  26. package/dist/batchchecks/types.d.ts +121 -0
  27. package/dist/batchchecks/view.d.ts +58 -0
  28. package/dist/benford/chart.d.ts +49 -0
  29. package/dist/benford/controller.d.ts +48 -0
  30. package/dist/benford/index.d.ts +7 -0
  31. package/dist/benford/messages.d.ts +3 -0
  32. package/dist/benford/model.d.ts +32 -0
  33. package/dist/benford/rest-port.d.ts +4 -0
  34. package/dist/benford/types.d.ts +144 -0
  35. package/dist/benford/view.d.ts +45 -0
  36. package/dist/dataprotection/dsfa.d.ts +55 -0
  37. package/dist/dataprotection/dsfaView.d.ts +45 -0
  38. package/dist/dataprotection/exporters.d.ts +33 -0
  39. package/dist/dataprotection/index.d.ts +10 -0
  40. package/dist/dataprotection/messages.d.ts +5 -0
  41. package/dist/dataprotection/registerView.d.ts +47 -0
  42. package/dist/dataprotection/requests.d.ts +16 -0
  43. package/dist/dataprotection/rest-port.d.ts +4 -0
  44. package/dist/dataprotection/types.d.ts +291 -0
  45. package/dist/dataprotection/vvt.d.ts +69 -0
  46. package/dist/dbkanban/controller.d.ts +54 -0
  47. package/dist/dbkanban/index.d.ts +3 -0
  48. package/dist/dbkanban/messages.d.ts +5 -0
  49. package/dist/dbkanban/view.d.ts +39 -0
  50. package/dist/documents/controller.d.ts +63 -0
  51. package/dist/documents/form.d.ts +52 -0
  52. package/dist/documents/importing.d.ts +12 -0
  53. package/dist/documents/index.d.ts +6 -0
  54. package/dist/documents/list.d.ts +21 -0
  55. package/dist/documents/messages.d.ts +8 -0
  56. package/dist/documents/view.d.ts +36 -0
  57. package/dist/download.d.ts +14 -0
  58. package/dist/extraction/controller.d.ts +34 -0
  59. package/dist/extraction/index.d.ts +5 -0
  60. package/dist/extraction/messages.d.ts +3 -0
  61. package/dist/extraction/rest-port.d.ts +4 -0
  62. package/dist/extraction/types.d.ts +115 -0
  63. package/dist/extraction/view.d.ts +35 -0
  64. package/dist/extrapolation/controller-subsample.d.ts +20 -0
  65. package/dist/extrapolation/controller.d.ts +72 -0
  66. package/dist/extrapolation/index.d.ts +9 -0
  67. package/dist/extrapolation/messages.d.ts +3 -0
  68. package/dist/extrapolation/model-design.d.ts +28 -0
  69. package/dist/extrapolation/model-subsample.d.ts +40 -0
  70. package/dist/extrapolation/model.d.ts +92 -0
  71. package/dist/extrapolation/rest-port.d.ts +4 -0
  72. package/dist/extrapolation/types.d.ts +255 -0
  73. package/dist/extrapolation/view-details.d.ts +46 -0
  74. package/dist/extrapolation/view.d.ts +50 -0
  75. package/dist/focus.d.ts +10 -0
  76. package/dist/geo/controller.d.ts +87 -0
  77. package/dist/geo/index.d.ts +6 -0
  78. package/dist/geo/mapView.d.ts +30 -0
  79. package/dist/geo/messages.d.ts +3 -0
  80. package/dist/geo/model.d.ts +43 -0
  81. package/dist/geo/rest-port.d.ts +12 -0
  82. package/dist/geo/types.d.ts +195 -0
  83. package/dist/i18n.d.ts +29 -0
  84. package/dist/identifiers/controller.d.ts +63 -0
  85. package/dist/identifiers/index.d.ts +5 -0
  86. package/dist/identifiers/messages.d.ts +3 -0
  87. package/dist/identifiers/model.d.ts +87 -0
  88. package/dist/identifiers/rest-port.d.ts +4 -0
  89. package/dist/identifiers/types.d.ts +101 -0
  90. package/dist/index.d.ts +33 -0
  91. package/dist/index.js +10676 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/kanban/index.d.ts +2 -0
  94. package/dist/kanban/messages.d.ts +6 -0
  95. package/dist/messages.d.ts +2 -0
  96. package/dist/reporting/controller.d.ts +46 -0
  97. package/dist/reporting/index.d.ts +5 -0
  98. package/dist/reporting/messages.d.ts +3 -0
  99. package/dist/reporting/rest-port.d.ts +4 -0
  100. package/dist/reporting/types.d.ts +72 -0
  101. package/dist/reporting/view.d.ts +12 -0
  102. package/dist/reporttemplates/controller.d.ts +46 -0
  103. package/dist/reporttemplates/index.d.ts +5 -0
  104. package/dist/reporttemplates/messages.d.ts +3 -0
  105. package/dist/reporttemplates/port.d.ts +4 -0
  106. package/dist/reporttemplates/types.d.ts +92 -0
  107. package/dist/reporttemplates/view.d.ts +27 -0
  108. package/dist/risk/controller.d.ts +54 -0
  109. package/dist/risk/format.d.ts +13 -0
  110. package/dist/risk/index.d.ts +7 -0
  111. package/dist/risk/labels.d.ts +9 -0
  112. package/dist/risk/messages.d.ts +3 -0
  113. package/dist/risk/port.d.ts +41 -0
  114. package/dist/risk/state.d.ts +61 -0
  115. package/dist/risk/types.d.ts +107 -0
  116. package/dist/runner/aktionen.d.ts +16 -0
  117. package/dist/runner/controller.d.ts +72 -0
  118. package/dist/runner/eingabe.d.ts +5 -0
  119. package/dist/runner/index.d.ts +9 -0
  120. package/dist/runner/messages.d.ts +3 -0
  121. package/dist/runner/port.d.ts +20 -0
  122. package/dist/runner/profil.d.ts +39 -0
  123. package/dist/runner/types.d.ts +109 -0
  124. package/dist/runner/view-listen.d.ts +32 -0
  125. package/dist/runner/view.d.ts +95 -0
  126. package/dist/samplesize/controller.d.ts +33 -0
  127. package/dist/samplesize/index.d.ts +7 -0
  128. package/dist/samplesize/messages.d.ts +3 -0
  129. package/dist/samplesize/model.d.ts +40 -0
  130. package/dist/samplesize/port.d.ts +9 -0
  131. package/dist/samplesize/types.d.ts +92 -0
  132. package/dist/samplesize/view.d.ts +39 -0
  133. package/dist/sampling/controller.d.ts +62 -0
  134. package/dist/sampling/index.d.ts +6 -0
  135. package/dist/sampling/messages.d.ts +3 -0
  136. package/dist/sampling/model.d.ts +63 -0
  137. package/dist/sampling/rest-port.d.ts +4 -0
  138. package/dist/sampling/types.d.ts +136 -0
  139. package/dist/sampling/view.d.ts +45 -0
  140. package/dist/screening/controller.d.ts +52 -0
  141. package/dist/screening/index.d.ts +8 -0
  142. package/dist/screening/messages.d.ts +7 -0
  143. package/dist/screening/rest-port.d.ts +4 -0
  144. package/dist/screening/runForm.d.ts +22 -0
  145. package/dist/screening/types.d.ts +295 -0
  146. package/dist/screening/view.d.ts +84 -0
  147. package/dist/store.d.ts +30 -0
  148. package/dist/synopsis/controller.d.ts +68 -0
  149. package/dist/synopsis/exporters.d.ts +16 -0
  150. package/dist/synopsis/index.d.ts +8 -0
  151. package/dist/synopsis/messages.d.ts +3 -0
  152. package/dist/synopsis/navigation.d.ts +5 -0
  153. package/dist/synopsis/port.d.ts +38 -0
  154. package/dist/synopsis/types.d.ts +121 -0
  155. package/dist/synopsis/viewModel.d.ts +74 -0
  156. package/dist/synopsis/wordDiff.d.ts +31 -0
  157. package/dist/table/index.d.ts +6 -0
  158. package/dist/tabular/index.d.ts +2 -0
  159. package/dist/tabular/messages.d.ts +3 -0
  160. package/dist/tabular/tableImport.d.ts +40 -0
  161. package/package.json +55 -0
  162. package/styles/account.css +37 -0
  163. package/styles/attributes.css +18 -0
  164. package/styles/base.css +116 -0
  165. package/styles/batchchecks.css +26 -0
  166. package/styles/benford.css +39 -0
  167. package/styles/dataprotection.css +68 -0
  168. package/styles/dbkanban.css +38 -0
  169. package/styles/documents.css +51 -0
  170. package/styles/extraction.css +25 -0
  171. package/styles/extrapolation.css +34 -0
  172. package/styles/geo.css +54 -0
  173. package/styles/identifiers.css +38 -0
  174. package/styles/index.css +24 -0
  175. package/styles/kanban.css +115 -0
  176. package/styles/reporting.css +22 -0
  177. package/styles/reporttemplates.css +21 -0
  178. package/styles/risk.css +92 -0
  179. package/styles/runner.css +54 -0
  180. package/styles/samplesize.css +27 -0
  181. package/styles/sampling.css +31 -0
  182. package/styles/screening.css +86 -0
  183. package/styles/synopsis.css +83 -0
  184. package/styles/table.css +17 -0
  185. package/styles/tabular.css +11 -0
  186. package/styles/tokens.css +121 -0
@@ -0,0 +1,14 @@
1
+ /** Text als Datei anbieten (Blob-URL); ohne Blob-Unterstützung geschieht nichts. */
2
+ export declare function downloadText(content: string, filename: string, mimeType: string): boolean;
3
+ /**
4
+ * Druckansicht in einem unsichtbaren Rahmen öffnen („Als PDF speichern“ im
5
+ * Druckdialog). Kein Pop-up, daher auch mit Pop-up-Blocker nutzbar.
6
+ */
7
+ export declare function printHtml(html: string): HTMLIFrameElement;
8
+ /** Export ausliefern: Druckansicht (`print`) oder Datei. */
9
+ export declare function deliverExport(payload: {
10
+ format: string;
11
+ content: string;
12
+ filename: string;
13
+ mimeType: string;
14
+ }): void;
@@ -0,0 +1,34 @@
1
+ import { RequestState } from '../store';
2
+ import { ExtractionCatalogue, ExtractionPort, ExtractionRun } from './types';
3
+ export type ExtractionBusy = 'load' | 'run';
4
+ export type ExtractionValidation = 'needFile' | 'tooLarge' | 'profile' | null;
5
+ export interface ExtractionCallbacks {
6
+ completed?: (result: ExtractionRun) => void;
7
+ failed?: (message: string) => void;
8
+ }
9
+ export interface ExtractionData extends RequestState<string> {
10
+ catalogue: ExtractionCatalogue | null;
11
+ profileId: string | null;
12
+ file: Blob | null;
13
+ filename: string;
14
+ result: ExtractionRun | null;
15
+ validation: ExtractionValidation;
16
+ }
17
+ export interface ExtractionSource {
18
+ port: () => ExtractionPort | null | undefined;
19
+ callbacks?: () => ExtractionCallbacks;
20
+ }
21
+ export declare const INITIAL_EXTRACTION: ExtractionData;
22
+ /** Prüfung vor dem Senden (reine Funktion). */
23
+ export declare function extractionValidation(state: ExtractionData): ExtractionValidation;
24
+ export declare function createExtractionController(source: ExtractionSource): {
25
+ store: import('..').Store<ExtractionData>;
26
+ load: () => Promise<void>;
27
+ extract: () => Promise<void>;
28
+ /** Datei wählen (`null` = Auswahl aufheben). */
29
+ selectFile: (file: File | null) => void;
30
+ setProfile: (profileId: string | null) => void;
31
+ /** Vorhandenes Ergebnis anzeigen (Eigenschaft `result`). */
32
+ showResult: (result: ExtractionRun | null) => void;
33
+ };
34
+ export type ExtractionController = ReturnType<typeof createExtractionController>;
@@ -0,0 +1,5 @@
1
+ export { extractionMessages, type ExtractionMessageKey } from './messages';
2
+ export { createExtractionRestPort } from './rest-port';
3
+ export type * from './types';
4
+ export * from './controller';
5
+ export * from './view';
@@ -0,0 +1,3 @@
1
+ /** Texte der Belegerkennung (`<flowaudit-extraction>`). */
2
+ export declare const extractionMessages: import('..').Catalogs<"loading" | "notice" | "title" | "profile" | "noPort" | "colDecision" | "result" | "failed" | "recommended" | "run" | "file" | "colValue" | "errorprofile" | "disabled" | "upload" | "fileHelp" | "unavailable" | "experimental" | "retention" | "errorneedFile" | "errortooLarge" | "statusok" | "statusreview_needed" | "statusrejected" | "statusfailed" | "statusOther" | "runError" | "retryable" | "document" | "documentValue" | "pages" | "ocr" | "ocrValue" | "qualityok" | "qualityreview" | "qualityrejected" | "fields" | "colField" | "colConfidence" | "noValue" | "noFields" | "confidenceHelp" | "decisionaccepted" | "decisionrejected" | "decisionunconfirmed" | "decisiondisagreement" | "decisionnot_taken" | "proposal" | "findings" | "findingsNone" | "passed" | "colRule" | "colSeverity" | "colOutcome" | "colMessage" | "severityINFO" | "severityWARN" | "severityCRITICAL" | "outcomePASS" | "outcomeFAIL" | "outcomeREVIEW" | "flags" | "pagesText" | "pageLabel" | "field_invoice_number" | "field_date" | "field_supply_date" | "field_due_date" | "field_supplier_name" | "field_net_amount" | "field_vat_amount" | "field_total" | "field_iban" | "field_bic" | "field_vat_id" | "field_vat_rates" | "rule_VAL_IBAN_CHECKSUM" | "rule_VAL_VAT_ID_FORMAT" | "rule_VAL_TOTAL_PLAUSIBILITY" | "rule_VAL_OCR_CONFIDENCE" | "rule_VAL_FRAUD_DETECTION" | "rule_VAL_AMOUNT_FORMAT" | "rule_VAL_DONUT_PLAUSIBILITY" | "rule_VAL_DONUT_DISAGREEMENT">;
3
+ export type ExtractionMessageKey = keyof typeof extractionMessages.de;
@@ -0,0 +1,4 @@
1
+ import { RestOptions } from '@auditcore/common';
2
+ import { ExtractionPort } from './types';
3
+ /** Port auf den REST-Vertrag `documents_extraction/1` von `auditcore_documents.web` (Starlette oder FastAPI). */
4
+ export declare function createExtractionRestPort(options: RestOptions): ExtractionPort;
@@ -0,0 +1,115 @@
1
+ /** Typen des REST-Vertrags `documents_extraction/1` (`docs/ui/extraction-rest.md`, auditcore_documents.web). */
2
+ export interface ExtractionProfile {
3
+ id: string;
4
+ version: string;
5
+ fingerprint: string;
6
+ label: string;
7
+ status: string;
8
+ ocr_backend: string | null;
9
+ recommended: boolean;
10
+ min_field_confidence: number | null;
11
+ available: boolean;
12
+ retention_categories: readonly string[];
13
+ }
14
+ export interface ExtractionCatalogue {
15
+ contract: string;
16
+ library: string;
17
+ enabled: boolean;
18
+ engines: Readonly<Record<'router' | 'chandra' | 'tesseract' | 'donut', boolean>>;
19
+ profiles: readonly ExtractionProfile[];
20
+ default_profile: string | null;
21
+ accepted_types: readonly string[];
22
+ limits: {
23
+ max_upload_bytes: number;
24
+ };
25
+ thresholds: {
26
+ ok: number;
27
+ review: number;
28
+ };
29
+ retention: {
30
+ stored: boolean;
31
+ days: Readonly<Record<string, number>>;
32
+ };
33
+ }
34
+ export type ExtractionRunStatus = 'queued' | 'running' | 'ok' | 'review_needed' | 'rejected' | 'failed' | (string & {});
35
+ export type ExtractionOcrQuality = 'ok' | 'review' | 'rejected';
36
+ export type ExtractionFieldDecision = 'accepted' | 'rejected' | 'unconfirmed' | 'not_taken' | (string & {});
37
+ export type ExtractionJson = string | number | boolean | null | readonly ExtractionJson[] | {
38
+ readonly [key: string]: ExtractionJson;
39
+ };
40
+ export interface ExtractedField {
41
+ name: string;
42
+ value: ExtractionJson;
43
+ raw: ExtractionJson;
44
+ /** Feldkonfidenz des Donut-Modells; `null` ohne Donut. */
45
+ confidence: number | null;
46
+ decision: ExtractionFieldDecision | null;
47
+ proposal: ExtractionJson;
48
+ text_match: boolean | null;
49
+ checks: readonly ExtractionJson[];
50
+ }
51
+ export interface ExtractionFinding {
52
+ rule_id: string;
53
+ rule_name: string;
54
+ severity: 'INFO' | 'WARN' | 'CRITICAL';
55
+ outcome: 'PASS' | 'FAIL' | 'REVIEW';
56
+ message: string;
57
+ evidence: ExtractionJson;
58
+ }
59
+ export interface ExtractionOcrSummary {
60
+ engine: string;
61
+ avg_confidence: number;
62
+ min_confidence: number;
63
+ max_confidence: number;
64
+ pages_processed: number;
65
+ pages_failed: number;
66
+ duration_ms: number;
67
+ retries: number;
68
+ quality: ExtractionOcrQuality;
69
+ }
70
+ export interface ExtractionRun {
71
+ contract: string;
72
+ library: string;
73
+ profile: {
74
+ id: string;
75
+ version: string;
76
+ fingerprint: string;
77
+ status: string;
78
+ };
79
+ run: {
80
+ run_id: string;
81
+ status: ExtractionRunStatus;
82
+ needs_review: boolean;
83
+ error_code: string | null;
84
+ error: string | null;
85
+ retryable: boolean;
86
+ completed_stages: readonly string[];
87
+ hash_chain: readonly string[];
88
+ duration_ms: number | null;
89
+ };
90
+ document: {
91
+ filename: string;
92
+ sha256: string;
93
+ size_bytes: number | null;
94
+ mime_type: string | null;
95
+ page_count: number | null;
96
+ };
97
+ ocr: ExtractionOcrSummary | null;
98
+ pages: readonly {
99
+ page: number;
100
+ confidence: number | null;
101
+ text: string;
102
+ }[];
103
+ fields: readonly ExtractedField[];
104
+ findings: readonly ExtractionFinding[];
105
+ flags: readonly string[];
106
+ stored: boolean;
107
+ }
108
+ /**
109
+ * Schnittstelle der Komponente zur Fachlogik; Standardumsetzung:
110
+ * `createExtractionRestPort`. Die Oberfläche erkennt nichts selbst.
111
+ */
112
+ export interface ExtractionPort {
113
+ catalogue(): Promise<ExtractionCatalogue>;
114
+ run(file: Blob, filename: string, profile: string): Promise<ExtractionRun>;
115
+ }
@@ -0,0 +1,35 @@
1
+ import { Locale, Translate } from '../i18n';
2
+ import { ExtractionMessageKey } from './messages';
3
+ import { ExtractedField, ExtractionCatalogue, ExtractionProfile, ExtractionRun, ExtractionJson, ExtractionFinding } from './types';
4
+ export type ExtractionTranslate = Translate<ExtractionMessageKey>;
5
+ export type ExtractionTone = 'success' | 'warning' | 'danger' | 'neutral';
6
+ /** Dateigröße in MiB (bzw. KiB unter 1 MiB). */
7
+ export declare function extractionSizeText(bytes: number, locale: Locale): string;
8
+ export declare function extractionProfileText(profile: ExtractionProfile, t: ExtractionTranslate): string;
9
+ export declare function extractionFieldLabel(name: string, t: ExtractionTranslate): string;
10
+ export declare function extractionRuleLabel(finding: ExtractionFinding, t: ExtractionTranslate): string;
11
+ /** Wert eines Feldes als Text (Zahlen sprachabhängig, Listen mit Komma). */
12
+ export declare function extractionValueText(value: ExtractionJson, locale: Locale): string;
13
+ export declare function extractionConfidenceText(value: number | null, locale: Locale): string;
14
+ /** Ton einer Feldkonfidenz gegen den Schwellwert des Profils. */
15
+ export declare function extractionConfidenceTone(value: number | null, threshold: number | null): ExtractionTone;
16
+ export declare function extractionDecisionText(field: ExtractedField, t: ExtractionTranslate): string;
17
+ export declare function extractionDecisionTone(field: ExtractedField): ExtractionTone;
18
+ export declare function extractionStatusText(result: ExtractionRun, t: ExtractionTranslate): string;
19
+ export declare function extractionStatusTone(result: ExtractionRun): ExtractionTone;
20
+ export declare function extractionDocumentText(result: ExtractionRun, t: ExtractionTranslate): string;
21
+ export declare function extractionOcrText(result: ExtractionRun, t: ExtractionTranslate, locale: Locale): string;
22
+ /** Auffällige Befunde (nicht bestanden, prüfen) zuerst nach Gewicht; bestandene getrennt. */
23
+ export declare function splitExtractionFindings(findings: readonly ExtractionFinding[]): {
24
+ open: ExtractionFinding[];
25
+ passed: ExtractionFinding[];
26
+ };
27
+ export declare function extractionOutcomeTone(finding: ExtractionFinding): ExtractionTone;
28
+ /** Schwellwert der Feldkonfidenz des gelaufenen Profils (nur Donut). */
29
+ export declare function extractionFieldThreshold(catalogue: ExtractionCatalogue | null, result: ExtractionRun): number | null;
30
+ /** Dateiauswahl der Oberfläche (`accept`) aus den zulässigen Typen. */
31
+ export declare function extractionAccept(catalogue: ExtractionCatalogue | null): string;
32
+ /** Donut-Vorschlag, wenn er nicht übernommen wurde (sonst leer). */
33
+ export declare function extractionProposalText(field: ExtractedField, t: ExtractionTranslate, locale: Locale): string;
34
+ /** Meldung zur Prüfung vor dem Senden. */
35
+ export declare function extractionValidationText(validation: 'needFile' | 'tooLarge' | 'profile', catalogue: ExtractionCatalogue | null, t: ExtractionTranslate, locale: Locale): string;
@@ -0,0 +1,20 @@
1
+ import { Store } from '../store';
2
+ import { ExtrapolationData } from './controller';
3
+ import { SubItemRow, SubsampleRows, SubStratumRow } from './model-subsample';
4
+ /** Gerade bearbeitete Teilstichprobe: die der Einheit oder die einer ihrer Teileinheiten. */
5
+ export declare function openSubsample(state: ExtrapolationData): SubsampleRows | null;
6
+ export declare function createSubsampleActions(store: Store<ExtrapolationData>, key: (prefix: string) => string): {
7
+ /** Teilstichprobe anlegen und öffnen bzw. entfernen (der Fehler kommt dann wieder aus dem Feld). */
8
+ toggleSubsample(index: number): void;
9
+ editSubsample: (index: number | null) => void;
10
+ /** Teilstichprobe einer Teileinheit anlegen bzw. entfernen (nur in der Teilstichprobe der Einheit). */
11
+ toggleNestedSubsample(item: number): void;
12
+ editNestedSubsample: (item: number | null) => void;
13
+ updateSubsample: (change: Partial<Pick<SubsampleRows, "estimator" | "populationSize">>) => void;
14
+ addSubStratum: () => void;
15
+ updateSubStratum: (index: number, change: Partial<SubStratumRow>) => void;
16
+ removeSubStratum: (index: number) => void;
17
+ addSubItem: () => void;
18
+ updateSubItem: (item: number, change: Partial<SubItemRow>) => void;
19
+ removeSubItem: (item: number) => void;
20
+ };
@@ -0,0 +1,72 @@
1
+ import { DownloadFile } from '@auditcore/common';
2
+ import { RequestState, Store } from '../store';
3
+ import { ExtrapolationForm, ExtrapolationFormError, ExtrapolationIssues, ResidualForm, StratumRow, UnitRow } from './model';
4
+ import { EvaluationRequest, EvaluationResult, ExtrapolationCatalogue, ExtrapolationExportFormat, ExtrapolationMethod, ExtrapolationPort, ResidualResult, StratumInput, UnitInput } from './types';
5
+ export type ExtrapolationBusy = 'load' | 'evaluate' | 'residual' | 'export';
6
+ export interface ExtrapolationCallbacks {
7
+ evaluated?: (result: EvaluationResult) => void;
8
+ residualComputed?: (result: ResidualResult) => void;
9
+ failed?: (message: string) => void;
10
+ }
11
+ /** Stand der Hochrechnung; `error` ist die Meldung der letzten abgelehnten Anfrage. */
12
+ export interface ExtrapolationData extends RequestState<string> {
13
+ catalogue: ExtrapolationCatalogue | null;
14
+ form: ExtrapolationForm;
15
+ formError: ExtrapolationFormError | null;
16
+ issues: ExtrapolationIssues;
17
+ result: EvaluationResult | null;
18
+ lastRequest: EvaluationRequest | null;
19
+ residualForm: ResidualForm;
20
+ residualIssues: ExtrapolationIssues;
21
+ residual: ResidualResult | null;
22
+ /** Einheit, deren Teilstichprobe gerade bearbeitet wird. */
23
+ subsampleUnit: number | null;
24
+ /** Teileinheit dieser Teilstichprobe, deren eigene Teilstichprobe bearbeitet wird (dreistufig). */
25
+ subsampleItem: number | null;
26
+ }
27
+ export interface ExtrapolationSource {
28
+ port: () => ExtrapolationPort | null | undefined;
29
+ strata: () => readonly StratumInput[];
30
+ units: () => readonly UnitInput[];
31
+ /** Zahl → Eingabetext im Sprachformat. */
32
+ format: (value: number) => string;
33
+ callbacks?: () => ExtrapolationCallbacks;
34
+ }
35
+ export declare const INITIAL_EXTRAPOLATION: ExtrapolationData;
36
+ export declare function extrapolationMethod(state: ExtrapolationData): ExtrapolationMethod | null;
37
+ export declare function createExtrapolationController(source: ExtrapolationSource): {
38
+ setConfidence: (confidence: number | null) => void;
39
+ setProfile: (profileId: string | null) => void;
40
+ setSampleSize: (sampleSize: string) => void;
41
+ setMateriality: (materiality: string) => void;
42
+ setDesign: (design: ExtrapolationForm["design"]) => void;
43
+ setSystemAssessment: (systemAssessment: string) => void;
44
+ setPopulationUnits: (populationUnits: string) => void;
45
+ setResidual: (patch: Partial<ResidualForm>) => void;
46
+ toggleSubsample(index: number): void;
47
+ editSubsample: (index: number | null) => void;
48
+ toggleNestedSubsample(item: number): void;
49
+ editNestedSubsample: (item: number | null) => void;
50
+ updateSubsample: (change: Partial<Pick<import('./model-subsample').SubsampleRows, "estimator" | "populationSize">>) => void;
51
+ addSubStratum: () => void;
52
+ updateSubStratum: (index: number, change: Partial<import('./model-subsample').SubStratumRow>) => void;
53
+ removeSubStratum: (index: number) => void;
54
+ addSubItem: () => void;
55
+ updateSubItem: (item: number, change: Partial<import('./model-subsample').SubItemRow>) => void;
56
+ removeSubItem: (item: number) => void;
57
+ patchForm: (patch: Partial<ExtrapolationForm>) => void;
58
+ addStratum: () => void;
59
+ updateStratum: (index: number, patch: Partial<StratumRow>) => void;
60
+ removeStratum: (index: number) => void;
61
+ addUnit: () => void;
62
+ updateUnit: (index: number, patch: Partial<UnitRow>) => void;
63
+ removeUnit: (index: number) => void;
64
+ evaluate: () => Promise<void>;
65
+ computeResidual: () => Promise<void>;
66
+ exportEvaluation: (format: ExtrapolationExportFormat) => Promise<DownloadFile | null>;
67
+ store: Store<ExtrapolationData>;
68
+ load: () => Promise<void>;
69
+ applyInputs: () => void;
70
+ selectMethod: (methodId: string) => void;
71
+ };
72
+ export type ExtrapolationController = ReturnType<typeof createExtrapolationController>;
@@ -0,0 +1,9 @@
1
+ export { extrapolationMessages, type ExtrapolationMessageKey } from './messages';
2
+ export * from './model';
3
+ export { createExtrapolationRestPort } from './rest-port';
4
+ export type * from './types';
5
+ export * from './controller';
6
+ export * from './view';
7
+ export * from './model-design';
8
+ export * from './model-subsample';
9
+ export * from './view-details';
@@ -0,0 +1,3 @@
1
+ /** Texte der Hochrechnung (TER) und der Restfehlerquote (RER). */
2
+ export declare const extrapolationMessages: import('..').Catalogs<"close" | "loading" | "title" | "settings" | "method" | "exportCsv" | "explanation" | "failed" | "choose" | "colName" | "remove" | "fingerprint" | "colLabel" | "confidence" | "derivation" | "sampleSize" | "stratum" | "colValue" | "exportJson" | "errorprofile" | "statistical" | "nonStatistical" | "methodSource" | "factorProfile" | "sampleSizeHint" | "materiality" | "materialityHint" | "strata" | "strataHint" | "stratumName" | "bookValue" | "populationSize" | "systemicDelimited" | "addStratum" | "removeRow" | "units" | "unitsHint" | "unitId" | "randomError" | "systemicError" | "anomalousError" | "anomalousReason" | "anomalousCorrected" | "exhaustive" | "addUnit" | "noUnits" | "cellLabel" | "evaluate" | "issueRequired" | "issueInvalid" | "issueRange" | "issueReason" | "issueStratum" | "issueDuplicate" | "formIncomplete" | "errormethod" | "errorconfidence" | "errorstrata" | "errorunits" | "resultTitle" | "resultNotice" | "projected" | "systemic" | "anomalousUncorrected" | "anomalousExcluded" | "totalError" | "ter" | "tolerable" | "precision" | "upperLimit" | "notDeterminable" | "correctedBookValue" | "lowerLimit" | "warnings" | "colStep" | "colFormula" | "colSource" | "residualTitle" | "residualNotice" | "auditPopulation" | "terRate" | "ongoing" | "otherNegative" | "corrections" | "computeResidual" | "rer" | "rerExceeds" | "rerWithin" | "extrapolatedCorrection" | "rateAfter" | "colRow" | "colAmount" | "notApplicable" | "design" | "designsingle" | "designperiods" | "designgroups" | "designHint" | "systemAssessment" | "systemAssessmentHint" | "systemNone" | "populationUnits" | "populationUnitsHint" | "period" | "group" | "groupOptional" | "errorperiods" | "subsample" | "subsampleCreate" | "subsampleOpen" | "subsampleDrop" | "fromSubsample" | "subsampleTitle" | "subsampleHint" | "estimator" | "estimatorratio" | "estimatormean_per_unit" | "estimatorpps" | "subPopulation" | "subItems" | "subItemId" | "subStratum" | "subStrata" | "subStrataHint" | "addSubStratum" | "subsampleNestedTitle" | "nestedCreate" | "nestedOpen" | "nestedDrop" | "backToUnit" | "addSubItem" | "detailsPeriods" | "detailsGroups" | "detailsSubsamples" | "recalcTitle" | "recalcLevel" | "recalcCoefficient" | "recalcRequired" | "recalcSupports" | "recalcNotSupported" | "recalcNoRequirement" | "colBookValue" | "colProjected" | "colPrecision" | "colSampleSize" | "colObservations" | "colTer" | "colUpper" | "colConclusion" | "colRate" | "colCoverage" | "colItems">;
3
+ export type ExtrapolationMessageKey = keyof typeof extrapolationMessages.de;
@@ -0,0 +1,28 @@
1
+ import { ExtrapolationDesign, StratumInput } from './types';
2
+ export type DesignIssue = 'required' | 'invalid' | 'range' | 'reason' | 'stratum' | 'duplicate';
3
+ export interface DesignRule {
4
+ required?: boolean;
5
+ positive?: boolean;
6
+ integer?: boolean;
7
+ max?: number;
8
+ }
9
+ /** Sammelt Feldbefunde (von `model.ts` bereitgestellt). */
10
+ export interface IssueSink {
11
+ take(key: string, text: string, rule?: DesignRule): number;
12
+ flag(key: string, issue: DesignIssue): void;
13
+ }
14
+ /** Aufbau aus vorbelegten Schichten: Zeitraum oder Gruppe gesetzt? */
15
+ export declare function designOf(strata: readonly StratumInput[]): ExtrapolationDesign;
16
+ export declare function stratumPart(stratum: StratumInput): string;
17
+ /** Zeiträume in der Reihenfolge ihres ersten Auftretens. */
18
+ export declare function periodNames(parts: readonly string[]): string[];
19
+ /** Ergänzungen der Anfrage je Aufbau (Zeitraumliste, Zahl der Einheiten, Systembewertung). */
20
+ export declare function designRequest(design: ExtrapolationDesign, parts: readonly string[], populationUnits: string, systemAssessment: string, out: IssueSink): {
21
+ system_assessment?: number | undefined;
22
+ population_units?: number | undefined;
23
+ periods?: {
24
+ name: string;
25
+ }[] | undefined;
26
+ };
27
+ /** Schlüssel einer Schicht für die Zuordnung der Einheiten (je Zeitraum eindeutig). */
28
+ export declare function stratumKey(design: ExtrapolationDesign, part: string, name: string): string;
@@ -0,0 +1,40 @@
1
+ import { IssueSink } from './model-design';
2
+ import { SubsampleEstimator, SubsampleInput } from './types';
3
+ export declare const SAMPLED_PART = "Stichprobe";
4
+ export declare const EXHAUSTIVE_PART = "Vollerhebung";
5
+ /** Einheit (Stufe 1) → Teileinheit (Stufe 2) → Teileinheit (Stufe 3). */
6
+ export declare const MAX_SUBSAMPLE_DEPTH = 2;
7
+ export interface SubStratumRow {
8
+ key: string;
9
+ name: string;
10
+ bookValue: string;
11
+ populationSize: string;
12
+ }
13
+ export interface SubItemRow {
14
+ key: string;
15
+ id: string;
16
+ /** Teilschicht (nur mit eigenen Teilschichten). */
17
+ stratum: string;
18
+ bookValue: string;
19
+ random: string;
20
+ exhaustive: boolean;
21
+ /** Teilstichprobe der Teileinheit (dreistufig). */
22
+ subsample: SubsampleRows | null;
23
+ }
24
+ export interface SubsampleRows {
25
+ estimator: SubsampleEstimator;
26
+ /** Anzahl Teileinheiten der Stichprobenschicht (einfache Form, Mittelwertschätzung). */
27
+ populationSize: string;
28
+ /** Eigene Teilschichten; leer = einfache Form. */
29
+ strata: readonly SubStratumRow[];
30
+ items: readonly SubItemRow[];
31
+ }
32
+ export declare function emptySubItem(key: string, stratum?: string): SubItemRow;
33
+ export declare function emptySubStratum(key: string): SubStratumRow;
34
+ export declare function emptySubsample(): SubsampleRows;
35
+ type Format = (value: number) => string;
36
+ /** Formularzeilen einer vorbelegten Teilstichprobe (einfache Form oder mit Teilschichten). */
37
+ export declare function subsampleRows(sub: SubsampleInput | undefined, format: Format, prefix?: string): SubsampleRows | null;
38
+ /** Teilstichprobe für die Anfrage (`depth` 1 = Teilstichprobe der Einheit). */
39
+ export declare function readSubsample(rows: SubsampleRows, unitBook: number, key: string, out: IssueSink, depth?: number): SubsampleInput;
40
+ export {};
@@ -0,0 +1,92 @@
1
+ import { SubsampleRows } from './model-subsample';
2
+ import { EvaluationRequest, EvaluationResult, ExtrapolationCatalogue, ExtrapolationDesign, ExtrapolationMethod, ResidualRequest, StratumInput, UnitInput } from './types';
3
+ export interface StratumRow {
4
+ key: string;
5
+ name: string;
6
+ bookValue: string;
7
+ populationSize: string;
8
+ systemic: string;
9
+ /** Zeitraum bzw. Programm (Aufbau `periods` bzw. `groups`). */
10
+ part: string;
11
+ /** Programm bei mehreren Zeiträumen (optional, Leitfaden 6.3.4 und 7.8). */
12
+ group: string;
13
+ }
14
+ export interface UnitRow {
15
+ key: string;
16
+ id: string;
17
+ stratum: string;
18
+ bookValue: string;
19
+ random: string;
20
+ systemic: string;
21
+ anomalous: string;
22
+ reason: string;
23
+ corrected: boolean;
24
+ exhaustive: boolean;
25
+ period: string;
26
+ subsample: SubsampleRows | null;
27
+ }
28
+ export interface ExtrapolationForm {
29
+ methodId: string;
30
+ confidence: number | null;
31
+ profileId: string | null;
32
+ sampleSize: string;
33
+ /** Wesentlichkeitsschwelle in Prozent. */
34
+ materiality: string;
35
+ strata: readonly StratumRow[];
36
+ units: readonly UnitRow[];
37
+ design: ExtrapolationDesign;
38
+ /** Kategorie 1–4 der Systembewertung (Tabelle 1, Leitfaden 3.2.1) oder leer. */
39
+ systemAssessment: string;
40
+ /** Verschiedene Einheiten aller Zeiträume (nicht-statistisch, 6.4.9). */
41
+ populationUnits: string;
42
+ }
43
+ export type ExtrapolationIssue = 'required' | 'invalid' | 'range' | 'reason' | 'stratum' | 'duplicate';
44
+ export type ExtrapolationFormError = 'method' | 'confidence' | 'profile' | 'strata' | 'units' | 'periods';
45
+ export type ExtrapolationIssues = Readonly<Record<string, ExtrapolationIssue>>;
46
+ export type EvaluationValidation = {
47
+ ok: true;
48
+ request: EvaluationRequest;
49
+ } | {
50
+ ok: false;
51
+ error: ExtrapolationFormError | null;
52
+ issues: ExtrapolationIssues;
53
+ };
54
+ export interface ResidualForm {
55
+ auditPopulation: string;
56
+ /** Gesamtfehlerquote in Prozent. */
57
+ terRate: string;
58
+ ongoing: string;
59
+ otherNegative: string;
60
+ corrections: string;
61
+ }
62
+ export type ResidualValidation = {
63
+ ok: true;
64
+ request: ResidualRequest;
65
+ } | {
66
+ ok: false;
67
+ issues: ExtrapolationIssues;
68
+ };
69
+ export declare const EMPTY_RESIDUAL: ResidualForm;
70
+ export declare function emptyStratum(key: string): StratumRow;
71
+ export declare function emptyUnit(key: string, stratum?: string, period?: string): UnitRow;
72
+ type Format = (value: number) => string;
73
+ export declare function stratumRows(strata: readonly StratumInput[], format: Format): StratumRow[];
74
+ export declare function unitRows(units: readonly UnitInput[], format: Format): UnitRow[];
75
+ interface Rule {
76
+ required?: boolean;
77
+ positive?: boolean;
78
+ integer?: boolean;
79
+ max?: number;
80
+ }
81
+ /** Zahl eines Textfelds oder der Befund; leere, nicht verlangte Felder ergeben 0. */
82
+ export declare function readExtrapolationAmount(text: string, rule?: Rule): number | ExtrapolationIssue;
83
+ /** Anfrage für `POST /evaluate`; bei Befunden die Feldschlüssel mit ihrem Fehler. */
84
+ export declare function buildEvaluationRequest(catalogue: ExtrapolationCatalogue, form: ExtrapolationForm): EvaluationValidation;
85
+ /** RER-Formular aus einer Auswertung: A = Buchwert, D = Gesamtfehlerquote (in Prozent). */
86
+ export declare function residualFormFrom(result: EvaluationResult, current: ResidualForm, format: (value: number) => string): ResidualForm;
87
+ /** Anfrage für `POST /residual`; die Gesamtfehlerquote wird in Prozent eingegeben. */
88
+ export declare function buildResidualRequest(form: ResidualForm, materialityRate: number): ResidualValidation;
89
+ export declare function extrapolationMethodById(catalogue: ExtrapolationCatalogue | null, id: string): ExtrapolationMethod | null;
90
+ /** Konfidenzniveaus, die die gewählte Methode mit Tabellenwerten erlaubt. */
91
+ export declare function confidenceChoices(catalogue: ExtrapolationCatalogue, method: ExtrapolationMethod | null): readonly number[];
92
+ export {};
@@ -0,0 +1,4 @@
1
+ import { RestOptions } from '@auditcore/common';
2
+ import { ExtrapolationPort } from './types';
3
+ /** Port auf den REST-Vertrag von `auditcore_extrapolation.web` (Starlette oder FastAPI). */
4
+ export declare function createExtrapolationRestPort(options: RestOptions): ExtrapolationPort;