The ₹85,800 Barcode: What 72 Hours in the Trenches Taught Me About Engineering Trust on AWS
An inside look at building an event-driven serverless pipeline on AWS that audits residential solar quotations against 3,914 official gazette records before homeowners sign a contract.
The ₹85,800 Barcode: What 72 Hours in the Trenches Taught Me About Engineering Trust on AWS
Solo Build · Bharat Builds Tour Hackathon (Track 03: Waste and Energy) Author: Shreshth · NIT Hamirpur · Built with AWS Serverless (SAM), Amazon Bedrock, DynamoDB, Amazon Polly, and NASA POWER
Prologue: The Cost of a Question Unasked
A few days ago, someone asked me if building a tool to audit solar panel serial numbers was "a bit too niche for a hackathon."
To an engineer in a tier-1 tech hub sipping a pour-over while reading Hacker News, parsing a government gazette PDF sounds like a tedious, pedantic edge case. But to understand why this project exists, you have to leave the glass towers of Bengaluru and stand on a corrugated tin roof in Hamirpur, Himachal Pradesh.
Imagine a salaried father in Hamirpur. He earns ₹40,000 a month teaching at a local government school. He wants to do the right thing for the planet, for his family’s escalating power bills, and for his pride. Under the Government of India’s PM Surya Ghar: Muft Bijli Yojana, he is promised an upfront central subsidy of ₹78,000, sweetened by an additional 10% special-category hill-state bonus up to ₹85,800.
The rooftop system costs ₹2,00,000. He empties his family’s emergency savings to pay the local contractor, who looks him in the eye and guarantees: "Chinta mat kijiye, subsidy guaranteed hai." (Don't worry, the subsidy is guaranteed.)
Three months later, the panels are bolted to his roof. The contractor has cashed the cheque and moved on. An inspector from the state electricity board (HPSEBL) climbs up a bamboo ladder to authorize the net meter. The inspector bends down, points a scanner at the faint barcode sticker on the underside of module number four, checks his tablet, and looks up with pity.
"I cannot approve this," the inspector says quietly. "These are unlisted, grey-market imported cells. They are not DCR certified. They are not on the Ministry’s ALMM list. Subsidy rejected."
Just like that, ₹85,800, which is more than two months of this man’s life labor just vanishes into thin air.
What happens next is what economists call an externality and what social scientists call a tragedy. Devastated and humiliated, that father does not file an administrative grievance. Instead, he sits down at dinner, visits his brothers, and posts in his neighborhood WhatsApp groups:
"Solar is a scam. The government doesn't pay. Do not put panels on your roof."
In an instant, an entire mohalla freezes its green transition.
The bottleneck to India’s clean energy revolution is not a deficit of sunlight. It is not even a shortage of capital- the Indian government has committed a staggering ₹75,021 Crore ($9 Billion USD) to PM Surya Ghar to power 10 million homes.
The bottleneck is a catastrophic deficit of trust caused by information asymmetry. The contractor speaks the dialect of mono-PERC, half-cut cells, ALMM, and DCR. The homeowner knows none of it. And the government’s solution was to bury the truth inside an impenetrable, 300+ page technical PDF gazette on an obscure government portal.
This is the story of how I spent 72 sleepless hours during the Bharat Builds Tour Hackathon building PakkaSolar (पक्का सोलर): taking that unreadable 300-page regulatory wall, embedding it into a deterministic AWS serverless engine, and putting a world-class solar auditor into the pocket of every Indian homeowner before they sign a contract.
1. The Core Philosophy: The LLM Perceives; It Never Judges
We are currently living through an era of reckless AI enthusiasm. Every problem is being slapped with a naive prompt: "You are an expert auditor. Read this quote and tell the user if it's legal."
In customer support or marketing copy, an LLM hallucination is an awkward typo. In regulatory compliance, an LLM hallucination is a family losing their life savings.
Large Language Models are probabilistic text synthesizers. They do not possess a concept of statutory law, certification registries, or physical truth. If you ask an LLM whether a fictitious solar panel brand like
"SunPower India SuperMax 540" is on the ALMM list, it will happily invent a plausible-sounding gazette circular to please you.Before writing a single line of backend logic, I wrote down ADR-001 (Architecture Decision Record 001): The LLM perceives; it never judges.
plaintext
┌──────────────────────────────────────────────────────────────┐│ THE PERCEPTION SEAM │└──────────────────────────────────────────────────────────────┘│Messy, Crumpled Image ▼[ User's Paper Quotation ] ──► [ Amazon Bedrock (Nova Multimodal) ]││ Extracted Attributes▼[ Typed Pydantic Schema ]• brand: "Waaree Energies"• model: "WS-540M"• system_kw: 3.0• price: 140000• vendor: "Cheapo Solar"│┌────────────────────────────────────────┼─────────────────────┐│ THE DETERMINISTIC BOUNDARY |└────────────────────────────────────────┼─────────────────────┘│▼[ 100% Deterministic Python Engine ]│┌─────────────────────────┼─────────────────────────┐▼ ▼ ▼[ DynamoDB ALMM ] [ DynamoDB Vendors ] [ NASA POWER S3 ]3,914 Verified Rows State DISCOM Registry Orbital Climatology│ │ │└───────────────────────────┼───────────────────────────┘│▼[ Cryptographic Verdict ]HIGH RISK | ALL CLEAR
The Separation of Powers
- Perception (Amazon Bedrock): Bedrock Nova Multimodal has exactly one job. It looks at the messy, coffee-stained photograph of a contractor’s quote, tolerates terrible lighting and handwriting, and extracts structured data into a rigid Pydantic model:
system_kw,brand,model,quoted_price,vendor_name, andwarranty_years. It does not evaluate compliance. It does not speculate.
- Judgment (Deterministic AWS Engine): The extracted tokens are fed into an immutable Python pipeline. Compliance is checked by querying 3,914 officially parsed MNRE ALMM models and state DISCOM registries in Amazon DynamoDB. The arithmetic is pure, reproducible, and verifiable.
ADR-004: Fail-Safe Safety Semantics ( UNCERTAIN Never Collapses to PASS )
In an early prototype, I implemented fuzzy matching with a standard
0.55 similarity threshold to forgive spelling mistakes. During unit testing, I injected a deliberate poison payload: "XYZ Fake Solar Ltd" .To my horror, the fuzzy matcher resolved the fake brand against a real manufacturer and emitted:
dcr_status: PASS .A false negative (telling a homeowner their panel might be unverified when it is actually fine) causes a delay. A false positive (telling a homeowner an unapproved panel is certified) causes financial ruin.
I immediately tightened the threshold to 0.75 and established our second safety axiom:
UNCERTAIN is a first-class terminal state. If a panel model cannot be definitively matched to an ALMM gazette entry, the verdict defaults to AMBER with an explicit directive: "Model unrecognized. Demand the manufacturer's physical ALMM certificate before signing."
2. Designing the Serverless Nervous System
Speed and reliability are not cosmetic features in rural India. If a web application spins for 30 seconds on a patchy 3G mobile connection, the user assumes it is broken and closes the tab. Furthermore, handling future webhooks (such as WhatsApp) introduces a hard constraint: Meta webhooks must be acknowledged in under 3 seconds, while multimodal vision and neural speech synthesis take 8 to 15 seconds.
To solve this, I designed a fully asynchronous, event-driven architecture using the AWS Serverless Application Model (SAM).
The Architectural Triumvirate
1. Painless Asynchronous Decoupling (ADR-002)
The synchronous API Gateway immediately delegates to
webhook_handler . The image is pushed to S3, an ephemeral record with status: pending is written to DynamoDB, and an event is queued in Amazon SQS. The API Gateway responds with an HTTP 202 Accepted token in under 250 milliseconds.The worker Lambda (
audit_worker , allocated 1024 MB of memory and a 120-second timeout) executes downstream at its own pace. If a transient network glitch occurs, SQS retries automatically; if a poisoned file arrives, the Dead-Letter Queue (DLQ) safely isolates it without killing the worker.2. Sub-10ms Queries at Zero Idle Cost (ADR-006)
Instead of running an expensive, always-on relational database (RDS), I leveraged Amazon DynamoDB with
PAY_PER_REQUEST billing across three purpose-built tables:-
almm_panels: Partition Keybrand_normalized, Sort Keymodel_prefix. Enables sub-10ms lookups across all 3,914 models.
-
vendors: Partition Keystate_code, Sort Keyvendor_name_normalized. Matches contractors against state empanelment lists.
-
audits: The operational state machine.
Because quotations contain sensitive PII (homeowner names, phone numbers, addresses), I utilized DynamoDB’s native Time to Live (TTL). Every audit record automatically writes an epoch timestamp:
ttl = now + 86400 . After 24 hours, AWS silently and permanently deletes the record. Zero cron jobs. Zero maintenance. Native data privacy compliance by default.3. Private by Default with STS Presigned URLs (ADR-003)
When generating voice verdicts in Amazon Polly, beginners often make their S3 buckets public so the browser can play the MP3. In an enterprise environment, this violates every security principle.
I kept the S3 bucket 100% private, locked behind Account-Level Block Public Access. When
audit_worker finishes synthesizing speech, it generates a time-limited 7-day AWS STS Presigned URL. The browser streams the audio directly from AWS's global edge without proxy overhead, while the underlying storage remains completely inaccessible to the public.
3. Replacing Thumb-Rules with Orbital Physics (ADR-005)
Every rooftop solar calculator in India uses the same lazy heuristic:
Generation = Capacity (kW) × 4.0 units/day
This is fundamentally flawed. Solar generation is governed by planetary physics—solar irradiance, atmospheric aerosol optical depth, temperature coefficients, and local terrain. A 3 kW system in the high mountain valleys of Hamirpur generates radically different energy compared to one in the Thar desert of Rajasthan.
To transform PakkaSolar from a hackathon toy into a defensible financial instrument, I tapped into the NASA POWER Climatology Dataset hosted on the AWS Open Data Registry.
Using precise GPS coordinates (Latitude: 31.6862° N, Longitude: 76.5222° E for Hamirpur), the pipeline fetches satellite-verified Global Horizontal Irradiance (GHI) averages across multi-year climatological observation windows.
Annual Energy (kWh) = System Size (kW) × (Sum of Monthly GHI) × 0.80 PR
Where Carbon offset is derived directly from the Central Electricity Authority (CEA) Baseline Document: 0.716 kg CO₂/kWh.
For our 3 kW Hamirpur system, PakkaSolar estimates an annual generation of 4,249 kWh and 3.04 tonnes of avoided grid CO₂, representing an annual household power saving of ₹19,119.
4. Accessibility: The Kajal Neural Engine
Data is useless if the person who needs it cannot read it.
In Himachal Pradesh and across rural India, many homeowners navigate digital life entirely through voice notes. Handing them an English data table with columns for "Degradation Rates" and "DCR Compliance" is an exercise in developer arrogance.
I wired the verdict output into Amazon Polly’s Neural Engine, selecting the
hi-IN neural voice Kajal.Plain text
┌──────────────────────────────────────────────────────────────┐│ POLLY NEURAL SYNTHESIS (hi-IN) │└──────────────────────────────────────────────────────────────┘│▼"Namaste! PakkaSolar ki jaanch poori ho gayi hai.Aapke quote mein likhe panels ALMM list mein shamilhain, LEKIN aapka vendor state electricity board kesaath registered NAHIN hai.Agar aapne sign kiya, toh aapko 85,800 rupaye kisubsidy NAHIN milegi. Kripya naya vendor chunein."
Polly synthesized technical compliance jargon into warm, conversational, and authoritative Hindi prosody. And directly beneath the audio player, the web application renders a 1-Click WhatsApp Negotiation Script: a pre-composed message in Hindi and English that the homeowner can copy and paste directly into their chat with the vendor, demanding an empanelled quote before releasing a single rupee.
5. What Fought Back: Friction in the Trenches
Writing a blog post after a hackathon is dangerous because it tempts the author to make the journey look clean, linear, and effortless.
It was none of those things. Building solo meant that when the architecture stalled at 3:00 AM, there was no teammate to tag in. A lot fought back.
Boss Fight 1: The Government PDF with 4,071 Rows and No Mercy
MNRE publishes the ALMM list not as a clean REST API, not as a JSON feed, and not even as a CSV. They publish it as a 300+ page vector PDF.
I spent hours battling it with Python's
pdfplumber . Everything that could go wrong with unstructured data went wrong:- Run 1: Brand names wrapped over line breaks (
"Emmvee Photovoltaic\nPower Pvt. Ltd."), so a single manufacturer split into multiple phantom brands.
- Run 2: Forward-filling merged cells caused wattage regexes to pick up cell-count substrings—reading
as-375-hm108as a 108-Watt panel.
- Run 4 (The Breakthrough): I engineered strict column aliases, restricted wattages to an authenticated 200W - 1000W window, and successfully extracted 3,914 models across 100 manufacturers.
Nobody gives hackathon points for writing PDF parsers, but the parser is where the real product lives.
Boss Fight 2: The Boto3 Float Trap
In the middle of deploying the NASA irradiance math, my Lambda worker began crashing with a bizarre error:
text
TypeError: Float types are not supported. Use Decimal, integer or binary, or string
The official AWS Python SDK (
boto3 ) strictly rejects native Python floats when serializing to DynamoDB. Every floating-point number from our orbital calculations had to be recursively converted to Python Decimal before writing to DynamoDB, and recursively converted back to float before returning JSON to API Gateway.Boss Fight 3: The Account Verification Freeze & The Power of Seams
With less than 24 hours to go, my AWS account hit an unexpected verification delay on Bedrock Foundation Models:
text
AccessDeniedException: Your account is currently being verified.
This is the moment where most hackathon projects die. You can rage at account support, or you can demonstrate architectural maturity.
I isolated the Bedrock OCR call behind an explicit interface boundary seam:
Python
# backend/audit_worker/tools/parse_quote.pyMOCK_MODE = os.environ.get("MOCK_MODE", "false").lower() == "true"
When
MOCK_MODE was active, the OCR step returned a fixed, schema-valid extraction ( Waaree WS-540M , Cheapo Solar Traders , ₹1,40,000 ).Everything downstream was 100% real, live AWS: API Gateway, SQS queues, Lambda execution, DynamoDB queries against 3,914 real ALMM records, the 10% HP subsidy calculations, Amazon Polly Neural speech synthesis, S3 storage, and STS presigned URL signing.
Furthermore, I built an offline test harness using Moto (the AWS open-source mock framework) and Pytest. I wrote over 60 automated tests validating our fuzzy-matcher cutoffs, Decimal serializers, and Lambda handlers locally, ensuring the entire system was hardened before deploying to
ap-south-1 .
6. The Macro Reality: Why This Matters to India
When evaluating climate tech, hackathon judges frequently ask: "Is this big enough to matter?"
Let us look at the actual numbers published by India's Central Electricity Authority (CEA) for FY 2023–2024:
- Coal accounted for ~75% to 78% of India's total electricity generation.
- Solar accounted for roughly 6% to 7%.
Solar currently produces less than 10% of what coal produces in India.
The Government of India launched PM Surya Ghar with a historic capital commitment of ₹75,021 Crore ($9 Billion) to fundamentally shift this balance. But capital allocation does not equal capital absorption.
That money cannot deploy at scale if the average Indian citizen is terrified of installer fraud, obscure DCR fine print, and surprise subsidy rejections.
When an installer cheats a homeowner, the installer does not just steal ₹85,800. They poison the well of public trust for the entire neighborhood.
Metric | PakkaSolar Verified Benchmark |
|---|---|
Capital Loss Prevented | ₹78,000 – ₹85,800 per fraudulent quotation caught |
Audit Latency | < 15 seconds (vs. 3–6 weeks DISCOM inspection lag) |
Indexed ALMM Models | 3,914 certified panels across 100 manufacturers |
Testing Rigor | 60+ automated unit & integration tests (Pytest + Moto) |
Compute Cost per Audit | < ₹0.85 ($0.01) (Fractions of a rupee on AWS Serverless) |
Carbon Abatement | ~3.04 tonnes $\text{CO}_2$/year unlocked per verified 3 kW install |
Epilogue: The Architecture of Trust
Over 2,400 years ago, Socrates argued that the highest form of human ignorance is when someone believes they know what they do not know.
The residential rooftop solar market in India is a textbook Socratic tragedy: contractors who claim they know the regulations, homeowners who assume the contractor is telling the truth, and a government that assumes a 300-page PDF constitutes public communication.
In 72 hours, my goal wasn't to build a flashy wrapper. I wanted to build an architecture of trust:
- Where the AI is humble enough to only read the words, never judge the law.
- Where compliance is anchored in deterministic databases and physics.
- Where rural accessibility is delivered through human voice, not complex jargon.
- Where the unit cost of truth is less than 85 paise.
Before a family empties their life savings onto a rooftop, they deserve to know that their investment is safe.
Check before you sign. Make it Pakka. ☀️
Resources & Links
- GitHub Repository: https://github.com/Shreshtthh/PakkaSolar
- Live Web App: https://pakka-solar.vercel.app
- 3-Minute Video Pitch: https://youtu.be/C9tdxlWbC18?si=duOTbecDkCf\_z9qD
- Stack: AWS SAM · Lambda · SQS · DynamoDB · Bedrock · Polly · S3 · NASA POWER · React + Vite
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article