Ali Ayhan Gunder - bounswe/bounswe2025group2 GitHub Wiki

👋 Hello, I'm Ayhan!

🎓 About Me

  • Studying Computer Engineering at Boğaziçi University since 2021
  • Passionate about coding, application development, and problem-solving

🛠 Skills

  • Programming Languages: Python, C, C++, Java, SQL, JS, Verilog
  • Software Development: Git, Unix/Linux
  • Experience: DBMS, OOP, DSA, AI, and System Security

🎯 Hobbies

  • Fitness – Staying active keeps my mind sharp
  • Gaming – Love competitive strategy games
  • Tech Blogs – Always learning something new

🛠 Favorite Tools

  • VS Code, Cursor, IntelliJ, PyCharm, GitHub , MYSQL

🎯 Goals

  • Short-term: Mastering Software Engineering and AI
  • Long-term: Building scalable and secure AI-powered applications

📬 Connect With Me

✨ Quotes / Inspiration

"The one who loves his country the most is the one who performs his duty best." – Mustafa Kemal Atatürk


API Documentation

API Documentation

Cohere LLM Integration – GenFit Challenges

Overview

GenFit uses Cohere’s Large Language Model (LLM) to power the chatbot on the Challenges page. The bot gives smart, context-aware help so users can join, follow, and complete fitness challenges with less friction.


Key Features

1. Challenge Info on Demand

The bot can:

  • Explain rules and requirements
  • Show details of active challenges
  • Answer questions about goals, metrics, dates and rewards

2. Natural-Language Progress Updates

Users update progress with simple sentences:

I just ran 5 kilometres for the marathon challenge.
Add 45 minutes of cycling to my cardio challenge.

The LLM detects intent and calls the update_progress API with the right fields.

3. Leaderboard Insights

  • Show the user’s rank and gap to next place
  • Compare the user with friends or the full group
  • Give quick stats (avg. pace, total time, etc.)

4. Smart Challenge Suggestions

Using past activity, the bot recommends:

  • Challenges that fit the user’s goals
  • Complementary challenges that build on current ones
  • Local events (if the user shares location)

Technical Details

SDK Setup

We call Cohere from the web app with their JavaScript SDK:

import Cohere from 'cohere-ai';

Cohere.init({ apiKey: COHERE_API_KEY });

Authentication

The API key lives in secure server storage and is sent only from the backend over HTTPS.

Cohere Model Choice

Model Purpose Context Window
command-r-plus Main chat replies 32 k tokens
embed-english-v3 Similarity search for challenges 4 k tokens

Tip: Stay below 75 % of the max context (≈24 k tokens) to keep latency low.

Typical Generation Parameters

{
  "model": "command-r-plus",
  "max_tokens": 200,
  "temperature": 0.3,
  "p": 0.95,
  "frequency_penalty": 0,
  "presence_penalty": 0
}
  • max_tokens – size of the answer
  • temperature / p – creativity vs. control
  • penalties – reduce repetition

Connected GenFit Endpoints

Endpoint Action
update_progress Save new workout data
challenge_leaderboard Get leaderboard rows
get_challenge_detail Fetch one challenge
search_challenges List matching challenges

Context Handling

We pass the last 10 chat turns to Cohere (messages array). Older turns are summarised when the total token count nears the limit.

Error & Rate-Limit Handling

HTTP code Meaning Bot action
401 Bad / missing key Show “login again” prompt
429 Rate limit hit Retry with exponential back-off
5xx Cohere server error Apologise and try once more

Cohere’s free tier allows ~90 requests / minute. Higher tiers raise this cap.


Privacy

  • Ephemeral chat logs – stored only for the session
  • GDPR/CCPA compliant – fitness data kept inside GenFit
  • No personal data sent for model training

Tips for Users

Do Why
“Tell me about the Spring Marathon Challenge.” Names remove doubt
“Add 5.2 km to my running challenge.” Exact numbers update correctly
“Am I in the top 10 for weight-loss?” Targets a clear answer

Known Limits

  • Only coaches can change challenge settings
  • The bot may ask for clarifications on vague requests
  • Voice control is still experimental

Roadmap

  • Full voice control
  • AI-based workout plans
  • Multi-language chat
  • Deeper analytics and weekly reports

Learn more: Cohere API docs → https://docs.cohere.com/reference/about


Unit Test Documentation

Unit Test Documentation

Unit Tests – Challenge Creation

Overview

These unit tests make sure that only coaches can create challenges, important fields are present, business rules hold, and the API answers with the right status codes.


Table of Contents

  1. Authorisation Tests
  2. Data Validation Tests
  3. Business-Logic Tests
  4. Location Tests
  5. Edge-Case Tests
  6. Implementation Example
  7. Running the Tests
  8. Best Practices
  9. CI Integration

