Skip to content

Document Generation: Overview

Document Generation v2 moves away from Word (.doc) templates and uses HTML files with embedded CSS. Templates are rendered by the Java backend using the Handlebars/Mustache engine and converted to PDF. Configuration lives in the client config repository (in Git), enabling code reviews and consistent styling across clients.

v1 vs v2

Version Description
v1 (legacy) Word (.doc) templates processed by an AWS Lambda. Still supported but deprecated. Not recommended for new implementations.
v2 (recommended) HTML + CSS templates rendered in the Java backend. Configured in document-template/ directory. Supports partial templates, data mapping from risk/policy, and Handlebars helpers.

Note

The version of document generation is controlled at the business class workflow level. This allows a phased rollout by LOB — you can run v1 for some lines of business and v2 for others simultaneously during migration.

Repository structure

Document generation spans several directories:

Directory Purpose
document-template/config/{bc}/{placing-type}.json Metadata config: links operation names to template HTML files, with date ranges and criteria
document-template/files/{bc}/*.html The actual HTML template files
document-template/files/common/*.html Shared partial templates (headers, footers, insurer info)
document-clause/config/{bc}/{placing-type}.json Defines which clause file applies for a business class and placing type
document-clause/files/{bc}/clauses.json Individual clause/subjectivity definitions
screen-meta-data/config/{bc}/ Links operations to data capture screen layout files
screen-meta-data/files/{bc}/ Screen meta data layout files for the data capture form
business-constants/action_group.json Defines action group codes (rate, broker_response)

How it works end to end

  1. The underwriter completes the document_creation risk action
  2. They select clauses and subjectivities from the clause library
  3. They fill in the data capture form (for any data not already on the risk record)
  4. They preview the rendered document
  5. They confirm generation — the backend renders the HTML template with Handlebars, converts it to PDF, and stores it in S3
  6. The document appears in the Documents tab on the risk record

Delivery checklist

For a new document generation implementation:

  1. Define action groups in business-constants/action_group.json
  2. Add document_creation and br_document_creation risk actions with correct prerequisites and additionalProperties
  3. Create the HTML template structure (layout, CSS, headers, footers)
  4. Add data mappings to the template ({{risk.*}}, {{policyGroup.*}}, clause loops)
  5. Create screen meta data config for any data capture not already in the risk object
  6. Configure clause library if required
  7. Set documentGenerationConfig.clientPartialTemplatesLookup: true in be_config.json (S3 business config) if using partial templates
  8. Deploy and test: preview document, generate PDF, verify data mappings

Next steps