-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CEP] System Forms Metadata Standardization #31873
Comments
Just the existence of that table is pretty useful! Thanks for compiling this. My first thoughts:
|
Sure thing, thanks for the clarifying questions, @dannyroberts First off, motivations:
I do think your breakdown is a logical one. I'm actually hoping to avoid advocating here for any general breaking changes as you describe in point 2, as I think that's more of a feature-by-feature question. Most of the USH features that submit system forms would be fine with a break in continuity, but it'd be disruptive to make such a change for GA features. Everything except deduplication uses a static XMLNS, even if it doesn't uniquely identify those features. I'd love to see us move say, case claim in this direction, but that'd be a whole thing trying to figure that out. I think the specific action items I'd like to see come out of this are the following non-breaking changes:
And then perhaps the following breaking change:
On that point, the XMLNS is already feature-specific, and the device ID is unused, so this wouldn't be too scary a change. However, any new features built around that device ID would only support future data. That still seems like a net win, but I think that's a separate discussion - we'd have to get Product's 👍 before making such things GA. |
This is a great outline of the different ways we use system forms. I like the idea of building conventions and tooling to make future system forms more consistent. A couple of other examples of system forms: One place where we created system forms was in the Forms & Cases Couch to SQL migration. System forms were used to patch cases to resolve otherwise irreconcilable case differences between Couch and SQL. Diff data and case updates were encoded in the body of the form (example). The code that reads and writes those forms has been deleted since the migration is complete, but the forms still exist as a permanent record of a few minor differences between Couch and SQL form processing. Anther use of system forms introduced during the Forms & Cases Couch to SQL migration was "system actions," which were used to record and replay (on the SQL side) form archive and deletion events that occurred while the migration was in progress. The code supporting the creation of system actions still exists, although I'm not sure anything is using it. |
Thanks for sharing those examples, Daniel - I didn't know that about the couch-to-sql migration forms. The more I think about it, the more I like using the form body for mostly unstructured logging, given that that's literally what xforms are built for. Thinking about how we can facilitate that, I guess a little validation is maybe all that's needed. We can add a |
To summarise the conversation thus far it seems the current suggestion is to:
I'm in agreement with all of that but would like to add a further suggestion. Storing human readable nameThe
In future if more information is needed beyond just the name we could develop a "display block" that allowed adding more content to show to the user. I can see this being useful as a hover widget or similar: |
@snopoke confirming that that summary is correct. I also like your suggestion for including a name. |
Abstract
A number of different parts of HQ create forms (pretty much all are case updates) for various purposes. As contrasted with forms submitted by CommCare mobile or webapps, these are generally thought of as "system forms". A recurring challenge is tagging these with useful information, and various conflicting mechanisms are currently in use.
References:
System forms in Reports
improve report filtering related to system forms #31654
Motivation
An ideal system would allow us to:
Specification
At the moment, 4 fields are commonly in use:
xmlns
,device_id
,user_id
, andusername
The
submit_case_blocks
docstring has some current guidance around how these fields are used. Here are some features that submit system forms, and how they use each of these fields:Aside: I do see that anything that uses “submit_case_blocks” (which I’m pretty sure includes everything save commtrack and smsforms) uses the same template, which stores the form instance in a
<system />
node, rather than<data />
as is normally used. This is a pretty reliable signal, and it is already queryable in elasticsearch. Still, I don't think it's necessary to build off of this in our desired end state.The proposal is that we adopt the following conventions:
SYSTEM_FORM_XMLNS_MAP
In this world, system forms could be identified conclusively with something like
form.xmlns in SYSTEM_FORM_XMLNS_MAP.keys()
in elasticsearch, postgres, or python. We would also be able to associate a human-readable name of the feature with the form based on its XMLNS (useful for reporting). Further granularity can be achieved by feature-specific filtering withdeviceID
as well. For example:An option for further extension if needed is expanding beyond these four fields. CommCare uses
appVersion
,app_build_version
, andcommcare_version
. I wouldn't want to abuse these beyond their stated meanings, though. We can also store essentially anything we want in the meta block, it just wouldn't be easily searchable in elasticsearch without switching to a subdocument model, though. Possible things we might want to store include:appVersion
for this)Perhaps the most straightforward approach to storing arbitrary info is as normal form data, as is done here, which we could trivially enable in
submit_case_blocks
. An alternative would be adding an optionalinfo
arg tosubmit_case_blocks
which accepts a dict and turns that into aninfo
node inside the meta block. I'm interested in opinions there.I imagine there's room for improving tooling to support this paradigm, plus certainly a docs change. One model that might be a good hook for standardization is the
SystemFormMeta
dataclassImpact on users
I don't propose a large scale migration at this time, just alignment on a desired future state to guide feature development
Impact on hosting
no change
Backwards compatibility
None at this time, but backwards incompatibility is likely as features are migrated to the new standard.
Release Timeline
N/A
Open questions and issues
I'm particularly interested in hearing thoughts about how we can make this easier to stick to going forward
The text was updated successfully, but these errors were encountered: