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

Đang mở
#485 2 bình luận 0 reaction 1 người được giao Được @prince-pokharna nhận Xem trên GitHub
Ngôn ngữ chính
Dart
Star
53
Fork
108
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

## 🚀 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?

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Review the hardcoded program data in lib/ and the existing program detail screens, then inspect pubspec.yaml. Confirm with maintainers whether the remote or asset-based JSON option is intended; done means program records use the chosen data layer and the listed files are updated so details no longer depend on hardcoded Dart data.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
dart, flutter
Lĩnh vực
mobile
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.