download_business_background_report

Business purpose: pull a background report for the supplier’s business entity and archive it for underwriters to read. This is the simplest process — it stores raw results and scores nothing.

Step 1 — thomson_reuters/request_business_background_report

InitialTask, runs in the Web API.

Input

supplier_key, person_id, business_name, state

Allowed sources

INTERNAL only

Input validator

yes (business name + required state)

Output

{correlation_id}

Side effects: save the row (pending) and start SWF with task_input = {correlation_id}. Workflow id: Automatic UW Tool - {supplier_key} - Download business background report.

This is the only request task that does not touch ToolTable — there is no business-report tool, so nothing is set to PENDING and nothing turns ERROR on failure.

Step 2 — thomson_reuters/handle_business_background_report_response

GenericTask + PurgableS3ObjectProducer. Input: {correlation_id}.

Flow

  1. Reload the row and build the search payload from background_business_search.xml (business_name, state).

  2. POST {THOMSON_REUTERS_API_URL}/v2/business/searchResults; read GroupCount from ns2:BusinessResults (0 or missing → ResultNotFound) and Uri (missing → MalformedResponse), then GET the search result.

  3. Read ns3:BusinessResultsPage.ResultGroup.GroupId (missing → MalformedResponse).

  4. POST /v2/businessReport/reportResults with background_business_report.xml, then poll the returned Uri until Status.StatusCode is no longer 204. The details node is read as ns10:BusinessReportDetails with a fallback to ns11:BusinessReportDetails.

  5. Archive the report to S3.

Unlike the other Thomson Reuters tasks this one addresses namespace-prefixed nodes literally (ns2:, ns3:, ns10:/ns11:) instead of discovering the prefix with find_key_in_tr_response. A CLEAR response whose prefixes shift will raise a KeyError here.

Side effects

  • S3: thomson_reuters/background_reports/supplier_key=<sk>/person_id=<pid>/business/<timestamp>.json.

  • TaskExecutionTable → processed, output = {raw_result_s3_path}, additional_data.full_result_s3_path.

  • No FinalStatusTable, no ToolTable, no EventBridge event.

  • Implements purge().

  • On failure only the task row is marked failed (no tool exists to flag). This task is also built without a logger, so its failures are visible through SWF and Sentry rather than application logs.

Source files

  • task/thomson_reuters/request_business_background_report/

  • task/thomson_reuters/handle_business_background_report_response/

  • components/thomson_reuters/request_template/background_business_search.xml, background_business_report.xml

  • Tests: development/unit_tests/task_/thomson_reuters/**