From 12e80295e2600439d714cb0131cae98e252bb811 Mon Sep 17 00:00:00 2001 From: Katie Rischpater <98350084+the-bay-kay@users.noreply.github.com> Date: Tue, 7 Nov 2023 14:55:44 -0800 Subject: [PATCH] Expanded diaryTypes - these types are used by timelineHelper --- www/js/types/diaryTypes.ts | 85 ++++++++++++++++++++++++++++++++++---- 1 file changed, 76 insertions(+), 9 deletions(-) diff --git a/www/js/types/diaryTypes.ts b/www/js/types/diaryTypes.ts index 14d8acc07..4f10fb50f 100644 --- a/www/js/types/diaryTypes.ts +++ b/www/js/types/diaryTypes.ts @@ -12,39 +12,71 @@ export type UserInputData = { match_id?: string; }; -type ConfirmedPlace = any; // TODO +export type TripTransition = { + currstate: string; + transition: string; + ts: number; +}; + +export type ObjId = { + $oid: string; // objIds have len 24 +}; + +export type LocationCoord = { + type: string; // e.x., "Point" + coordinates: [number, number]; +}; + +type ConfirmedPlace = { + cleaned_place: { + string; + }; + additions: Array; // Todo + ender_local_dt: LocalDt; + starting_trip: ObjId; + exit_fmt_time: string; // ISO + exit_local_dt: LocalDt; + enter_ts: number; + source: string; + enter_fmt_time: string; + raw_places: Array; + location: LocationCoord; + exit_ts: number; + ending_trip: ObjId; + user_input: {}; //todo +}; export type CompositeTrip = { - _id: { $oid: string }; + _id: ObjId; additions: any[]; // TODO cleaned_section_summary: any; // TODO - cleaned_trip: { $oid: string }; + cleaned_trip: ObjId; confidence_threshold: number; - confirmed_trip: { $oid: string }; + confirmed_trip: ObjId; distance: number; duration: number; end_confirmed_place: ConfirmedPlace; end_fmt_time: string; end_loc: { type: string; coordinates: number[] }; end_local_dt: LocalDt; - end_place: { $oid: string }; + end_place: ObjId; end_ts: number; expectation: any; // TODO "{to_label: boolean}" - expected_trip: { $oid: string }; + expected_trip: ObjId; inferred_labels: any[]; // TODO inferred_section_summary: any; // TODO - inferred_trip: { $oid: string }; + inferred_trip: ObjId; key: string; locations: any[]; // TODO origin_key: string; - raw_trip: { $oid: string }; + raw_trip: ObjId; sections: any[]; // TODO source: string; start_confirmed_place: ConfirmedPlace; start_fmt_time: string; start_loc: { type: string; coordinates: number[] }; start_local_dt: LocalDt; - start_place: { $oid: string }; + start_place: ObjId; start_ts: number; user_input: UserInput; }; @@ -73,3 +105,38 @@ export type TlEntry = { duration: number; getNextEntry?: () => PopulatedTrip | ConfirmedPlace; }; + +export type Location = { + speed: number; + heading: number; + local_dt: LocalDt; + idx: number; + section: ObjId; + longitude: number; + latitude: number; + fmt_time: string; // ISO + mode: number; + loc: LocationCoord; + ts: number; // Unix + altitude: number; + distance: number; +}; + +// used in readAllCompositeTrips +export type SectionData = { + end_ts: number; // Unix time, e.x. 1696352498.804 + end_loc: LocationCoord; + start_fmt_time: string; // ISO time + end_fmt_time: string; + trip_id: ObjId; + sensed_mode: number; + source: string; // e.x., "SmoothedHighConfidenceMotion" + start_ts: number; // Unix + start_loc: LocationCoord; + cleaned_section: ObjId; + start_local_dt: LocalDt; + end_local_dt: LocalDt; + sensed_mode_str: string; //e.x., "CAR" + duration: number; + distance: number; +};