# Project export: StudyFinder

This document was generated by HackStack to give an AI agent context about a hackathon project. Sections are labeled with their provenance; content marked as truncated was cut to keep this document small.

## Project metadata

- Hackathon: Cal Hacks 11.0
- Tagline: Do you ever want to study but don't have people to study with? StudyFinder is the perfect tool to best match you with others to study together!
- Devpost: https://devpost.com/software/studyfinder-acxg0i
- GitHub: https://github.com/alokthakrar/calhacks24
- Team: 0 GitHub contributor(s) — 

## Devpost submission (written by the team)

### Inspiration

With our busy schedules at UC Berkeley, we sometimes crave buddies to study with, to grind through homework and practice exams. However, oftentimes we struggle to set up a time and place with people we would genuinely enjoy studying with, which inspires us to create this app that can help students find their perfect match to work through tough content together.

### What it does

By entering your own preferences, StudyFinder helps to match students with other students to form the perfect group, taking into account many different preferences.

### How we built it

We created the Frontend with Flutter to show questions to the users that is then stored in a Chroma database. This database processes the users' inputs and calculates similarity scores to best match users with other users.

### Challenges we ran into

We were struggling with the time crunch and given that we only ended up with 2 people in the group, we had to work really hard overnight to crunch out the program. Our code definitely had some issues too where there were often functions that were jumbled up because of how many files there were.

### Accomplishments we're proud of

This is our first time at a Hackathon! We are proud that we were able to get on task quick and work through the various challenges with persistence.

### What we learned

We need to manage our time better in splitting up the tasks and figuring out an organization that can help our code look neater and more efficient.

### What's next

StudyFinder will implement location that can help students form the most efficient study groups where no one has to walk extra far to meet up with others. Users need to allow location access and we will use Google Maps to create the most optimal path. We would also like to expand it to campuses outside of UC Berkeley, to reach a wider range of people.

## README (from the GitHub repository)

No README available.

## Detected evidence (automated analysis)

Indexed codebase: 58 recognized source files, 62 KB.
- C (language) — detected in the code
- C++ (language) — detected in the code
- Dart (language) — detected in the code
- HTML (language) — detected in the code
- Kotlin (language) — detected in the code
- Python (language) — detected in the code
- Swift (language) — detected in the code
- Django (technology) — claimed on Devpost, not found in the code
- Google Gemini (technology) — claimed on Devpost, not found in the code

## Codebase structure (from repository index)

### Files (119 of 119)

