๐ฅ Introduction
If there's one name in Maratha history that embodies courage under pressure, it’s Tanaji Malusare.
When the Kondhana Fort had to be reclaimed, Tanaji didn’t wait. He scaled the cliffs with a monitor lizard ๐ฆ, led a night raid, and paid the ultimate price — but won the fort.
In the Fraud-Free Swarajya project, Tanaji is our AI fraud scorer — making fast, high-stakes decisions on every incoming transaction.
Just like the real Tanaji, our AI:
-
Works under uncertainty
-
Evaluates risk on the fly
-
Doesn’t wait for permission to act ๐
๐ง What Tanaji (the AI) Does
The tanaji module is a Python-based microservice powered by:
✅ FastAPI
✅ scikit-learn
for ML
✅ pydantic
for validation
✅ uvicorn
for async web serving
✅ Logging + formatting with loguru
and pythonjsonlogger
It receives a transaction like this:
Then it returns a fraud score, a risk level, and even an explanation.
๐งช How It Works Behind the Scenes
-
Feature Extraction:
We extract meaningful inputs like:-
Amount
-
Whether the location or payment method is risky
-
-
Model Training:
We trained a basicRandomForestClassifier
on synthetic data to:-
Classify transactions as fraud or not
-
Assign a confidence score (0 to 1)
-
-
Scoring Endpoint:
Exposed at/score
, it predicts and responds in milliseconds. -
Logging Everything
Every request and response is structured, logged, and dockerized.
๐งฑ Why FastAPI?
Because:
-
It’s async by design
-
Lightning fast (even for ML)
-
Auto-generates Swagger docs
-
Works beautifully inside Docker
-
And let’s be honest: It feels like Spring Boot’s cousin — but cooler with Python ๐
๐ฅ Tanaji Trivia Time
Here are some legendary facts about Tanaji Malusare:
-
๐ฅ He led the assault on Kondhana Fort in 1670 with just a handful of soldiers.
-
๐ฆ He used a monitor lizard (ghorpad) to scale the vertical walls of the fort at night.
-
๐ Though mortally wounded in the battle, his mission succeeded — and Shivaji said:
"Gad aala, pan Sinh gela." (We got the fort, but lost the lion.) -
๐ก️ Kondhana was later renamed Sinhagad in his honor.
Like Tanaji, our AI doesn't hesitate. It detects danger, acts swiftly, and protects the digital kingdom.
⚙️ Sample Response from Tanaji
Simple. Actionable. Defensible.
๐งฐ Dockerizing Tanaji
We packaged Tanaji with a clean Docker setup:
-
uvicorn
+FastAPI
as entrypoint -
Exposes port
8000
-
Shared volume for
fraud_model.pkl
-
Ready to scale with Docker Compose
๐ง What Makes This Exciting?
-
You can retrain the model (
train_model.py
) anytime -
Logs are structured and Prometheus-ready
-
Pluggable with any orchestrator or microservices platform
-
As the Fraud-Free Swarajya grows, Tanaji will evolve — just like his legacy lives on
๐งญ What’s Next?
In the next post, we’ll meet dadoji
— the rule engine who checks the AI’s decisions using wisdom and business rules.
We’ll also show how AI and logic can work together — just like generals and warriors on a battlefield.
No comments:
Post a Comment