Static Documents

Static documents allow you to configure and deploy pre-published PDF documents rather than generating the PDF dynamically from a liquid template. Use static documents for PDF documents with fixed content. Such content may vary over time but, for example, would not vary based on policy details. See the Documents topic for more information on handling HTML documents and PDF documents with variable content.

Configure and Deploy Static documents

You can configure and deploy static PDF documents as part of your configuration either by including the PDF documents in Config.zip or independent of Config.zip using the Static Documents API or through the administrator panel. Independent static documents also have an effective date associated with each document.

Use independent static documents to:

  • Manage some or all of your static documents independently from Config.zip. Adding or updating documents does not require a new deployment.

  • Associate an effective date with each version of a static document.

Deploying static documents

You can deploy static documents using one of the following options:

  • Config.zip Static Documents:
    • Add the PDF files to the /products/{productName}/policy/static_documents/ directory in your Config.zip file.

    • Deploy the updated Config.zip.

  • Independent Static Documents:
    • Add the PDF files to your configuration using the Static Documents API or through the administrator panel.

    • No deployment necessary.

Using static documents

  1. Configure documents in policy.json and other config files as usual.

  2. Use the expression {{ "my_document.pdf" | render_effective_document: as_of_timestamp}} to retrieve my_document.pdf from your configuration, whether my_document.pdf was deployed as a static document or as part of Config.zip. * The optional as_of_timestamp is a timestamp in milliseconds from unix epoch format for the effective timestamp desired. A default value of now will be used for as_of_timestamp if omitted.

    • If you specify the effective date, the application will: a. First look for an independent static document, my_document.pdf, with an effective date matching the specified as_of_timestamp. b. If no matching independent static document is found, the application will look for my_document.pdf with the static documents deployed with Config.zip.

    • If you omit the effective date, the application will: a. First look for an independent static document, my_document.pdf, with an effective date matching now. b. If no matching independent static document is found, the application will look for my_document.pdf with the static documents deployed with Config.zip, without considering the as_of_timestamp.

Example 1: Basic Static Documents

Assume a file called state_disclosure_2020.pdf exists in /products/{productName}/policy/static_documents/, and that policy.json defines the following policy document:

{
  "documents": [
    {
      "displayName": "Regulatory Disclosure",
      "fileName": "state_disclosure.pdf",
      "templateName": "state.disclosure.template.liquid"
    }
  ]
}

Then, the render_static_document call will instruct Socotra to attach the static PDF to the policy, using this code in state.disclosure.template.liquid:

{% if policy_state contains "California" %}
  {{ "state_disclosure_2020.pdf" | render_static_document }}
{% else %}
  {% comment %}
    HTML or another render_static_document call, as desired
  {% endcomment %}
{% endif %}

Example 2: Conditional Dynamic Documents

The render_static_document call can also be used to control whether a dynamic document is rendered. Consider case where a dynamic document should only be rendered if the policy is written in the state of California. If policy.json defines a document as follows:

{
  "documents": [
    {
      "displayName": "California Regulatory Disclosure",
      "fileName": "state_specific_disclosure.pdf",
      "templateName": "state.specific.disclosure.template.liquid"
    }
  ]
}

Then the render_static_document call instructs Socotra to attach the static PDF to the policy in state.specific.disclosure.template.liquid:

{% if policy_state contains "California" %}
  {% comment %} HTML of the desired dynamic document goes here: {% endcomment %}
  <h1>A heading</h1>
  <p>content...</p>
{% else %}
  {{ nil | render_static_document }}
{% endif %}