StartAnalysis
The single entry point for case analysis. Provide your evidence data and receive complete case analytics with progress tracking.
What It Does
StartAnalysis handles the entire workflow automatically:
- Creates a case (or uses existing
caseId) - Uploads files (vehicle images, EDR data)
- Runs crash analysis (Delta-V, PDOF calculations)
- Runs biomechanics (if occupants provided)
- Computes analytics (scores, strengths, recommendations)
Quick Example
- Go
- TypeScript
poller, err := silentwitness.StartAnalysis(ctx, &silentwitness.AnalyzeCaseRequest{
OrganizationID: silentwitness.String("org_abc123"),
CaseName: silentwitness.String("Smith v. Jones"),
Plaintiff: &silentwitness.VehicleAnalysisData{
Images: [][]byte{img1, img2},
},
})
if err != nil {
log.Fatal(err)
}
// Wait for completion
for !poller.Done() {
fmt.Printf("Status: %s\n", poller.StatusMessage())
time.Sleep(5 * time.Second)
}
result, err := poller.Result()
fmt.Printf("Score: %d/100\n", result.Analytics.OverallScore)
const poller = startAnalysis(client, {
organizationId: "org_abc123",
caseName: "Smith v. Jones",
plaintiff: {
images: [img1, img2],
},
});
// Wait for completion
while (!poller.isDone()) {
console.log(`Status: ${poller.getStatusMessage()}`);
await new Promise(r => setTimeout(r, 5000));
}
const result = await poller.wait();
console.log(`Score: ${result.analytics.overallScore}/100`);
Signature
- Go
- TypeScript
// Package-level function (uses global Key)
func StartAnalysis(ctx context.Context, req *AnalyzeCaseRequest) (*AnalysisPoller, error)
function startAnalysis(
client: SilentWitnessClient,
request: AnalyzeCaseRequest
): AnalysisPoller
Request Parameters
AnalyzeCaseRequest
| Parameter | Type | Required | Description |
|---|---|---|---|
organizationId | string | Yes | Organization to associate case with |
caseId | string | No | Existing case ID (creates new if not provided) |
caseName | string | No | Name for new case |
clientName | string | No | Client name |
plaintiff | VehicleAnalysisData | Yes | Plaintiff vehicle data |
defendant | VehicleAnalysisData | No | Defendant vehicle data |
occupants | OccupantAnalysisData[] | No | Include for biomechanics analysis |
accidentDescription | string | No | Narrative description |
accidentDate | string | No | Date in YYYY-MM-DD format |
pollingInterval | duration | No | Poll frequency (default: 5s) |
maxWaitTime | duration | No | Maximum wait time (default: 30m) |
VehicleAnalysisData
| Field | Type | Required | Description |
|---|---|---|---|
images | []bytes | Yes* | Vehicle damage photos (JPEG/PNG) |
edrFile | bytes | Yes* | EDR file contents |
vehicleMake | string | No | e.g., "Toyota" |
vehicleModel | string | No | e.g., "Camry" |
vehicleYear | string | No | e.g., "2020" |
seatbelt | bool | No | Seatbelt worn (default: true) |
*At least one of images or edrFile is required for plaintiff.
OccupantAnalysisData
| Field | Type | Required | Description |
|---|---|---|---|
name | string | No | Occupant name |
age | int | Yes | Age (1-120) |
gender | string | Yes | "male", "female", "other" |
position | string | Yes | "driver", "front_passenger", "rear_left", "rear_center", "rear_right" |
allegedInjuries | []string | Yes | Injury types (see below) |
preExisting | string | No | Pre-existing conditions |
Injury Types: head_brain, cervical_spine, thoracic_spine, lumbar_spine, shoulder, hip, knee, foot_ankle
AnalysisPoller
The poller provides methods to track progress and retrieve results.
- Go
- TypeScript
| Method | Return Type | Description |
|---|---|---|
Status() | AnalysisStatus | Current status |
StatusMessage() | string | Status details |
Done() | bool | True if complete |
Result() | (*AnalyzeCaseResult, error) | Get result |
Wait(ctx) | (*AnalyzeCaseResult, error) | Block until complete |
Cancel() | - | Cancel the analysis |
| Method | Return Type | Description |
|---|---|---|
getStatus() | AnalysisStatus | Current status |
getStatusMessage() | string | Status details |
isDone() | boolean | True if complete |
getResult() | AnalyzeCaseResult | undefined | Get result |
getError() | Error | undefined | Get error if failed |
wait() | Promise<AnalyzeCaseResult> | Wait for completion |
Status Values
| Status | Description |
|---|---|
creating_case | Creating the case |
uploading_files | Uploading images and EDR |
analyzing_crash | Running crash analysis |
analyzing_biomechanics | Running biomechanics (if occupants provided) |
computing_analytics | Computing case analytics |
completed | Analysis finished |
failed | Analysis failed |
Response
AnalyzeCaseResult
| Field | Type | Description |
|---|---|---|
caseId | string | The case ID |
analytics | CaseAnalytics | Case strength analysis |
reports | AnalysisReports | Generated report URLs |
CaseAnalytics
| Field | Type | Description |
|---|---|---|
overallScore | int | 0-100 case strength score |
category | string | "Strong Case", "Moderate Case", "Weak Case" |
metrics | []CaseMetric | Individual metric scores |
strengths | []string | Case strengths (markdown) |
weaknesses | []string | Case weaknesses (markdown) |
recommendations | []string | Recommendations (markdown) |
Timing
Analysis typically takes 2-5 minutes depending on data volume.
See Also
- Analyzing a Case Guide - Step-by-step tutorial
- Case Analytics Overview - Understanding analytics output