AI System Development for Citizen Request Processing Automation
Citizen requests to government agencies is a high-load and strictly regulated process. Federal Law No. 59-FZ establishes deadlines: written requests — 30 days, separate categories — 10-15 days. Missing deadlines entails administrative liability. AI system automates receipt, classification, routing, and response preparation while complying with all regulatory requirements.
System Architecture
The system consists of several independent modules, each can be implemented separately:
Intake Module — integration with request submission channels: Government Services Portal (ESIA), agency official website, email, MFC (SMEV), reception offices. Normalization of incoming data into unified format.
Classification Module — determining request topic by agency classifier, competent body, urgency. Identifying duplicate requests and complaints about missed deadlines.
Routing Module — automatic determination of responsible department and executor based on topic, territorial affiliation, and workload.
Response Preparation Module — draft response generation for typical requests, search in regulatory base and previous responses.
Deadline Control Module — SLA tracking accounting for holidays, escalation as deadline approaches.
Classification and Data Extraction
from pydantic import BaseModel
from enum import Enum
class RequestCategory(str, Enum):
HOUSING = "housing"
UTILITIES = "utilities"
LAND = "land relations"
SOCIAL = "social protection"
TRANSPORT = "transport and roads"
ECOLOGY = "ecology"
PERMISSIONS = "permits and licenses"
COMPLAINT = "complaint against officials"
OTHER = "other"
class CitizenRequest(BaseModel):
applicant_name: str
applicant_contact: str
request_text: str
attachments: list[str]
class ProcessedRequest(BaseModel):
category: RequestCategory
subcategory: str
subject_summary: str # brief summary in 1-2 sentences
responsible_department: str
priority: str # routine / urgent / special_control
deadline_days: int # calculated response deadline per law 59-FZ
requires_interdepartmental: bool # interdepartmental request needed
extracted_addresses: list[str] # addresses from request text
extracted_organizations: list[str]
is_repeat: bool # repeat request
related_request_ids: list[str]
def process_citizen_request(request: CitizenRequest, db) -> ProcessedRequest:
# Search for similar previous requests
similar = db.semantic_search(request.request_text, top_k=5)
context = build_context(similar)
return llm.parse(
build_classification_prompt(request, context),
response_format=ProcessedRequest
)
Deadline Calculation per Law 59-FZ
Deadline calculation is non-trivial: base deadline is 30 days, but there are exceptions — housing and utilities requests may require response in 10 days per regional laws, urgent requests — 15 days. Interdepartmental request extends deadline by 30 days with applicant notification.
def calculate_deadline(
request: ProcessedRequest,
received_date: date,
holiday_calendar: HolidayCalendar
) -> DeadlineInfo:
base_days = 30 # base deadline per law 59-FZ art. 12
if request.priority == "urgent":
base_days = 15
elif request.category == RequestCategory.UTILITIES:
base_days = 10 # regional requirements
if request.requires_interdepartmental:
base_days += 30 # art. 10 ch. 2 law 59-FZ
# Working days accounting for production calendar
deadline = holiday_calendar.add_working_days(received_date, base_days)
return DeadlineInfo(
deadline=deadline,
warning_date=holiday_calendar.add_working_days(received_date, base_days - 5),
escalation_date=holiday_calendar.add_working_days(received_date, base_days - 2)
)
Response Draft Preparation
For typical requests (80-90% of incoming flow) system generates response draft automatically. Response must contain references to regulatory documents and specific explanations, not generic phrases.
def generate_draft_response(
request: ProcessedRequest,
original_text: str,
knowledge_base: KnowledgeBase
) -> DraftResponse:
# Search for relevant regulatory documents, resolutions, regulations
relevant_docs = knowledge_base.search(
query=original_text,
doc_types=["law", "regulation", "instruction", "precedent"],
top_k=10
)
# Response generation with references
prompt = f"""Prepare official response to citizen request.
Request: {original_text}
Topic: {request.category}
Relevant Documents:
{format_documents(relevant_docs)}
Requirements:
- Official business style
- Specific references to regulatory articles
- Description of action procedure for applicant
- No generic phrases or boilerplate"""
draft = llm.generate(prompt, max_tokens=800)
return DraftResponse(
text=draft,
referenced_documents=[d.id for d in relevant_docs[:5]],
confidence=estimate_confidence(request, relevant_docs),
requires_human_review=request.priority == "urgent" or request.category == RequestCategory.COMPLAINT
)
ESIA and SMEV Integration
Integration with federal infrastructure:
ESIA (Unified Identification and Authentication System): applicant authentication, obtaining verified personal data — full name, SNILS, address. Eliminates need for document re-submission.
SMEV (Interdepartmental Electronic Exchange System): interdepartmental requests in automated mode. For example, for response to land property request system automatically requests data from Rosreestr.
Housing and Utilities GIS API: for utilities requests — verification of charges, emergency requests, building condition.
EPGU (Government Services): receiving requests via Government Services API, publishing review status.
Systemic Problem Detection
Aggregated analysis of requests identifies recurring problems:
def detect_systemic_issues(
requests: list[ProcessedRequest],
period_days: int = 30
) -> list[SystemicIssue]:
# Clustering by topic and addresses
clusterer = HDBSCANClusterer(min_cluster_size=10)
clusters = clusterer.fit(requests)
issues = []
for cluster in clusters:
if cluster.growth_rate > 2.0: # 2x+ increase in requests
issues.append(SystemicIssue(
category=cluster.dominant_category,
location=cluster.most_common_address,
request_count=len(cluster.requests),
sample_texts=cluster.get_samples(n=3),
trend="growing",
recommended_action=generate_action_recommendation(cluster)
))
return sorted(issues, key=lambda x: x.request_count, reverse=True)
Anti-Fraud and Abuse Prevention
System detects: coordinated campaigns using single template, requests showing manipulation signs, content-free requests. Doesn't block — marks for separate review. Each request must be considered per law 59-FZ.
Implementation Timeline
Month 1-2: Intake module (email, web form), basic classification by classifier, SLA tracking
Month 3-4: ESIA integration, routing module, management dashboard
Month 5-6: Response draft generation, regulatory base integration
Month 7-8: SMEV integration, systemic problem analytics, pilot on 3 departments
Month 9-10: Scaling, staff training, efficiency evaluation