```
.DS_Store
Backend/apis/__init__.py
Backend/apis/admin.py
Backend/apis/apps.py
Backend/apis/migrations/__init__.py
Backend/apis/migrations/0001_initial.py
Backend/apis/models.py
Backend/apis/serializers.py
Backend/apis/tests.py
Backend/apis/urls.py
Backend/apis/views.py
Backend/db.sqlite3
Backend/geminiProcessingExample.py
Backend/manage.py
Backend/myapp/chroma_manager.py
Backend/myapp/models.py
Backend/myapp/urls.py
Backend/myapp/views.py
Backend/mysite/__init__.py
Backend/mysite/asgi.py
Backend/mysite/settings.py
Backend/mysite/todo.txt
Backend/mysite/wsgi.py
Backend/serializer.py
Frontend/flutter_p1/.gitignore
Frontend/flutter_p1/.metadata
Frontend/flutter_p1/analysis_options.yaml
Frontend/flutter_p1/android/.gitignore
Frontend/flutter_p1/android/app/build.gradle
Frontend/flutter_p1/android/app/src/debug/AndroidManifest.xml
Frontend/flutter_p1/android/app/src/main/AndroidManifest.xml
Frontend/flutter_p1/android/app/src/main/kotlin/com/example/flutter_p1/MainActivity.kt
Frontend/flutter_p1/android/app/src/main/res/drawable-v21/launch_background.xml
Frontend/flutter_p1/android/app/src/main/res/drawable/launch_background.xml
Frontend/flutter_p1/android/app/src/main/res/values-night/styles.xml
Frontend/flutter_p1/android/app/src/main/res/values/styles.xml
Frontend/flutter_p1/android/app/src/profile/AndroidManifest.xml
Frontend/flutter_p1/android/build.gradle
Frontend/flutter_p1/android/gradle.properties
Frontend/flutter_p1/android/gradle/wrapper/gradle-wrapper.properties
Frontend/flutter_p1/android/settings.gradle
Frontend/flutter_p1/ios/.gitignore
Frontend/flutter_p1/ios/Flutter/AppFrameworkInfo.plist
Frontend/flutter_p1/ios/Flutter/Debug.xcconfig
Frontend/flutter_p1/ios/Flutter/Release.xcconfig
Frontend/flutter_p1/ios/Podfile
Frontend/flutter_p1/ios/Podfile.lock
Frontend/flutter_p1/ios/Runner.xcodeproj/project.pbxproj
Frontend/flutter_p1/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Frontend/flutter_p1/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Frontend/flutter_p1/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
Frontend/flutter_p1/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
Frontend/flutter_p1/ios/Runner.xcworkspace/contents.xcworkspacedata
Frontend/flutter_p1/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Frontend/flutter_p1/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
Frontend/flutter_p1/ios/Runner/AppDelegate.swift
Frontend/flutter_p1/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
Frontend/flutter_p1/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
Frontend/flutter_p1/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
Frontend/flutter_p1/ios/Runner/Base.lproj/LaunchScreen.storyboard
Frontend/flutter_p1/ios/Runner/Base.lproj/Main.storyboard
Frontend/flutter_p1/ios/Runner/Info.plist
Frontend/flutter_p1/ios/Runner/Runner-Bridging-Header.h
Frontend/flutter_p1/ios/RunnerTests/RunnerTests.swift
Frontend/flutter_p1/lib/main.dart
Frontend/flutter_p1/linux/.gitignore
Frontend/flutter_p1/linux/CMakeLists.txt
Frontend/flutter_p1/linux/flutter/CMakeLists.txt
Frontend/flutter_p1/linux/flutter/generated_plugin_registrant.cc
Frontend/flutter_p1/linux/flutter/generated_plugin_registrant.h
Frontend/flutter_p1/linux/flutter/generated_plugins.cmake
Frontend/flutter_p1/linux/main.cc
Frontend/flutter_p1/linux/my_application.cc
Frontend/flutter_p1/linux/my_application.h
Frontend/flutter_p1/macos/.gitignore
Frontend/flutter_p1/macos/Flutter/Flutter-Debug.xcconfig
Frontend/flutter_p1/macos/Flutter/Flutter-Release.xcconfig
Frontend/flutter_p1/macos/Flutter/GeneratedPluginRegistrant.swift
Frontend/flutter_p1/macos/Podfile
Frontend/flutter_p1/macos/Runner.xcodeproj/project.pbxproj
Frontend/flutter_p1/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Frontend/flutter_p1/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
Frontend/flutter_p1/macos/Runner.xcworkspace/contents.xcworkspacedata
Frontend/flutter_p1/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
Frontend/flutter_p1/macos/Runner/AppDelegate.swift
Frontend/flutter_p1/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
Frontend/flutter_p1/macos/Runner/Base.lproj/MainMenu.xib
Frontend/flutter_p1/macos/Runner/Configs/AppInfo.xcconfig
Frontend/flutter_p1/macos/Runner/Configs/Debug.xcconfig
Frontend/flutter_p1/macos/Runner/Configs/Release.xcconfig
Frontend/flutter_p1/macos/Runner/Configs/Warnings.xcconfig
Frontend/flutter_p1/macos/Runner/DebugProfile.entitlements
Frontend/flutter_p1/macos/Runner/Info.plist
Frontend/flutter_p1/macos/Runner/MainFlutterWindow.swift
Frontend/flutter_p1/macos/Runner/Release.entitlements
Frontend/flutter_p1/macos/RunnerTests/RunnerTests.swift
Frontend/flutter_p1/pubspec.lock
Frontend/flutter_p1/pubspec.yaml
Frontend/flutter_p1/README.md
Frontend/flutter_p1/test/widget_test.dart
Frontend/flutter_p1/web/index.html
Frontend/flutter_p1/web/manifest.json
Frontend/flutter_p1/windows/.gitignore
Frontend/flutter_p1/windows/CMakeLists.txt
Frontend/flutter_p1/windows/flutter/CMakeLists.txt
Frontend/flutter_p1/windows/flutter/generated_plugin_registrant.cc
Frontend/flutter_p1/windows/flutter/generated_plugin_registrant.h
Frontend/flutter_p1/windows/flutter/generated_plugins.cmake
Frontend/flutter_p1/windows/runner/CMakeLists.txt
Frontend/flutter_p1/windows/runner/flutter_window.cpp
Frontend/flutter_p1/windows/runner/flutter_window.h
Frontend/flutter_p1/windows/runner/main.cpp
Frontend/flutter_p1/windows/runner/resource.h
Frontend/flutter_p1/windows/runner/runner.exe.manifest
Frontend/flutter_p1/windows/runner/Runner.rc
Frontend/flutter_p1/windows/runner/utils.cpp
Frontend/flutter_p1/windows/runner/utils.h
Frontend/flutter_p1/windows/runner/win32_window.cpp
Frontend/flutter_p1/windows/runner/win32_window.h
```

