data_gov_gr 1.0.1
data_gov_gr: ^1.0.1 copied to clipboard
Unofficial Dart SDK for Greek Government Open Data (data.gov.gr).
flutter-data_gov_gr #
An unofficial, type-safe, and modular Dart SDK for the Greek Government Open Data API (data.gov.gr).
Features #
- Full Coverage: Access to all 200+ datasets via type-safe modules or the universal generic service.
- Unified Authentication: Simple API Token management.
- Type-Safe Models: Built with Freezed for robust data handling.
- Fluent Query DSL: Chainable filtering for fuel prices and more.
- Reactive Rate Limiting: Real-time status stream of your API usage.
- Built-in Mocking: Test your apps offline with
DataGovMockClientand realistic stubs. - Discovery: Programmatically list and search datasets, topics, and providers.
- Robust Networking: Automatic retries, logging, and error mapping.
Getting Started #
1. Add dependency #
Add data_gov_gr to your project using the command line:
dart pub add data_gov_gr
Or add it directly to your pubspec.yaml dependencies:
dependencies:
data_gov_gr: ^1.0.0
2. Initialize the client #
import 'package:data_gov_gr/data_gov_gr.dart';
final client = DataGovClient(apiKey: 'YOUR_API_TOKEN');
3. Usage Examples #
Fetch Type-Safe Vaccination Data
final stats = await client.health.getVaccinationStatistics(
from: DateTime(2023, 1, 1),
area: 'ΑΘΗΝΩΝ',
);
Use the Query DSL for Fuel Prices
final stations = await client.fuel.query()
.wherePrefecture(Prefecture.attica)
.fetch();
Fetch Procurement Data (KIMDIS)
final decisions = await client.procurement.getKimdisDecisions(
organizationId: '99200827',
);
Generic Access to Any Dataset
final results = await client.generic.query('mcp_forest_fires');
Testing & Verification #
Unit & Mock Tests #
Run the standard test suite:
dart test
Integration Tests (Live API) #
To verify the SDK against the real Greek government servers, provide your API token as an environment variable:
DATA_GOV_GR_TOKEN=your_token_here dart test test/integration_test.dart
Flutter Example App #
Explore the interactive dashboard:
cd example
# For Web (handles CORS)
flutter run -d chrome --web-browser-flag "--disable-web-security"
Supported Type-Safe Modules #
- ✅ Fuel: Detailed Station Prices & Prefecture Min/Max
- ✅ Health: COVID-19 Vaccinations & Ministry Statistics
- ✅ Procurement: KIMDIS Decisions (
khmdhs_decisions) - ✅ Telecom: GR-IX Internet Traffic
- ✅ Environment: Forest Fire Statistics
- ✅ Business & Economy: Debt, Budget, and Revenue Data
- ✅ Crime & Justice: Road Accident Statistics
- ✅ Education: University & Training Data
- ✅ Society: Employment & Labor Market Metrics
- ✅ Technology: Digital Adoption & Internet Usage
- ✅ Transport: Public Transport & Airport Traffic
- ✅ Discovery: Datasets, Topics, Providers
- ✅ Generic: Universal access to all endpoints with auto-pagination
Related Projects #
- Python: pydatagovgr
- Go: go-data-gov-gr-sdk
- R: datagovgR
API Compatibility & Architecture #
The SDK targets the modern data.gov.gr CKAN Action API v3 (https://data.gov.gr/api/3/action/).
To prevent breaking existing applications, a built-in CkanCompatibilityInterceptor automatically intercepts legacy REST-style endpoints (e.g., vaccine, fuel, and traffic paths) and translates them on-the-fly into CKAN action queries (like datastore_search). This ensures 100% backward compatibility for all API methods.
License #
MIT License - see LICENSE for details.