Skip to main content

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

  • success flag
  • report_id
  • total_records_loaded
  • next_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_CostReports before returning metadata.

Implementation details

  • SQL-only flow: The tool requires report_id; it rejects file_path and file_data in the current server-side flow.
  • Data checks: Queries SDAC.data_CostReports for the report and SDAC.data_PersonnelRecords for the row count.
  • Next steps: Returns a fixed next_steps list to guide validation order.
  • Storage path: Uses executeSql from packages/platform-data/src/sqlserver-client.ts to 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