Main projectPersonal projectAug–Oct 2026, built alongside my internship
Churn Survival
A tool that predicts which customers are likely to leave, and when. It reads customer data and support messages, ranks customers by risk, and explains each ranking in plain language.
In short. Companies get lists of customers who might leave, but a score alone doesn't say why an account is critical. This tool predicts who is likely to leave within 30, 90 and 180 days, ranks customers with fixed rules, and explains each ranking in plain language. The AI only writes the explanations, so it can never change a score.
A recording of the web page: upload a file, run the five steps and read the ranked report. It also shows what happens when there is too little data or the columns are not mapped.
Speed14 chapters
Core flow
Safety and limits
Core flow
Safety and limits
How it flows
Follow a customer file through the five steps
Pick a file from the demo:
What came out
3,832 accounts ranked: 228 critical, 6 high, 245 medium, 3,353 low. CUST-2996 is rank 1 with "cancellation intent detected".
Click any box to see what that step does.
Problem
Customer data is messy, and a risk score is only useful if you can see where it came from.
Approach
Use a method made for "when will it happen" questions, rank customers with fixed rules, and let the AI only help write the explanations.
Result
Tests confirm that the written explanations can never change a customer's score or rank, and that the same data always gives identical results.
Limits
The main tests use made-up data. The demo also runs on a few real datasets from outside sources. They have no support conversations, so their reports show low confidence. Coverage gate is 92%; the last run reached 94%.
The AI explains. It never decides the numbers. Scores and rankings come from fixed rules, so the same data always gives the same result.
5
steps from raw data to report
0
AI calls when ranking customers
1,546
automated tests passing
30 · 90 · 180
day predictions per customer
01What it does
Companies want to know which customers are about to leave, so they can act in time. This tool takes a customer file and, if you have them, support conversations. It estimates each customer's chance of leaving within 30, 90 and 180 days, ranks everyone by risk, and writes a short explanation for each one.
The key idea: a risk score is only useful if you can see where it came from. So the numbers come from a proven statistics method and fixed rules, and the AI is only allowed to help with wording.
02The five steps
The five steps run one after another in plain Python code. (The project's README mentions LangGraph, but the code does not use it.)
step 1Fixed rules
Read and clean the data
Takes a customer file (CSV or Excel), checks it, and keeps out columns that should not be used.
Stops if the data contains dates from the future, which would be cheating.
Only approved columns reach the prediction. Other columns are set aside.
If it does not recognise the file layout, it stops and asks for a column mapping instead of guessing.
Uses a method built for "how long until something happens" (survival analysis) to estimate each customer's chance of leaving within 30, 90 and 180 days.
It needs enough customers and enough customers who left. If not, it uses a simpler method (Kaplan-Meier) instead.
Each time horizon is only reported if there is enough data behind it.
The result records which method was used, so you can see when the data was thin.
This is step four, the ranking. I do not show real customer predictions here, because this explorer uses made-up test data. (The demo video above also runs a few real datasets, which show low confidence because they have no support conversations.) What I can show is the real ranking logic. Move the slider, add warning signs and watch how the level changes.
Your inputs
Result
CRITICAL
Prediction score
0.800
Warning-sign score
0.900
Strongest warning sign
strong
Agreement bonus
+0.05
Final score
0.890
from the model Prediction score: in the real tool it comes from the statistics model. Here you set it with the slider.
from support messages Warning-sign score: worked out by rules from the warning signs found in support messages.
fixed rules Final score, bonus and level: set by fixed rules in code. No AI is involved.
0.6 × 0.800 + 0.4 × 0.900 + 0.05 = 0.890
Critical rules triggered (any one of them makes the level CRITICAL):
High quantitative risk plus a strong contract concern
High quantitative risk plus a repeated high-severity flag
This runs the project's real ranking rules on the numbers you set. It is not a prediction and not real customer data.
04Why it works this way
Use survival analysis, not a yes/no model
The question is "when", so the model gives risk over 30, 90 and 180 days.
Rank with fixed rules, no AI
Scores must be repeatable and easy to explain. Every level comes from a weight, a limit or a named rule.
Say "not enough data"
A small group of customers cannot support a prediction, so the tool says so instead of showing a confident-looking number.
Ask before guessing a file layout
If a file looks new, a person confirms which column is which.
05What the AI may do
By default, nothing: the AI is switched off, support messages are read with a keyword search and explanations come from templates. If you switch it on, it can suggest which column is which in a new file (a person confirms), find warning signs in support messages, and polish the wording of explanations.
Tests check that the ranking never calls an AI and that an explanation can never change a customer's score, level or rank. One thing to remember: if the AI is used to find warning signs, those signs come from the AI, and the ranking then works from them.
Running the same data twice gives exactly the same output in the project's tests (with the same date setting and the AI off).
06The web page
The project comes with a simple web page where you upload data, start a run and read the results. These are its own screenshots.
The list of past runs. Some finished, some stopped because the data needed checking.
Upload data and start a run.
For a new file, a person confirms which column is which.
07What to know
The data in the tests is made-up. The demo also runs on a few real datasets from outside sources. They have no support conversations, so their reports show low confidence. This page shows how the ranking rules work, not validated real-world predictions.
If the optional AI is switched on to find warning signs, those signs come from the AI. The ranking and explanations still follow fixed rules.
Running the same data twice gives identical results on the machine it was built on. Other machines have not been tested.
The project is protected by 1,546 automated tests (2 skipped) that cover 94% of the code. On every push, CI (GitHub Actions) checks a 92% coverage minimum, the code style and the types. Tests that need an AI service are marked and never run in CI, so CI needs no AI key.