This repository contains the source code for the Pre-Visualisation stages of the STAY project.
- uv installed
Install uv with pip:
pip install uvFor more installation options go to uv installation
- Clone the repository :
git clone https://github.com/ITSAIDI/STAY_DEV
cd STAY_DEV- Create virtual environment with
uv:
uv venv --python 3.10.16- We set the python version already used.
- The venv is activated by default.
- Install dependencies:
uv sync--> You can start now work with any file.
- You need first to generate a Youtube_API_KEY
- Create a
.envfile on the root of the cloned repository and add your key there as YOUTUBE_API_KEY - Go to the
main.ipynbin collecting folder and run the cells, aqueries.jsonfile is already there.
- We used the free version of gemini-flash for the filtering, then you need first to generate a GEMINI_API_KEY
- Add the generated key as envirement variable.
- Go to the
main.ipynbin filtering/videos folder, there are three levels of filtreing each one generates a json file with result of the applied filters. The Refinements step is necessary to prepare data for filtering.
Output : videosF3.json file with all relevant videos.
Filtering process for channels is in a main.ipynb at filtering/channels folder.
Output : channelsF3.json file for relevant channels and channelsF3Non.json for irrelevant ones.
To update the Posgres Database with new relevant videos and channels you need to :
- First to set your POSTGRE_PASSWORD as envirement variable, then you need the outputs of the filtering step.
- Go to the
main.ipynbin DataBase folder and folllow the steps.
For updating only the metrics of existing videos and channels you have to :
- Open the project folder in your Code Editor (VSCode for example).
- Ensure that you virtual envirement is activated.
- Open a new powershell, get into the Database folder and run the python script updateMetrics.py like this :
uv run updateMetrics.py YOUR_POSTGRE_PASSWORD YOUR_YOUTUBE_API_KEYThe script will connect to your database then call two python functions one for channels metrics and the other for videos metrics.
The server contain already the updateMetrics.py, after connecting to the server you :
- Activate the virtual envirement
source venv/bin/activate- Execute the following command :
python3 run updateMetrics.py YOUR_POSTGRE_PASSWORD YOUR_YOUTUBE_API_KEY