Skip to content

fix(supplementalDetails): tolerate missing 'value' in NLP results DEV-2508 - #350

Merged
platreth merged 2 commits into
mainfrom
dev-2508-guard-missing-value-in-supplemental-details
Jul 30, 2026
Merged

fix(supplementalDetails): tolerate missing 'value' in NLP results DEV-2508#350
platreth merged 2 commits into
mainfrom
dev-2508-guard-missing-value-in-supplemental-details

Conversation

@platreth

@platreth platreth commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

📣 Summary

Downloading data as XLS or CSV no longer fails on projects that have an automatic transcription still waiting to be reviewed.

📖 Description

If a project had a transcription that had been generated but not yet accepted, every XLS and CSV download of that project failed with a generic "Export Failed" message. Downloads now work again, and a transcription that hasn't been accepted yet is left blank in the file, as it was before.

💭 Notes

  • kpi DEV-2333 started emitting {'languageCode': …, 'pendingReview': True} with no value key. QualNameSplittingTransxField branched on languageCode and then read responses['value'] unguarded, so a single un-accepted transcript killed the whole export.
  • The translation branch a few lines below already swallowed that KeyError and returned ''; this just makes the transcript branch consistent with it.
  • QualField gets the same guard: a qual response may legitimately hold only verified and no value (kpi's qualCommon oneOf). Not reachable through kpi's current output transform — defensive only.
  • ⚠️ This restores pre-DEV-2333 behaviour, where an un-accepted result exports blank. If exports should instead include the un-reviewed text, the fix belongs in kpi (subsequences/actions/mixins.py) rather than here — hence draft.
  • Needs a follow-up kpi PR bumping the formpack pin.

👀 Preview steps

  1. ℹ️ pip install -r dev-requirements.txt
  2. run pytest tests/test_additional_field_exports.py
  3. 🔴 [on main] test_transcript_pending_review_exports_as_blank and test_qual_response_without_value_exports_as_blank fail with KeyError: 'value', at fields.py:717 and fields.py:552
  4. 🟢 [on PR] full suite passes — 255 passed, 2 skipped

@platreth
platreth force-pushed the dev-2508-guard-missing-value-in-supplemental-details branch from 066a28e to dff2b0d Compare July 29, 2026 12:49
@platreth platreth self-assigned this Jul 29, 2026
@platreth
platreth marked this pull request as ready for review July 29, 2026 14:19
@greptile-apps

greptile-apps Bot commented Jul 29, 2026

Copy link
Copy Markdown

Greptile Summary

Updates supplemental-detail exports to:

  • Return a blank value when qualitative responses omit value.
  • Return a blank transcript when pending-review NLP results omit value.
  • Add regression coverage for both payload shapes.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (2): Last reviewed commit: "docs(test): clarify pre-kpi#7344 payload..." | Re-trigger Greptile

@noliveleger noliveleger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only nitpicks but overall LGTM.

Also ask your robot to not limit the PR description to 80 characters per line :-D

Comment thread tests/test_additional_field_exports.py Outdated
@platreth
platreth requested a review from noliveleger July 30, 2026 11:52

@noliveleger noliveleger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@platreth
platreth merged commit c006832 into main Jul 30, 2026
3 checks passed
platreth added a commit to kobotoolbox/kpi that referenced this pull request Jul 30, 2026
…508 (#7345)

### 💭 Notes

Internal only — no user-facing change, no migration. `formpack`
dependency pin bump only; no KPI code changes.

- Bumps the `formpack` pin `3bf65b7` → `c006832` to include
[kobotoolbox/formpack#350](kobotoolbox/formpack#350)
(`fix(supplementalDetails): tolerate missing 'value' in NLP results
DEV-2508`): a defensive `KeyError` guard in the transcript/qual export
fields.
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.

2 participants