Prototype — Proof of Concept
A local, browser-based tool for life insurance actuaries to upload Excel workbooks and receive a structured PDF diagnostic report identifying risks across 24 categories.
This tool is a proof of concept and has not been through full or formal testing. It is provided for educational and reference purposes only.
- Do not rely on its outputs for production, regulatory, or commercial decisions.
- Results may be incomplete, inaccurate, or misleading.
- Use entirely at your own risk. See LICENSE for full terms.
The tool runs entirely on your local machine. No data is sent to any external
server. It analyses .xlsx and .xlsm workbooks and produces:
- An interactive summary within the browser (RAG rating, finding counts, top findings)
- A downloadable structured PDF report per workbook
| Tier | Category | Checks |
|---|---|---|
| 1 — Automated | Formulas | Hardcoded literals, VLOOKUP approximate match, volatile functions, inconsistent ranges, paste overrides, mixed $ anchors |
| 1 — Automated | Errors | Cell errors (#REF!, #N/A, #DIV/0!, etc.) |
| 1 — Automated | Links | Broken external links, broken named ranges, circular references |
| 1 — Automated | Structure | File size, excessive cells, hidden sheets, sheet protection |
| 1 — Automated | VBA | VBA presence, hardcoded parameters, missing error handling, On Error Resume Next, dangerous commands, hardcoded file paths |
| 2 — Heuristic | Actuarial | High-sensitivity sheet detection, VLOOKUP escalation, assumption consistency, isolated hardcoded values |
Requirements: Python 3.9 or later.
# 1. Clone the repository
git clone https://github.com/chadwickkcc/Excel-Risks-Checker---Prototype.git
cd "Excel-Risks-Checker---Prototype"
# 2. (Recommended) create a virtual environment
python -m venv .venv
source .venv/bin/activate # macOS / Linux
.venv\Scripts\activate.bat # Windows
# 3. Install dependencies
pip install -r requirements.txtstreamlit run app.pyThe app will open automatically in your default browser at
http://localhost:8501.
The sidebar contains a Settings panel where you can adjust:
| Setting | Default | Description |
|---|---|---|
| File size warning (MB) | 20 | Files above this receive a Medium finding |
| File size critical (MB) | 50 | Files above this receive a High finding |
| Max cells per sheet | 50,000 | Sheets with more populated cells trigger a finding |
| Actuarial keywords | See below | Sheet names containing these words are flagged as sensitive |
Default actuarial keywords: assumption, mortality, lapse, discount, reserve, capital, reinsurance, premium, claim, exposure, liability, asset
Click Apply Settings to activate changes before running analysis.
| Rating | Score | Meaning |
|---|---|---|
| 🟢 Green | 0–10 | Low risk — no immediate action required |
| 🟠 Amber | 11–40 | Moderate risk — review High and Medium findings before use |
| 🔴 Red | 41+ | High risk — significant issues require resolution |
Each finding contributes to a total risk score:
- High severity: 10 points each
- Medium severity: 3 points each
- Low severity: 1 point each
- Cover page — RAG badge, finding counts, file metadata
- Executive Summary — auto-generated plain-English summary
- AI Workbook Intelligence (only if AI commentary is enabled) — workbook purpose, sheet-by-sheet narratives, key formula explanations, and assumption commentary; all content labelled "AI-Generated — Interpretive Only"
- Findings by Category — one section per checker type
- High-Sensitivity Sheets — findings specific to actuarially sensitive sheets
- Appendix — complete findings table sorted by severity
app.py ← Streamlit UI (entry point)
settings.py ← All configurable constants
models.py ← Finding / WorkbookAnalysisResult / AI data classes
workbook_analyser.py ← Orchestrator (callable without UI)
checkers/
formula_checker.py ← Checks 1–6
error_checker.py ← Check 7
link_checker.py ← Checks 8–10
structure_checker.py ← Checks 11–14
vba_checker.py ← Checks 15–20
actuarial_checker.py ← Checks 21–24
reporter.py ← ReportLab PDF generation
digest_builder.py ← Extracts token-efficient workbook digest for AI
ai_analyser.py ← Anthropic API calls; returns AICommentary
workbook_analyser.analyse_workbook(Path(...)) can be called independently
of Streamlit for batch processing or scripted use.
The tool includes an optional AI-powered commentary layer that calls the Anthropic API to produce plain-English analysis alongside the deterministic findings. All four features are opt-in and gated behind a sidebar toggle — the deterministic checks run entirely offline whether or not AI is enabled.
- Open the AI Commentary (Optional) expander in the sidebar.
- Check Enable AI commentary.
- Enter your Anthropic API key in the password field and click Set API Key. The field clears immediately on submission and a confirmation message is shown in its place. The key is held in Streamlit session state only and is never written to disk. Click Remove API key to clear it at any time.
- Select which features to include (all are enabled by default).
- Run the analysis — expect an additional 30–60 seconds per workbook.
| Feature | Description |
|---|---|
| Findings narrative | Plain-English synthesis of risk findings for the PDF executive summary |
| Workbook purpose & sheet summaries | What the workbook does and what each tab contributes |
| Key formula explanations | Plain-English explanation of the most structurally complex formulas |
| Assumption / input commentary | Discovery and plausibility review of input parameters |
AI features use claude-sonnet-4-6 (configurable via AI_MODEL in
settings.py).
If AI commentary was generated, the PDF report gains an "AI Workbook Intelligence" section between the Executive Summary and the Findings by Category section. All AI-generated content is labelled "AI-Generated — Interpretive Only" and carries a disclaimer footer.
- Password-protected files cannot be analysed. Remove the password before uploading.
- VBA analysis requires
.xlsmformat..xlsxfiles never contain VBA and this is handled gracefully. - Formula checks use openpyxl's formula string representation, which may not match Excel's display in all cases (e.g. array formulas).
- Circular references are inferred from iterative calculation settings rather than traced directly — some edge cases may be missed.
- External link accessibility is checked relative to the temp upload path; external files will almost always appear inaccessible during upload.
To validate key checks, create these three test workbooks:
test_formulas.xlsx
- Sheet named
Assumptions: formula=A1*0.045, a VLOOKUP with no 4th argument, a plain value surrounded by formula cells - Sheet named
Mortality: cells with=NOW()and=INDIRECT("A1")
test_structure.xlsx
- A hidden sheet named
Hidden_Reserves - A protected worksheet
- 50,000+ populated cells on one sheet
test_macros.xlsm (requires Excel to create)
- VBA module containing:
On Error Resume NextKill "C:\temp\file.txt"- A
Subwith noOn Errorstatement Dim dRate As Double: dRate = 0.045
All thresholds are in settings.py. Edit that file to:
- Add new actuarial keywords
- Change severity point weights
- Modify the list of dangerous VBA commands
- Adjust the "safe" numeric constants excluded from literal checks
This project is not open source. Source code is made available for educational and reference purposes only. No rights to use, copy, modify, distribute, or commercialise this software are granted.
See LICENSE for full terms.
Copyright © 2026 chadwickkcc@gmail.com. All rights reserved.