<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Layton Tozvireva</title>
    <description>The latest articles on DEV Community by Layton Tozvireva (@laytontozvirevastar).</description>
    <link>https://dev.to/laytontozvirevastar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4055473%2Fb9354347-25fe-4396-995e-b77865e392b2.jpg</url>
      <title>DEV Community: Layton Tozvireva</title>
      <link>https://dev.to/laytontozvirevastar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/laytontozvirevastar"/>
    <language>en</language>
    <item>
      <title>PIRS — Public Infrastructure Reporting System</title>
      <dc:creator>Layton Tozvireva</dc:creator>
      <pubDate>Tue, 29 Sep 2026 12:18:34 +0000</pubDate>
      <link>https://dev.to/laytontozvirevastar/pirs-public-infrastructure-reporting-system-489i</link>
      <guid>https://dev.to/laytontozvirevastar/pirs-public-infrastructure-reporting-system-489i</guid>
      <description>&lt;h1&gt;
  
  
  PIRS — Public Infrastructure Reporting System
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/sanity-2026-09-16"&gt;Sanity Challenge, Path Two: Vibe-Code Something Strange&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  What I Built
&lt;/h1&gt;

&lt;p&gt;PIRS (Public Infrastructure Reporting System) is a civic technology platform designed to help citizens report public infrastructure problems and understand what to do about them.&lt;/p&gt;

&lt;p&gt;The idea started with a simple question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What if reporting a pothole, water problem, sewer blockage, electricity fault, or broken traffic light could be easier and more informative?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Instead of simply submitting a complaint and forgetting about it, PIRS connects three parts of the experience:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;REPORT → LOCATE → TRACK&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A citizen can report an infrastructure problem, provide its location and supporting information, and then track the report.&lt;/p&gt;

&lt;p&gt;I also wanted PIRS to go beyond being a reporting form.&lt;/p&gt;

&lt;p&gt;The platform includes a &lt;strong&gt;Knowledge Center&lt;/strong&gt; containing structured infrastructure information and an &lt;strong&gt;AI Assistant&lt;/strong&gt; that uses that knowledge to help citizens understand infrastructure problems and reporting procedures.&lt;/p&gt;

&lt;p&gt;The application currently covers infrastructure categories including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Electricity&lt;/li&gt;
&lt;li&gt;Water&lt;/li&gt;
&lt;li&gt;Sewer&lt;/li&gt;
&lt;li&gt;Roads&lt;/li&gt;
&lt;li&gt;Traffic Lights&lt;/li&gt;
&lt;li&gt;Illegal Dumping&lt;/li&gt;
&lt;li&gt;Fallen Trees&lt;/li&gt;
&lt;li&gt;Other&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal was to create something that feels like a real civic technology product rather than just a form submission project.&lt;/p&gt;

&lt;h1&gt;
  
  
  Demo
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Live application:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://public-infrastructure-reporting-sys.vercel.app/" rel="noopener noreferrer"&gt;https://public-infrastructure-reporting-sys.vercel.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The application includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Home&lt;/li&gt;
&lt;li&gt;Report Issue&lt;/li&gt;
&lt;li&gt;My Reports&lt;/li&gt;
&lt;li&gt;Knowledge Center&lt;/li&gt;
&lt;li&gt;AI Assistant&lt;/li&gt;
&lt;li&gt;Login and Registration&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The AI Assistant can answer questions such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How do I report a water problem?&lt;/li&gt;
&lt;li&gt;What information should I provide when reporting an electricity fault?&lt;/li&gt;
&lt;li&gt;Who should I contact about a damaged road?&lt;/li&gt;
&lt;li&gt;What should I do if I see a blocked sewer?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The answers are grounded in infrastructure knowledge stored in Sanity rather than being generated from an empty prompt.&lt;/p&gt;
&lt;h2&gt;
  
  
  Screenshots
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Home
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/Screenshot_2026-09-29_135910.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/Screenshot_2026-09-29_135910.png" alt="PIRS Home page — Report infrastructure problems, improve your community" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The landing page introduces the reporting workflow and makes the REPORT, LOCATE and TRACK concept central to the experience.&lt;/p&gt;
&lt;h3&gt;
  
  
  Report Issue
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/Screenshot_2026-09-29_141232.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/Screenshot_2026-09-29_141232.png" alt="PIRS Report Issue form" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The reporting interface allows citizens to select an infrastructure category, describe the problem, provide a location and attach supporting information.&lt;/p&gt;
&lt;h3&gt;
  
  
  My Reports
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/Screenshot_2026-09-29_141408.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/Screenshot_2026-09-29_141408.png" alt="PIRS My Reports dashboard" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Citizens can view the issues they have submitted and follow their current status.&lt;/p&gt;
&lt;h3&gt;
  
  
  Knowledge Center
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/Screenshot_2026-09-29_141348.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/Screenshot_2026-09-29_141348.png" alt="PIRS Infrastructure Knowledge Base" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Knowledge Center presents structured infrastructure information organized by category.&lt;/p&gt;
&lt;h3&gt;
  
  
  AI Assistant
