## KART API KON Repository Rules ### Repository Role and Boundaries - This .NET 8 Web API processes and aggregates survey data for KON reporting. Treat its endpoints, report shapes, Excel output, calculation results, and operational behavior as current compatibility contracts. - Preserve the established separation among controllers, services, utilities/DAL code, DTOs, and statistics helpers while the current implementation remains active. - The application reads from several MSSQL data sources. Keep connection selection, SQL dialect, result shapes, and cross-source assumptions explicit; do not infer that similarly shaped sources are interchangeable. ### DataTable and Statistics Improvement - Excessive `DataTable` and `DataSet` usage in project, report, common, and DAL services is a primary migration concern. - Do not mechanically replace a fixed schema with `Map`. Prefer a specific DTO or record and `List`; use a typed `Map` only when survey dimensions or question keys are genuinely dynamic. - Separate database retrieval, row normalization, statistical calculation, report shaping, and Excel serialization before changing frameworks. - Treat weighting, respondent base, missing values, multiple responses, grouping, ordering, decimal precision, rounding, totals, and significance/statistical outputs as behavior contracts. - Establish representative golden-master inputs and outputs before replacing a DataTable or Accord-based calculation. Compare correctness and performance before removing the old path. ### Java Migration Direction - The approved destination is a Gradle-based Spring Boot backend migrated in bounded vertical slices. - Introduce typed Java boundary and domain models rather than reproducing DataTable semantics. Preserve external response compatibility while callers remain on the current contract. - Do not combine framework migration with an unapproved statistical-method change. ### Harness and Verification - `AGENTS.md` and `CLAUDE.md` are generated. Edit `.agent/profile.yml` or `.agent/project.md`, then recompose instead of editing generated files. - Use the solution's existing narrow build and test workflow. Do not connect to real databases or regenerate production reports during validation without separate approval.