interface SentianceFeedback {
    submitOccupantRoleFeedback(transportId: string, occupantRoleFeedback: OccupantRoleFeedback): Promise<OccupantRoleFeedbackResult>;
    submitVehicleCrashDetectionFeedback(vehicleCrashDetectionFeedback: VehicleCrashDetectionFeedback): Promise<VehicleCrashDetectionFeedbackResult>;
}

Methods

  • Submits feedback for the detected occupant role of a specified transport.

    Parameters

    • transportId: string

      The identifier of the transport for which feedback is being provided.

    • occupantRoleFeedback: OccupantRoleFeedback

      The correct occupant role.

    Returns Promise<OccupantRoleFeedbackResult>

    A Promise that resolves with a result object that you can use to check whether feedback was successfully submitted, or if it failed for a certain reason.

    This feedback is utilized to enhance the accuracy of occupant role detection in future transport instances. It is important to note that submitting feedback will not alter the occupant role currently assigned to the transport.

    import {submitOccupantRoleFeedback} from "@sentiance-react-native/event-timeline";

    const transportId = "some_transport_id";
    let result = await submitOccupantRoleFeedback(transportId, "DRIVER");
  • Submits feedback about a vehicle crash, whether it was detected and reported by the Sentiance SDK or occurred in real life but was not detected.

    Parameters

    Returns Promise<VehicleCrashDetectionFeedbackResult>

    A Promise that resolves with a result object that you can use to check whether feedback was successfully submitted, or if it failed for a certain reason.

    This feedback is used by Sentiance to analyze incidents and improve the accuracy and reliability of future crash detections.

    import {submitVehicleCrashDetectionFeedback} from "@sentiance-react-native/event-timeline";

    const feedback: VehicleCrashDetectionFeedback = {
    type: "CRASH",
    crashTimeEpoch: 1761048047000,
    wasCrashDetectedBySentiance: true,
    crashLocation: {
    latitude: 5.66,
    longitude: -2.45
    }
    };
    const result = await submitVehicleCrashDetectionFeedback(feedback);

    switch (result) {
    case "ACCEPTED": {
    console.log("Feedback accepted.");
    break;
    }
    case "INVALID_EVENT_DATE": {
    console.warn("The provided event date is in the future, or too old.");
    break;
    }
    case "INVALID_LOCATION": {
    console.warn("The provided crash location was invalid.");
    break;
    }
    case "FEEDBACK_ALREADY_PROVIDED": {
    console.warn("Feedback already provided for an event with the given date.");
    break;
    }
    case "NO_USER": {
    console.warn("SDK not initialized with a user.");
    break;
    }
    default: {
    // Exhaustiveness check
    const _exhaustive: never = result;
    throw new Error(`Unhandled result: ${_exhaustive}`);
    }
    }