Skip to content

Data Models ​

This document describes the core data type definitions in GoWherer. Source code is located in the types/ directory.

Enums ​

JourneyKind ​

Journey type, distinguishing between travel and commute modes.

typescript
export type JourneyKind = 'travel' | 'commute';
ValueDescription
travelTravel
commuteCommute

JourneyStatus ​

Journey status, indicating whether the journey is in progress.

typescript
export type JourneyStatus = 'active' | 'completed';
ValueDescription
activeIn progress
completedCompleted

MediaType ​

Media attachment type.

typescript
export type MediaType = 'photo' | 'video' | 'audio';
ValueDescription
photoPhoto
videoVideo
audioAudio

JourneyCostMode ​

Transport mode of a cost record.

typescript
export type JourneyCostMode =
  | 'metro'
  | 'rail'
  | 'bus'
  | 'taxi'
  | 'flight'
  | 'other';
ValueDescription
metroMetro
railRail / train
busBus
taxiTaxi / ride-hailing
flightFlight
otherOther

CoordinateType ​

Coordinate system type, used to distinguish WGS84 and GCJ02.

typescript
export type CoordinateType = 'wgs84' | 'gcj02';
ValueDescription
wgs84World Geodetic System 1984 (used by GPS)
gcj02China Geodetic Coordinate System 2000 (used by Amap, Tencent)

ReverseGeocodeProvider ​

Reverse geocoding service provider.

typescript
export type ReverseGeocodeProvider = 'system' | 'amap';
ValueDescription
systemSystem native geocoding
amapAmap Web API

Core Types ​

TimelineLocation ​

Location data in a timeline entry.

typescript
export type TimelineLocation = {
  latitude: number;          // Latitude (-90 ~ 90)
  longitude: number;          // Longitude (-180 ~ 180)
  accuracy?: number | null;  // Accuracy in meters, optional
  placeName?: string;        // Place name (via reverse geocoding), optional
  capturedAt?: string;       // Capture time (ISO 8601), optional
  source?: 'manual' | 'tracking'; // Source: manual picker | background tracking, optional
  coordSystem?: 'wgs84' | 'gcj02'; // Coordinate system, optional (missing = legacy data, normalized on load)
};

TimelineMedia ​

Media attachment in a timeline entry.

typescript
export type TimelineMedia = {
  id: string;                // Unique identifier (UUID)
  type: MediaType;            // Media type: photo | video | audio
  uri: string;               // Media resource URI (local path or URL)
  thumbnailUri?: string;      // Video thumbnail URI, optional
};

EntryCost ​

Transportation cost attached to a timeline entry.

typescript
export type EntryCost = {
  mode: JourneyCostMode;      // Transport mode
  amount: number;             // Amount (CNY), up to two decimal places
};

TimelineEntry ​

A single entry on the journey timeline.

typescript
export type TimelineEntry = {
  id: string;                // Unique identifier (UUID)
  createdAt: string;         // Creation time, ISO 8601 string
  text: string;               // Text content
  location?: TimelineLocation; // Associated location, optional
  media: TimelineMedia[];    // Media attachments list
  tags: string[];             // Tags list
  cost?: EntryCost;           // Transportation cost of this segment, optional
};

Journey ​

The journey entity, containing all information for a complete trip.

typescript
export type Journey = {
  id: string;                // Unique identifier (UUID)
  title: string;             // Journey title
  kind: JourneyKind;          // Journey type: travel | commute
  createdAt: string;          // Creation time, ISO 8601
  endedAt?: string;           // End time, ISO 8601, optional
  status: JourneyStatus;      // Journey status: active | completed
  tags: string[];             // Journey-level tags
  entries: TimelineEntry[];   // Timeline entries list
  trackLocations: TimelineLocation[]; // Continuous GPS track points
};

EntryTemplate ​

Entry template (defined in types/template.ts) for quick preset text and tag insertion.

typescript
export type EntryTemplate = {
  id: string;                // Unique identifier
  label: string;              // Display label
  text: string;               // Template preset text content
  tags: string[];             // Preset tags list
};

EntryTemplateConfig ​

Template configuration grouped by journey type.

typescript
export type EntryTemplateConfig = Record<JourneyKind, EntryTemplate[]>;

NearbyPlace ​

Nearby place query result.

typescript
export type NearbyPlace = {
  id: string;                // Unique place identifier
  name: string;               // Place name
  address?: string;            // Detailed address, optional
  distance?: number;           // Distance from query point (meters), optional
  latitude: number;            // Latitude
  longitude: number;           // Longitude
};

ReportTemplateId ​

Export report template identifier (defined in lib/report-templates.ts).

typescript
export type ReportTemplateId = 'classic' | 'compact';
ValueDescription
classicClassic: teal cover · timeline cards · cost table
compactCompact: single-page tight layout · blue tone

LocalePreference ​

Language preference setting.

typescript
export type LocalePreference = Locale | 'system';
export type Locale = 'en' | 'zh';

AppBackupV1 ​

Application backup data structure for data export and migration.

typescript
export type AppBackupV1 = {
  version: 1;
  exportedAt: string;
  app: {
    slug: string;
    version: string;
  };
  preferences: {
    locale: LocalePreference;
    theme: ThemePreference;
  };
  journeys: Journey[];
  entryTemplates: Record<Locale, EntryTemplateConfig>;
};

Data Flow ​

mermaid
flowchart TD
    User[User Action] --> JourneyMgmt[Journey Management]
    User --> TimelineEntry[Timeline Entry]
    User --> Cost[Transportation Cost]
    User --> Template[Template Recording]
    User --> Map[Map & Location]

    JourneyMgmt -->|create| Journey[Journey]
    JourneyMgmt -->|end| Journey
    JourneyMgmt -->|search| JourneyList[Journey List]

    TimelineEntry -->|text| TimelineEntry
    TimelineEntry -->|location| TimelineLocation
    TimelineEntry -->|media| TimelineMedia
    TimelineEntry -->|tags| TagList[Tag List]
    TimelineEntry -->|cost| EntryCost

    Template -->|travel| TravelTemplate[Travel Templates]
    Template -->|commute| CommuteTemplate[Commute Templates]

    Map --> ReverseGeocode[Reverse Geocoding]
    Map --> Track[Track Recording]
    Map --> Nearby[Nearby Places]

    Journey --> Storage[(AsyncStorage)]
    Storage --> Persistence[Data Persistence]

Storage Keys ​

All data is persisted locally via AsyncStorage with the prefix gowherer:, centrally defined in lib/storage-keys.ts.

Storage KeyData TypeDescription
gowherer:journeys:v1Journey[]All journey data
gowherer:entry-templates:v1:zhEntryTemplate[]Chinese templates
gowherer:entry-templates:v1:enEntryTemplate[]English templates
gowherer:pending-location:v1TimelineLocationPending location (temporarily stored after map picker)
gowherer:locale-preference:v1LocalePreferenceLocale preference
gowherer:theme-preference:v1ThemePreferenceTheme preference
gowherer:review-filters:v1Review filters statePersisted type/tag filters and expansion state
gowherer:geocode-cache:v1GeocodeCachePayloadReverse geocoding local cache (~110m grid keys, capped at 500 entries)

Released under the MIT License