
Building ChallanCheck: What Broke, What We Learned, and How We Deployed on AWS
ChallanCheck is an evidence-consistency engine for e-Challans. This is the build story: the architecture decisions, AWS deployment, trust-boundary design, failed Bedrock access, and the lessons we learned under hackathon time pressure.
Why I built ChallanCheck
An e-Challan usually contains two important things: the violation that was cited and photographic evidence.
Sometimes those two do not appear to match.
If that happens, the driver has to manually inspect the image, understand the cited violation, and reason about whether the evidence is actually consistent with the claim.
That was the problem I wanted to solve.
ChallanCheck is an evidence-consistency engine for e-Challans. It does not decide whether a challan is legally valid, whether someone is guilty, or whether they should dispute it.
It does one narrower thing:
compare the cited violation with observable facts in the attached evidence.
The most important architecture decision
My original instinct was simple:
send the image and the challan claim to an AI model and ask whether they match.
I ended up rejecting that architecture.
The problem was trust.
A multimodal model is useful at describing what it can see, but I did not want a probabilistic model deciding whether a traffic violation was legally correct.
So I separated the system into two layers.
Observation
The model or local fixture adapter may only return structured visual facts such as:
- vehicle type
- people visible
- helmet visibility
- license plate visibility
- image quality
- occlusion
- uncertainty
Evaluation
Deterministic application code compares those observations with the selected claim and produces one of a small set of outcomes:
- Observable Inconsistency
- No Mismatch Found
- Insufficient Evidence
- Unsupported Check
That boundary became the core of the project.
AI observes. Code evaluates.
The system never decides guilt, innocence, legal validity, or whether someone should dispute a challan.
Handling uncertainty was harder than expected
One of the easiest mistakes in a system like this is forcing an answer when the image is unclear.
For example, if the evidence is heavily occluded and helmet visibility is uncertain, returning a confident mismatch would be worse than returning no result.
So uncertainty became a first-class part of the system.
If the evidence is not strong enough, ChallanCheck returns:
Insufficient Evidence
That sounds simple, but it changed how I designed the entire rule engine.
Instead of asking only:
What did the model observe?
I also had to ask:
How confident is that observation, and is it strong enough to evaluate the claim safely?
Multi-claim challans created another problem
A challan can contain more than one recognizable violation.
I did not want the application silently choosing whichever claim appeared first.
So the rule became:
- detect all supported candidate claims
- show all candidates to the user
- require explicit selection if there is more than one
- evaluate exactly one selected claim per audit
This seems like a UX detail, but it is really a correctness rule.
Silent assumptions are dangerous in evidence-review software.
Deploying on AWS
For the Ship It path, I kept the architecture deliberately small.
The deployed application uses:
- Amazon API Gateway
- AWS Lambda
- AWS CloudFormation
- Amazon CloudWatch
- Amazon S3 for the deployment package
The browser talks to API Gateway, which invokes one Lambda function.
The Lambda serves the application and provides the backend API.
I deliberately did not add a database, queue, authentication system, or extra services just to make the architecture look bigger.
For this project, they were unnecessary.
Keeping the architecture small also made it easier for me to understand what was happening when something failed.
Where Amazon Bedrock fits
Amazon Bedrock is the intended visual-observation layer, and the integration is written in the application.
Its job is only to observe the image and return structured facts.
The claim itself is not supposed to be interpreted by the model as a legal question.
The deterministic rule engine stays responsible for the actual consistency evaluation.
This kept the model inside a narrow, testable boundary.
At the time of this article, the Bedrock integration had not completed a successful live model call.
The AWS problem I did not expect
The biggest blocker was not application code.
It was Bedrock model authorization.
I tested both third-party and Amazon-native models.
Anthropic first-time-use submission was blocked by the AWS account, and direct model invocation returned:
ValidationException: Operation not allowed I then tested Amazon Nova Lite directly through the Converse API.
That failed with the same error.
Model availability showed:
authorizationStatus = NOT_AUTHORIZED while agreement, entitlement, and regional availability were available.
At that point, continuing to rewrite application code would have been the wrong response.
The application was not failing because the request parser or rule engine was broken.
The account was simply not authorized to invoke the model.
I opened an AWS Support case and kept the product honest.
The deployed live path returns an explicit failure.
It never silently substitutes fixture observations and pretends Bedrock succeeded.
For the hackathon demo, fixture observations are clearly labelled and pass through the same deterministic evaluation path.
I could have hidden the failure behind fixture data, but that would have made the demo misleading.
So I kept the failure visible and labelled fixture mode clearly.
A deployment lesson I only discovered in production
Another issue only became obvious after deploying.
The browser initially allowed an image that looked small enough locally.
But once the image was base64-encoded inside the request body, the payload became much larger.
A file around 4.6 MB became roughly 6.5 MB in transit and exceeded the deployed request-size limit before the application code could process it.
Local tests did not reveal this.
The live AWS deployment did.
I reduced the accepted upload size and added tests so the frontend and backend share the same contract.
That was a useful reminder:
platform limits are part of the application contract too.
What actually works today
The current project can:
- detect supported violation claims
- require explicit selection when multiple claims exist
- validate structured observations
- evaluate observations using deterministic rules
- return uncertainty instead of guessing
- reject checks that a single image cannot support
- distinguish fixture observations from live model observations
- fail explicitly when Bedrock is unavailable
- run the frontend and API as a deployed AWS application
I also built a browser-tested spatial UI that keeps the relationship between:
Claim → Evidence → Observation → Result
visible throughout the flow.
At the time of submission, the repository had 155 automated tests covering core logic, adversarial cases, contracts, and failure behavior.
What I learned
These were the main things I learned while building it.
1. AI should observe, not adjudicate
The safest architecture was not:
ask the model for the answer
It was:
observe with AI, evaluate with deterministic code.
2. Uncertainty is a feature
A system that can say "I cannot tell" is safer than one that always produces an answer.
3. Fixtures and live AI must never be interchangeable
Fixture mode is useful for testing and demonstration.
But fixture output must never be presented as live model output.
Provenance matters.
4. AWS access is part of the architecture
Model IDs, inference profiles, account authorization, regional availability, quotas, and permissions are not just setup details.
They directly affect whether the system can run.
5. Production teaches things local development cannot
The upload-size issue only appeared after deploying.
A technically correct local system can still fail at the platform boundary.
Final architecture
The intended full path is:
User ↓AWS-hosted ChallanCheck ↓API Gateway ↓Lambda ↓Amazon Bedrock ↓Structured visual observations ↓Schema validation ↓Deterministic rule engine ↓Evidence consistency resultEnjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article