Authorisation Tests

test_coach_can_create_challenge

Detail
Purpose Coaches can create challenges.
Setup User with user_type='Coach'.
Action POST /api/challenges/create/ with valid data.
Assert 201 Created and challenge stored with coach’s ID.

test_non_coach_cannot_create_challenge

Detail
Purpose Block regular users.
Setup User with user_type='Regular'.
Action Same POST call.
Assert 403 Forbidden and error “Only coaches can create…”.

Data Validation Tests

test_challenge_creation_requires_mandatory_fields

Checks that missing required fields return 400 Bad Request with field errors.

test_challenge_creation_with_valid_data

Valid payload returns 201 Created and DB row equals request.


Business-Logic Tests

Test Rule Expected
test_challenge_dates_validation end_date after start_date 400
test_challenge_age_range_validation min_age < max_age 400
test_challenge_target_value_validation target_value > 0 400

Location Tests

test_challenge_creation_with_location

Valid coordinates + name → challenge saved with location data.

test_challenge_creation_with_invalid_coordinates

Lat outside ±90 or lon outside ±180 → 400 with error.


Edge-Case Tests

Scenario Expected
Max-length title/description 201
Only required fields present 201 & defaults added

Implementation Example

from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
from rest_framework.test import APIClient
from rest_framework import status
from ..models import Challenge
from datetime import datetime, timedelta
import json

User = get_user_model()

class ChallengeCreationTests(TestCase):
    def setUp(self):
        self.coach = User.objects.create_user(
            username="coach_test",
            email="[email protected]",
            password="securepassword",
            user_type="Coach"
        )
        self.regular = User.objects.create_user(
            username="regular_test",
            email="[email protected]",
            password="securepassword",
            user_type="Regular"
        )
        self.client = APIClient()
        self.url = reverse("create_challenge")
        self.payload = {
            "title": "Test Challenge",
            "description": "This is a test challenge",
            "challenge_type": "Running",
            "target_value": 100,
            "unit": "km",
            "start_date": (datetime.now() + timedelta(days=1)).isoformat(),
            "end_date": (datetime.now() + timedelta(days=30)).isoformat(),
            "min_age": 18,
            "max_age": 65,
            "is_public": True,
            "latitude": 41.0082,
            "longitude": 28.9784,
            "location_name": "Istanbul"
        }

    def test_coach_can_create_challenge(self):
        self.client.force_authenticate(self.coach)
        res = self.client.post(self.url, json.dumps(self.payload), "application/json")
        self.assertEqual(res.status_code, status.HTTP_201_CREATED)
        self.assertTrue(Challenge.objects.filter(title="Test Challenge").exists())

    def test_non_coach_cannot_create_challenge(self):
        self.client.force_authenticate(self.regular)
        res = self.client.post(self.url, json.dumps(self.payload), "application/json")
        self.assertEqual(res.status_code, status.HTTP_403_FORBIDDEN)

Weekly Effort Table

Weekly Effort Table - 352

📅 Weekly Effort Table

Week 1
Task Description Duration Type Issue
Group Meeting Initial group meeting 60 min Meeting Meeting 1
Trying Git Features Testing various Git commands 120 min Task #12
Learning Git and GitHub Understanding basic Git and GitHub features 90 min Task #12
Building a Personal Profile Page Creating personal profile web page 120 min Task #9
Week 2
Task Description Duration Type Issue
Group Meeting Discuss project progression 60 min Meeting Meeting 2
Group Meeting Planning session 60 min Meeting Meeting 3
Group Meeting Weekly synchronization 60 min Meeting Meeting 4
Studying Advanced Git Topics In-depth study of advanced Git concepts 180 min Task #21
Preparing Wiki Page About Advanced Git Creating documentation for advanced Git 180 min Task #21
Week 3
Task Description Duration Type Issue
Group Meeting Extended project discussion 120 min Meeting Meeting 5
Research on Creating Proper Scenario Research methods for scenario creation 120 min Task #36
Drafting Scenarios 3 and 6 Initial draft for specific scenarios 120 min Task #36
Week 4
Task Description Duration Type Issue
Creating Wiki Pages About Scenarios Documenting scenarios 120 min Task #36
Group Meeting Routine weekly meeting 60 min Meeting Meeting 6
Customer Meeting Meeting with customer for project insights 120 min Meeting Customer Meeting 1
Group Meeting Discussion on recent activities 60 min Meeting Meeting 7
Updating the Wiki Main Page Updating primary wiki documentation 60 min Task #41
Reviewing Notes From Meeting 6 Reviewing and finalizing meeting notes 60 min Task #48
Week 5
Task Description Duration Type Issue
Learning Basics of Class Diagrams Understanding UML class diagram fundamentals 90 min Task #56
Revising Scenarios 3 and 6 Updating scenarios based on feedback 120 min Task #50
Group Meeting Weekly sync-up meeting 60 min Meeting Meeting 8
Creating Class Diagrams Designing class diagrams for project 180 min Task #56
Creating Weekly Effort Table for Myself Documenting personal effort 180 min Task #70
Week 6
Task Description Duration Type Issue
Adding Mockup to Mentor Registration Scenario Designing mentor registration mockup 120 min Feature #85
Adding Mockup to User Mentor Contact Scenario Designing user-mentor contact mockup 120 min Feature #86
Group Meeting Weekly team meeting 60 min Meeting Meeting 9
Creating Group Photo Arranging and taking group photo 180 min Task #69
Week 7
Task Description Duration Type Issue
Research React for Starting Implementation Exploring React basics 180 min Task #100
Preparing Myself for Implementing the Web App Part Learning web app requirements 240 min Task #100
Group Meeting Weekly team meeting 60 min Meeting Meeting 10
Implementing the Basics of Web Part Initial coding of frontend basics 300 min Task Commit
Week 8

