
The policy document nobody can read
A Madhya Pradesh government subsidy policy that is 56 pages, 59 MB, and has zero extractable text. What I built to make it findable, why the language model is not allowed to decide eligibility, and how an account-wide Bedrock invocation hold turned into a one-file change.
I spent this weekend building something for the First Commit hackathon, and the most useful thing I found had nothing to do with code.
The Madhya Pradesh MSME Development Policy 2025 is a public document. It lays out capital subsidies for small manufacturing units — the kind of thing a person making leaf plates at home in a village would want to know about. Forty percent of eligible investment in plant and machinery, paid over four years. If you are from a Scheduled Caste or Scheduled Tribe, or a woman, you get two percent more per year. An SC or ST woman gets two and a half.
That last sentence is worth real money to a real person. I found it on printed page 13.
Here is the thing. The document is 56 pages and 59 megabytes. I ran
pdftotext over all of it and got back exactly zero characters. Every single page is an image, exported from CorelDRAW in February 2025. You cannot search it. You cannot copy from it. A screen reader gets nothing at all, which means a person with low vision simply cannot read their own government's policy. And it is written in English, for a scheme aimed at village manufacturers.The information is public. It is not accessible. Those are different things, and the gap between them is where I decided to build.
What I built
Sahayak Setu. It is an interview, not a search box.
A search box only works if you already know the words. Someone who has never heard of an industrial development subsidy will never type "industrial development subsidy". So instead, the user says what they do, in Hindi, in one sentence — I make leaf plates in my village — and the app asks two or three short follow-up questions. Is the unit new. What category do you belong to. Then it returns what they are likely eligible for.
Every card shows the specific criterion they meet, the printed page it came from, the date a human verified it, and which office to actually walk into.
The rule that shaped everything
The language model never decides who qualifies.
This was not a stylistic preference. Telling someone they qualify for a subsidy they do not qualify for costs them a bus fare, a day of work, and their trust in the next person who tries to help. A confident wrong answer is worse than no answer.
So the model does exactly two jobs: it turns plain speech into a structured profile, and it writes the final explanation in simple Hindi. The actual decision is plain Python reading structured eligibility rules and returning pass, fail, or unknown.
I wanted that claim to be checkable rather than asserted, so there is a test that parses the matcher's own source code and fails the build if it can import boto3, requests, urllib, or the extractor module. The model cannot reach the decision, by construction.
There is a second guard on the way out. After the model writes its answer, Python deletes any scheme ID or any URL that was not in the matched set. A citation reaches a user only if a human put it in a scheme file first.
The third piece is refusal. If nothing survives validation, the app says it does not know and points at the office that does. Most demos hide their failure mode. I think it is the most important screen in mine.
What fought back
Bedrock. Completely.
I set up IAM properly — a dedicated user, a least-privilege customer-managed policy, not root. I requested model access. I wrote the integration. And then every single
converse call came back with ValidationException: Operation not allowed .I assumed it was my IAM policy. It was not. I assumed it was the model agreement, so I went to fill out the Anthropic use-case form, and the form itself returned "your account is not authorized to perform this action, please create a support case." I assumed it was a region problem and checked. I assumed it was Anthropic-specific and tried OpenAI. Then I tried Amazon's own Nova.
Nova failed identically. That is what settled it.
get-foundation-model-availability reported entitlementAvailability: AVAILABLE and authorizationStatus: NOT_AUTHORIZED at the same time — an account-wide invocation hold on a new account, with the only documented path being a support case. In a four-day hackathon, that is not a path.So I put the model call behind a thin provider interface,
api/llm.py , one function, and pointed it at an external inference API. The extractor, the interview loop, the matcher, the explainer and the validator did not change by a single line. Neither did the AWS architecture.If I had called Bedrock directly from the handler on Friday, that would have been a rewrite at nine in the evening on Sunday. Instead it was one file.
Where AWS fits
S3 holds the verified scheme corpus, cached in
/tmp across warm invocations. A Lambda function runs the whole pipeline — extract, interview, match, explain, validate. API Gateway gives it a public endpoint. The React frontend is on Amplify Hosting. The whole stack is defined in one SAM template.Two deliberate omissions. I did not use OpenSearch, because matching is deterministic code over a small curated corpus, and a vector cluster would have been cost and complexity for no benefit. I did not use Cognito, because asking a village entrepreneur to create an account before he can find out about a subsidy defeats the entire point.
Choosing not to use a service is an architecture decision too, and I would rather defend a small stack I understand than a diagram full of logos.
What I actually learned
This was my first AWS deploy. First Lambda, first S3, first SAM, first IAM policy written by hand.
SAM was the thing that made the weekend survivable.
sam local invoke meant I could test the handler on my laptop without deploying, and having the function, its permissions, the API route and the environment variables in one file meant every redeploy was one command. Coming from GCP, infrastructure-as-code by default was the right call.Lambda's programming model turned out to be far simpler than I expected. Event in, dict out. My existing Python moved across almost unchanged.
But the real lesson was the abstraction. Not because abstraction is virtuous — most of the time it is over-engineering — but because I could name the specific thing that might fail. I could not control whether Bedrock would unblock. I could control how much of my codebase depended on the answer.
What is actually the contribution
Not the code. The code is a few hundred lines and anyone could write it.
The corpus. A machine-readable, hand-verified, source-cited JSON file of scheme eligibility rules with per-criterion page references. That does not exist anywhere that I could find. I verified one scheme this weekend, by reading the source document myself and transcribing it. Not by asking a model, which would have produced something plausible and possibly wrong, and I would not have known which.
The schema is the part that generalises. Someone in Bihar or Odisha can fork it, swap in their own state's schemes, and have the same guarantees. That is why it is Apache-2.0 for the code and CC-BY-4.0 for the data.
One scheme verified. Fifty-five more pages in that PDF that nobody can search.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article