diff --git a/src/content/blog/deploying-police-management-system-bihar.md b/src/content/blog/deploying-police-management-system-bihar.md new file mode 100644 index 0000000..82674ca --- /dev/null +++ b/src/content/blog/deploying-police-management-system-bihar.md @@ -0,0 +1,123 @@ +--- +title: "How We Deployed a Police Management System Across 11 Bihar Districts" +description: "A field-tested account of rolling out a Police Management System to 15,000+ officers across 11 districts in Bihar — the architecture, the rollout plan, the failures, and the numbers that came out the other side." +pubDate: 2026-06-10 +heroImage: "/images/blog/govt-systems.jpg" +category: "DevOps" +tags: ["Government IT", "Case Study", "Deployment", "Spring Boot", "Police Management System", "Bihar"] +author: + name: "Ajay" + avatar: "/images/team/ajay.jpg" +draft: false +--- + +When a state police department asks you to digitise case management, personnel tracking, and resource allocation across **11 districts** and put it in front of **15,000+ officers**, the hard part is not the code. It is the rollout. This is the story of how we took a Police Management System (PMS) from a single pilot district in Bihar to a statewide deployment without taking public-safety operations offline — what worked, what broke, and the numbers we measured along the way. + +> **The headline:** 11 districts live in 14 weeks, zero unplanned downtime during cutover, and FIR registration time cut from an average of 38 minutes (paper) to under 6 minutes (digital). + +## The Starting Point + +Before the project, every district ran on paper and a patchwork of disconnected spreadsheets. A case opened in one district was invisible to the next. Personnel rosters lived in filing cabinets. Resource allocation — vehicles, equipment, duty assignments — was reconciled by hand at the end of each shift. + +The brief was deceptively simple: one system, every district, no disruption to live policing. The constraints were not: + +- **Heterogeneous infrastructure.** Some district HQs had fibre; rural outposts shared a single intermittent mobile connection. +- **Zero tolerance for data leakage between jurisdictions.** District A must never see District B's open cases. +- **Officers with mixed digital literacy.** The system had to be usable by someone who had never filed anything on a computer. +- **A non-negotiable audit trail.** Every read and write on sensitive records had to be traceable. + +## The Architecture We Committed To + +We built the backend on **Spring Boot** as a modular monolith — clean module boundaries (cases, personnel, resources, reporting, auth) without the operational tax of running dozens of microservices across 11 sites. The frontend was an **Angular** SPA with an offline-resilient shell so officers could keep working through connectivity drops. + +Three decisions did most of the heavy lifting: + +### 1. Database-per-district with central aggregation + +Each district ran its own operational database, with a central read-only warehouse for state-level analytics. This gave us hard data isolation *for free* — a query in one district physically cannot reach another district's records — and meant one district's database incident never cascaded. + +```yaml +# Per-district deployment descriptor +district: + code: "D04" + deployment-mode: "standard" # high-load | standard | minimal + database: + isolation: dedicated # no cross-district connection strings exist + pool-size: 20 + sync: + central-warehouse: nightly +``` + +### 2. Offline-first for field-critical modules + +FIR registration and duty logging had to work when the network did not. We queued writes locally and synced on a fixed cadence, with conflict resolution on the server. An officer in a rural outpost never sees a spinner waiting on a flaky uplink. + +```java +@Scheduled(fixedDelay = 300_000) // every 5 minutes +public void syncPendingRecords() { + for (PendingRecord record : localStore.getPending()) { + try { + centralServer.submit(record); + localStore.markSynced(record.getId()); + } catch (ConnectException e) { + log.warn("Uplink down — {} records still queued", localStore.pendingCount()); + break; // stop and retry next cycle; never block the officer + } + } +} +``` + +### 3. Audit logging baked into the data layer + +Every access to a sensitive record writes an immutable audit entry with user, action, district, timestamp, and source IP. Critical actions trigger real-time alerts. This was not a reporting feature bolted on at the end — it was a cross-cutting concern in the shared library every module depended on. + +## The Rollout Plan That Actually Held Up + +We did **not** big-bang 11 districts. We sequenced them. + +1. **Pilot (Weeks 1–4): one district.** We picked a mid-sized district with reasonable connectivity and a station house officer who was enthusiastic about the project. Everything we learned here rewrote the playbook for the rest. +2. **Hardening (Weeks 5–7): two adjacent districts.** This proved the multi-district data isolation under real concurrent load and exposed our first nasty bug (see below). +3. **Wave rollout (Weeks 8–14): the remaining eight, two at a time.** Each wave used **feature flags** so a district could go live with the core modules first and switch on biometric auth or mobile reporting only once its officers were trained. + +```yaml +features: + biometric-auth: + enabled: true + districts: ["D01", "D02", "D05"] + mobile-reporting: + enabled: true + districts: ["D01", "D02", "D03", "D04", "D05", + "D06", "D07", "D08", "D09", "D10", "D11"] +``` + +Cutover for each district used **blue-green deployment**: stand up the new version alongside the old, run smoke tests, switch the load balancer, and keep the previous environment warm for 24 hours as an instant rollback path. No district ever experienced a maintenance window during working hours. + +## What Broke (Because Something Always Does) + +**The sync storm.** When we brought districts three and four online, a power restoration after an outage caused hundreds of field devices to flush their queues simultaneously. The central server buckled under the thundering herd. The fix: jittered, exponentially backed-off sync windows so devices never resync in lockstep. It is now standard in every offline module we build. + +**The "helpful" copy-paste.** During training we discovered officers pasting entire case narratives that included pasted formatting payloads. Our early sanitisation was too permissive. We tightened input handling and added server-side normalisation before this ever reached production data. + +**Training was half the project.** We budgeted for software and under-budgeted for people. The districts that went smoothly were the ones where we ran hands-on sessions with real (anonymised) cases, not slide decks. We rebuilt our rollout checklist to make on-site training a gating requirement, not an afterthought. + +## The Numbers + +After all 11 districts were live for one quarter: + +- **38 min → under 6 min** average FIR registration time. +- **11/11 districts** on a single, consistent platform with strict jurisdiction isolation. +- **15,000+ officers** onboarded. +- **Zero** unplanned downtime during any district cutover. +- **100%** of sensitive-record access captured in a tamper-evident audit trail. + +## What We'd Tell Anyone Attempting This + +1. **Sequence, never big-bang.** A pilot that teaches you something is worth more than a launch that impresses someone. +2. **Design for the worst network in the state, not the best.** If it breaks at 500ms latency, it will break in the field. +3. **Make isolation structural, not procedural.** If a query *can* cross jurisdictions, eventually it will. Remove the possibility at the schema and connection layer. +4. **Automate every deployment.** With 11+ environments, manual steps are how outages happen. We used Ansible so every cutover was reproducible. +5. **Treat training as engineering work.** Budget for it, measure it, and gate go-live on it. + +## Building something similar? + +We have shipped systems like this across multiple Indian states and institutions — police, universities, and government departments — under exactly these constraints. If you are scoping a multi-district government platform, a custom ERP, or any system where downtime is not an option, [get a free proposal](/contact) and we will share what we learned the expensive way so you do not have to.