andoriyaprashant / andoriyaprashant/OpSo

feat: program data (GSoC, Summer of Bitcoin, etc.) is hardcoded in Dart files — adding or updating a program requires a code change and app release, making the data impossible to keep current without contributor intervention

Open
#485 2 comments 0 reactions 1 assignee Claimed by @prince-pokharna View on GitHub
Dominant language
Dart
Stars
53
Forks
108
PR merge metrics
No merged PRs in 30d

Description

## 🚀 Problem Statement

OpSo stores open-source program information (organization names, stipend amounts, timeline dates, eligibility criteria) as hardcoded data in Dart files within `lib/`. When program details change — which happens every year (new application dates, updated stipends, new mentoring organizations) — the data goes stale without a new app release.

For example:
- GSoC stipend amounts change annually
- Application deadlines differ every year
- New programs are added (NSoC, ECSoC are listed in the repository but may not be in the app)
- Programs may be discontinued

This creates a maintenance burden that grows with each program added and makes the app a stale information source after each annual program cycle.

## Proposed Fix

Move program data to a JSON-based data layer that can be updated without an app release:

### Option A — Remote JSON data source (recommended for production)

Host a `programs.json` at a static URL (GitHub Pages or a CDN) and fetch it on app launch:

```dart
// lib/services/programs_service.dart
import 'package:http/http.dart' as http;
import 'dart:convert';

class ProgramsService {
static const String DATA_URL =
'https://andoriyaprashant.github.io/OpSo/data/programs.json';

Future> fetchPrograms() async {
try {
final response = await http.get(Uri.parse(DATA_URL));
if (response.statusCode == 200) {
final List data = json.decode(response.body);
return data.map((p) => Program.fromJson(p)).toList();
}
} catch (e) {
// Fall back to bundled data on network error
}
return _loadBundledData();
}
}
```

### Option B — Asset-based JSON (simpler, updates with each release)

Move data from Dart files to `assets/data/programs.json`:

```json
// assets/data/programs.json
[
{
"id": "gsoc",
"name": "Google Summer of Code",
"year": 2026,
"applicationStart": "2026-03-24",
"applicationEnd": "2026-04-08",
"stipendUSD": { "min": 1500, "max": 6600 },
"eligibility": "University students",
"organizationsUrl": "https://summerofcode.withgoogle.com/organizations"
}
]
```

This approach at minimum allows updating program data by editing one JSON file rather than touching Dart code.

### Data model update

```dart
// lib/models/program.dart
class Program {
final String id;
final String name;
final String year;
final DateTime? applicationStart;
final DateTime? applicationEnd;
final String eligibility;

Program.fromJson(Map json) : ...;
}
```

## Files to Create / Modify

| File | Change |
|---|---|
| `assets/data/programs.json` | New — externalized program data |
| `lib/services/programs_service.dart` | New — data loading service |
| `lib/` (program detail screens) | Update to consume `ProgramsService` |
| `pubspec.yaml` | Add assets entry for `assets/data/` |

**Suggested labels:** `enhancement`, `architecture`, `flutter`

I would like to work on this. Could you please assign it to me?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.