Skip to main content

Get Result

Retrieve the status and download URL for a biomechanics analysis report.

Request Parameters

ParameterTypeRequiredDescription
reportIdstringYesReport ID from CreateReport response

Response

FieldTypeDescription
reportIdstringReport identifier
statusstringCurrent status (see below)
reportUrlstringDownload URL (only when status is "completed")
occupantIdstringOccupant identifier
occupantNamestringOccupant name for reference

Status Values

  • pending - Report queued for processing
  • processing - Analysis in progress
  • completed - Report ready for download
  • failed - Analysis failed (contact support)

Examples

Basic Status Check

import "github.com/silentwitness/go-sdk"

silentwitness.Key = "sk_test_..."

// Get report status
result, err := silentwitness.BiomechanicsAnalysis.GetResult(ctx, &silentwitness.GetBiomechanicsResultRequest{
ReportId: "bio_abc123",
})
if err != nil {
log.Fatal(err)
}

fmt.Printf("Status: %s\n", result.Status)
if result.Status == "completed" && result.ReportUrl != nil {
fmt.Printf("Download: %s\n", *result.ReportUrl)
}

Polling for Completion

import (
"time"
"github.com/silentwitness/go-sdk"
)

// Poll until report is ready
func waitForReport(reportId string) (*silentwitness.GetBiomechanicsResultResponse, error) {
maxAttempts := 60
pollInterval := 10 * time.Second

for attempt := 0; attempt < maxAttempts; attempt++ {
result, err := silentwitness.BiomechanicsAnalysis.GetResult(ctx, &silentwitness.GetBiomechanicsResultRequest{
ReportId: reportId,
})
if err != nil {
return nil, err
}

if result.Status == "completed" {
return result, nil
}

if result.Status == "failed" {
return nil, fmt.Errorf("report generation failed")
}

time.Sleep(pollInterval)
}

return nil, fmt.Errorf("timeout waiting for report")
}

// Use the polling function
result, err := waitForReport("bio_abc123")
if err != nil {
log.Fatal(err)
}

fmt.Printf("Report ready: %s\n", *result.ReportUrl)

Monitoring Multiple Reports

// Check status of multiple reports from multi-occupant analysis
async function checkAllReports(reportIds: string[]) {
const results = await Promise.all(
reportIds.map(id => getBiomechanicsResult({ reportId: id }))
);

results.forEach((result, index) => {
console.log(`Occupant ${index + 1} (${result.occupantName}): ${result.status}`);
if (result.status === "completed") {
console.log(` Download: ${result.reportUrl}`);
}
});

return results;
}

// After creating multi-occupant analysis
const createResponse = await createBiomechanicsReport({
caseId: "case_123",
occupants: [/* driver and passenger */]
});

// Check all report statuses
await checkAllReports(createResponse.reportIds);

Timing Expectations

ComplexityTypical Duration
Single injury2-5 minutes
Multiple injuries (2-3)5-8 minutes
Complex multi-injury8-15 minutes
Pregnancy complications10-15 minutes

Note: Times vary based on system load and analysis complexity.

  1. Initial delay: Wait 2 minutes before first poll
  2. Poll interval: Check every 10 seconds
  3. Timeout: Give up after 15 minutes
  4. Exponential backoff: Increase interval for long-running reports
// Optimized polling with initial delay
async function smartPoll(reportId: string) {
// Wait 2 minutes before first check
await new Promise(resolve => setTimeout(resolve, 120000));

let interval = 10000; // Start with 10 seconds
const maxInterval = 30000; // Max 30 seconds
const timeout = 900000; // 15 minutes total
const startTime = Date.now();

while (Date.now() - startTime < timeout) {
const result = await getBiomechanicsResult({ reportId });

if (result.status === "completed" || result.status === "failed") {
return result;
}

await new Promise(resolve => setTimeout(resolve, interval));

// Gradually increase interval (exponential backoff)
interval = Math.min(interval * 1.2, maxInterval);
}

throw new Error("Timeout");
}

Downloading Reports

The reportUrl field contains a relative path. Construct the full URL:

const fullUrl = `https://api.silentwitness.com${result.reportUrl}`;

// Download the PDF
const response = await fetch(fullUrl, {
headers: {
'Authorization': `Bearer ${apiKey}`
}
});

const pdfBlob = await response.blob();
// Save or display PDF

Errors

CodeDescription
NOT_FOUNDReport ID not found or belongs to different account
PERMISSION_DENIEDReport not accessible
UNAUTHENTICATEDInvalid or missing API key

Report Contents

When status is completed, the PDF report includes:

  • Executive Summary - Key findings
  • Occupant Profile - Demographics and physical data
  • Crash Reconstruction - Impact analysis
  • Injury-Specific Analysis - For each alleged injury:
    • Force calculations
    • Medical tolerance thresholds
    • Risk assessment
    • Causation analysis
  • Medical Literature - Research citations
  • Expert Opinion - Professional conclusions
  • Appendices - Detailed methodology

Best Practices

Efficient Polling

  • Don't poll immediately; wait 2 minutes
  • Use exponential backoff for long-running reports
  • Set reasonable timeouts (15 minutes recommended)

Error Handling

  • Check for failed status and alert users
  • Retry on transient network errors
  • Log report IDs for support requests

Multi-Occupant Reports

  • Poll all reports in parallel using Promise.all
  • Track progress per occupant
  • Handle partial completion gracefully

Storage

  • Download and store PDFs on your servers
  • Don't rely on report URLs being permanent
  • Cache completed reports to avoid re-downloading

Next Steps