-
Notifications
You must be signed in to change notification settings - Fork 0
Feat/analytics reporting engine #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
133 commits
Select commit
Hold shift + click to select a range
f192dac
feat(analytics): add environment variables for analytics providers
fulleni 69aa290
build(core): update dependency ref
fulleni 18403c9
feat(analytics): expose analytics credentials in EnvironmentConfig
fulleni d052b75
feat(analytics): add models for Google Analytics Data API responses
fulleni d8c9d96
feat(analytics): add models for Mixpanel API responses
fulleni 968d7bc
chore: barrels
fulleni 41be562
feat(analytics): define abstract analytics reporting client
fulleni 51d464a
feat(analytics): implement Google Analytics data client
fulleni 124dbfd
feat(analytics): implement Mixpanel data client
fulleni ba0bf50
chore: add intl dep
fulleni 0235fe7
feat(analytics): implement analytics sync service
fulleni ec9624a
feat(analytics): create entry point for analytics sync worker
fulleni 53ebe1e
feat(analytics): add analytics read permission
fulleni 41d76f2
feat(analytics): grant analytics permission to admin role
fulleni 8ac9b80
feat(analytics): register analytics operations and remove dashboard s…
fulleni 5a73c57
fix: miss import
fulleni 1c019d5
feat(analytics): register analytics operations and remove dashboard s…
fulleni 2e33fc5
feat(analytics): seed analytics data collections
fulleni 323d9ff
chore: enhance class docs
fulleni fa9fd9b
refactor(registry): remove dashboard_summary model config
fulleni ab10f82
feat(analytics): enhance analytics sync service with headline and met…
fulleni 0321884
refactor(middleware): replace DashboardSummaryService with individual…
fulleni 9fe08f8
feat(analytics): implement getRankedList method for Google Analytics
fulleni 6bc592f
feat(analytics): implement ranked list functionality and enhance metr…
fulleni 42edc96
feat(analytics): implement metric mapper for analytics providers
fulleni 090a946
feat(analytics): implement synchronous data fetching and mapping for …
fulleni 5084570
feat(analytics): add analytics metric mapper export
fulleni 3908c30
refactor(dependencies): remove redundant instance call
fulleni 89ad504
build(serialization): sync
fulleni 7093c5e
feat(analytics): introduce structured AnalyticsQuery model
fulleni f5bd373
chore: barrels
fulleni dcfbe65
refactor(analytics): update client interface to use AnalyticsQuery
fulleni b99fb99
refactor(analytics): implement full logic in GoogleAnalyticsDataClient
fulleni af8477d
refactor(analytics): implement full logic in MixpanelDataClient
fulleni 417bc53
feat(analytics): overhaul AnalyticsMetricMapper
fulleni a45d447
refactor(analytics): simplify AnalyticsSyncService to an orchestrator
fulleni c6d0d18
refactor(analytics): introduce specific metric query types
fulleni c0fb986
feat(analytics): add strongly-typed GA4 request models
fulleni 7d31d78
chore: barrels
fulleni acb71aa
refactor(analytics): update client interface for type safety
fulleni b38de13
feat(analytics): fully implement all card ID mappings
fulleni 2e2f286
refactor(analytics): use typed request models in GA4 client
fulleni 512ff2a
refactor(analytics): align Mixpanel client with new patterns
fulleni 2c34f59
feat(analytics): implement internal database metric queries
fulleni c284eef
feat(analytics): provide additional repositories to sync service
fulleni 066f754
fix(analytics): add fromJson factories to GA4 request models
fulleni 2b73f3b
feat(analytics): add strongly-typed Mixpanel request models
fulleni 0609d5b
chore: barrels
fulleni d71c535
fix(analytics): correct type definitions in AnalyticsMetricMapper
fulleni 422b0c4
refactor(analytics): use typed request models in Mixpanel client
fulleni 68a3275
feat(analytics): implement all database queries and trend calculation
fulleni 4034897
docs(README): enhance documentation with analytics engine and archite…
fulleni 7243e95
build(serialization): sync
fulleni 894f197
refactor(analytics): extract database query logic to AnalyticsQueryBu…
fulleni efbf13f
feat(dependencies): add report repository to app dependencies
fulleni ea8e97b
refactor(analytics): enhance Mixpanel request models
fulleni a0fb554
refactor(analytics): enhance documentation and prepare for local data…
fulleni 87b0c58
feat(analytics): add engagement and app review repositories to Analyt…
fulleni 0f1eeb5
style(analytics): add missing semicolons in MixpanelTimeUnit enum
fulleni f61e2ed
refactor(analytics): reorganize and simplify database queries
fulleni a80c9b5
feat(analytics): add query builder for database metrics
fulleni d6c7eaf
chore(core): update core repository ref to eeb2e42
fulleni b5be136
style: format
fulleni 68a370e
build(serialization): sync
fulleni 93eaae7
chore: misc
fulleni 5a5793a
chore: barrel
fulleni 6ddd813
refactor(analytics): improve database query handling and repo selection
fulleni 64b2e9d
feat(analytics): add pipelines for ranking sources and topics by foll…
fulleni c8ed729
feat(analytics): implement new database metrics and improve date hand…
fulleni c257ff5
feat(analytics): add support for calculated metrics and new database …
fulleni de4099a
refactor(analyticsref): update content metrics for ChartCard
fulleni cdf8b87
refactor(analytics): replace follower metrics with new distributions
fulleni 8b136c4
fix(analytics): include 'reportsByReason' metric in report repository
fulleni 5bde2fd
feat(analytics): add logging for database analytics pipelines
fulleni 7152464
fix(analytics): correct label formatting and pass client to calculate…
fulleni a7adc93
chore: update core repository ref in pubspec.yaml
fulleni e6491bb
refactor(analytics): update ChartCardId enum values to camelCase
fulleni ea36204
style: format
fulleni c4a1c6f
refactor(database): remove analytics placeholder seeding
fulleni ff38821
feat(database): ensure analytics indexes for collections
fulleni 5ad27a8
docs(env): update analytics providers section and reorder configurati…
fulleni 6b75916
fix(database): use runCommand for creating indexes to prevent unique …
fulleni c2cd4ff
chore: update dep version
fulleni d8c99ef
build(serialization): sync
fulleni a3d0457
refactor(analytics): enhance Google Analytics request model
fulleni dda19ec
fix(analytics): add JSON serialization for Mixpanel requests
fulleni 9cda15e
fix(analytics): add missing metric query for content topics engagement
fulleni 17e19a1
feat(analytics): add topic engagement query and improve source status…
fulleni 015c8d2
refactor(analytics): improve MixpanelDataClient testability and modul…
fulleni de79c2e
test(analytics): add value equality tests for analytics queries
fulleni 44e3df6
test(analytics): add unit tests for Google Analytics request models
fulleni 0507441
test(analytics): add Google Analytics response model tests
fulleni 1431cc9
test(analytics): add unit tests for Mixpanel request models
fulleni f8e0b7a
test(analytics): add unit tests for MixpanelResponse model
fulleni bde0d94
test(analytics): add unit tests for AnalyticsMetricMapper
fulleni 718f066
test(analytics): add AnalyticsSyncService unit tests
fulleni 906e77e
test(analytics): add unit tests for MixpanelDataClient
fulleni dbc2ce1
test(analytics): add unit tests for AnalyticsQueryBuilder
fulleni 9a06d5b
docs(README): update code coverage percentage
fulleni 892523f
feat(analytics): add integration test for AnalyticsSyncService
fulleni 6afb629
feat(config): add support for optional test database connection
fulleni 04da1e0
refactor(analytics): make HttpClient configurable in GoogleAnalyticsD…
fulleni a15185e
style: format
fulleni 3732d85
refactor(analytics): remove unused Mixpanel credentials
fulleni d01fef6
feat(analytics): inject http client into google analytics data client
fulleni 42e0317
test(analytics): remove integration test file
fulleni 2d1bec8
fix(analytics): provide default value for dimensionValues in GARow
fulleni 12c238d
test(analytics): add unit tests for GoogleAnalyticsDataClient
fulleni 0f69ad4
test(analytics): add unit tests for empty API responses in MixpanelDa…
fulleni adfa018
build(serialization): sync
fulleni 58d0dc7
refactor(config): remove test database URL configuration
fulleni 04cf956
docs: update code coverage badge in README
fulleni 038aae9
style(models): reorder required and not required parameters
fulleni 12f131d
test(analytics): improve type safety in Google Analytics tests
fulleni bbe05fb
test(analytics): fix type warnings in mixpanel data client tests
fulleni 1111896
docs(README): enhance analytics engine description and remove high-pe…
fulleni 09bc280
refactor(analytics): remove unnecessary null-aware operator
fulleni 28a633a
fix(config): remove null safety from AnalyticsSyncService
fulleni 989c1bc
fix(analytics): update metric names to match backend changes
fulleni b45e17e
refactor(analytics): update database metric names and categorization
fulleni e1aa67e
refactor(analytics): improve metric handling and repository lookup
fulleni 7fa9d39
test(analytics): update metric names in query builder tests
fulleni 9cc25de
refactor(database): improve remote config seeding and sanitization
fulleni dec5fb3
feat(registry): add analytics card data models
fulleni c4c4186
fix(analytics): improve error handling in data aggregation
fulleni 97ab01e
fix(analytics): prevent crashes in GoogleAnalyticsDataClient
fulleni 46e4ff1
fix(analytics): correct total calculation for Mixpanel segmentations
fulleni 12c9a99
fix(analytics): sum multiple engagement types in Mixpanel data
fulleni 8ea795c
fix(analytics): allow null unit in MixpanelSegmentationRequest
fulleni c8a2315
- Refactor total request to use MixpanelSegmentationRequest model wit…
fulleni 0f0b412
test(analytics): add missing unit parameter in mixpanel data client test
fulleni 85db269
build(serialization): sync
fulleni f8a1218
fix(analytics): update GARow constructor to require dimensionValues
fulleni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import 'dart:io'; | ||
|
|
||
| import 'package:flutter_news_app_api_server_full_source_code/src/config/app_dependencies.dart'; | ||
| import 'package:flutter_news_app_api_server_full_source_code/src/services/analytics/analytics.dart'; | ||
| import 'package:logging/logging.dart'; | ||
|
|
||
| /// The main entry point for the standalone Analytics Sync Worker process. | ||
| /// | ||
| /// This script initializes application dependencies, retrieves the | ||
| /// [AnalyticsSyncService], and executes its `run()` method to perform the | ||
| /// periodic data synchronization. | ||
| /// | ||
| /// This executable can be compiled into a native binary and run by a scheduler | ||
| /// (e.g., a cron job) to automate the analytics data pipeline. | ||
| Future<void> main(List<String> args) async { | ||
| // Configure logger for console output. | ||
| Logger.root.level = Level.ALL; | ||
| Logger.root.onRecord.listen((record) { | ||
| // ignore: avoid_print | ||
| print('${record.level.name}: ${record.time}: ${record.message}'); | ||
| if (record.error != null) { | ||
| // ignore: avoid_print | ||
| print(' ERROR: ${record.error}'); | ||
| } | ||
| if (record.stackTrace != null) { | ||
| // ignore: avoid_print | ||
| print(' STACK TRACE: ${record.stackTrace}'); | ||
| } | ||
| }); | ||
|
|
||
| await AppDependencies.instance.init(); | ||
| await AppDependencies.instance.analyticsSyncService.run(); | ||
| await AppDependencies.instance.dispose(); | ||
| exit(0); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export 'analytics_query.dart'; | ||
| export 'google_analytics_request.dart'; | ||
| export 'google_analytics_response.dart'; | ||
| export 'mixpanel_request.dart'; | ||
| export 'mixpanel_response.dart'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import 'package:core/core.dart'; | ||
|
|
||
| /// A sealed class representing a structured, provider-agnostic analytics query. | ||
| /// | ||
| /// This replaces the fragile pattern of passing primitive strings for metrics | ||
| /// and dimensions, centralizing query definitions into type-safe objects. | ||
| sealed class AnalyticsQuery { | ||
| /// {@macro analytics_query} | ||
| const AnalyticsQuery(); | ||
| } | ||
|
|
||
| /// A sealed class for queries that return a numeric metric value, such as | ||
| /// a total count or a time series. | ||
| sealed class MetricQuery extends AnalyticsQuery { | ||
| /// {@macro metric_query} | ||
| const MetricQuery(); | ||
| } | ||
|
|
||
| /// A query for a simple event count. | ||
| /// | ||
| /// This is used when the metric is the count of a specific [AnalyticsEvent]. | ||
| class EventCountQuery extends MetricQuery { | ||
| /// {@macro event_count_query} | ||
| const EventCountQuery({required this.event}); | ||
|
|
||
| /// The core, type-safe event from the shared [AnalyticsEvent] enum. | ||
| final AnalyticsEvent event; | ||
| } | ||
|
|
||
| /// A query for a standard, provider-defined metric (e.g., 'activeUsers'). | ||
| /// | ||
| /// This is used for metrics that have a built-in name in the provider's API. | ||
| class StandardMetricQuery extends MetricQuery { | ||
| /// {@macro standard_metric_query} | ||
| const StandardMetricQuery({required this.metric}); | ||
|
|
||
| /// The provider-specific name for a standard metric. | ||
| final String metric; | ||
| } | ||
|
|
||
| /// A query for a ranked list of items. | ||
| /// | ||
| /// This is used to get a "Top N" list, such as most viewed headlines. | ||
| class RankedListQuery extends AnalyticsQuery { | ||
| /// {@macro ranked_list_query} | ||
| const RankedListQuery({ | ||
| required this.event, | ||
| required this.dimension, | ||
| this.limit = 10, | ||
| }); | ||
|
|
||
| /// The event to count for ranking (e.g., `contentViewed`). | ||
| final AnalyticsEvent event; | ||
|
|
||
| /// The property/dimension to group by (e.g., `contentId`). | ||
| final String dimension; | ||
|
|
||
| /// The number of items to return in the ranked list. | ||
| final int limit; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.