-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Pune] Kashif Shaik - Subm #1208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
a8ebb9b
14f5a52
c8aa0f0
20f2ddd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,16 @@ | ||
| # agents.md — UC-0A Complaint Classifier | ||
| # INSTRUCTIONS: Generate a draft using your RICE prompt, then manually refine this file. | ||
| # Delete these comments before committing. | ||
|
|
||
| role: > | ||
| [FILL IN: Who is this agent? What is its operational boundary?] | ||
| You are a Civic Complaint Classifier for the Pune Municipal Corporation. Your role is to accurately categorize citizen complaints, assign priority based on safety risks, and provide a clear justification for your decisions. You must strictly adhere to the provided taxonomy and priority rules. | ||
|
|
||
| intent: > | ||
| [FILL IN: What does a correct output look like — make it verifiable] | ||
| Produce a verifiable classification for each complaint. A correct output is a JSON or CSV row containing exactly: complaint_id, category (from the allowed list), priority (Urgent, Standard, or Low), a one-sentence reason citing specific words from the description, and a flag (NEEDS_REVIEW) if ambiguous. | ||
|
|
||
| context: > | ||
| [FILL IN: What information is the agent allowed to use? State exclusions explicitly.] | ||
| You are provided with a CSV file containing citizen complaints. Each row has a `description` and a `complaint_id`. You are allowed to use ONLY the information in the description. Do not use external knowledge or hallucinate details. Exclude any personal identifying information from the reasoning. | ||
|
|
||
| enforcement: | ||
| - "[FILL IN: Specific testable rule 1 — e.g. Category must be exactly one of: Pothole, Flooding, ...]" | ||
| - "[FILL IN: Specific testable rule 2 — e.g. Priority must be Urgent if description contains: injury, child, school, ...]" | ||
| - "[FILL IN: Specific testable rule 3 — e.g. Every output row must include a reason field citing specific words from the description]" | ||
| - "[FILL IN: Refusal condition — e.g. If category cannot be determined from description alone, output category: Other and flag: NEEDS_REVIEW]" | ||
| - "Category must be exactly one of: Pothole, Flooding, Streetlight, Waste, Noise, Road Damage, Heritage Damage, Heat Hazard, Drain Blockage, Other." | ||
| - "Priority must be 'Urgent' if description contains any of: injury, child, school, hospital, ambulance, fire, hazard, fell, collapse." | ||
| - "Every output row must include a 'reason' field that is exactly one sentence long and cites specific words from the description." | ||
| - "If the category is genuinely ambiguous or cannot be determined from the description alone, set category to 'Other' and set flag to 'NEEDS_REVIEW'." |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,29 +1,107 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| UC-0A — Complaint Classifier | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Starter file. Build this using the RICE → agents.md → skills.md → CRAFT workflow. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Implementation based on RICE → agents.md → skills.md workflow. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import argparse | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import csv | ||||||||||||||||||||||||||||||||||||||||||||||||||
| import re | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| def classify_complaint(row: dict) -> dict: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Classify a single complaint row. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Returns: dict with keys: complaint_id, category, priority, reason, flag | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| TODO: Build this using your AI tool guided by your agents.md and skills.md. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Your RICE enforcement rules must be reflected in this function's behaviour. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| Classify a single complaint row based on keywords and safety rules. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| raise NotImplementedError("Build this using your AI tool + RICE prompt") | ||||||||||||||||||||||||||||||||||||||||||||||||||
| desc = row.get('description', '').lower() | ||||||||||||||||||||||||||||||||||||||||||||||||||
| complaint_id = row.get('complaint_id', 'Unknown') | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| # 1. Determine Category | ||||||||||||||||||||||||||||||||||||||||||||||||||
| category = "Other" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| flag = "" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+13
to
+19
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| desc = row.get('description', '').lower() | |
| complaint_id = row.get('complaint_id', 'Unknown') | |
| # 1. Determine Category | |
| category = "Other" | |
| flag = "" | |
| complaint_id = row.get('complaint_id', 'Unknown') | |
| raw_desc = row.get('description', '') | |
| if raw_desc is None or not str(raw_desc).strip(): | |
| return { | |
| "complaint_id": complaint_id, | |
| "category": "Other", | |
| "priority": "Standard", | |
| "reason": "Missing description", | |
| "flag": "NEEDS_REVIEW" | |
| } | |
| desc = str(raw_desc).lower() | |
| # 1. Determine Category | |
| category = "Other" | |
| flag = "" |
Copilot
AI
Apr 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason string claims the description mentions '{category.lower()}', but the exact category phrase often isn't present in the text (e.g., "Road Damage" vs "road surface cracked"). This violates the requirement to cite specific words from the description. Please capture and cite the actual triggering keyword(s) used for classification.
Copilot
AI
Apr 20, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On FileNotFoundError, batch_classify returns without writing an output file. Because batch_classify doesn’t signal failure to the caller, the CLI code below can still print a success message even when nothing was written. Please return a boolean/exit code (or raise) from batch_classify and have __main__ only print success when the output was actually created.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| complaint_id,category,priority,reason,flag | ||
| PM-202401,Pothole,Standard,Classified as Pothole because description mentions 'pothole'; prioritized as Standard due to words like 'none'., | ||
| PM-202402,Pothole,Urgent,"Classified as Pothole because description mentions 'pothole'; prioritized as Urgent due to words like 'child, school'.", | ||
| PM-202406,Flooding,Standard,Classified as Flooding because description mentions 'flooding'; prioritized as Standard due to words like 'none'., | ||
| PM-202408,Flooding,Standard,Classified as Flooding because description mentions 'flooding'; prioritized as Standard due to words like 'none'., | ||
| PM-202410,Streetlight,Standard,Classified as Streetlight because description mentions 'streetlight'; prioritized as Standard due to words like 'none'., | ||
| PM-202411,Streetlight,Urgent,Classified as Streetlight because description mentions 'streetlight'; prioritized as Urgent due to words like 'hazard'., | ||
| PM-202413,Waste,Low,Classified as Waste because description mentions 'waste'; prioritized as Low due to words like 'none'., | ||
| PM-202418,Noise,Standard,Classified as Noise because description mentions 'noise'; prioritized as Standard due to words like 'none'., | ||
| PM-202419,Road Damage,Standard,Classified as Road Damage because description mentions 'road damage'; prioritized as Standard due to words like 'none'., | ||
| PM-202420,Other,Urgent,Classified as Other because description mentions 'other'; prioritized as Urgent due to words like 'injury'.,NEEDS_REVIEW | ||
| PM-202427,Flooding,Standard,Classified as Flooding because description mentions 'flooding'; prioritized as Standard due to words like 'none'., | ||
| PM-202428,Waste,Standard,Classified as Waste because description mentions 'waste'; prioritized as Standard due to words like 'none'., | ||
| PM-202430,Heritage Damage,Standard,Classified as Heritage Damage because description mentions 'heritage damage'; prioritized as Standard due to words like 'none'., | ||
| PM-202433,Waste,Standard,Classified as Waste because description mentions 'waste'; prioritized as Standard due to words like 'none'., | ||
| PM-202446,Other,Urgent,Classified as Other because description mentions 'other'; prioritized as Urgent due to words like 'fell'.,NEEDS_REVIEW |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,14 @@ | ||
| # skills.md | ||
| # INSTRUCTIONS: Generate a draft by prompting AI, then manually refine this file. | ||
| # Delete these comments before committing. | ||
|
|
||
| skills: | ||
| - name: [skill_name] | ||
| description: [One sentence — what does this skill do?] | ||
| input: [What does it receive? Type and format.] | ||
| output: [What does it return? Type and format.] | ||
| error_handling: [What does it do when input is invalid or ambiguous?] | ||
| - name: classify_complaint | ||
| description: Analyzes a single citizen complaint to determine its category, priority, and reason for classification. | ||
| input: A dictionary representing a row from the input CSV, containing at least 'complaint_id' and 'description'. | ||
| output: A dictionary with keys 'complaint_id', 'category', 'priority', 'reason', and 'flag'. | ||
| error_handling: If 'description' is missing or empty, returns category 'Other', priority 'Standard', reason 'Missing description', and flag 'NEEDS_REVIEW'. | ||
|
|
||
| - name: [second_skill_name] | ||
| description: [One sentence] | ||
| input: [Type and format] | ||
| output: [Type and format] | ||
| error_handling: [What does it do when input is invalid or ambiguous?] | ||
| - name: batch_classify | ||
| description: Processes an entire CSV file of complaints and saves the results to a new CSV file. | ||
| input: Paths to the input CSV file and the desired output CSV file. | ||
| output: None (writes to a file). | ||
| error_handling: Handles missing input files gracefully and ensures the output file is created even if some rows fail to classify. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reis imported but not used. Please remove the unused import to keep the module clean and avoid lint failures.