&lt;/h3&gt;

&lt;p&gt;[INSERT AI ASSISTANT SCREENSHOT]&lt;/p&gt;

&lt;p&gt;The AI Assistant uses the PIRS knowledge stored in Sanity to provide grounded infrastructure guidance.&lt;/p&gt;
&lt;h1&gt;
  
  
  Code
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;GitHub repository:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/laytontozvireva-star/Public_Infrastructure_Reporting_System" rel="noopener noreferrer"&gt;https://github.com/laytontozvireva-star/Public_Infrastructure_Reporting_System&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The project is built as a React application with Tailwind CSS and Supabase, with Sanity powering the structured infrastructure knowledge layer.&lt;/p&gt;
&lt;h1&gt;
  
  
  My Build Process
&lt;/h1&gt;

&lt;p&gt;This project was built iteratively rather than from a finished specification.&lt;/p&gt;

&lt;p&gt;I started with the original PIRS concept: a platform where citizens could report infrastructure problems such as electricity faults, water problems, sewer blockages, potholes and broken traffic lights.&lt;/p&gt;

&lt;p&gt;The first version focused primarily on the reporting experience.&lt;/p&gt;

&lt;p&gt;As the project developed, I realized that reporting alone was not enough. A citizen might know that something is broken but still not know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Who is responsible?&lt;/li&gt;
&lt;li&gt;What information should be provided?&lt;/li&gt;
&lt;li&gt;What safety precautions should be taken?&lt;/li&gt;
&lt;li&gt;How should the problem actually be reported?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That led me to add a structured knowledge layer using Sanity.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 1 — Designing the reporting experience
&lt;/h2&gt;

&lt;p&gt;The first goal was to make reporting simple.&lt;/p&gt;

&lt;p&gt;I created the main reporting flow around:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Category → Description → Location → Photo → Submit&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The application uses Supabase for authentication, database storage and report photos.&lt;/p&gt;

&lt;p&gt;The infrastructure categories were also designed to match the types of public problems PIRS is intended to handle.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 2 — Introducing Sanity
&lt;/h2&gt;

&lt;p&gt;I then created a Sanity project specifically for PIRS infrastructure knowledge.&lt;/p&gt;

&lt;p&gt;Instead of storing everything as unstructured text, I created a structured &lt;code&gt;infrastructureKnowledge&lt;/code&gt; document type.&lt;/p&gt;

&lt;p&gt;The schema contains fields such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Title&lt;/li&gt;
&lt;li&gt;Category&lt;/li&gt;
&lt;li&gt;Problem&lt;/li&gt;
&lt;li&gt;Safety guidance&lt;/li&gt;
&lt;li&gt;Reporting procedure&lt;/li&gt;
&lt;li&gt;Required information&lt;/li&gt;
&lt;li&gt;Responsible authority&lt;/li&gt;
&lt;li&gt;Location context&lt;/li&gt;
&lt;li&gt;Summary&lt;/li&gt;
&lt;li&gt;Source name&lt;/li&gt;
&lt;li&gt;Source&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This became an important change in the architecture.&lt;/p&gt;

&lt;p&gt;The knowledge was no longer just text displayed on a page. It became structured content that the application could query and use.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 3 — Collecting infrastructure knowledge
&lt;/h2&gt;

&lt;p&gt;I started adding real infrastructure information from relevant Zimbabwean sources.&lt;/p&gt;

