• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

akvo / akvo-mis / #496
88%

Build:
DEFAULT BRANCH: main
Ran 12 Jan 2026 06:35AM UTC
Jobs 1
Files 98
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

12 Jan 2026 06:25AM UTC coverage: 88.202% (-0.5%) from 88.68%
#496

push

coveralls-python

web-flow
Akvo Flow Data Seeding (#149)

* [#148] feat: add .gitignore files for caddisfly, data, invalid_values, and seeded directories

* [#148] feat: Add robust Akvo Flow data seeder management command

Add a full-featured Django management command flow_data_seeder.py to
import Akvo Flow CSV exports into MIS FormData/answers.
- Provide CLI args: `--form` (required), `--limit`, and `--revert`.
- Validate inputs and print clear console messages for success/error.
- Load question mappings from `<FLOW_SOURCE_DIR>/{form}_forms_mapping.csv`.
- Load Flow data files from `<FLOW_SOURCE_DIR>/data/{form}_*.csv`.
- Load administration mappings from `<FLOW_SOURCE_DIR>/administration_mapping.csv`.
- Pre-fetch MIS Questions in a single DB query to avoid N+1 issues.
- Extract and normalize Flow values (JSON/text/number/date/base64).
- Handle special types:
    - Caddisfly results: extract numeric and flatten result rows for CSV debug.
    - Options/multiple options: map labels to option values.
    - Geo, photo, signature, number, administration handling.
- Collect invalid values and provide optional CSV export for debugging (`invalid_values`).
- Optionally write debug CSVs: `caddisfly`, `invalid_values`, and `seeded`.
- Insert data transactionally with `transaction.atomic()` and bulk-create answers.
- Implement a `--revert` flow that reads seeded CSV and deletes created `FormData` records.
- Improve maintainability with constants, type hints, docstrings, and structured helper methods.
- Provide robust error handling and informative logging for reviewers and operators.

fix: Correct field name for created_at in FormData creation and update results handling logic

* [#148] feat: Add comprehensive test suite for flow_data_seeder management command

* [#148] feat(flow-seeder): robust Akvo Flow data seeding with mapping, validation, and bulk insert

Add constants and structured column/key names for maintainability and readability.
Implement robust CSV loading and file-globbing ... (continued)

3694 of 4296 branches covered (85.99%)

Branch coverage included in aggregate %.

7617 of 8528 relevant lines covered (89.32%)

0.89 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
1
93.02
-2.33% api/v1/v1_forms/views.py
1
98.95
-0.52% api/v1/v1_profile/models.py
1
98.4
0.0% utils/custom_generator.py
Jobs
ID Job ID Ran Files Coverage
1 #496.1 12 Jan 2026 06:35AM UTC 98
88.2
Source Files on build #496
  • Tree
  • List 98
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • d95c08b9 on github
  • Prev Build on main
  • Next Build on main
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc