Skip to main content

The Report Object

A Report represents a generated analysis document. Reports are created asynchronously and include PDF and DOCX outputs when completed.

Object Structure​

Full Report (from GET /api/reports/:id)​

{
"id": "rpt_xyz789",
"case_id": "case_abc123",
"type": "technical_report",
"status": "completed",
"progress": {
"current_step": "report_generation",
"steps_completed": ["delta_v_calculation", "biomechanics_analysis", "report_generation"],
"message": "Report generation complete"
},
"output": {
"pdf_url": "https://storage.silentwitness.ai/reports/rpt_xyz789.pdf",
"docx_url": "https://storage.silentwitness.ai/reports/rpt_xyz789.docx"
},
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:45:00Z"
}

Report Summary (nested in Case)​

{
"id": "rpt_xyz789",
"status": "completed",
"type": "technical_report",
"pdf_url": "https://storage.silentwitness.ai/reports/rpt_xyz789.pdf",
"docx_url": "https://storage.silentwitness.ai/reports/rpt_xyz789.docx",
"created_at": "2024-01-15T10:30:00Z"
}

Attributes​

Core Fields​

AttributeTypeDescription
idstringUnique identifier with rpt_ prefix
case_idstringID of the associated case
typestringReport type (see below)
statusstringCurrent processing status (see below)
created_atstringISO 8601 creation timestamp
updated_atstringISO 8601 last update timestamp

Progress Object​

AttributeTypeDescription
current_stepstringStep currently being processed
steps_completedarrayArray of completed step names
messagestringHuman-readable status message

Output Object​

Available when status is completed:

AttributeTypeDescription
pdf_urlstringSigned URL to download PDF (expires in 1 hour)
docx_urlstringSigned URL to download DOCX (expires in 1 hour)

Report Types​

ValueDescription
technical_reportFull technical analysis report with crash parameters and biomechanics

Status Values​

StatusDescription
pendingReport creation accepted, processing not started
processingReport is actively being generated
completedReport is ready for download
failedReport generation failed
cancelledReport was cancelled

Processing Steps​

A technical report typically goes through these steps:

StepDescription
delta_v_calculationComputing delta-v from vehicle damage photos
biomechanics_analysisRunning biomechanics calculations for occupants
report_generationGenerating final PDF and DOCX documents

Polling for Completion​

Reports are generated asynchronously. Poll GET /api/reports/:id until status is terminal:

// Recommended polling strategy
const poll = async (reportId) => {
const maxAttempts = 180; // 15 minutes

for (let i = 0; i < maxAttempts; i++) {
const { data } = await fetch(`/api/reports/${reportId}`).then(r => r.json());

if (data.status === 'completed') return data;
if (data.status === 'failed') throw new Error(data.progress?.message);

await new Promise(r => setTimeout(r, 5000)); // 5 second intervals
}

throw new Error('Timeout');
};