feat(commcare): UCR expression atoms + CRUD response parsing fix#397
Merged
Conversation
Adds list + create for named UCR expressions / filters. Removes the
"manual UCR push from master" step that was blocking clean V1 bootstrap.
- commcare_list_ucr_expressions: POST paginate to /data/ucr_expressions/.
- commcare_create_ucr_expression: action=create with name + expression_type
("named_expression" | "named_filter") + JSON definition + optional
description. Verified end-to-end on connect-ace-prod (created id=291
named_filter with a real boolean_expression definition).
Also fixes a CRUDPaginatedViewMixin response parsing bug that affected
createInboundApi: the wrapper is `{newItem: {itemData, template}}`, not
`{itemData, template}` directly. The previous parser silently fell back
to list-and-find which worked but was slower and didn't surface
IntegrityError messages. Both createUcrExpression and createInboundApi
now read newItem.itemData first, surface newItem.error explicitly.
V1 manual steps reduced from 4 to 3:
- DONE: UCR expressions (this PR)
- STILL MANUAL: subscription provisioning (out-of-band, accounts@)
- STILL MANUAL: custom user data field (Knockout-bound form, read of
existing state isn't HTML-scrapable — needs careful "set" semantics
to avoid destroying existing fields; defer to V1.5)
- STILL MANUAL: conditional alert create (3-form combined POST with
dynamic fields; defer to V1.5)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
jjackson
added a commit
that referenced
this pull request
May 22, 2026
…moved)
- commcare_list_user_fields: GETs /a/<domain>/users/user_data/, parses
the <div data-name="custom_fields" data-value="<json>"> initial_page_data
div (HQ's Django→JS bootstrap mechanism, per
corehq/apps/hqwebapp/templatetags/hq_shared_tags.py:650). Returns
the list of current fields + profiles. Surfaces the 302-to-settings
/users/ permission-redirect as a typed error.
- commcare_set_user_fields: POSTs the CustomDataFieldsForm to the
same URL with `data_fields` JSON-encoded. Direct form POST bypasses
the React/Knockout UI (verified against apps/custom_data_fields/
edit_model.py:491 — post() calls form.is_valid() then
save_custom_fields(), no UI involvement). DESTRUCTIVE: replaces
the existing list; callers should list_user_fields → merge → set.
V1 manual steps reduced from 3 to 2:
- DONE: UCR expressions (PR #397)
- DONE: custom user data field (this PR)
- STILL MANUAL: subscription provisioning (out-of-band, accounts@)
- STILL MANUAL: conditional alert (30+ field 3-form combined POST
with dynamic criteria + schedule choice tree; needs a known-working
reference to safely construct field combos. Defer until we have
access to one of the team's existing alerts to model against.)
Conditional alert API hunt confirmed via codebase:
- corehq/messaging/scheduling/urls.py — only admin views (list/create/
edit/download/upload). No Tastypie, no DRF.
- The download/upload variants are XLS, not CSV (Format.XLS_2007).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Removes the manual-UCR step from V1 bootstrap.
V1 manual steps: 4 → 3 (subscription + custom user data field + conditional alert remain).
🤖 Generated with Claude Code