&lt;p&gt;For example, the knowledge base contains information related to organizations and services such as ZINWA, ZESA and City of Harare services.&lt;/p&gt;

&lt;p&gt;The source material was transformed into structured PIRS knowledge records rather than simply copied into frontend components.&lt;/p&gt;

&lt;p&gt;This means the application can retrieve information by category and the AI layer can work with the structured fields.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 4 — Building the Knowledge Center
&lt;/h2&gt;

&lt;p&gt;After the Sanity content was available, I built the Knowledge Center in the React application.&lt;/p&gt;

&lt;p&gt;The frontend retrieves infrastructure knowledge from Sanity and presents it in a citizen-friendly interface.&lt;/p&gt;

&lt;p&gt;This created a second major experience inside PIRS:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Report an issue → Learn about the issue&lt;/strong&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 5 — Adding the AI Assistant
&lt;/h2&gt;

&lt;p&gt;The next step was connecting Gemini to the structured PIRS knowledge.&lt;/p&gt;

&lt;p&gt;The AI assistant does not simply receive the user's question and generate an unrestricted answer.&lt;/p&gt;

&lt;p&gt;The backend first retrieves the available infrastructure knowledge and identifies records that are relevant to the question.&lt;/p&gt;

&lt;p&gt;Those records are then provided to Gemini with instructions to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use only the supplied PIRS knowledge&lt;/li&gt;
&lt;li&gt;Avoid inventing authorities or procedures&lt;/li&gt;
&lt;li&gt;Avoid inventing contact information&lt;/li&gt;
&lt;li&gt;Prioritize safety&lt;/li&gt;
&lt;li&gt;Clearly state when the available knowledge is insufficient&lt;/li&gt;
&lt;li&gt;Preserve the supplied source information&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This was important because infrastructure reporting can involve safety issues and incorrect contact information could make the system less useful.&lt;/p&gt;
&lt;h2&gt;
  
  
  Step 6 — Debugging real problems
&lt;/h2&gt;

&lt;p&gt;The build was not completely smooth.&lt;/p&gt;

&lt;p&gt;One of the biggest problems appeared when the Gemini API started returning HTTP 429 responses because the free-tier request quota had been reached.&lt;/p&gt;

&lt;p&gt;Initially, the frontend displayed a generic connection error.&lt;/p&gt;

&lt;p&gt;I traced the problem through the production logs and found that the actual backend response was a Gemini quota error.&lt;/p&gt;

&lt;p&gt;I then changed the backend to return a clear &lt;code&gt;429&lt;/code&gt; response when the quota is exceeded and changed the frontend to preserve and display the backend error message.&lt;/p&gt;

&lt;p&gt;That turned a vague:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Unable to connect to the PIRS knowledge assistant.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;into a useful message explaining that the AI service had reached its daily limit.&lt;/p&gt;

&lt;p&gt;I also added retry handling for temporary Gemini service errors.&lt;/p&gt;

&lt;p&gt;This was one of the most useful parts of the build because it showed me that getting an AI feature working is only one part of the problem. Handling failure states matters just as much.&lt;/p&gt;
&lt;h2&gt;
  
  
  What worked
&lt;/h2&gt;

&lt;p&gt;The final architecture became:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Citizen
   ↓
React + Tailwind PIRS
   ↓
┌───────────────────────┐
│                       │
│   Supabase            │
│   Reports + Auth      │
│   Photos              │
│                       │
└───────────────────────┘

   +

┌───────────────────────┐
│                       │
│   Sanity              │
│   Infrastructure      │
│   Knowledge           │
│                       │
└───────────────────────┘
            ↓
      Relevant Knowledge
            ↓
          Gemini
            ↓
     PIRS AI Assistant
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The combination of structured content and an AI interface made the Knowledge Center much more useful than a collection of static articles.&lt;/p&gt;

&lt;h1&gt;
  
  
  Sanity Project Details
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;Sanity Project ID:&lt;/strong&gt; &lt;code&gt;wenswj4d&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dataset:&lt;/strong&gt; &lt;code&gt;production&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The main Sanity document type is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;infrastructureKnowledge&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The schema was created specifically for PIRS and contains structured fields for infrastructure categories, safety guidance, reporting procedures, responsible authorities and source information.&lt;/p&gt;