Ramadan Feast Holiday — no scheduled activities.

Week 9
Task Description Duration Type Issue
Group Meeting Weekly sync meeting 60 min Meeting Meeting 11
Working on the Design of Web Part Designing frontend UI 180 min Task #128
Week 10
Task Description Duration Type Issue
Group Meeting Weekly sync meeting 60 min Meeting Meeting 12
Web Group Meeting Frontend-focused meeting 60 min Meeting Web Meeting #1
Note Taking in Meeting Documenting meeting notes 60 min Task #114
Preparing Notes Section in Wiki Adding notes to wiki 40 min Task #114
Review the theme Review the web frontends new theme 40 min Review #117
Adding Functionality to Goals Page Implementing goals page features 180 min Task #134
Goal Functionality System Construction Implementing goals page's functionality 180 min PR TASK #PR136
Week 11
Task Description Duration Type Issue
Reviewing Web Frontend Reviewing frontend code 120 min Bug #128
Review Setting Design Review the implementation of settings page 60 min Review #154
Web Meeting Taking Notes Note-taking for web meeting 60 min Meeting #156
Web Meeting Notes Adding to Wiki Publishing meeting notes to wiki 60 min Task #156
Web Group Meeting 2 Continued frontend meeting 60 min Meeting Web Meeting #2
Group Meeting 13 Weekly sync meeting 60 min Meeting Meeting 13
Goal Page Added new Features Implementing goals page's new features 120 min PR TASK #PR174
Week 12
Task Description Duration Type Issue
Group Meeting Weekly sync meeting 60 min Meeting Meeting 14
Debugging Issues in Frontend Web About Migrations Fixing migration bugs in frontend 120 min Bug #208
Updating Weekly Effort Table Updating the table for accuracy 120 min Wiki #209
Adding Challenges Page to Web Developing challenges page 120 min Task #213
Goal & Challenge Features Enhancement Goal & Challenge page bug fix & enhancement 150 min PR BUG #PR242
Review the profile page As a reviewer I tested profile page 50 min Review #204
Week 13
Task Description Duration Type Issue
Group Meeting Weekly sync meeting 90 min Meeting Meeting 15
Group Meeting Weekly sync meeting 90 min Meeting Meeting 16
Learn How to Write Unit Tests Studying unit testing techniques 120 min Task #219
Implement Unit Tests Writing initial unit tests 120 min Feature #219
Adding LLM API to Challenges Page Adding helper chatbot to guide users 150 min Feature #221
Review zenquotes api Reviewed the api implementation as rewiever 40 min Review #243
Research About Milestones Research on writing milestone reports 120 min Task #253
Reviewed Unit Tests Reviewed Nutritionix API's unit tests as rewiever 30 min Review #258
Rewieved Unit Tests Reviewed cck's unit tests as rewiever 30 min Review #260
Unit tests added Unit tests added to goals and challenges page 150 min PR TASK #PR267
Edge case hot fix Goal creating edge case error fixed 90 min PR BUG #PR277
Weekly Effort Table - 451

📅 Weekly Effort Table

Week 1
Task Description Duration Type of Work Issues
Group Information Revision Revised the readme file information and banner with help of Guney 2 hours Development #319
Lab 1 report Wrote the Lab 1 report during the lab hour 0.5 hours Task -
Meeting Attended the first group meeting of this semester 1 hours Task #Meeting-1:-23.09.2025
Meeting Got acquainted with the newcomers to our team 0.25 hours Task -
⚠️ **GitHub.com Fallback** ⚠️