SmartSearch is a platform that replicates the Canvas Discussions module with enhanced search capabilities using semantic search. It comprises three main components: analysis notebooks, a Flask backend, and a Next.js frontend.
SmartSearch enhances the Canvas Discussions module by using semantic search for better information retrieval. It allows users to interact with discussions more effectively, using semantic understanding to search through content.
The repository is organized as follows:
SmartSearch/
│
├── backend/ # Flask backend for API and data processing
│ ├── app.py # Main Flask application
│ ├── requirements.txt
│ └── ... # Other backend files and directories
│
├── not_canvas/ # Next.js frontend for UI
│ ├── pages/
│ ├── components/
│ └── ... # Other frontend files and directories
│
├── analysis/ # Jupyter notebooks for data exploration and testing
│ └── notebooks/
│
└── README.md # Documentation
Ensure you have the following installed on your system:
- Python 3.7+
- Node.js 14.x+
- npm (comes with Node.js)
- Virtual Environment (optional, but recommended)
The backend is a Flask application located in the backend/
directory. To set up and run the backend:
-
Navigate to the backend directory:
cd backend/
-
Create a virtual environment (optional):
python -m venv venv source venv/bin/activate # On Windows, use: venv\Scripts\activate
-
Install dependencies from
requirements.txt
:pip install -r requirements.txt
-
Set up environment variables:
- Create a
.env
file in thebackend/
directory with the following variables:CANVAS_API_URL=https://canvas.ubc.ca/ CANVAS_API_KEY=your_api_key_here CANVAS_COURSE_ID=161721
- Replace
your_api_key_here
with your actual Canvas API key. - Ensure
.env
is added to.gitignore
to avoid pushing it to version control.
- Create a
-
Run the Flask application:
flask run --port=5001
The backend will be accessible at http://localhost:5001.
-
Testing the Backend:
- Visit http://localhost:5001/discussions to see a list of discussions.
- Use tools like Postman or
curl
to test the endpoints:curl http://localhost:5001/discussions
The frontend is a Next.js application located in the not_canvas/
directory.
-
Navigate to the frontend directory:
cd not_canvas/
-
Install Node.js dependencies:
npm install
-
Start the Next.js application in development mode:
npm run dev
The frontend will be accessible at http://localhost:3000.
-
Testing the Frontend:
- Visit http://localhost:3000 to interact with the SmartSearch UI.
The analysis/
directory contains Jupyter notebooks for testing and prototyping semantic search models.
-
Navigate to the analysis directory:
cd analysis/
-
Install Jupyter Notebook (if not already installed):
pip install jupyter
-
Launch Jupyter Notebook:
jupyter notebook
Open and run the notebooks for analysis and testing.
- Ensure all dependencies are installed and environment variables are set up.
- Start the Flask server:
flask run --port=5001
- Ensure the backend is running.
- Start the Next.js application:
npm run dev
- Navigate to the
analysis/
directory. - Launch Jupyter Notebook:
jupyter notebook
- Open and run the desired notebook.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new branch:
git checkout -b feature-branch
- Make changes and commit:
git commit -m 'Add new feature'
- Push to your branch:
git push origin feature-branch
- Open a pull request.
This project is licensed under the MIT License.