EFSPIntegration.conversions
Functions that help convert the JSON-ized XML from the proxy server into usable information.
error_notificationβ
Copied from docassemble.webapp.server.error_notification, since:
- things from webapp.* are unstable
- it breaks the unit tests and the mypy
Some slight modifications to work without server backends
log_error_and_notifyβ
Similar to docassemble.webapp.server.error_notification, which will send an email to
the error_notification_email
in the config.
convert_court_to_idβ
Converts a court type to the specific id string expected by Tyler.
A fairly ad-hoc function; it will check if the object has several attributes ("tyler_court_code", "tyler_code", or "name"), or if it's already a string, it tries to just make a lower case on the string. We strongly recommend that your court object use the "tyler_court_code" attribute though.
Arguments:
trial_court
- the court object
Returns:
the string that should be the Tyler EFM court id, i.e. adams
or peoria:cr
choices_and_mapβ
Takes the responses from the 'codes' service and make a DA ready list of choices and a map back to the full code object
Arguments:
codes_list
- should be the direct response from a 'codes' service, i.e.proxy_conn.get_case_categories(court_id).data
display
- a python format string, where the input variables are the keys of the individual code elements. By default, it's "{name}", but could be something else like "{name} ({code})"backing
- the key to each dict element in the codes_list that you want to use as the "canonical" representation of the code, i.e. each is unique, and there aren't conflicts
Returns:
a tuple; first, a list of the codes that can be used at the choices
in a docassemble field,
second, a map of each code, from the backing key to the full code element. Useful for getting
all of the information about a code after a user has selected it.
pretty_displayβ
Given an arbitrarily nested JSON structure, print it nicely as markdown.
Recursive, for subsequent calls tab_depth
increases.
Arguments:
data
- the JSON structure (python dicts, lists, strings and ints) to printtab_depth
- how many spaces to add before each new line, to make the markdown correctskip_xml
- this function is mostly for printing responses from the EfileProxyServer, which lazily returns XML as JSON. If this is true, we won't show the useless XML cruftitem_name
- when recursing, will show the parent's name when showing elements in a list
Returns:
The string of markdown text that displays info about the given JSON structure
debug_displayβ
Returns a string with either the error of the response, or it's data run through pretty_display
tyler_daterep_to_datetimeβ
Takes an jsonized-XML object of "{http://niem.gov/niem/niem-core/2.0\}ActivityDate, returns the datetime it repsents.
tyler_timestamp_to_datetimeβ
Given a timestamp in milliseconds from epoch (in UTC), make a datetime from it
validate_tyler_regexβ
Return a function that validates a given input with the provided regex,
suitable for use with Docassemble's validate:
question modifier
parse_service_contactsβ
We'll take both Tyler service contact lists and Niem service contact lists. Tyler's are just `{"firstName": "Bob", "middleName": "P", ..., "serviceContactId": "abcrunh-13..." Niem's are more complicated
parse_case_infoβ
Given sparse information about a case, gets the full details about it
Arguments:
proxy_conn
- the connection to the EFileProxyServernew_case
- the object to hold all of the information about the caseentry
- the information we have about the case, usually from a call toget_cases
court_id
- the id of the court that we searched in to get this infofetch
- if true, will fetch more detailed information about the case, include the case titleroles
- a dictionary of the party type codes to the party type name. Used so we can filter and sort participants later
fetch_case_infoβ
Fills in these attributes with the full case details:
- attorneys
- party_to_attorneys
- case_details_worked
- case_details
- case_type
- title
- date
- participants
filter_payment_accountsβ
Gets a list of all payment accounts and filters them by if the card is accepted at a particular court.
Arguments:
account_list:
allowable_card_types
- a list of the accepted card types at a court, usually from the 'allowablecardtypes' dict entry in get_full_court_info's response
Returns:
the list of payment account choices that are valid for a particular court
payment_account_labelsβ
Returns all payment accounts as choices, without filters.
filing_id_and_labelβ
Converts a raw case information from proxy_conn.get_filing_list() into a key-value pair, where the key is the filing id and the value is the user-facing label for that filing.
get_tyler_rolesβ
Gets whether or not the user of this interview is a Tyler Admin, and a 'global' admin. The global admin means that they are allowed to change specific Global payment methods, and can be listed under the 'global server admins' section of the 'efile proxy' settings in the DAConfig