sdac-upload-cost-report
Purpose
Registers a processed cost report in SDAC storage and returns a report_id plus basic metadata for downstream validation.
Tool type
Deterministic (rule-based)
Tool ID
sdac-upload-cost-report
Inputs
report_id(string, optional): Existing report identifier (required for SQL-only flow).district_id(string): District identifier.quarter(string): Quarter label (for example,Q1-2024).report_name(string, optional): Custom display name.file_path/file_data(optional): Accepted by schema but currently rejected in SQL-only mode (ingestion happens upstream).
Outputs
successflagreport_idtotal_records_loadednext_steps
Example output
{
"success": true,
"report_id": "SDAC-2024-Q2-001",
"total_records_loaded": 84,
"next_steps": [
"Run report analysis workflow",
"Review source-code and linkage findings"
]
}
Functional details
- Registers report metadata already ingested by the pipeline.
- Counts personnel rows for basic completeness checks.
- Returns a recommended validation order in
next_steps.
Usage notes
- Use this after the ingestion service has already processed the Excel file.
- This tool validates the report exists in
SDAC.data_CostReportsbefore returning metadata.
Implementation details
- SQL-only flow: The tool requires
report_id; it rejectsfile_pathandfile_datain the current server-side flow. - Data checks: Queries
SDAC.data_CostReportsfor the report andSDAC.data_PersonnelRecordsfor the row count. - Next steps: Returns a fixed
next_stepslist to guide validation order. - Storage path: Uses
executeSqlfrompackages/platform-data/src/sqlserver-client.tsto run parameterized queries. - Error handling: Missing report rows throw a structured error (
Report not found in SDAC.data_CostReports).
Code Location: packages/domain-sdac/src/tools/upload-cost-report.tool.ts