A Python script that analyzes Logseq files to gather and organize hashtags, providing insights into your note-taking habits and helping you discover new connections between ideas.
This project has only been tested on Python 3.11 and Python 3.12.
You can get Python 3.11 or Python 3.12 from python.org or from the Microsoft store (easier setup).
-
Create a virtual environment and activate it
You can create a virtual environment with
python3 -m venv .venv
Activate the virtual environment with:
- On Windows:
.venv\Scripts\activate
(to activate the virtual environment) - On linux & macOS:
source .venv/bin/activate
- On Windows:
-
Install the required packages
Run:
pip install -r requirements.txt
Before you can run the scripts, you'll need to set some environment variables.
You can rename the included example-env
to .env
and set all the variables there.
The scaper is going to need your Logseq graph. You can configure this by setting LOGSEQ_BASE_PATH
in the .env
LOGSEQ_BASE_PATH = "/home/stafd/Documents/git/logseq"
Important
The Neo4j database is currently not supported for the webui. If you want to use the webui for visualization, you need to use SQLite.
There are currently 2 database types available:
- SQLite
- Neo4j
You can select the database type by setting the DB_TYPE
environment variable to either sqlite
or neo4j
.
this is also later explained in the Database Configuration
section.
-
Install Neo4j: If you haven't already installed Neo4j, download it from Neo4j's official website and follow the installation instructions for your operating system.
-
Configure Environment Variables: Ensure that the
.env
file in your project root directory is correctly configured for Neo4j. The relevant entries should look like this:DB_TYPE=neo4j NEO4J_URL=neo4j://localhost:7687 NEO4J_USERNAME=neo4j NEO4J_PASSWORD=changeme
SQLite is already set up as a default option if you don't specify otherwise. SQLite will work and be used out of the box.
-
Configure Environment Variables: Ensure that the
.env
file in your project root directory is correctly configured for SQLite. The relevant entries should look like this:DB_TYPE=sqlite SQLALCHEMY_URL = sqlite:///database.sqlite
Before running any of the scripts, make sure you have all dependencies installed and your database is properly configured and the Virtual Environment activated.
Important
Without running the scraper first, the database will be empty and thus no data will be shown on the webui.
What does the scraper do? It reads a Logseq library and extracts all hashtags. Then it saves them into the chosen database type.
To run the scraper, use the following command: python scraper.py
To run the webui, use the following command: python webui.py
The webui will not open automatically, instead it will print out a URL in the terminal. You can then open this URL in your browser to access the webui.
You can view the current progress and to do list in progress.md
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate. (I wrote no tests :(, but you should! :D)
Don't know what to contribure, search for TODO:
in the code!