From a87a4b095b9731b1b2ea15a4d63fa7e7f5b46d6e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 07:43:28 +0000 Subject: [PATCH 1/2] Initial plan From bda231c3bc9e83c611fe7d151b90ea455595214d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 25 Feb 2026 07:46:50 +0000 Subject: [PATCH 2/2] Add domain support to scans API and orchestrator with default 'influenza' Co-authored-by: dhvanithakkar <113112823+dhvanithakkar@users.noreply.github.com> --- DuckiePop/src/server.js | 55 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/DuckiePop/src/server.js b/DuckiePop/src/server.js index 80763c3..e887b00 100644 --- a/DuckiePop/src/server.js +++ b/DuckiePop/src/server.js @@ -5,16 +5,57 @@ import { createServer } from "http"; import { Server } from "socket.io"; const app = express(); +app.use(express.json()); + const server = createServer(app); const io = new Server(server, { cors: { origin: "*" } }); +const DEFAULT_DOMAIN = "influenza"; + +const domains = { + influenza: [ + "influenza", "virus", "vaccine", "outbreak", "pandemic", "epidemic", + "symptoms", "fever", "cough", "transmission", "antiviral", "immunity", + "respiratory", "infection", "diagnosis", "treatment", "strain", "mutation", + "hemagglutinin", "neuraminidase", "h1n1", "h3n2", "swine", "avian", + "seasonal", "tamiflu", "oseltamivir", "zanamivir", "prophylaxis", + "surveillance", "quarantine", "isolation", "incubation" + ], + javascript: [ + "javascript", "react", "html", "css", "api", "framework", "frontend", + "backend", "typescript", "node", "express", "dom", "webpack", "babel", + "redux", "hooks", "component", "routing", "authentication", "database", + "rest", "graphql", "fetch", "axios", "promise", "async", "await", + "callback", "middleware", "session", "cookie", "deployment", "docker" + ], + machinelearning: [ + "algorithm", "dataset", "model", "tensor", "neuron", "gradient", + "backpropagation", "classification", "regression", "overfitting", + "validation", "hyperparameter", "feature", "vector", "bias", "activation", + "epoch", "parameter", "ensemble", "regularization", "kernel", "clustering", + "precision", "recall", "accuracy", "transformer", "embedding", "network", + "pipeline", "optimization", "inference", "dropout", "convolutional" + ] +}; + +// GET /api/scans - returns words for the specified domain (default: influenza) +app.get("/api/scans", (req, res) => { + const domain = (req.query.domain || DEFAULT_DOMAIN).toLowerCase(); + const words = domains[domain]; + if (!words) { + return res.status(404).json({ error: `Domain '${domain}' not found.`, availableDomains: Object.keys(domains) }); + } + res.json({ domain, words }); +}); + const games = {}; // Stores active games io.on("connection", (socket) => { console.log(`✅ User connected: ${socket.id}`); - socket.on("submit-number", ({ number, name }) => { - console.log(`🔹 Player ${name} submitted number: ${number}`); + socket.on("submit-number", ({ number, name, domain }) => { + const gameDomain = (domain || DEFAULT_DOMAIN).toLowerCase(); + console.log(`🔹 Player ${name} submitted number: ${number} | domain: ${gameDomain}`); let matchFound = null; for (const [gameId, game] of Object.entries(games)) { @@ -25,18 +66,20 @@ io.on("connection", (socket) => { } } + const domainWords = domains[gameDomain] || domains[DEFAULT_DOMAIN]; + if (matchFound) { const game = games[matchFound]; const [player1, player2] = game.players; console.log(`✅ Match found: ${player1.name} vs ${player2.name} | gameId: ${matchFound}`); - io.to(player1.id).emit("start-game", { opponentName: player2.name, gameId: matchFound }); - io.to(player2.id).emit("start-game", { opponentName: player1.name, gameId: matchFound }); + io.to(player1.id).emit("start-game", { opponentName: player2.name, gameId: matchFound, domain: game.domain, domainWords: game.domainWords }); + io.to(player2.id).emit("start-game", { opponentName: player1.name, gameId: matchFound, domain: game.domain, domainWords: game.domainWords }); } else { const gameId = Math.floor(Math.random() * 1000000); - games[gameId] = { players: [{ id: socket.id, name }], number, words: {} }; - console.log(`🕒 Player ${name} is waiting for a match on number ${number}`); + games[gameId] = { players: [{ id: socket.id, name }], number, words: {}, domain: gameDomain, domainWords }; + console.log(`🕒 Player ${name} is waiting for a match on number ${number} | domain: ${gameDomain}`); } });