Spaces:
Sleeping

edi.chat.test / backend /src /controllers /ugaController.js
Claude Code Bot
Claude
Deploy edi.chat UGA AI Assistant to Hugging Face Spaces
0b355ec
Raw History Blame Contribute Delete
17.4 kB
const { validationResult } = require('express-validator');
const knowledgeBaseService = require('../services/knowledgeBaseService');
const ugaService = require('../services/ugaService');
const logger = require('../utils/logger');
class UGAController {
async searchKnowledge(req, res) {
try {
const errors = validationResult(req);
if (!errors.isEmpty()) {
return res.status(400).json({
success: false,
errors: errors.array()
});
}
const { q: query, category = 'all' } = req.query;
const results = await knowledgeBaseService.queryKnowledgeBase(query, category);
res.json({
success: true,
data: {
query,
category,
results,
count: results.length
}
});
} catch (error) {
logger.error('Knowledge search error:', error);
res.status(500).json({
success: false,
error: 'Failed to search knowledge base'
});
}
}
async getCampusBuildings(req, res) {
try {
const buildings = {
academic: [
{ name: 'Miller Learning Center', purpose: '24/7 study space, computer labs', location: 'North Campus' },
{ name: 'Main Library', purpose: 'Primary library, archives', location: 'North Campus' },
{ name: 'Science Library', purpose: 'Science resources, group study', location: 'South Campus' },
{ name: 'Correll Hall', purpose: 'Terry College of Business', location: 'South Campus' },
{ name: 'Grady College', purpose: 'Journalism and Mass Communication', location: 'North Campus' },
{ name: 'Driftmier Engineering Center', purpose: 'Engineering programs', location: 'South Campus' }
],
administrative: [
{ name: 'Administration Building', purpose: 'University administration', location: 'North Campus' },
{ name: 'Terrell Hall', purpose: 'Financial Aid Office', location: 'North Campus' },
{ name: 'Lustrat House', purpose: 'Student Accounts', location: 'North Campus' }
],
student: [
{ name: 'Tate Student Center', purpose: 'Dining, bookstore, organizations', location: 'North Campus' },
{ name: 'Ramsey Student Center', purpose: 'Recreation and fitness', location: 'South Campus' },
{ name: 'University Health Center', purpose: 'Student health services', location: 'East Campus' }
],
athletics: [
{ name: 'Sanford Stadium', purpose: 'Football stadium', capacity: '92,746' },
{ name: 'Stegeman Coliseum', purpose: 'Basketball arena', capacity: '10,523' },
{ name: 'Foley Field', purpose: 'Baseball stadium', capacity: '3,291' }
]
};
res.json({
success: true,
data: buildings
});
} catch (error) {
logger.error('Get campus buildings error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch campus buildings'
});
}
}
async getDiningOptions(req, res) {
try {
const dining = {
diningHalls: [
{ name: 'The Niche', location: 'Memorial Hall', type: 'All-you-can-eat', hours: '7 AM - 11 PM' },
{ name: 'ECV Dining Commons', location: 'East Campus Village', type: 'All-you-can-eat', hours: '7 AM - 10 PM' },
{ name: 'Village Summit Food Court', location: 'Village Summit', type: 'Food court', hours: '7 AM - 12 AM' },
{ name: 'O-House Dining', location: 'Oglethorpe House', type: 'All-you-can-eat', hours: '7 AM - 10 PM' }
],
cafes: [
{ name: 'Bulldog Cafe', location: 'Miller Learning Center', specialty: 'Coffee, light meals' },
{ name: 'Starbucks', location: 'Tate Student Center', specialty: 'Coffee, pastries' },
{ name: 'Einstein Bros', location: 'Various locations', specialty: 'Bagels, coffee' }
],
restaurants: [
{ name: 'Chick-fil-A', location: 'Tate Student Center', type: 'Fast food' },
{ name: 'Panda Express', location: 'Tate Student Center', type: 'Asian fast food' },
{ name: 'Subway', location: 'Multiple locations', type: 'Sandwiches' }
]
};
res.json({
success: true,
data: dining
});
} catch (error) {
logger.error('Get dining options error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch dining options'
});
}
}
async getRecreationFacilities(req, res) {
try {
const recreation = {
ramseyCenter: {
name: 'Ramsey Student Center',
facilities: [
'Fitness equipment and free weights',
'25-yard swimming pool',
'Basketball and volleyball courts',
'Racquetball courts',
'Rock climbing wall',
'Group fitness studios',
'Outdoor recreation equipment rental'
],
hours: 'M-F: 5:30 AM - 12:00 AM, Weekends vary',
programs: ['Group fitness classes', 'Intramural sports', 'Personal training', 'Outdoor trips']
},
outdoorFacilities: [
{ name: 'Intramural Fields', activities: ['Flag football', 'Soccer', 'Ultimate frisbee'] },
{ name: 'Tennis Courts', location: 'Various campus locations', courts: '20+ courts' },
{ name: 'Golf Course', name: 'University of Georgia Golf Course', type: '18-hole championship course' }
],
programs: {
intramural: ['Flag football', 'Basketball', 'Soccer', 'Softball', 'Tennis', 'Swimming'],
clubSports: ['Rugby', 'Lacrosse', 'Cycling', 'Martial arts', 'Rock climbing'],
outdoorRecreation: ['Hiking', 'Camping', 'Kayaking', 'Rock climbing', 'Skiing trips']
}
};
res.json({
success: true,
data: recreation
});
} catch (error) {
logger.error('Get recreation facilities error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch recreation facilities'
});
}
}
async getAthensNeighborhoods(req, res) {
try {
const neighborhoods = {
downtown: {
description: 'Historic downtown with shops, restaurants, nightlife',
highlights: ['Georgia Theatre', 'Classic Center', 'Walking distance to campus'],
housing: 'Limited, mostly lofts and apartments',
character: 'Urban, bustling, historic'
},
fivePoints: {
description: 'Popular student area with bars and restaurants',
highlights: ['The World Famous', 'Copper Creek', 'Late night food'],
housing: 'Student apartments and houses',
character: 'College party scene, very walkable'
},
normaltown: {
description: 'Hip neighborhood east of downtown',
highlights: ['40 Watt Club', 'Local shops', 'The Grit restaurant'],
housing: 'Mix of apartments and houses',
character: 'Artsy, local music scene'
},
boulevard: {
description: 'Close to campus, mix of student and family housing',
highlights: ['Easy campus access', 'Quieter than Five Points'],
housing: 'Student apartments and rental houses',
character: 'Residential, convenient'
},
westside: {
description: 'Growing area with shopping and dining',
highlights: ['Atlanta Highway shopping', 'Chain restaurants'],
housing: 'New apartment complexes',
character: 'Suburban feel, car-dependent'
}
};
res.json({
success: true,
data: neighborhoods
});
} catch (error) {
logger.error('Get Athens neighborhoods error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch Athens neighborhoods'
});
}
}
async getStudentOrganizations(req, res) {
try {
const organizations = {
categories: {
academic: {
description: 'Professional organizations related to majors',
examples: ['Accounting Club', 'Engineering Student Council', 'Pre-Med Society', 'Journalism Club']
},
cultural: {
description: 'Organizations celebrating different cultures',
examples: ['International Student Life', 'Black Student Union', 'Hispanic Student Association', 'Asian Student Association']
},
religious: {
description: 'Faith-based organizations and ministries',
examples: ['Baptist Student Union', 'Catholic Student Association', 'Hillel', 'Muslim Student Association']
},
service: {
description: 'Community service and volunteer organizations',
examples: ['Habitat for Humanity', 'Circle K', 'Alpha Phi Omega', 'Relay for Life']
},
special: {
description: 'Special interest and hobby groups',
examples: ['Outdoor Recreation', 'Gaming Club', 'Chess Club', 'Photography Club']
},
greek: {
description: 'Fraternity and sorority life',
stats: {
participation: '25% of students',
chapters: '70+ chapters',
types: ['IFC', 'Panhellenic', 'NPHC', 'Multicultural']
}
}
},
totalOrganizations: '600+',
howToJoin: 'Involvement fair, organization websites, campus events',
benefits: ['Leadership opportunities', 'Social connections', 'Resume building', 'Community service']
};
res.json({
success: true,
data: organizations
});
} catch (error) {
logger.error('Get student organizations error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch student organizations'
});
}
}
async getUGATraditions(req, res) {
try {
const traditions = {
academic: [
{
name: 'The Arch',
description: 'Students traditionally don\'t walk under the Arch until graduation',
significance: 'Symbol of academic journey'
},
{
name: 'Ring Ceremony',
description: 'Junior year tradition celebrating academic progress',
when: 'Spring semester of junior year'
},
{
name: 'Dawg Days',
description: 'Orientation for new students',
when: 'Before fall semester'
}
],
athletic: [
{
name: 'Calling the Dawgs',
description: 'Crowd chant: "Goooooo Dawgs! Sic \'em! Woof woof woof!"',
when: 'At all athletic events'
},
{
name: 'The Dawg Walk',
description: 'Team walks through campus before home football games',
when: '2 hours before kickoff'
},
{
name: 'Between the Hedges',
description: 'Sanford Stadium\'s famous privet hedges',
significance: 'Unique stadium feature since 1929'
},
{
name: 'Ringing the Chapel Bell',
description: 'Bell rings after football victories',
tradition: 'Students gather to celebrate wins'
}
],
social: [
{
name: 'SpringFest',
description: 'Annual spring concert and festival',
when: 'Spring semester'
},
{
name: 'Homecoming',
description: 'Week of events celebrating UGA',
activities: ['Parade', 'Alumni events', 'Football game']
},
{
name: 'Wild Rumpus',
description: 'Halloween parade in downtown Athens',
participation: 'Students and community'
}
]
};
res.json({
success: true,
data: traditions
});
} catch (error) {
logger.error('Get UGA traditions error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch UGA traditions'
});
}
}
async getEmergencyInfo(req, res) {
try {
const emergency = {
emergencyNumbers: {
campusPolice: '706-542-2200',
ugaEmergency: '911 or 706-542-2200',
healthCenter: '706-542-1162',
counselingServices: '706-542-2273',
afterHoursCrisis: '706-542-2273'
},
procedures: {
medical: 'Call 911 for medical emergencies, University Health Center for non-emergency health issues',
safety: 'Use blue light emergency phones, escort services available',
weather: 'Follow UGA alerts, seek shelter in designated areas',
campusClosure: 'University will announce closures via UGA Alert system'
},
resources: {
ugaAlert: 'Emergency notification system via text/email',
escortService: 'Safe rides and walks available 24/7',
bluePhones: 'Emergency phones throughout campus',
safetyApp: 'UGA Safe mobile app for emergencies'
}
};
res.json({
success: true,
data: emergency
});
} catch (error) {
logger.error('Get emergency info error:', error);
res.status(500).json({
success: false,
error: 'Failed to fetch emergency information'
});
}
}
// Additional controller methods would be implemented here
async getLibraries(req, res) {
try {
res.json({ success: true, message: 'Libraries endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getParkingInfo(req, res) {
try {
res.json({ success: true, message: 'Parking info endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getAthensRestaurants(req, res) {
try {
res.json({ success: true, message: 'Athens restaurants endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getAthensTransportation(req, res) {
try {
res.json({ success: true, message: 'Athens transportation endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getAthensEntertainment(req, res) {
try {
res.json({ success: true, message: 'Athens entertainment endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getColleges(req, res) {
try {
res.json({ success: true, message: 'Colleges endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getAcademicCalendar(req, res) {
try {
res.json({ success: true, message: 'Academic calendar endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getGraduationRequirements(req, res) {
try {
res.json({ success: true, message: 'Graduation requirements endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getGreekLife(req, res) {
try {
res.json({ success: true, message: 'Greek life endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getAthleticsSchedule(req, res) {
try {
res.json({ success: true, message: 'Athletics schedule endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getAthleticsFacilities(req, res) {
try {
res.json({ success: true, message: 'Athletics facilities endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getAthleticsTraditions(req, res) {
try {
res.json({ success: true, message: 'Athletics traditions endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getSafetyContacts(req, res) {
try {
res.json({ success: true, message: 'Safety contacts endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getCampusEvents(req, res) {
try {
res.json({ success: true, message: 'Campus events endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
async getAthensEvents(req, res) {
try {
res.json({ success: true, message: 'Athens events endpoint - to be implemented' });
} catch (error) {
res.status(500).json({ success: false, error: 'Method not implemented' });
}
}
}
module.exports = new UGAController();