AI-la-Carte: Your Personalized Food Navigator
AI-la-Carte tackles the challenge of food insecurity by intelligently matching users to nearby food assistance locations that precisely fit their unique dietary needs, travel range, and language preferences.
Its core strength lies in providing seamless proximity filtering, clearly displaying hours, ID or appointment requirements, and presenting information through multilingual, low-literacy-friendly prompts.
This isn't just a directory; it's a personalized guide, ensuring everyone can quickly find – and get – exactly the food support they need.
Under the Hood: How AI-la-Carte Works Its Magic
The magic behind AI-la-Carte is a sophisticated blend of data management, geospatial intelligence, and state-of-the-art AI, all orchestrated to provide a smooth user experience.
Building the Knowledge Base
File: src/db_helper/sql_helper.py
Before any search begins, AI-la-Carte meticulously organizes data about
food assistance locations. It takes raw Excel files (like
CAFB_Markets_Shopping_Partners.xlsx) and transforms them
into a structured SQLite database. This process handles various data
types, including time conversions, ensuring all information is readily
queryable.
Pinpointing Your Location
File: src/geo_helper/geo_helper.py
When a user inputs their address, the GeoHelper springs into action.
Leveraging ArcGIS geocoding, it accurately converts the address into
precise latitude and longitude coordinates. Then, using the
geopy.distance.geodesic library, it calculates the exact
distance to every food assistance location in the database. This allows
the platform to intelligently filter and prioritize locations within the
user's specified travel radius.
Intelligent Matching with AI
RAG System: src/rag_helper/langchain.py
This is where the "AI" in AI-la-Carte truly shines, utilizing a
Retrieval Augmented Generation (RAG) system powered by large language
models (LLMs) like OpenAI's gpt-4o-mini and gpt-4.
| Component | Description |
|---|---|
| DietaryFilterGenerator |
Takes a user's natural language preferences (e.g., "I need halal
food," "I'm diabetic and need fresh produce") and, guided by
predefined DIETARY_RULES, intelligently translates
them into precise SQL WHERE clauses. This ensures that only
relevant assistance locations meeting specific dietary or cultural
requirements are considered.
|
| QueryBuilder | Combines AI-generated dietary filters with geospatial proximity results. It constructs a comprehensive SQL query that retrieves only the most suitable food assistance options from the SQLite database. |
| ResponseGenerator |
Takes the raw results from the database query and transforms them
into a clear, concise, and user-friendly response. Using a
detailed RESPONSE_TEMPLATE and its own LLM, it
formats information about agency name, address, distance,
operating hours, food format, and any specific requirements.
Crucially, it ensures responses are generated in the user's
preferred language and are easy to understand, avoiding jargon and
providing "Not available" for missing data to prevent "AI
hallucinations."
|
The User-Friendly Interface
Files: streamlit_app.py &
src/user_preferences/user_preferences.py
The entire experience is delivered through an intuitive web interface
built with Streamlit. user_preferences.py handles the
interactive collection of user inputs, guiding them through a series of
questions about their language, address, dietary needs, preferred pickup
times (dynamically generated based on "today," "tomorrow," or future
dates), and other services. This seamless interaction is designed for
maximum accessibility, even for those with low digital literacy.
Breaking Barriers, Empowering Communities
- Find Food Quickly: Reduce the time and effort spent searching.
- Get the Right Food: Ensure dietary needs are met, promoting health and dignity.
- Access Local Support: Connect with nearby resources, minimizing travel burden.
- Communicate Clearly: Overcome language barriers with multilingual support.
- Navigate Requirements: Understand what's needed for access, reducing frustration.
Dive Deeper & Get Involved!
AI-la-Carte stands as a powerful example of how intelligent systems can create real-world impact. It's an open-source project, encouraging collaboration and further development.
To explore the code, understand the intricate workings, or contribute to this vital initiative, visit the GitHub repository.
By making food assistance "à la carte," AI-la-Carte is paving the way for a more equitable and food-secure future.