Skip to content

Feat/add orange cameroun MNO data simulator#36

Merged
cchwala merged 10 commits intomainfrom
feat/add-orange-cameroun-simulator
Apr 21, 2026
Merged

Feat/add orange cameroun MNO data simulator#36
cchwala merged 10 commits intomainfrom
feat/add-orange-cameroun-simulator

Conversation

@cchwala
Copy link
Copy Markdown
Member

@cchwala cchwala commented Apr 21, 2026

Add Orange Cameroun second MNO simulator

Summary

Adds a second MNO data source simulator representing Orange Cameroun, alongside the existing OpenMRG simulator. Renames the original SFTP user from cml_user / user1 to demo_openmrg for consistency, and introduces demo_orange_cameroun as the second user. Both users now have DB-enforced row-level separation.

Changes

New MNO simulator

  • Added mno_simulator_orange_cameroun service to docker-compose.yml with its own SFTP credentials, SSH key pair, archive generator, and archive loader
  • Added cml_raw_douala.nc NetCDF source file for the Orange Cameroun dataset (Douala, Cameroon)
  • Extended data_generator.py and parse_netcdf_archive.py to support configurable RSL/TSL variable names (rsl_min, tsl_min) needed by the Douala dataset

User rename

  • cml_user / user1demo_openmrg; user2demo_orange_cameroun across SFTP config, SSH keys, DB roles, and all services
  • Migration 007_rename_users_add_orange_cameroun.sql handles in-place rename of existing data rows and roles

Infrastructure

  • mno_data_source_simulator/main.py: env var overrides for SFTP config are now applied before the SFTP client is initialised (bug fix — previously overrides had no effect)
  • SSH key generation script updated to produce separate key pairs for each user
  • parser_orange_cameroun service added, sharing the same parser image with USER_ID=demo_orange_cameroun

CI / testing

  • E2E workflow and local test script updated to use new service names, SFTP paths, and SSH key directories
  • test_parse_netcdf_archive.py extended to cover the new RSL/TSL variable name configuration

Testing

  • All unit tests pass; e2e integration test passes (5 passed, 2 skipped)
  • Full local stack verified: archive data loaded for both MNOs (~8.5M OpenMRG + ~2.3M Orange Cameroun rows), real-time streams active, data flowing through parsers to TimescaleDB

cchwala added 3 commits April 21, 2026 13:50
- Rename SFTP/DB users: cml_user/user1 -> demo_openmrg, user2 -> demo_orange_cameroun
  - New DB migration 007 renames roles and relabels existing data rows
  - database/init.sql updated for fresh deployments
  - ssh_keys/.gitignore updated; user1/ -> demo_openmrg/, user2/ -> demo_orange_cameroun/
  - New dedicated SSH key pair for demo_orange_cameroun (id_rsa_orange_cameroun)
  - sftp_receiver entrypoint and integration test updated

- Add second MNO data source simulator for Orange Cameroun (cml_raw_douala.nc)
  - New services: mno_simulator_orange_cameroun, archive_generator_orange_cameroun,
    archive_loader_orange_cameroun, parser_orange_cameroun
  - All existing services renamed from generic to *_openmrg suffix
  - 31-day archive at 15-min native resolution (ARCHIVE_INTERVAL_SECONDS=900)

- Support rsl_min/tsl_min variable names (Phase 1: use min values as rsl/tsl)
  - data_generator.py: NETCDF_RSL_VAR / NETCDF_TSL_VAR env vars
  - generate_archive.py: uses generator.rsl_var / tsl_var
  - parse_netcdf_archive.py: ARCHIVE_RSL_VAR / ARCHIVE_TSL_VAR / ARCHIVE_USER_ID

- Filter fully-NaN sublinks at metadata extraction time
  - Only sublinks with >=1 valid value are written to DB and CSV
  - Handles both (sublink_id, cml_id, time) and (cml_id, sublink_id, time) dim orders
  - Handles datasets without polarization coordinate (stores NULL)
  - Handles pre-computed length coordinate (skips haversine calculation)

- database/init_archive_data.sh: ARCHIVE_USER_ID tags all loaded rows correctly

Phase 2 (next PR): extend DB schema + parser + Grafana for min/avg/max columns
Compressed TimescaleDB hypertable chunks cannot be updated without first
decompressing them, which on months of raw data is prohibitively slow.

cml_metadata and cml_stats (small, uncompressed) are still relabelled.
cml_data rows retain user_id='user1' for historical data; new rows from
the renamed parser will be written as 'demo_openmrg' going forward.
Grafana (connecting as myuser/superuser) sees all rows regardless.

Instructions for a full relabel when needed are left as comments in the
migration file.
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 21, 2026

Codecov Report

❌ Patch coverage is 90.85714% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.93%. Comparing base (6e63eef) to head (aafcfec).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
parser/parse_netcdf_archive.py 84.28% 11 Missing ⚠️
mno_data_source_simulator/data_generator.py 85.71% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #36      +/-   ##
==========================================
+ Coverage   77.76%   78.93%   +1.17%     
==========================================
  Files          24       24              
  Lines        2190     2317     +127     
==========================================
+ Hits         1703     1829     +126     
- Misses        487      488       +1     
Flag Coverage Δ
mno_simulator 86.72% <90.74%> (+0.23%) ⬆️
parser 85.48% <90.90%> (+1.31%) ⬆️
webserver 49.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

cchwala added 5 commits April 21, 2026 16:13
…i-user setup

- Add SFTP connection env var overrides in mno_data_source_simulator/main.py
  so SFTP_USERNAME and other env vars from docker-compose override config.yml
  (fixes auth failure: was connecting as cml_user instead of demo_openmrg)
- Update scripts/run_e2e_test_locally.sh to use correct service names
  (parser_openmrg, mno_simulator_openmrg), SFTP path (/home/demo_openmrg/uploads),
  SSH key dirs (demo_openmrg/demo_orange_cameroun), and set OPENMRG_NETCDF_FILE
  env var to avoid downloading the large 3-month dataset during local testing
- Fix SFTP directory path in CI workflow (cml_user -> demo_openmrg)
@cchwala cchwala changed the title Feat/add orange cameroun simulator Feat/add orange cameroun MNO data simulator Apr 21, 2026
@cchwala cchwala merged commit 226a04c into main Apr 21, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant