Project

General

Profile

Actions

Feature #60

open
AS

Feature #33: Canofy Control Centre Backend Development

Feature #46: Canofy Control Centre Onboarding Process

# [CANOFY-114] Register Site on OCR Server

Feature #60: # [CANOFY-114] Register Site on OCR Server

Added by Akshath Shettigara about 1 month ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
07/23/2026
Due date:
% Done:

0%

Estimated time:

Description

[CANOFY-114] Register Site on OCR Server

Type: Story
Epic: New Client Onboarding — Automated AWS + Frappe Provisioning
Stage key: ocr_register (pipeline stage 14 of 15)
Component: utils/ocr_config_manager.py, utils/onboarding_executor.py

User Story

As an operations engineer,
I want the new client's site automatically registered in the shared
OCR server's config files,
so that the OCR pipeline recognizes and processes documents for this
client without a manual config file edit on the OCR server.

Description

Call ocr_config_manager.register_site_on_ocr(site_name, client_code),
which:

  1. Updates property.json on the shared OCR server (adds
    {site_name: {client_code}}).
  2. Updates sites.json on the client's own server (adds site_name to the
    list).
  3. Appends a row to OCR Server Config.registered_sites.
  4. Sets Client Site.ocr_registered = 1.

This stage is explicitly best-effort / non-fatal — unlike stage 7
(ocr_policy_update, IAM), a failure here must not fail the whole
onboarding run, since OCR registration can be corrected after the fact
without re-provisioning anything. The failure must still be clearly logged
so it isn't silently missed.

Configuration / Prerequisites

  • OCR Server Config singleton populated (ocr_server,
    property_json_path, sites_json_path) — if this is unset, the stage
    should log a clear "OCR not configured, skipping" message and continue,
    not throw an unhandled exception.
  • Depends on stage 10 (site exists) and stage 5 (client_code known).

Acceptance Criteria

  • property.json on the OCR server gains an entry for this site/client,
    with every previously-registered site's entry left untouched.
  • sites.json on the client's own server gains this site.
  • A failure at any point in this stage (OCR server unreachable, config
    file malformed, etc.) is caught, logged, and does NOT change
    Onboarding Request.onboarding_status to Failed — the pipeline
    proceeds to the next stage.
  • Client Site.ocr_registered is only set to 1 on actual success, not
    when the stage is skipped/failed.

Test Cases

ID Scenario Steps Expected Result
TC-1 Happy path Run stage with valid OCR config Both config files updated; Client Site.ocr_registered = 1
TC-2 No regression to existing registrations Diff property.json/sites.json before/after All previously-registered clients/sites remain present
TC-3 OCR not configured OCR Server Config.ocr_server unset Stage logs "skipped, not configured" and the pipeline continues to stage 15 without failing
TC-4 OCR server unreachable Simulate an SSM failure against the OCR server Stage logs the failure with detail; pipeline still continues; ocr_registered stays 0
TC-5 Idempotent re-run Run stage twice for the same site sites.json/property.json don't end up with duplicate entries

No data to display

Actions

Also available in: PDF Atom