&lt;p&gt;Sanity is therefore not just being used as a generic CMS.&lt;/p&gt;

&lt;p&gt;It acts as the structured knowledge layer behind the Knowledge Center and AI Assistant.&lt;/p&gt;

&lt;h1&gt;
  
  
  Technical Stack
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Frontend
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;React&lt;/li&gt;
&lt;li&gt;React Router&lt;/li&gt;
&lt;li&gt;Tailwind CSS&lt;/li&gt;
&lt;li&gt;React Markdown&lt;/li&gt;
&lt;li&gt;Lucide React&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Backend / Data
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Supabase&lt;/li&gt;
&lt;li&gt;Sanity Content Lake&lt;/li&gt;
&lt;li&gt;GROQ&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  AI
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Google Gemini API&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Deployment
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Vercel&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Development
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;VS Code&lt;/li&gt;
&lt;li&gt;Git&lt;/li&gt;
&lt;li&gt;GitHub&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  What I Learned
&lt;/h1&gt;

&lt;p&gt;Building PIRS taught me several things about combining structured content with AI.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Structured content changes what an AI application can do
&lt;/h3&gt;

&lt;p&gt;Instead of giving an AI model a completely open-ended prompt, I can provide it with a defined body of infrastructure knowledge.&lt;/p&gt;

&lt;p&gt;That makes the application's behavior easier to control.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Schema design matters
&lt;/h3&gt;

&lt;p&gt;The Sanity schema determines what information is available to the application.&lt;/p&gt;

&lt;p&gt;Fields such as &lt;code&gt;responsibleAuthority&lt;/code&gt;, &lt;code&gt;safetyGuidance&lt;/code&gt;, &lt;code&gt;reportingProcedure&lt;/code&gt; and &lt;code&gt;requiredInformation&lt;/code&gt; give the AI and frontend meaningful structure to work with.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. AI features need failure handling
&lt;/h3&gt;

&lt;p&gt;The Gemini quota problem was a good reminder that an AI API can fail even when the application itself is working correctly.&lt;/p&gt;

&lt;p&gt;The application therefore needs proper handling for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rate limits&lt;/li&gt;
&lt;li&gt;Temporary service failures&lt;/li&gt;
&lt;li&gt;Missing API keys&lt;/li&gt;
&lt;li&gt;Missing knowledge&lt;/li&gt;
&lt;li&gt;Invalid questions&lt;/li&gt;
&lt;li&gt;Backend errors&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. The product should come before the AI
&lt;/h3&gt;

&lt;p&gt;The AI Assistant became more useful after the underlying PIRS product and knowledge model were defined.&lt;/p&gt;

&lt;p&gt;The AI is not the entire product.&lt;/p&gt;

&lt;p&gt;It is one part of a larger civic reporting experience.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why I Built PIRS
&lt;/h1&gt;

&lt;p&gt;Infrastructure problems are often visible to citizens long before they are formally reported.&lt;/p&gt;

&lt;p&gt;A fallen pole, leaking pipe, pothole, blocked sewer or broken traffic light can affect an entire community.&lt;/p&gt;

&lt;p&gt;PIRS explores how software can make the process of reporting these problems more accessible while also helping citizens understand what information they need to provide.&lt;/p&gt;

&lt;p&gt;The project started as a reporting system.&lt;/p&gt;

&lt;p&gt;It evolved into a combination of:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Civic Reporting + Structured Knowledge + AI Assistance&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That evolution is what made the project especially interesting to build.&lt;/p&gt;

&lt;h1&gt;
  
  
  Final Thoughts
&lt;/h1&gt;

&lt;p&gt;PIRS started as a simple idea:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;See a problem → Report it → Provide the location → Track it&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While building it, the project became much larger.&lt;/p&gt;

&lt;p&gt;Sanity gave the application a structured infrastructure knowledge layer, while Gemini provided a conversational interface over that knowledge.&lt;/p&gt;

&lt;p&gt;The result is a civic technology platform that combines reporting, location, tracking, structured content and AI assistance in one experience.&lt;/p&gt;

