This project connects to Notion using Notion API, retrieves entries from the database defined in .env
, performs sentiment (happiness) analysis for each entry, and creates a diagram of sentiment over time, using NOTION_DATE_FIELD
field.
Before running the project, you need to install the required Python libraries. You can do this by running the following command:
pip install -r requirements.txt
- Create a new integration in your Notion account.
- Give your integration a name and select the workspace you want to use it in.
- Once your integration is created, you will be given a
secret
value. This is yourNOTION_TOKEN
. - Copy this value to
NOTION_TOKEN
environment variable in.env
file.
- Open the database in Notion and click the "Share" button in the top-right corner.
- In the "Invite people" dialog that appears, click the "Copy link" button to copy the URL to your clipboard.
- Paste the URL into your web browser and navigate to the database.
- The
NOTION_DATABASE_ID
is the string of characters that appears in the URL afterhttps://www.notion.so/
- Add
REDIS_*
ENVs for caching.
- If you're using "gpt4" analyzer type, add
OPENAI_API_KEY
to .env
file.
By default, Docker runs the analyzer with NLTK model. To change that, update docker-compose.yml
file.
docker-compose up
python analyzer.py
python analyzer.py -m gpt4
The resulting heatmap is in output/
folder.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.