Lines

Gen 3

Lines

Replace a form without going through the Lines module

Before you can replace a form outside of the Lines module, you need to determine which forms need to be replaced and collect the following information:

  • File title
  • File form code
  • File’s edition number
  • Policy type the form belongs to (policy_type or policy_type_item)
  • Line’s effective date
  • New form PDFs

Identify the correct files and return the file URLs

To identify the correct files and return the file URLs:

  • In the database, use this query to identify the correct files and return the file URLs:

select files.url from files

inner join x_policy_types_docs

on files.id = x_policy_types_docs.fileId

inner join policy_types

on policy_types.id = files.referenceId

inner join effective_dates

on effective_dates.id = policy_types.effectiveId

where x_policy_types_docs.formCode = ‘HAL-NC-NTP’ and effectiveDate = ‘2016-01-01’;

Replace the files on s3

To replace the files on s3:

  1. In the database, use this query to retrieve the complete URLs:
    select concat(‘s3://britecorepro/halifax’, files.url) from files

inner join x_policy_types_docs

on files.id = x_policy_types_docs.fileId

inner join policy_types

on policy_types.id = files.referenceId

inner join effective_dates

on effective_dates.id = policy_types.effectiveId

where x_policy_types_docs.formCode = ‘HAL-NC-NTP’ and effectiveDate = ‘2016-01-01’;

  1. Copy the s3 URLs to the s3files.txt file.
  2. Use the aws s3 cp command to upload the new PDF to the URLs in the client’s s3 bucket.Note: This command takes two arguments: a path to a local file for an s3 upload and the s3 location where you want to upload the files.
  3. Run the command for f in ‘cat s3files.txt’; do aws cp ~/Downloads/HAL-NC-NTP-2016.pdf $f; done.Note: This command effectively overwrites the current PDFs by reading the s3files.txt URLs and uploading the new PDF.

Removing the local files

To cut down on s3 requests, BriteCore caches PDFs when they’re viewed. Instead of asking s3 for the PDF, BriteCore only asks for a PDF at a certain address if that file doesn’t exist on disk, and then, it saves that file to the disk so it doesn’t have to ask again. Subsequent requests for the PDF at that address simply get the copied version from the disk. Since the new PDFs exist at the same address as the old ones, cached PDFs must be removed to ensure the newest version appears when a user accesses the PDF.

Note: Removing a cached PDF forces BriteCore to request the file from s3 again.

To remove the local files:

  1. In the database, access the Leader and Follower instances.
  2. Use this query to locate the cached files:select concat(‘/srv/www/britecore/’, files.url) from files

inner join x_policy_types_docs

on files.id = x_policy_types_docs.fileId

inner join policy_types

on policy_types.id = files.referenceId

inner join effective_dates

on effective_dates.id = policy_types.effectiveId

where x_policy_types_docs.formCode = ‘HAL-NC-NTP’ and effectiveDate = ‘2016-01-01’;

  1. Copy the file names to a file on the /tmp/files.txt disk.
  2. In both instances, run for f in ‘cat /tmp/files.txt’; do rm $f; done to remove the cached PDFs.Note: Since only some of the files exist on the Leader and Follower, you can expect this command to produce some errors stating some of the files can’t be removed.
  3. In BriteCore, verify the new form was retrieved by following the steps below:
    1. In the BriteCore menu, select Lines.
    2. On the Effective Dates screen, select the applicable effective date.
    3. On the Policy Types screen, complete the following steps:
      1. In the Select State or Province dropdown, select a state or province.
      2. Navigate to the applicable Policy Type, and then select Edit .
    4. On the Details screen, navigate to the Line Item with the new form, and then, select Edit .
    5. On the Edit Line Item screen, select Setup, and then, under Documents, verify the new form was retrieved.
  4. Use this query to update the edition number:update files

inner join x_policy_types_docs

on files.id = x_policy_types_docs.fileId

inner join policy_types

on policy_types.id = files.referenceId

inner join effective_dates

on effective_dates.id = policy_types.effectiveId

set x_policy_types_docs.editionNumber = ‘(01-16)’

where x_policy_types_docs.formCode = ‘HAL-NC-NTP’ and effectiveDate = ‘2016-01-01’;