Skip to content

[TAN-7987] Add Survey Response PDF Export tool (for UK planning)#14090

Open
amanda-anderson wants to merge 27 commits into
masterfrom
TAN-7987-uk-pdf-export-tool
Open

[TAN-7987] Add Survey Response PDF Export tool (for UK planning)#14090
amanda-anderson wants to merge 27 commits into
masterfrom
TAN-7987-uk-pdf-export-tool

Conversation

@amanda-anderson

Copy link
Copy Markdown
Contributor

Changelog

Added

  • [TAN-7987] Add Survey Response PDF Export tool (for UK planning).

For translators

@notion-workspace

Copy link
Copy Markdown

@cl-dev-bot

cl-dev-bot commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator
Messages
📖 Changelog provided 🎉
📖 Notion issue: TAN-7987
📖

Run the e2e tests

📖 Check translation progress

Generated by 🚫 dangerJS against c893e40

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

@amanda-anderson amanda-anderson Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@amanda-anderson amanda-anderson Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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',

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants