Skip to main content

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:

  1. Creates a case (or uses existing caseId)
  2. Uploads files (vehicle images, EDR data)
  3. Runs crash analysis (Delta-V, PDOF calculations)
  4. Runs biomechanics (if occupants provided)
  5. Computes analytics (scores, strengths, recommendations)

Quick Example

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)

Signature

// Package-level function (uses global Key)
func StartAnalysis(ctx context.Context, req *AnalyzeCaseRequest) (*AnalysisPoller, error)

Request Parameters

AnalyzeCaseRequest

ParameterTypeRequiredDescription
organizationIdstringYesOrganization to associate case with
caseIdstringNoExisting case ID (creates new if not provided)
caseNamestringNoName for new case
clientNamestringNoClient name
plaintiffVehicleAnalysisDataYesPlaintiff vehicle data
defendantVehicleAnalysisDataNoDefendant vehicle data
occupantsOccupantAnalysisData[]NoInclude for biomechanics analysis
accidentDescriptionstringNoNarrative description
accidentDatestringNoDate in YYYY-MM-DD format
pollingIntervaldurationNoPoll frequency (default: 5s)
maxWaitTimedurationNoMaximum wait time (default: 30m)

VehicleAnalysisData

FieldTypeRequiredDescription
images[]bytesYes*Vehicle damage photos (JPEG/PNG)
edrFilebytesYes*EDR file contents
vehicleMakestringNoe.g., "Toyota"
vehicleModelstringNoe.g., "Camry"
vehicleYearstringNoe.g., "2020"
seatbeltboolNoSeatbelt worn (default: true)

*At least one of images or edrFile is required for plaintiff.

OccupantAnalysisData

FieldTypeRequiredDescription
namestringNoOccupant name
ageintYesAge (1-120)
genderstringYes"male", "female", "other"
positionstringYes"driver", "front_passenger", "rear_left", "rear_center", "rear_right"
allegedInjuries[]stringYesInjury types (see below)
preExistingstringNoPre-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.

MethodReturn TypeDescription
Status()AnalysisStatusCurrent status
StatusMessage()stringStatus details
Done()boolTrue if complete
Result()(*AnalyzeCaseResult, error)Get result
Wait(ctx)(*AnalyzeCaseResult, error)Block until complete
Cancel()-Cancel the analysis

Status Values

StatusDescription
creating_caseCreating the case
uploading_filesUploading images and EDR
analyzing_crashRunning crash analysis
analyzing_biomechanicsRunning biomechanics (if occupants provided)
computing_analyticsComputing case analytics
completedAnalysis finished
failedAnalysis failed

Response

AnalyzeCaseResult

FieldTypeDescription
caseIdstringThe case ID
analyticsCaseAnalyticsCase strength analysis
reportsAnalysisReportsGenerated report URLs

CaseAnalytics

FieldTypeDescription
overallScoreint0-100 case strength score
categorystring"Strong Case", "Moderate Case", "Weak Case"
metrics[]CaseMetricIndividual metric scores
strengths[]stringCase strengths (markdown)
weaknesses[]stringCase weaknesses (markdown)
recommendations[]stringRecommendations (markdown)

Timing

Analysis typically takes 2-5 minutes depending on data volume.

See Also