&lt;p&gt;This submission represents the actual build process, including the problems, debugging and architectural decisions that happened along the way.&lt;/p&gt;

&lt;h1&gt;
  
  
  sanitychallenge #devchallenge #sanity #ai
&lt;/h1&gt;

</description>
      <category>devchallenge</category>
      <category>sanitychallenge</category>
      <category>sanity</category>
      <category>ai</category>
    </item>
    <item>
      <title>PIRS — Public Infrastructure Reporting System</title>
      <dc:creator>Layton Tozvireva</dc:creator>
      <pubDate>Tue, 29 Sep 2026 12:00:04 +0000</pubDate>
      <link>https://dev.to/laytontozvirevastar/pirs-public-infrastructure-reporting-system-36oc</link>
      <guid>https://dev.to/laytontozvirevastar/pirs-public-infrastructure-reporting-system-36oc</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/sanity-2026-09-16"&gt;Sanity Challenge, Path One: Ship an Agent That Queries Real Content&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;h1&gt;
  
  
  PIRS — Public Infrastructure Reporting System
&lt;/h1&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I built &lt;strong&gt;PIRS (Public Infrastructure Reporting System)&lt;/strong&gt;, a civic technology platform designed to help citizens report and understand public infrastructure problems in their communities.&lt;/p&gt;

&lt;p&gt;People can encounter issues such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Electricity faults&lt;/li&gt;
&lt;li&gt;Water problems&lt;/li&gt;
&lt;li&gt;Blocked sewer systems&lt;/li&gt;
&lt;li&gt;Potholes and damaged roads&lt;/li&gt;
&lt;li&gt;Broken traffic lights&lt;/li&gt;
&lt;li&gt;Illegal dumping&lt;/li&gt;
&lt;li&gt;Fallen trees&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PIRS gives citizens a way to report these problems, provide their location and supporting information, and track submitted reports.&lt;/p&gt;

&lt;p&gt;For the Sanity Challenge, I extended PIRS with a structured &lt;strong&gt;Infrastructure Knowledge Base and AI assistant&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Instead of asking the AI to answer infrastructure questions purely from general knowledge, the assistant retrieves relevant structured PIRS knowledge from Sanity and uses that information as context for its response.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Live application:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://public-infrastructure-reporting-sys.vercel.app/" rel="noopener noreferrer"&gt;https://public-infrastructure-reporting-sys.vercel.app/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Knowledge&lt;/strong&gt; page contains the Infrastructure Knowledge Base and AI assistant.&lt;/p&gt;

&lt;p&gt;Example questions include:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;How do I report a water problem?&lt;/p&gt;

&lt;p&gt;Who should I contact about a damaged road?&lt;/p&gt;

&lt;p&gt;What information should I provide when reporting an electricity fault?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The application also provides a directory of the underlying infrastructure knowledge and links to source information.&lt;/p&gt;
&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;GitHub repository:&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://github.com/laytontozvireva-star/Public_Infrastructure_Reporting_System" rel="noopener noreferrer"&gt;https://github.com/laytontozvireva-star/Public_Infrastructure_Reporting_System&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  How I Used Sanity
&lt;/h2&gt;

&lt;p&gt;Sanity is used as the structured knowledge layer behind the PIRS infrastructure assistant.&lt;/p&gt;

&lt;p&gt;I created a Sanity project with a dedicated &lt;code&gt;infrastructureKnowledge&lt;/code&gt; document type.&lt;/p&gt;

&lt;p&gt;Each knowledge record can contain structured information such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Title&lt;/li&gt;
&lt;li&gt;Infrastructure category&lt;/li&gt;
&lt;li&gt;Problem&lt;/li&gt;
&lt;li&gt;Safety guidance&lt;/li&gt;
&lt;li&gt;Reporting procedure&lt;/li&gt;
&lt;li&gt;Required information&lt;/li&gt;
&lt;li&gt;Responsible authority&lt;/li&gt;
&lt;li&gt;Location context&lt;/li&gt;
&lt;li&gt;Summary&lt;/li&gt;
&lt;li&gt;Source name&lt;/li&gt;
&lt;li&gt;Source URL&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The categories include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Electricity&lt;/li&gt;
&lt;li&gt;Water&lt;/li&gt;
&lt;li&gt;Sewer&lt;/li&gt;
&lt;li&gt;Roads&lt;/li&gt;
&lt;li&gt;Traffic Lights&lt;/li&gt;
&lt;li&gt;Illegal Dumping&lt;/li&gt;
&lt;li&gt;Fallen Trees&lt;/li&gt;
&lt;li&gt;Other&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The knowledge base contains infrastructure information collected from relevant sources, with source information preserved alongside the structured records.&lt;/p&gt;

