Inspiration

After being faced with the challenge to improve the quality of life for Kingston citizens, we decided to spend some time researching what problems the community faces the most. It was on this journey that we discovered an open-source large database dating back years of complaints, providing invaluable data on community concerns. However, it can often be a struggle for citizens to work with such data, especially without the proper tools. Compass aims to reap the rewards of this hidden gem by helping consumers make data-driven decisions, optimizing available resources to empower the community. This tool is additionally designed to be helpful to the municipal government, acting like an easy-to-use assistant, guiding community leaders on the most concerning problems.

What it does

Compass is an AI-agent-powered (or rather Boo-Hoo Bear-powered) dashboard providing real-time insight into community concerns, built for any community member, technical or non-technical. It provides data-backed answers to a range of requests, whether it is a simple yes or no question, or a detailed report relaying critical trends and complex problem solutions. Since Compass is based on community requests, it eliminates personal bias from decision-making to ensure equity and encourages people to voice their concerns.

How we built it

The backend handled the complex data storage, server operations, and AI agent pipelines to provide users with real-time information and assistance.

On the data storage side, the request table underwent preprocessing before being uploaded to Supabase, including adding vector embeddings through pgvector, allowing text-based queries from the user. Additionally, the requests were clustered using K-Means into 25 major categories, which all contained up to 10 smaller categories, providing a quantitative measure of how common specific concerns are.

In terms of raw data, multiple data analysis methods were conducted caluclating values such as trends, popularity, and spatial distribution to provide a vast range of visualization methods for the large dataset. In particular, the method helped present outliers, further support the AI agent's reasoning, and provide quantitative results for the final report.

Vultr!!!

Vultr is the core of our services, it hosts our backend fast api endpoints and our daily batch tasks. It is fetching all the updated records from the kingston database and processing them individually, some days it may be few, but some days there are MANY. These batch tasks involve intense data processing of thousands of records into millions of vector embeddings. Something that is completely unfeasible on a personal computer in a timely manner. Vultr allows custom options to scale as needed, where we were able to upgrade our payment plan super easily to meet the needs of our project in an extreme time crunch. The easy setup also allowed us to get it up and running on the cloud in an instant, with excellent security compliance and data validation.

Gradium!!!

The agent pipeline, powered by Gemini and Gradium, consisted of chatbot interactions and customizable tool calls, focusing on gathering, presenting and vocalizing information about the request database through vector searches, trend analysis and report generation. The agent was built to handle complex interactions through context-based data research, providing a report-style output for the user to review easily.

When it comes to the frontend, the site was built through Shadcn and React-based components for a visually appealing user interface and a strong user experience. To promote a comfortable environment, we designed an animated agent avatar inspired by Queen's own Boo Hoo the Bear. Additionally, we display a 3d representation of the 384-dimensional vector embedding clusters via umap to help the user visualize how related clusters form. Moreover, we included a trends page with various autogenerated charts to encourage user understanding. Finally, the report featured key insights, metric visualization, charts, and recommendations to help the user address major concerns.

Challenges we ran into

One major challenge we faced was the impact that vector embeddings and clustering would have on database memory. Originally, we were using vector embeddings consisting of 768 dimensions and unoptimized cluster mappings, causing us to surpass our superbase resources by 35%. To mitigate the memory, we ended up refactoring the database to use 384-dim vectors and optimized the clusters table, reducing our total memory usage by more than 50%.

Additionally, when integrating Vultr, we kept running into max RAM storage issues, since we wanted to optimize data processing speed, despite the sizable amount of data required. To address this concern, we ended up going with the biggest plan, ensuring the users have access to in-depth resources without suffering from a laggy or slow UX.

Accomplishments that we're proud of

The biggest accomplishment that we are proud of is how the integrated AI system works, with cool animations, TTS conversations, strong vector search capabilities, trend analysis and report generation. The biggest win was seeing the amalgamated product work and go through the flow, as it successfully informed the user about the population's concerns and approaches to meet the needs of the citizens.

What we learned

We learned a lot about cloud storage and the difficult art of balancing heavy response payloads with a reasonably fast runtime. By using Vultr, we were exposed to the benefits of cloud architecture in improving the performance of processing large datasets and computing machine learning algorithms.

What's next for Compass

A feature we would like to add is to include a language setting so that the user can select the language from the landing page, and this would work hand in hand with our Gradium integration, making use of the many language models Gradium has, in an effort to further our accessibility and increase community involvement.

Additionally, we would love to further our scope and benefit more people. Kingston is not the only community that can benefit from a centralized problem analysis database. Being offered a simple, unbiased, and analytical view to improve the city will be invaluable to leaders and community members alike. Compass will continue to strive to combine AI/ML with cloud computing to streamline community involvement in government-level decision-making.

Built With

Share this project:

Updates