A FastAPI-based service to store and query Jan Aushadhi Kendra information extracted from official PDFs.
The API supports uploading new datasets (via PDF), searching Kendras by code, pincode, or location, and checking service status.
- Upload latest Jan Aushadhi Kendra PDF (parses with
pdfplumberand saves to MongoDB Atlas). - Query Kendras by:
- ✅ Kendra Code
- ✅ Pin Code
- ✅ State + District
- Service status endpoint to check if API is live and when data was last updated.
- MongoDB batching to handle large files (17k+ rows).
- API key protection for upload.
- Uploads require an API key (
x-api-keyheader). - Set your key in
.envfile as:
API_KEY=your_api_key_here
MONGO_URI=your_mongo_connection_string
GET /status
Check if the service is live and see when data was last updated.
curl https://kendra-api.onrender.com/status{
"message": "Service is live",
"updated_at": "2025-08-05T10:42:12.123456"
}GET /kendra/{kendra_code}
Retrieve details of a Kendra by its code.
curl https://kendra-api.onrender.com/kendra/PMBJK00005{
"updated_at": "2025-08-05T10:42:12.123456",
"results": [
{
"Sr.No": "1",
"Kendra Code": "PMBJK00005",
"Name": "B Md Arif Basha",
"Contact": "9490477786",
"State Name": "Andhra Pradesh",
"District Name": "Ananthapuramu",
"Pin Code": "515001",
"Address": "28 635 Sangameshwara Nagar 80Feet Road, Anantapur"
}
]
}GET /pincode/{pincode}
Find Kendras in a specific pincode.
curl https://kendra-api.onrender.com/pincode/522503{
"updated_at": "2025-08-05T10:42:12.123456",
"results": [
{
"Sr.No": "4",
"Kendra Code": "PMBJK00024",
"Name": "Divvela Yedukondalu",
"Contact": "8790567432",
"State Name": "Andhra Pradesh",
"District Name": "Guntur",
"Pin Code": "522503",
"Address": "Jan Aushadhi Storedoor No 7154 Shop No 7 Midde Center, Visakhapatnam(Rural)"
}
]
}GET /location?state={state}&district={district}
Retrieve Kendras by state and district.
curl "https://kendra-api.onrender.com/location?state=Andhra%20Pradesh&district=Annamayya"{
"updated_at": "2025-08-05T10:42:12.123456",
"results": [
{
"Sr.No": "2",
"Kendra Code": "PMBJK00012",
"Name": "Reddy Lakshmi Deepak P",
"Contact": "9177772726",
"State Name": "Andhra Pradesh",
"District Name": "Annamayya",
"Pin Code": "517325",
"Address": "Dno31531 Ctm Road, Madanapalle"
},
{
"Sr.No": "3",
"Kendra Code": "PMBJK00017",
"Name": "E. Naga Rajesh and E. Sreedevi",
"Contact": "9440539203",
"State Name": "Andhra Pradesh",
"District Name": "Annamayya",
"Pin Code": "517325",
"Address": "D No 1511632 Ground Floor K G Street Extention, Madanapalle"
}
]
}POST /upload?reset={true|false}
Upload a new Jan Aushadhi PDF.
- Use
reset=trueon the first upload to clear old data. - Use
reset=falsefor subsequent chunks (if splitting PDF).
curl -X POST "https://kendra-api.onrender.com/upload?reset=true" -H "x-api-key: your_api_key_here" -F "file=@JanAushadhiKendra.pdf"{
"message": "Chunk uploaded successfully",
"reset": true
}- Large PDFs (~862 pages, 17k rows) are supported using batching (
batch_size=750). - MongoDB indexes automatically keep queries fast on:
Kendra CodePin Code(State Name, District Name)
- Free-tier hosting may cause long uploads to timeout on the frontend, but the backend will still finish processing and update the DB.
Built with ❤️ by @kunal7236 using FastAPI, MongoDB Atlas, and pdfplumber.
You can explore and test the API interactively using the built-in Swagger UI: