This is a detailed outline of all the public functions created in the LSAPIs.py
file. There are a few other functions used internally in the module but not
listed here.
Note that the functions here are listed identified with LegalServer's convention
that a GET API call that does not specify a uuid
is a Search API. All the
functions start with that verb/convention.
This is a function that will get a LegalServer report and return the data in a python dictionary.
This uses the LegalServer Reports API
to get any report type data back from
LegalServer and return it as a python dictionary. LegalServer Report APIs can
return data in either JSON or XML format and this will parse either into a
python dictionary. Note that LegalServer's JSON content is not perfect. True/False
are rendered as t
and f
instead of JSON booleans. Also integers are
returned as strings. It is also worth noting that the Reports API typically
defaults to include hidden columns. This function defaults to exclude them
unless otherwise specified.
legalserver_site
- requireddisplay_hidden_columns
- optional boolean to allow for hidden columns (in the LegalServer Report) to be excluded or included from the results. This defaults toFalse
.report number
- required integer for the specific reportreport_params
- optional dictionary of additional filters
This is a keyword defined function that retrieves all the details available on a case using the LegalServer Get Matter Details API. This returns the json dictionary of the data returned by the API.
legalserver_site
- requiredlegalserver_matter_uuid
- requiredcustom_fields
- optional python list of string valuescustom_fields_charges
- optional python list of string valuescustom_fields_litigations
- optional python list of string valuescustom_fields_services
- optional python list of string valuessort
- optional string to sort the results
This is a keyword defined function that searches for organizations based on a
set of criteria passed in the organization_search_params
. This uses the
Legalserver Search Organizations
API endpoint. This returns the json list of the data returned by the API.
legalserver_site
- requiredorganization_search_params
- optional python dictionary of any search parameterscustom_fields
- optional python list of string valuessort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that gets details back on a specific organization record. This allows for the identification of the custom fields as well. This uses the Get Organizations API endpoint. This returns the json dictionary of the data returned by the API.
legalserver_site
- requiredlegalserver_organization_uuid
- requiredcustom_fields
- optional python list of string values
This is a keyword defined function that searches for users based on a set of
criteria passed in the user_search_params
. This uses the Legalserver
Search Users
API endpoint. This returns the json list of the data returned by the API.
legalserver_site
- requireduser_search_params
- optional python dictionary of any search parameterscustom_fields
- optional python list of string valuessort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that gets details back on a specific user record. This allows for the identification of the custom fields as well. This uses the Get User API endpoint. This returns the json dictionary of the data returned by the API.
This makes a followup API call to get the organization affiliation data for the same user before returning all of that data in the response. This uses the Search User Organization Affiliation API endpoint.
legalserver_site
- requiredlegalserver_user_uuid
- requiredcustom_fields
- optional python list of string values
This is a keyword defined function that searches for contacts based on a set of
criteria passed in the contact_search_params
. This uses the Legalserver
Search Contacts
API endpoint. This returns the json list of the data returned by the API.
legalserver_site
- requiredcontact_search_params
- optional python dictionary of any search parameterscustom_fields
- optional python list of string valuessort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that gets details back on a specific contact record. This allows for the identification of the custom fields as well. This uses the Get Contact API endpoint. This returns the json dictionary of the data returned by the API.
legalserver_site
- requiredlegalserver_contact_uuid
- requiredcustom_fields
- optional python list of string values
This is a keyword defined function that searches a specific matter for additional names of the client. This uses the Search Matter Additional Names API endpoint. This returns the json list of the data returned by the API.
legalserver_site
- requiredlegalserver_matter_uuid
- requiredmatter_additional_names_search_params
- Optional dictionary of search parameterssort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that searches a specific matter for adverse Parties. This uses the Search Matter Adverse Parties API endpoint. This returns the json list of the data returned by the API.
legalserver_site
- requiredlegalserver_matter_uuid
- requiredmatter_adverse_parties_search_params
- Optional dictionary of search parameterssort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that searches a specific matter for assignments. This uses the Search Matter Assignments API endpoint. This returns the json list of the data returned by the API.
legalserver_site
- requiredlegalserver_matter_uuid
- required string for the LegalServer Matter's UUIDmatter_assignment_search_params
- optional python dictionary of filterssort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that searches a specific matter for charges. This uses the Search Matter Charges API endpoint. This returns the json list of the data returned by the API.
legalserver_site
- requiredlegalserver_matter_uuid
- requiredcharges_search_params
- Optional dictionary of search parameterssort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that searches a specific matter for case contacts. This uses the Search Matter Contacts API endpoint. This returns the json list of the data returned by the API.
legalserver_site
- requiredlegalserver_matter_uuid
- requiredmatter_contact_search_params
- Optional dictionary of search parameterssort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that searches a specific matter for litigations. This uses the Search Matter Litigations API endpoint. This returns the json list of the data returned by the API.
legalserver_site
- requiredlegalserver_matter_uuid
- requiredlitigation_search_params
- Optional dictionary of search parameterssort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that searches a specific matter for Non-Adverse Parties. This uses the Search Matter Non-Adverse Parties API endpoint. This returns the json list of the data returned by the API.
legalserver_site
- requiredlegalserver_matter_uuid
- requiredmatter_non_adverse_parties_search_params
- Optional dictionary of search parameterssort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that gets back all of the notes on a case. The notes can be filtered in the API call based on the note_type. This uses the Search Matter Notes API endpoint. They are returned as a list of notes.
legalserver_site
- requiredlegalserver_matter_uuid
- requirednote_type
- Optional string to filter on Note Typesearch_note_params
- Optional dictionary of search parameterssort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that searches a specific matter for Services. This uses the Search Matter Services API endpoint. This returns the json list of the data returned by the API.
legalserver_site
- requiredlegalserver_matter_uuid
- requiredservices_search_params
- Optional dictionary of search parameterssort
- optional string to sort the resultspage_limit
- optional limit to the number of pages returned
This is a keyword defined function that gets back all of the organization affiliation records on a user. This uses the Search User Organization Affiliation API endpoint. They are returned as a list of Organization Affiliations.
legalserver_site
- required stringlegalserver_user_uuid
- required string
This is a keyword defined function that takes a DAList of IndividualNames and
populates it with the contact details related to a case. If the general
legalserver_data from the get_matter_details
response is not included, it will
make an API call using the search_matter_additional_names
function. Since the
standard response from the get_matter_details
does not include this data, it
will always make that call.
additional_name_list
- required DAList of Individuals for the contactslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not provided
This is a keyword defined function that takes a DAList of Persons and
populates it with the assignment details related to a case. If the general
legalserver_data from the get_matter_details
response is not included, it will
make an API call using the search_matter_adverse_parties
function.
adverse_party_list
- DAList of Persons. Note that if it is an Individual Adverse Party, thename
attribute will be set to anIndividualName
.legalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not provided
This is a keyword defined function that takes a DAList of DAObjects and
populates it with the assignment details related to a case. If the general
legalserver_data from the get_matter_details
response is not included, it will
make an API call using the search_assignment_data
function.
assignment_list
- DAList of DAObjectslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not provided
This is a keyword defined function that takes a DAObject and populates it with
the case related details related to a case. It requires the general
legalserver_data from the get_matter_details
response.
case
- DAObjectlegalserver_data
- the full case data returned from the Get Matter API call to LegalServer
This is a keyword defined function that takes a DAList of DAObjects and
populates it with the charge details related to a case. If the general
legalserver_data from the get_matter_details
response is not included, it will
make an API call using the search_matter_charges_data
function.
charge_list
- DAList of DAObjectslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not providedcustom_fields
- Optional list of field names for custom fields to include
This is a keyword defined function that takes a the general legalserver_data
from the get_matter_details
and saves the client related data to either an
Individual or a Person depending on whether the client is an individual or a
group.
client
- Either an Individual or a Person objectlegalserver_data
- the full case data returned from the Get Matter API call to LegalServer
This is a keyword defined function that takes a DAList of Individuals and
populates it with the contact details related to a case. If the general
legalserver_data from the get_matter_details
response is not included, it will
make an API call using the search_contact_data
function.
contact_list
- required DAList of Individuals for the contactslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not providedcustom_fields
- Optional list of field names for custom fields to include
This is a keyword defined function that takes an Individual object and populates it with the user data of the user who initiated the Docassemble Interview from LegalServer.
legalserver_current_user
- Individual object that will be returnedlegalserver_current_user_uuid
- needed to identify the user.legalserver_site
- needed to identify the site.user_custom_fields
- Optional list of custom fields to gather on the User record.
This is a keyword defined function that takes a DAList of DAObjects and
populates it with the event details related to a case. If the general
legalserver_data from the get_matter_details
response is not included, it will
make an API call using the search_event_data
function.
Note that because this package is designed to connect LegalServer cases to Docassemble, it does not address the Outreaches key present in the LegalServer event response.
event_list
- DAList of DAObjectslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not providedcustom_fields
- Optional list of field names for custom fields to include
This is a keyword defined function that takes an Individual object and populates
it with the user data of the earliest Pro Bono assignment on a case that has not
yet ended. This needs populate_assignment()
run first so that it can parse the
list of assignments on the case for the expected Pro Bono assignment.
legalserver_first_pro_bono_assignment
- Individual object that will be returnedassignment_list
- DAList of DAObjectslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not provideduser_custom_fields
- Optional list of custom fields to gather on the User record.
This is a keyword defined function that takes a DAList of DAObjects and
populates it with the income details related to a case. If the general
legalserver_data from the get_matter_details
response is not included, it
would make an API call using the search_income_data
function. Unfortunately,
the Search Income API endpoint does not currently exist.
income_list
- DAList of DAObjectslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not provided
This is a keyword defined function that takes an Individual object and populates
it with the user data of the latest Pro Bono assignment on a case that has not
yet ended. This needs populate_assignment()
run first so that it can parse the
list of assignments on the case for the expected Pro Bono assignment.
legalserver_latest_pro_bono_assignment
- Individual object that will be returnedassignment_list
- DAList of DAObjectslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not provideduser_custom_fields
- Optional list of custom fields to gather on the User record.
This is a keyword defined function that takes a DAList of DAObjects and
populates it with the litigation details related to a case. If the general
legalserver_data from the get_matter_details
response is not included, it will
make an API call using the search_matter_litigation_data
function.
litigation_list
- DAList of DAObjectslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not providedcustom_fields
- Optional list of field names for custom fields to include
This is a keyword defined function that takes a DAList of DAObjects and
populates it with the note details related to a case. If the general
legalserver_data from the get_matter_details
response is not included, it will
make an API call using the search_matter_notes_data
function.
note_list
- DAList of DAObjectslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not provided
This is a keyword defined function that takes an Individual object and populates
it with the user data of the current primary assignment on a case. This needs
populate_assignment()
run first so that it can parse the list of assignments
on the case for the current primary assignment.
primary_assignment
- Individual object that will be returnedassignment_list
- DAList of DAObjectslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not provideduser_custom_fields
- Optional list of custom fields to gather on the User record.
This is a keyword defined function that takes a DAList of Individuals and populates
it with the user data of all the assigned Pro Bono assignments on a case
whose assignments have not yet been ended. This needs
populate_assignment()
run first so that it can parse the list of assignments
on the case for the current primary assignment.
pro_bono_assignment_list
- DAList object of Individual objects that will be returnedassignment_list
- DAList of DAObjectslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not provideduser_custom_fields
- Optional list of custom fields to gather on the User record.
This is a keyword defined function that takes a DAList of DAObjects and
populates it with the service details related to a case. If the general
legalserver_data from the get_matter_details
response is not included, it will
make an API call using the search_matter_service_data
function.
service_list
- DAList of DAObjectslegalserver_data
- Optional dictionary of the matter data from a LegalServer requestlegalserver_matter_uuid
- needed if thelegalserver_data
is not providedlegalserver_site
- needed if thelegalserver_data
is not providedcustom_fields
- Optional list of field names for custom fields to include
This is a keyword defined function that helps populate an Individual record with details from the Get User API response.
user
- The Individual object to be populated and returned.user_data
- The get_user_details() response dictionary that has the information to populate the record with.
This is a keyword defined function that takes three required parameters and one
optional parameter. Like the other function, it requires the
legalserver_site
and legalserver_matter_uuid
to link back to
the case. It also takes the file_path
of the file that was generated in
Docassemble. This can be retrieved by using .path()
with the file variable. If
the file uploaded is a zip file, the file will be saved to the case, unzipped to
the specified folder (or the root directory if one was not supplied) and a case
note linked to those documents created. If the file is not a zip file, it will
just be saved to the case. The folder can be specified with the subfolder
optional parameter. This uses the Post Documents to LegalServer as a Zip
endpoint.
legalserver_site
- required string for the LegalServer Site Abbreviationlegalserver_matter_uuid
- required string for the LegalServer Matter UUIDfile_path
- required string for the path to the file to be sent.subfolder
- optional string to identify a subfolder to store the file in when uploaded to LegalServersave_to_sharepoint
- optional boolean to save the file to the case's SharePoint case folder instead of the LegalServer document storage.
This uses the PyCountry module's fuzzy search to convert the name of the country to the alpha_2 abbreviation. Docassemble uses the abbreviation for location recognition, but LegalServer stores the name of the country, so this allows access to both. If multiple countries are identified, the response is "Unknown" and the error is logged.
There is a built in override that forces "United States" to return "US". Otherwise, it will return "US", "UM", and "VI".
country_name_string
- required string
This uses the PyCountry module to convert the name of the language to the alpha_2 abbreviation. Docassemble uses the abbreviation for language recognition, but LegalServer stores the name of the language, so this allows access to both.
language_name
- required string
This is a small helper function to identify whether the file_path
presented is
a zip file. This makes a difference when uploading the file to LegalServer.
file_path
- required string
Returns True
if two things are true:
- An API token for the given site is present in Docassemble's Config file.
- The Expiration date for the API token has not passed.
legalserver_site
- required string for the LegalServer Site Abbreviation
Simple function that checks how many pro bono assignments there are.
pro_bono_assignment_list
- required DAList of assignments
This is a small helper function that allows you to get a list of all the
templates stored in the /data/templates
folder of a given package. If no
package is specified, it will check against the current package. A list of
strings is returned.
package
- optional string name of a Docassemble package.
There are functions also designed to just return the list of standard keys returned in the LegalServer API calls. This makes it easier to identify when there are custom fields present in the API response. These exist for the following LegalServer response objects:
- Additional Names
- Adverse Parties
- Assignments
- Charges
- Client Addresses
- Contacts
- Documents
- Events
- Incomes
- Litigations
- Matters
- Non-Adverse Parties
- Organizations
- Services
- Tasks
- Users