[TAN-7987] Add Survey Response PDF Export tool (for UK planning)#14090
[TAN-7987] Add Survey Response PDF Export tool (for UK planning)#14090amanda-anderson wants to merge 27 commits into
Conversation
|
| around_action :detect_invalid_timeline_changes, only: %i[create update destroy] | ||
| before_action :set_phase, only: %i[ | ||
| show show_mini update destroy survey_results sentiment_by_quarter | ||
| submission_count index_xlsx delete_inputs show_progress common_ground_results |
There was a problem hiding this comment.
Added two things:
survey_responses_pdf - which returns the final PDF, and
survey_response_fields - which returns the list of all form fields including any demographic/registration fields asked within the form (when that option is selected). The general custom fields endpoint only returns fields in the form, but I figured we'd also want to include the registration questions if they are asked in-form as well 🤔 Some of them might be PII or indirect PII, but others could be relevant to include.
Open to discussing this decision though!
| @@ -0,0 +1,101 @@ | |||
| # frozen_string_literal: true | |||
There was a problem hiding this comment.
These files in the export/pdf folder I'm less sure about regarding code conventions 🤔 Claude did most of the heavy lifting here.
| module Pdf | ||
| # Flags survey fields that likely hold personal data, so the export UI can | ||
| # pre-select them for redaction. Two signals: | ||
| # 1. Registration/user fields, tagged with a 'u_' key prefix by |
There was a problem hiding this comment.
Had it flag registration fields by default since it seemed likely they would have PII or indirect PII.
| import { FormattedMessage } from 'utils/cl-intl'; | ||
|
|
||
| import messages from './messages'; | ||
|
|
There was a problem hiding this comment.
(Works similarly to the input importer "PdfViewer" component. Used a separate component though as the PdfViewer is quite specific for the input importer context.)
| render json: raw_json(results) | ||
| end | ||
|
|
||
| # Lists the survey fields that will appear in the PDF export, flagging |
There was a problem hiding this comment.
Felt a bit strange to add survey-specific stuff to this general phases_controller, but seems like that's what we're doing for other method-specific things 🤔
| @@ -10,19 +10,24 @@ export function requestBlob( | |||
| | 'text/calendar' | |||
| | 'application/geo+json' | |||
| | 'application/pdf', | |||
There was a problem hiding this comment.
Updated this shared util to support a POST with a body as well, for sending info like the redacted field keys + cover page values. Could be useful elsewhere I think 🤔
Changelog
Added
For translators