|
| 1 | +# Integration Blueprints |
| 2 | + |
| 3 | +This page shows practical integration blueprints for the v2.4 import platform |
| 4 | +layer. |
| 5 | +These are not new product surfaces. |
| 6 | +They are recommended ways to compose the current 2.x capabilities. |
| 7 | + |
| 8 | +If you want the platform capability map, see |
| 9 | +[`docs/platform-architecture.md`](platform-architecture.md). |
| 10 | +If you want the runtime sequence view, see |
| 11 | +[`docs/runtime-model.md`](runtime-model.md). |
| 12 | +If you want detailed result payload shapes, see |
| 13 | +[`docs/result-objects.md`](result-objects.md) and |
| 14 | +[`docs/api-response-cookbook.md`](api-response-cookbook.md). |
| 15 | + |
| 16 | +## Blueprint 1: Backend Worker Import Flow |
| 17 | + |
| 18 | +Use this blueprint when your application already has a worker, queue, or job |
| 19 | +runner and you want ExcelAlchemy to remain the import engine inside that worker. |
| 20 | + |
| 21 | +This is an application-level worker blueprint. |
| 22 | +It is not a claim that ExcelAlchemy ships a worker framework. |
| 23 | + |
| 24 | +### Recommended shape |
| 25 | + |
| 26 | +```mermaid |
| 27 | +flowchart LR |
| 28 | + U[Spreadsheet User] --> API[Upload API] |
| 29 | + API --> PF[Preflight Gate] |
| 30 | + PF -->|valid| Q[App Queue / Worker Trigger] |
| 31 | + PF -->|invalid| PFR[Preflight Response] |
| 32 | +
|
| 33 | + Q --> W[Backend Worker] |
| 34 | + W --> EA[ExcelAlchemy import_data(..., on_event=...)] |
| 35 | + EA --> RES[ImportResult + Issue Maps] |
| 36 | + EA --> OUT[Result Workbook Upload] |
| 37 | + RES --> APIRES[API Status Store / Polling Endpoint] |
| 38 | + OUT --> APIRES |
| 39 | +``` |
| 40 | + |
| 41 | +### Why this fits the current platform |
| 42 | + |
| 43 | +- preflight stays a lightweight synchronous gate |
| 44 | +- the worker owns application scheduling and retries |
| 45 | +- `import_data(..., on_event=...)` remains the real runtime entry point |
| 46 | +- lifecycle events can update application job status inline |
| 47 | +- result intelligence remains post-import and machine-readable |
| 48 | + |
| 49 | +### Recommended responsibilities |
| 50 | + |
| 51 | +Upload API: |
| 52 | + |
| 53 | +- accept the workbook reference |
| 54 | +- run `preflight_import(...)` |
| 55 | +- reject obvious structural failures early |
| 56 | +- enqueue only structurally importable workbooks |
| 57 | + |
| 58 | +Backend worker: |
| 59 | + |
| 60 | +- call `import_data(..., on_event=...)` |
| 61 | +- update job status using lifecycle events |
| 62 | +- persist `ImportResult` |
| 63 | +- persist row/cell issue payloads when needed |
| 64 | +- expose result workbook URL when one is produced |
| 65 | + |
| 66 | +Application status endpoint: |
| 67 | + |
| 68 | +- return job state |
| 69 | +- return final result payloads |
| 70 | +- optionally expose remediation payloads for UI consumers |
| 71 | + |
| 72 | +### Important boundaries |
| 73 | + |
| 74 | +- the queue, worker, retry policy, and job persistence belong to the |
| 75 | + application |
| 76 | +- ExcelAlchemy remains synchronous inside the worker execution |
| 77 | +- do not describe this as an ExcelAlchemy job subsystem |
| 78 | + |
| 79 | +## Blueprint 2: Frontend Remediation Flow |
| 80 | + |
| 81 | +Use this blueprint when a frontend needs both high-level outcome information and |
| 82 | +compact retry guidance after a failed import. |
| 83 | + |
| 84 | +```mermaid |
| 85 | +flowchart TD |
| 86 | + U[Spreadsheet User] --> FE[Frontend] |
| 87 | + FE --> API[Backend API] |
| 88 | + API --> PF[preflight_import(...)] |
| 89 | +
|
| 90 | + PF -->|invalid| PRE[ImportPreflightResult payload] |
| 91 | + PF -->|valid| RUN[import_data(...)] |
| 92 | +
|
| 93 | + RUN --> R[ImportResult] |
| 94 | + RUN --> C[CellErrorMap] |
| 95 | + RUN --> RI[RowIssueMap] |
| 96 | + RUN --> RP[build_frontend_remediation_payload(...)] |
| 97 | + RUN --> URL[result workbook URL] |
| 98 | +
|
| 99 | + PRE --> FE |
| 100 | + R --> FE |
| 101 | + C --> FE |
| 102 | + RI --> FE |
| 103 | + RP --> FE |
| 104 | + URL --> FE |
| 105 | +``` |
| 106 | + |
| 107 | +### Recommended frontend use |
| 108 | + |
| 109 | +Preflight response: |
| 110 | + |
| 111 | +- decide whether the workbook is structurally importable |
| 112 | +- show blocking sheet/header problems before full execution |
| 113 | + |
| 114 | +Result response: |
| 115 | + |
| 116 | +- use `ImportResult` for high-level outcome and counts |
| 117 | +- use `CellErrorMap` for precise field/cell UI highlighting |
| 118 | +- use `RowIssueMap` for list/table summaries |
| 119 | +- use the remediation payload for concise retry guidance |
| 120 | +- use the result workbook URL when the user should download the annotated file |
| 121 | + |
| 122 | +### Recommended response layering |
| 123 | + |
| 124 | +- `preflight` |
| 125 | + - structural gate result only |
| 126 | +- `result` |
| 127 | + - overall import outcome |
| 128 | +- `cell_errors` |
| 129 | + - precise workbook-coordinate issues |
| 130 | +- `row_errors` |
| 131 | + - grouped row summaries |
| 132 | +- `remediation` |
| 133 | + - optional condensed retry guidance |
| 134 | + |
| 135 | +### Important boundaries |
| 136 | + |
| 137 | +- remediation payloads are additive and opt-in |
| 138 | +- they do not replace the stable result payloads |
| 139 | +- they should stay conservative and avoid overstating automatic fix guidance |
| 140 | + |
| 141 | +## Blueprint 3: Artifact Delivery Flow |
| 142 | + |
| 143 | +Use this blueprint when delivery of the template artifact and result workbook is |
| 144 | +part of the integration design. |
| 145 | + |
| 146 | +```mermaid |
| 147 | +flowchart LR |
| 148 | + A[Application] --> T[Template Artifact Request] |
| 149 | + T --> EA[ExcelAlchemy] |
| 150 | + EA --> TA[ExcelArtifact] |
| 151 | + TA --> DL[Browser Download or API Response] |
| 152 | +
|
| 153 | + A --> I[Import Runtime] |
| 154 | + I --> RW[Rendered Result Workbook] |
| 155 | + RW --> ST[ExcelStorage Upload] |
| 156 | + ST --> URL[Result Workbook URL] |
| 157 | + URL --> API[API Response or Worker Status] |
| 158 | +``` |
| 159 | + |
| 160 | +### What this highlights |
| 161 | + |
| 162 | +- template authoring and result delivery share rendering primitives |
| 163 | +- artifact delivery is a platform stage even though it depends on earlier |
| 164 | + stages |
| 165 | +- storage remains a seam rather than a mandated backend |
| 166 | + |
| 167 | +## Choosing The Right Blueprint |
| 168 | + |
| 169 | +- use the backend worker blueprint when your application already has queued or |
| 170 | + long-running import orchestration |
| 171 | +- use the frontend remediation blueprint when the UI needs compact retry |
| 172 | + guidance after validation failures |
| 173 | +- use the artifact delivery blueprint when file delivery semantics are a first |
| 174 | + class part of the integration |
| 175 | + |
| 176 | +In all three cases, keep the same platform order: |
| 177 | + |
| 178 | +1. template authoring |
| 179 | +2. preflight gate |
| 180 | +3. import runtime |
| 181 | +4. result intelligence |
| 182 | +5. artifact and delivery |
| 183 | + |
| 184 | +## Recommended Reading |
| 185 | + |
| 186 | +- [`docs/platform-architecture.md`](platform-architecture.md) |
| 187 | +- [`docs/runtime-model.md`](runtime-model.md) |
| 188 | +- [`docs/result-objects.md`](result-objects.md) |
| 189 | +- [`docs/api-response-cookbook.md`](api-response-cookbook.md) |
0 commit comments