Skip to content

The CSV export

ai_disclosure_csv_export adds a CSV export to the compliance report. It is a separate submodule: installing ai_disclosure does not enable it, and without it the report has no export command and no export display at all.

It needs core's rest and serialization modules, which is why it is kept apart: a site that only wants the report on screen does not have to enable either of them.

What an editor sees

The command sits in the report's footer, next to the row count, and offers two links.

The export command with no filter active

Full exports every row the report covers. Filtered exports the rows the active filters match. With no filter active the two would export the same rows, so Filtered is disabled rather than offered as a choice that changes nothing.

Apply a filter and it becomes a real choice, naming how many rows it would write:

The export command with a filter active

The two shots above are the same report: eight rows with no filter, one row once a grade filter is on, and the link says so. The count is the query's own total, not the number of rows the current page happens to show, so a result spread over several pages still reports all of it.

What lands in the file

The export streams as CSV with the same columns as the table on screen, so what you read in the browser and what you open in a spreadsheet agree.

One difference is deliberate. A title starting with =, +, - or @ gets a leading apostrophe in the file, because a spreadsheet application reads those characters as the start of a formula. The apostrophe is what stops a title from being executed as one. It is a property of the file, not of the content, and the title in Drupal is untouched.

Permissions

Both links are behind access ai disclosure report, the same permission that opens the report itself. There is no separate "may export" permission: the export shows what the report already shows, to whoever can already see it. See Configuration for the full list.