&lt;p&gt;The PIRS backend queries the Sanity Content Lake and retrieves the infrastructure knowledge used by the assistant.&lt;/p&gt;

&lt;p&gt;The AI assistant then performs relevance matching against the structured content before providing the relevant knowledge as context to Gemini.&lt;/p&gt;

&lt;p&gt;The assistant is instructed to:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Use only the provided PIRS knowledge.&lt;/li&gt;
&lt;li&gt;Avoid inventing authorities, procedures, phone numbers, or other facts.&lt;/li&gt;
&lt;li&gt;Prioritize safety information where applicable.&lt;/li&gt;
&lt;li&gt;State when the available knowledge is insufficient.&lt;/li&gt;
&lt;li&gt;Preserve the relationship between the answer and the underlying source information.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This makes Sanity the structured knowledge layer that the PIRS AI assistant depends on.&lt;/p&gt;
&lt;h2&gt;
  
  
  Sanity Project Details
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Sanity Project ID:&lt;/strong&gt; &lt;code&gt;wenswj4d&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dataset:&lt;/strong&gt; &lt;code&gt;production&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The project contains the &lt;code&gt;infrastructureKnowledge&lt;/code&gt; schema and published infrastructure knowledge records used by the PIRS application.&lt;/p&gt;
&lt;h2&gt;
  
  
  Technical Stack
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Frontend&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;React&lt;/li&gt;
&lt;li&gt;React Router&lt;/li&gt;
&lt;li&gt;Tailwind CSS&lt;/li&gt;
&lt;li&gt;React Markdown&lt;/li&gt;
&lt;li&gt;Lucide React&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Backend / Services&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Vercel serverless API routes&lt;/li&gt;
&lt;li&gt;Sanity&lt;/li&gt;
&lt;li&gt;Supabase&lt;/li&gt;
&lt;li&gt;Google Gemini&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Core flow&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Citizen question
      ↓
PIRS AI Assistant
      ↓
Sanity structured knowledge
      ↓
Relevant infrastructure records
      ↓
Gemini
      ↓
Grounded response
      ↓
Source information displayed to the citizen
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The main PIRS reporting system also uses Supabase for authentication, reports, and report photos.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;The biggest lesson from this project was that an AI assistant becomes much more useful when the information it relies on is structured and traceable.&lt;/p&gt;

&lt;p&gt;Instead of treating infrastructure information as one large block of text, I modeled important parts of each issue separately: category, authority, reporting procedure, safety guidance, required information, location context, and source.&lt;/p&gt;

&lt;p&gt;That structure made it possible for the application to retrieve relevant knowledge and give the AI a focused context for answering questions.&lt;/p&gt;

&lt;p&gt;I also encountered real production issues during development, including temporary Gemini service errors and free-tier quota exhaustion. I added explicit handling for these conditions so users receive a meaningful service-limit message instead of a generic connection failure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why PIRS
&lt;/h2&gt;

&lt;p&gt;Infrastructure problems are easy to see but often difficult to report correctly.&lt;/p&gt;

&lt;p&gt;A citizen may know that a road is damaged or that a water pipe is leaking, but may not know:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Who is responsible?&lt;/li&gt;
&lt;li&gt;What information should be provided?&lt;/li&gt;
&lt;li&gt;Where should the problem be reported?&lt;/li&gt;
&lt;li&gt;What safety precautions are necessary?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;PIRS brings reporting, location, tracking, structured infrastructure knowledge, and an AI assistant into one civic technology experience.&lt;/p&gt;

&lt;p&gt;The goal is simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Report. Locate. Track.&lt;/strong&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  sanitychallenge
&lt;/h1&gt;

</description>
      <category>devchallenge</category>
      <category>sanitychallenge</category>
      <category>sanity</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