### Dependencies

No dependency index available.

### Recent commits (newest first)

- pushing everything

## Key source files (fetched from GitHub, selected and truncated for size)

### Backend/serializer.py

```python
from rest_framework import serializers
from myapp.models import UserPreference
from myapp.chroma_manager import ChromaManage

class UserPreferenceSerializer(serializers.ModelSerializer):
    embedding = serializers.SerializerMethodField()

    class Meta:
        model = UserPreference 
        fields = ['user_id', 'preferences', 'embedding']
    
    def get_embedding(self, obj):
        chroma_manager = ChromaManage()
        embedding = chroma_manager.get_user_embedding(obj.user_id)
        if embedding is None:
            return None
        return embedding 
```

### Backend/manage.py

```python
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys


def main():
    """Run administrative tasks."""
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'Backend.settings')
    try:
        from django.core.management import execute_from_command_line
    except ImportError as exc:
        raise ImportError(
            "Couldn't import Django. Are you sure it's installed and "
            "available on your PYTHONPATH environment variable? Did you "
            "forget to activate a virtual environment?"
        ) from exc
    execute_from_command_line(sys.argv)


if __name__ == '__main__':
    main()

```

### Backend/geminiProcessingExample.py

```python
import google.generativeai as genai
import os
import numpy as np
import matplotlib.pyplot as plt
import time 
genai.configure(api_key="AIzaSyDuNu-risK3DWG_-0T1h-pRbxLWQ51pUaw")
model = genai.GenerativeModel("gemini-1.5-flash")
numbers = []
for _ in range(30):
    response = model.generate_content("""Given the two following samples, assign them a score from 0-100 for how similar they are. Output only one number. Be precise to the nearest ones digit. 
                                  1.) Hello! I love to play chess and go to the beach. I am a big fan of Sharetea, and I love to chat while studying! 

                                  2.) Hello. I like to take long walks at the beach and pet puppies. I'll be LOCKING IN during our study sesh. 
                                  """)
    numbers.append(int(str(response)))
    time.sleep(10)

print(numbers)
plt.hist(numbers)
plt.xlabel('score')
plt.ylabel('# of responses')
plt.show()

    
```

### Backend/apis/tests.py

```python
from django.test import TestCase

# Create your tests here.

```

### Backend/apis/admin.py

```python
from django.contrib import admin
from .models import Person
admin.site.register(Person)
# Register your models here.

```

### Backend/apis/apps.py

```python
from django.apps import AppConfig


class ApisConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'apis'

```

### Backend/myapp/urls.py

```python
from django.urls import path 
from myapp import views

url_patterns = [
    path('add_preferences/', views.add_user_preferences_view, name = 'add_preferences'),
    path('explore_similar/', views.explore_similar_users_view, name = 'explore_similar')
]
```

### Backend/apis/models.py

```python
from django.db import models

# Create your models here.
# change parameters here. 
class Person(models.Model):
    name = models.CharField(max_length=60)
    favoriteBoba = models.CharField(max_length=60)
    def __str__(self):
        return str(self.name)

```

### Backend/apis/serializers.py

```python
from rest_framework import serializers

from .models import Person
#this is ultimately what is written out to our database. 
class PersonSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Person
        fields = ('id', 'name', 'favoriteBoba')

```

### Backend/myapp/models.py

```python
from django.db import models

## file used as a model for all data collected
class UserPreference(models.Model):
    user_id = models.CharField(max_length = 100, unique = True)
    preferences_metadata = models.JSONField(null = True, blank = True)
    time_created = models.DateTimeField(auto_now_add = True)
```

[43 more indexed source files omitted to keep this export small. The full file list is in the Codebase structure section above.]