getodk / central

ODK Central is a server that is easy to use, very fast, and stuffed with features that make data collection easier. Contribute and make the world a better place! ✨🗄✨
https://docs.getodk.org/central-intro/
Apache License 2.0
121 stars 145 forks source link

Client audit "user" and "change reason" columns are not included in audit export #654

Open lognaturel opened 2 months ago

lognaturel commented 2 months ago

Problem description

Client audits can include columns that identify the user making changes and the reason they've made changes.

These are not included in the known header values used to build audit exports and are not saved to the database.

This means the only way to access these audit events is to manually/programatically download each submission's audit attachment. It's not possible to use the submission export because all audit files have filename audit.csv and stack.

Reported by @chrissyhroberts in Slack

URL of the page

Steps to reproduce the problem

Use a form like this one that identifies user and tracks change reasons. Fill out the form in Collect, making sure to save a draft, reopen, change a value so that you can enter a change reason.

Screenshot

Expected behavior

user and change-reason columns are included in export.

Central version shown in version.txt

Browser version

Around when did you see the problem (in UTC)?

Other notes (if any)

matthew-white commented 2 months ago

not saved to the database

If I remember the setup correctly, I think they would be stored in the jsonb column client_audits.remainder. We'd probably still want a database migration to create new columns on client_audits and extract their initial values from remainder. But if all goes well, we wouldn't need to reprocess every client audit attachment.

It's not possible to use the submission export because all audit files have filename audit.csv and stack.

As of getodk/central-backend#947, we don't even export the individual audit.csv files anymore in the .csv.zip.

lognaturel commented 2 months ago

we wouldn't need to reprocess every client audit attachment

Ah yes, I remember that, nice!

we don't even export the individual audit.csv files anymore

Excellent.