DocsAutoResponderProcess

Multipub (subscription data)#

Purpose: Subscriber lookup and subscription validation before marking someone inactive (cross-check against subscription signals). Treated as subscription / marketing-owned data for most mutations.

Code: src/auto_responder/services/databases/multipub.py

Configuration#

SettingNotes
MULTIPUB_ORDER_SERVER, MULTIPUB_ORDER_DATABASE, MULTIPUB_ORDER_USER, MULTIPUB_ORDER_PASSWORDPrimary pattern: connection to the order server DB that exposes Multipub via linked server / OPENQUERY (see get_multipub_connection_string() in config.py).
MULTIPUB_CONNECTION_STRINGAlternative full connection string when order-server fields are not used.
multipub_order_request_timeoutRequest timeout for Multipub SQL (milliseconds in settings; used when building queries).

Contact lookup#

CallPurpose
lookup_by_emailPrimary subscriber match

(Other lookup helpers exist on the class for user ID / name+org; validation uses fields from the matched subscriber.)

Action engine touches#

Validation (INACTIVE path)#

CallPurpose
validate_for_inactive(...)Match subscriber; load active orders, recently expired (12 months), recent single-issue; set should_flag_for_review, review_reason

Downstream effects:

Reads after validation#

CallPurpose
check_active_subscription(subsnum)INACTIVE path — if Multipub still “active” in check, adds Multipub to subscription notification list

Writes — intentionally skipped in action_engine#

For INACTIVE, changed-email, title-update, and ACTIVE flows, the engine logs "Skip … — marketing team handles" and records a skip action instead of calling:

So routine pipeline processing does not mutate Multipub, even though the connector implements write methods for operational flexibility / future use.

OUT_OF_OFFICE never reaches validate_for_inactive or any Multipub read beyond the original contact lookup — _handle_out_of_office short-circuits to Human Review.

Read-only / dry-run#

Notifications#

Tarun upload feedback loop#

Once Tarun has reviewed the Multipub audit deliverable, he uploads the reviewed file back through the FastAPI microservice (started automatically with auto-responder, or via the dedicated script):

DetailValue
Console scriptauto-responder-tarun-upload
Entry pointsrc/auto_responder/services/tarun_upload_api.py (create_app, main)
RoutePOST /multipub/upload (health check at GET /healthz)
Persistence dirTARUN_UPLOAD_DIR env var (default ./tarun_uploads)
Embedded startup controlsTARUN_UPLOAD_API_ENABLED, TARUN_UPLOAD_API_HOST (default 0.0.0.0 so the API is reachable on the LAN), TARUN_UPLOAD_API_PORT, TARUN_UPLOAD_API_KEEP_ALIVE_AFTER_BATCH
Allowed suffixes.csv, .json, .xlsx, .xls, .tsv
Client Services email (Yes path)notify_multipub_subscriber_followup_from_upload — Angel + Yogesh To, Matt Cc (same shape as batch 1.1)
Installpip install -e . (FastAPI packages are in base dependencies)

The endpoint copies the upload into TARUN_UPLOAD_DIR/<timestamp>_<filename> and triggers EmailService.send_email with the reviewed file attached, closing the loop without a manual hand-off.

Output artifacts#