Skip to content

Conversation

@regeter
Copy link
Contributor

@regeter regeter commented Sep 30, 2025

feat: Refactor Data Loading to Support Multiple Data Sources

PR Description

This PR introduces a significant refactor of the data loading and normalization pipeline to support multiple data sources.

The Problem

The application's data pipeline was tightly coupled to the Google Cloud Logging format. Integrating a new data source with a different format (snake_case keys)

The Solution

This PR addresses these issues by re-architecting the data pipeline and improving our utilities.

1. Multi-Source Data Loading & UI (DatasetLoading.js, App.js)

  • A new DatasetLoading.js component provides a unified modal for selecting a data source: Cloud Logging, the new "Extra" data source, or a local file upload.
  • The UI now clearly indicates the active data source and provides a clean, intuitive user experience.
  • App.js has been refactored to handle the data from any of these sources and pass it to a unified processing pipeline.

2. Centralized & Corrected Normalization Pipeline (localStorage.js)

  • Critical Bug Fix: The ensureCorrectFormat function is now the single source of truth for data processing. It correctly performs the TOS-restricted log merge first on raw, unmodified data, preserving the insertId keys needed for the lookup.
  • After the merge is complete, a robust normalization function (parseJsonContent) is applied to every log. This recursively lowercases and removes underscores from all keys, ensuring all data is stored in a clean, consistent format, regardless of its origin.
  • The pipeline now correctly handles three distinct input formats: our app's own export format, raw Cloud Logging exports, and raw payload arrays.

3. Enhanced Logging Utility (Utils.js)

  • The log() function has been significantly improved to be the primary utility for all console and toast notifications.
  • It can now create toasts of different levels by passing a keyword (e.g., log('message', 'success')).
  • It automatically infers an 'error' type if an Error object is passed as an argument (e.g., log('Something failed', error)).

4. Additional Bug Fix (commit: fix: GPS toggle...)

  • Resolves an issue where toggling the GPS view could cause the currently selected row in the log table to become deselected or "blanked out".

5. package.json script updates.

  • Lint all command that also fixes.
  • Deploy command with variables

@regeter regeter merged commit 16f1e8b into googlemaps:main Sep 30, 2025
9 checks passed
github-actions bot pushed a commit that referenced this pull request Sep 30, 2025
* feat: Utils better log() and padUtcTimestamp

* feat: refactor logs loading to enable extra datasource

* fix: GPS toggle could blank out current row

* feat: lintfix and better deploy 16f1e8b
googlemaps-bot pushed a commit that referenced this pull request Sep 30, 2025
## [1.21.0](v1.20.8...v1.21.0) (2025-09-30)

### Features

* Refactor Data Loading to Support Multiple Data Sources ([#255](#255)) ([16f1e8b](16f1e8b))
@googlemaps-bot
Copy link
Contributor

🎉 This PR is included in version 1.21.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants