Below are some of the functions available for generating HTML-based deliverables.
get_available_function_names
-
Parameters
- html (bool) – When true, will return function names in HTML format
-
Returns
- func_names
-
Description
- Returns, but doesn’t load, the names of all functions available in the custom template scope
calculate_luhn
-
Parameters
- partial (string): Number whose luhn checkdigit should be calculated
- append (bool): When true, will return the given partial and the calculated checkdigit. Otherwise, will only return the checkdigit.
-
Returns
- ‘{}{}’.format(partial, check_digit) if append else check_digit
-
Description
- Calculates the luhn checkdigit for a partial number; used for OCR scalines
format_address
-
Parameters
- items (Contact, XPropertiesContact, XRevisionContact, dict, list): Collection of contact data, or a reference to a contact, whose address details should be returned
- show_phone (bool): When true, include phone number details in the return
- show_name (bool): When true, include all contact’s name in the return
- single_line (bool): When true, all formatted details will be returned with no line breaks
- show_email (bool): When true, include email address details in the return
- show_county (bool): When true, include the address’ county in the return
- sep (string): Override for how to separate distinct lines of data in the return, as controlled by the ‘single_line’ parameter
- not_this_kind (string): Type phone numbers that should be blacklisted from the return, assuming that the ‘show_phone’ parameter is allowing phone details to be returned at all
- bold (bool): When true, all returned data will be bold-faced
-
Returns
- string
-
Description
- Format address in a number of ways
format_names
-
Returns
- string
-
Description
- Format multiple names so they are presented correctly (i.e. John, Mary, and Susan)
format_item_name
-
Parameters
- source_item (PropertyItem, RevisionItem): Item whose details should be formatted
- use_dec_aliases (bool): When true, will calculate a more specific item name based on ht e configuration of the aliases assigned to the item’s details
-
For example, if item.decAliases contains the next value:
-
Returns
- item [‘name’]
-
Description
- Format the name of a given item dict according to decAliases setting
get_logo_url
-
Returns
- ‘file://’ + logo_file_path
-
Description
- Returns the URL to the company logo
get_phone_numbers
-
Parameters
- items (Contact, XPropertiesConact, XRevisionsContact, dict, list): Contact details, or a reference to a contact’s details, that should be queried for phone number data
-
Returns
- phones
-
Description
- Extract and return the phone(s) Contact information returning it in the format {“type”: string, “number”: string}. It will return an empty list in case of nothing found or applicable.
get_return_signature
-
Returns
- ‘file://’ + sig_file_path
-
Description
- Returns the URL to the company signature
get_license_for_contact
-
Parameters
- contact_id (string): Database identifier of the contact whose license is requested
- business_location_id (string): Database identifier of the business location that should be searched for licenses
-
Returns
- license_id
-
Description
- To get the license for contact in the specified business location
money
-
Parameters
- text (string): The numeric value to be converted to a monetary format string
- include_decimals (boolean): When true, will include decimal precision in the return
- kwargs (dict): Collection of named arguments to further control the return format
-
Return
- knum (string)
-
Description
- Render the given numeric value as a currency
Namespace re
- Exposes the standard regex class of Python: https://docs.python.org/2/library/re.html?highlight=re#module-re
relativedelta
-
This is imported from the dateutil library. Docustring reproduced below:
date.today
- Imported from the standard Python datetime library: https://docs.python.org/2.7/library/datetime.html?highlight=date%20today#datetime.date.today
include_template
-
Parameters
- template_name (string): Name of the template that should be rendered
- kwargs (dict): collection of the named arguments to pass on to the rendered template
-
Return
- license_id
-
Description
- Render the requested template with the specified arguments and inject the result into the current template
retrieve_mailing
-
Parameters
- propid (string): Database identifier of the property, whose contacts should be inspected for mailing details
-
Returns
- match_address (result)
-
Description
- Returns, but doesn’t load
retrieve_company_logo
-
Returns
- os.path.join(ROOT_PATH, ‘uploads’, ‘reports’, Setting.get_value_by_section_option(‘reports’, ‘logo’))
-
Description
- Returns the absolute path to the company logo
retrieve_company_signature
-
Returns
- os.path.join(ROOT_PATH, ‘uploads’, ‘reports’, Setting.get_value_by_section_option(‘reports’, ‘signature’))
-
Description
- Returns the absolute path to the company signature
retrieve_header_info
-
Returns
- header
-
Description
- Retrieves address information for deliverable headers
static_resource
-
Parameters
- name (string): Name of the static resource that should be returned
-
Returns
- ET.ElementTree(root)
-
Description
- Returns, and optionally writes to, the path of a StaticResource instance with the given name
to_dec
-
Parameters
- val: Can be any type. This value is then type-casted to a string, then to a decimal.
- default: Set to 0; the value that is returned if val is a non-convertible type.
-
Returns
- Either the decimal version of val or the decimal version of default (in the case that val is non-convertible)
-
Description
- Simple function that always returns a decimal number. Removes all characters other than digits, “.”, and “-“.
sort_items
- Parameters
- items (list<dict>): Details relating to line items that should be sorted
- sections (list<string>): Ordered groups of sections, by which items should be sorted, if given
- Returns
- items
- Description
- Sorts line items by various rules
create_barcode_image_data_for_invoice_code
-
Parameters
- invoice: AccountHistory SQLAlchemy model instance for the invoice
- height: Height of the barcode image to render
-
Returns
- data URI compliant to the HTML image tag source attribute
-
Description
- Generates barcode data for the invoice code from the given invoice object
zip
- This is the Python builtin: https://docs.python.org/2.7/library/functions.html?highlight=builtin#zip
get_conact_by_id
-
Parameters
- contact_id (string): Database identifier of the contact to return
-
Returns
- Contact.get (contact_id)
-
Description
- Returns the contact identified by the given database id
prev_rev_comparison
-
Parameters
- revid (string): Database identifier of the revision whose predecessor is in question
- stringify (bool): When true, numeric values in the return will be rendered as currencies. Otherwise, they will maintain a Decimal type.
- allow_archived (bool): When true, will include archived revisions in the search for the given revision’s predecessor. Useful when building negative endorsement invoices, among other things.
-
Returns
- Previous_revision_comparison
- rev.id
- prior_rev.id
- fxn(to_dec(prior_rev.annual_premium) )
-
Description
- Function to provide a revision comparison with the prior revision of ‘revid”. Sorts based by most recent revision date <= revision date & state is not archived.
Get the info function details
get_account_balance
-
Returns
- account_balance
-
Description
- Loads the most up-to-date accounting details for the loaded policy, based on the level of specificity of data that is currently loaded
get_additional_interests
-
Returns
- additional_interests
-
Description
- Loads the additional interests for the loaded revision
get_agent
-
Returns
- agent
-
Description
- Reloads revision. Loads agent for loaded revision
get_agency
-
Returns
- agency
-
Description
- Loads agency for loaded revision, potentially reloading agent in the process
get_agency_group
-
Returns
- agency_group
-
Description
- Loads agency group for loaded agency, potentially reloading agency in the process
Function get_all_labeled_contacts
-
Returns
- _all_labeled_contacts
-
Description
- Loads all contacts with proper labels from the loaded revision, potentially reloading revision in the process
get_all_forms
-
Returns
- all_forms
-
Description
- Loads forms that apply to loaded data, potentially reloading revision, revision items, and properties in the process
get_bill_when
-
Returns
- billing_schedule.name
-
Description
- Reloads billing schedule returns billing schedule name
get_bill_whom
-
Returns
- _bill_whom
-
Description
- Loads the bill whom of the loaded term, potentially reloading the policy term in the process get_bliiling_schedule_installments
-
Returns
- billing_schedule_installments
-
Description
- Loads installment details for billing schedule, potentially reloading all accounting data in the process
get_billing_schedule_options
-
Returns
- billing_schedule_options
-
Description
- Loads all applicable billing schedules, potentially reloading all accounting data in the process
get_billing_schedule
-
Returns
- billing_schedule
-
Description
- Loads billing schedule for loaded term, potentially reloading all accounting data in the process
get_billing
- Returns
- billing
- Description
- Loads initial and recurring billing options, potentially reloading all accounting details in the process
get_card_list
-
Returns
- card_list
-
Description
- Loads a list of available credit card types from the enabled payment vendor
get_claim
-
Returns
- The claim object associated with the deliverable.
-
Description
- Returns the claim object associated with the deliverable containing the related data, such as loss address, loss date, loss causes, claim number
get_contact
-
Returns
- contact
-
Description
- Loads an arbitrary contact, chosen by database id
get_data_object
-
Returns
- data
-
Description
- Returns a collection of additional data, not distinctly collected or contained helpers
get_debit_deltas_to_date
-
Returns
- debit_deltas_to_date
-
Description
- Loads status of all debits as they stand on the loaded deliverable date, potentially reloads all accounting data in the process
get_deliverable_date
-
Returns
- deliverable_date
-
Description
- Returns the effective date of the generating deliverable
get_first_underpaid_debit_exceeding_threshold
-
Returns
- first_underpaid_debit_exceeding_threshold
-
Description
- Loads first debit that could cancel the loaded policy, potentially reloading the status of all debits in the process
get_invoice
-
Returns
- invoice
-
Description
- Loads the invoice identified by a database id. Also reloads the deliverable date to that invoice’s transaction date
get_last_invoice
-
Parameters
- invoice_id (string) – Database identifier for the invoice that should be returned
-
Returns
- last_invoice
-
Description
- Loads either an accounting record identified by a database id, or the final invoice for the loaded policy term. Potentially reloads all accounting data in the process
get_last_non_pay
-
Returns
- last_non_pay
-
Description
- Loads the final Non Pay for the loaded policy term, potentially reloading all accounting
get_last_payment
-
Returns
- last_payment
-
Description
- Loads the final payment for the loaded policy term, potentially reloading all accounting data in the process
get_life_cycle
-
Returns
- life_cycle
-
Description
- Reloads all accounting data, then returns life cycle details
get_named_insureds
-
Returns
- named_insureds
-
Description
- Returns all named insureds for the loaded policy, potentially reloading all contacts in the process
get_past_due
-
Returns
- past_due
-
Description
- Loads total debits whose due dates precede the loaded deliverable date, potentially reloading all accounting data in the process
get_payment_method
-
Returns
- payment_method
-
Description
- Reloads a flag indicating if the initial invoice for the loaded payment schedule is unpaid, then reloads the payment schedule for the loaded policy. Then loads details regarding auto payment methods into the generic data collector, and loads the current payment method
get_payoff_amount
-
Returns
- payoff_amount
-
Description
- Loads the payoff amount for the loaded policy, potentially reloading all accounting data in the process
get_permission_questions
-
Returns
- permission_questions
-
Description
- Retrieves, but doesn’t load, all named insureds and additional interests for the loaded policy. If the credit scoring vendor is configured to prompt for permissions before retrieving credit scores, this function returns each contact for the policy, along with whether or not they have given permission to have their credit score retrieved. Potentially reloads the revision in the process
get_policy_accounting
-
Returns
- policy_accounting
-
Description
- Loads all accounting data that applies to the loaded policy. The more specific the loaded data, the more specific the accounting data. Potentially reload the policy, revision, and policy term in the process
get_policy_term
-
Returns
- policy_term
-
Description
- Reloads the policy, then loads the “current” term of that policy
get_policy
-
Returns
- policy
-
Description
- Loads the policy, using whatever data is already loaded to infer the appropriate entity
get_print_date
-
Returns
- print_date
-
Description
- Returns the loaded print date
get_properties
-
Parameters
- include_underwriting_questions (bool): When true, underwriting questions are included with rating details
- combine_dup_items (bool): When true, rating details will be combined for items that are included multiple times on the loaded property (at a loss of subline data)
- rate (bool): When true, line items under the loaded property are also loaded. When false, neither of the above parameters have any effect on the loaded data, as they both deal exclusively with the line item data.
-
Returns
- properties
-
Description
- Reloads the revision, then loads all property-specific details. These details are cached by a combination of their associated revision’s id and all other arguments passed
get_recipient
-
Returns
- recipient
-
Description
- Returns the loaded recipient for the generating document
get_return_premium
-
Parameters
- return_premium_id (string) – Database identifier of the Return Premium to load
-
Returns
- return_premium
-
Description
- Loads a Return Premium identified by the database id, or the final Return Premium for the loaded policy term. Potentially reloads all accounting data in the process.
get_revision_items
-
Parameters
- include_underwriting_questions (bool): When true, underwriting questions are included with rating details
- combine_dup_items (bool): When true, rating details will be combined for items that are included multiple times on the loaded revision (at loss of subline data)
- force (boo): When true, reloads line items associated with the loaded revision
-
Returns
- revision_items
-
Description
- Loads line items associated with the loaded revision, potentially reloading the revision in the process
get_revision
-
Parameters
- revision_id (string): Database identifier of the revision to load
-
Returns
- revision
-
Description
- Loads the revision identified by a database id, or by using whatever data is already loaded to infer the appropriate entity. Potentially reloads the policy and policy term in the process.
get_tagged_items
-
Parameters
- tag_name
- prop_id
- Defaults to the current context if not specified
- revision_id
- Defaults to the current context if not specified
-
Returns
- Line items for the loaded policy that have the given system tag given to them
-
Description
- Function allows the author to scope the results of the query, to collect system tagged data for a revision that is not the contextual revision, the render template provides the details of multiple policies at once
get_setting
-
Parameters
- section (string): Section of the setting that should be scanned for the setting
- option (string): Specific name of setting that should be returned
-
Returns
- setting
-
Description
- Returns a setting identified by the given section and option, potentially reloading all setting data in the process
get_settings
-
Returns
- settings
-
Description
- Loads all setting data
get_system_tags_for_dec
-
Returns
- system_tags_for_dec
-
Description
- Reloads the revision, then loads all system tags for all items of the loaded properties and revision that have system tags applied that are configured to displays on Declarations. If any tags are configured to display on Declarations, they are not returned. Only system tags that apply to category options are considered. Potentially reloads all property data and revision items in the process.
get_system_tags
-
Returns
- system_tags
-
Description
- Loads all system tags
get_policy_system_tags
-
Returns
- policy_tag_data
-
Description
- Returns, but doesn’t load, data regarding the system tags applied to the loaded policy. Potentially reloads that policy and all system tags in the process.
get_template_name
-
Returns
- template_name
-
Description
- Returns loaded template name
get_tagged_items
-
Parameters
- tag_name (string): Name of system tag that should apply to the line items
- prop_id (string): Database id of a specific property, whose items should be queried for the named system tag
- revision_id (strong): Database id of a specific revision, whose items should be queried for the named system tag
-
Returns
- items
-
Description
- Returns, but doesn’t load, data related to property items and revision items that have a named tag applied to them. This lookup doesn’t key off any loaded data, all considered entities are fetched and forgotten.
get_underwriter
-
Returns
- underwriter
-
Description
- Loads the underwriter of the loaded revision, potentially reloading the revision in the process
get_underwriting_questions
-
Returns
- underwriting_questions
-
Description
- Loads data pertaining to the loaded revision’s underwriting questions and assigned answers. Potentially reloads the revision in the process.
get_underwriting_questions_from_revision_policy_type
-
Returns
- Underwriting_questions_from_revision_policy_type
-
Description
- Loads data pertaining to underwriting questions that are available to the loaded revision’s policy type, along with the loaded revision’s assigned answers. Potentially reloads the revision in the process.
get_unpaid_debits_to_date
-
Returns
- unpain_debits_to_date
-
Description
- Loads all unpaid debits as they stand on the loaded deliverable date, potentially reloading the status of all debits in the process
get_unpaid_initial_invoice
-
Returns
- unpaid_initial_invoice
-
Description
- Reloads the payment schedule for the loaded policy, then reloads a flag indicating if the initial invoice for the loaded payment schedule is unpaid
is_wholesale_agency
-
Parameters
- agency_id (string): Database identifier of the agency to check for wholesale mode. doesn’t LOAD this agency
-
Returns
- is_wholesale_mode_agency(agency_id)
-
Description
- Returns, but doesn’t load, a flag suggesting whether the loaded agency operates in wholesale mode. Potentially reloads the agency in the process.
retrieve_primary_address
-
Parameters
- contact_id (string): Database id of the contact whose addresses should be returned
- mailing_address_preferred (bool): When true, will return the contact’s “Mailing” type address over any other physical address
- include_do_ssn (bool): When true, will include the contact’s date of birth and social security number
-
Returns
- data
-
Description
- Returns, but doesn’t load, data regarding a specified contact’s physical, phone, and email addresses. No data in this return is fed by loaded entities and relies on database ids to ensure access is granted to the expected contact
get_property_subline
-
Parameters
- property_item_id (string): Database identifier of the property item to return
-
Returns
- Sub line of a specific property item, identified by a database id.
-
Description
- Returns, but doesn’t load, the subline of a specific property item, identified by a database id
is_revision_amendment
-
Parameters
- amendment_on_effective_date (bool): When true, will consider the revision is amendment when endorsement(s) exist on the current term effective date
-
Returns
- is_revision_amendment (self.revision, amendment_on_effective_date=amendment_on_effective_date)
-
Description
- Reloads the revision, then returns, but doesn’t load, a flag suggesting whether the loaded revision is a committed or archived amendment on its own term (NOT the first revision in its term)
get_auto_pay_schedule
-
Returns
- auto_pay_schedule
-
Description
- Loads the payment schedule for the loaded policy, as well as the draw date and current balance of the first invoice in that schedule. Potentially reloads all accounting data in the process.
show_scheduled_table
-
Returns
- show_scheduled
-
Description
- Loads the payment schedule for the loaded policy, as well as the draw date and current balance of the first invoice in that schedule. Potentially reloads all accounting data in the process.
get_policy_revisions
-
Returns
- rquery.all()
-
Description
- Returns, but doesn’t load, all revisions for the loaded policy, ordered by relevance
get_item_premium_amount
-
Parameters
- item (dict): Details pertaining to a line item, whose total premium should be returned
-
Returns
- amount
-
Description
- Returns, but doesn’t load, the total premium of a given line item, as it applies to the loaded revision
get_primary_property
-
Returns
- Primary property (if not available, first listed property)
-
Description
- Exposes primary property data onto the documents sent to insureds