[![Build Status](https://github.com/Nikolay-Lysenko/readingbricks/actions/workflows/main.yml/badge.svg)](https://github.com/Nikolay-Lysenko/readingbricks/actions/workflows/main.yml)
[![codecov](https://codecov.io/gh/Nikolay-Lysenko/readingbricks/branch/master/graph/badge.svg)](https://codecov.io/gh/Nikolay-Lysenko/readingbricks)
[![Maintainability](https://api.codeclimate.com/v1/badges/ac3959677909d81cb271/maintainability)](https://codeclimate.com/github/Nikolay-Lysenko/readingbricks/maintainability)
[![PyPI version](https://badge.fury.io/py/readingbricks.svg)](https://pypi.org/project/readingbricks/)
# ReadingBricks
## Overview
It is a Flask app for reading and searching notes from a personal knowledge base. Here, knowledge base means a collection of Jupyter notebooks with Markdown cells which may have tags and may contain links to each other. So, the approach resembles [Zettelkasten](https://en.wikipedia.org/wiki/Zettelkasten).
Features of the search system include:
- [x] Separate spaces for fields of knowledge
- [x] Search by single tag
- [x] Search by expressions consisting of tags, logical operators, and parentheses
- [x] Full-text search with TF-IDF
- [ ] Search within kNN-index built on vector representations of notes
The repository can be used either as a whole (with notes written by me) or as a Python package providing an interface to your notes.
## Usage as existing knowledge base
The most valuable part of this project is not a software. It is the [notes](https://github.com/Nikolay-Lysenko/readingbricks/tree/master/notes) themselves. When writing them, I try to explain complicated things in a way that allows efficient grasping with as little ambiguity as possible. I write mostly on machine learning, but new topics are coming. Alas, there is a potential dealbreaker — as of now, the notes are in Russian only. If it does not suit you, please go to the [next section](#usage-as-an-interface).
To start with, you need to clone the repository to your local machine and install `readingbricks` package. This can be done by running the below commands from a terminal:
```bash
cd /your/path/
git clone https://github.com/Nikolay-Lysenko/readingbricks
cd readingbricks
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
pip install -e .
```
Every time you want to start a Flask application, run these commands:
```bash
cd /your/path/readingbricks
source venv/bin/activate
python -m readingbricks
```
The last command launches a local server. After it is ready, open your web browser and go to `127.0.0.1:5000`. See [interface guide](#interface-guide) for further details.
## Usage as an interface
To make your own knowledge base compatible with the app, it must be represented as follows:
```
notes_directory
├── field_one
│ ├── notebook_one.ipynb
│ ├── ...
│ └── notebook_n.ipynb
├── ...
└── field_k
├── notebook_one.ipynb
├── ...
└── notebook_m.ipynb
```
Here, fields stand for independent domains (say, machine learning, chemistry, music theory, etc.). Within a particular field, distribution of notes among Jupyter notebooks can be arbitrary. For example, you may simply keep all notes in a single notebook.
All cells of a notebook must be Markdown cells starting with `## {title}`. To tag a note, activate tagging facilities with 'View -> Cell Toolbar -> Tags'. To add link from one note to an other note, special patterns `__root_url__/{field}/notes/{note_title}` and `__home_url__/notes/{note_title}` can be used. While the latter is less verbose, only the former supports cross-field links.
So far so good. The knowledge base is ready, but the app must be configured to use it. Create a JSON file somewhere that looks like this:
```json
{
"LANGUAGE": "en",
"FIELDS": ["field_one", "field_two"],
"FIELD_TO_ALIAS": {"field_one": "Field #1", "field_two": "Field #2"},
"FIELD_TO_SEARCH_PROMPT": {"field_one": "the_most_popular_tag", "field_two": "the_most_popular_tag"},
"NOTES_DIR": "/absolute/path/to/notes_directory",
"RESOURCES_DIR": "/any/directory/for/storing/internal/files"
}
```
Now, let us install the Python package:
```bash
source /your/path/venv/bin/activate
pip install readingbricks
```
All that remains is to launch the app:
```bash
python -m readingbricks -c /absolute/path/to/config.json
```
As in the previous section, go to `127.0.0.1:5000`.
## Interface guide
The web interface is quite self-explanatory.
The only non-trivial control element is search bar which is located on home pages of fields. It can operate in three modes:
* query in natural language (e.g., `transformers in recommender systems`);
* query as expression consisting of tags, logical operators, and parentheses — special keyword `tags:` is required (e.g. `tags: transformers AND recommender_systems`);
* combination of above options — symbols before `tags:` form natural language query and symbols after it form tag expression (e.g., `transformers tags: recommender_systems`).
If at least part of a query is in natural language, results are sorted by TF-IDF. Else, order of results depends on lexicographic positions of their notebooks inside their field directory and on positions of cells inside notebooks.
Enjoy reading!
Raw data
{
"_id": null,
"home_page": null,
"name": "readingbricks",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "knowledge_base, lecture_notes, search_engine, tf_idf, zettelkasten",
"author": null,
"author_email": "Nikolay Lysenko <nikolay-lysenco@yandex.ru>",
"download_url": "https://files.pythonhosted.org/packages/a2/35/f00e55fde2c7ad51935b14be5c128ce46dcd9837833a6ffae8353431b422/readingbricks-0.2.1.tar.gz",
"platform": null,
"description": "[![Build Status](https://github.com/Nikolay-Lysenko/readingbricks/actions/workflows/main.yml/badge.svg)](https://github.com/Nikolay-Lysenko/readingbricks/actions/workflows/main.yml)\n[![codecov](https://codecov.io/gh/Nikolay-Lysenko/readingbricks/branch/master/graph/badge.svg)](https://codecov.io/gh/Nikolay-Lysenko/readingbricks)\n[![Maintainability](https://api.codeclimate.com/v1/badges/ac3959677909d81cb271/maintainability)](https://codeclimate.com/github/Nikolay-Lysenko/readingbricks/maintainability)\n[![PyPI version](https://badge.fury.io/py/readingbricks.svg)](https://pypi.org/project/readingbricks/)\n\n# ReadingBricks\n\n## Overview\n\nIt is a Flask app for reading and searching notes from a personal knowledge base. Here, knowledge base means a collection of Jupyter notebooks with Markdown cells which may have tags and may contain links to each other. So, the approach resembles [Zettelkasten](https://en.wikipedia.org/wiki/Zettelkasten).\n\nFeatures of the search system include:\n- [x] Separate spaces for fields of knowledge\n- [x] Search by single tag\n- [x] Search by expressions consisting of tags, logical operators, and parentheses\n- [x] Full-text search with TF-IDF\n- [ ] Search within kNN-index built on vector representations of notes\n\nThe repository can be used either as a whole (with notes written by me) or as a Python package providing an interface to your notes.\n\n## Usage as existing knowledge base\n\nThe most valuable part of this project is not a software. It is the [notes](https://github.com/Nikolay-Lysenko/readingbricks/tree/master/notes) themselves. When writing them, I try to explain complicated things in a way that allows efficient grasping with as little ambiguity as possible. I write mostly on machine learning, but new topics are coming. Alas, there is a potential dealbreaker \u2014 as of now, the notes are in Russian only. If it does not suit you, please go to the [next section](#usage-as-an-interface).\n\nTo start with, you need to clone the repository to your local machine and install `readingbricks` package. This can be done by running the below commands from a terminal:\n```bash\ncd /your/path/\ngit clone https://github.com/Nikolay-Lysenko/readingbricks\ncd readingbricks\npython -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\npip install -e .\n```\n\nEvery time you want to start a Flask application, run these commands:\n```bash\ncd /your/path/readingbricks\nsource venv/bin/activate\npython -m readingbricks\n```\n\nThe last command launches a local server. After it is ready, open your web browser and go to `127.0.0.1:5000`. See [interface guide](#interface-guide) for further details.\n\n## Usage as an interface\n\nTo make your own knowledge base compatible with the app, it must be represented as follows:\n```\nnotes_directory\n\u251c\u2500\u2500 field_one\n\u2502 \u251c\u2500\u2500 notebook_one.ipynb\n\u2502 \u251c\u2500\u2500 ...\n\u2502 \u2514\u2500\u2500 notebook_n.ipynb\n\u251c\u2500\u2500 ...\n\u2514\u2500\u2500 field_k\n \u251c\u2500\u2500 notebook_one.ipynb\n \u251c\u2500\u2500 ...\n \u2514\u2500\u2500 notebook_m.ipynb\n```\nHere, fields stand for independent domains (say, machine learning, chemistry, music theory, etc.). Within a particular field, distribution of notes among Jupyter notebooks can be arbitrary. For example, you may simply keep all notes in a single notebook.\n\nAll cells of a notebook must be Markdown cells starting with `## {title}`. To tag a note, activate tagging facilities with 'View -> Cell Toolbar -> Tags'. To add link from one note to an other note, special patterns `__root_url__/{field}/notes/{note_title}` and `__home_url__/notes/{note_title}` can be used. While the latter is less verbose, only the former supports cross-field links.\n\nSo far so good. The knowledge base is ready, but the app must be configured to use it. Create a JSON file somewhere that looks like this:\n```json\n{\n \"LANGUAGE\": \"en\",\n \"FIELDS\": [\"field_one\", \"field_two\"],\n \"FIELD_TO_ALIAS\": {\"field_one\": \"Field #1\", \"field_two\": \"Field #2\"},\n \"FIELD_TO_SEARCH_PROMPT\": {\"field_one\": \"the_most_popular_tag\", \"field_two\": \"the_most_popular_tag\"},\n \"NOTES_DIR\": \"/absolute/path/to/notes_directory\",\n \"RESOURCES_DIR\": \"/any/directory/for/storing/internal/files\"\n}\n```\n\nNow, let us install the Python package:\n```bash\nsource /your/path/venv/bin/activate\npip install readingbricks\n```\n\nAll that remains is to launch the app:\n```bash\npython -m readingbricks -c /absolute/path/to/config.json\n```\n\nAs in the previous section, go to `127.0.0.1:5000`.\n\n## Interface guide\n\nThe web interface is quite self-explanatory.\n\nThe only non-trivial control element is search bar which is located on home pages of fields. It can operate in three modes:\n* query in natural language (e.g., `transformers in recommender systems`);\n* query as expression consisting of tags, logical operators, and parentheses \u2014 special keyword `tags:` is required (e.g. `tags: transformers AND recommender_systems`);\n* combination of above options \u2014 symbols before `tags:` form natural language query and symbols after it form tag expression (e.g., `transformers tags: recommender_systems`).\n\nIf at least part of a query is in natural language, results are sorted by TF-IDF. Else, order of results depends on lexicographic positions of their notebooks inside their field directory and on positions of cells inside notebooks.\n\nEnjoy reading!\n",
"bugtrack_url": null,
"license": null,
"summary": "Flask app for reading and searching notes from a personal knowledge base",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/Nikolay-Lysenko/readingbricks"
},
"split_keywords": [
"knowledge_base",
" lecture_notes",
" search_engine",
" tf_idf",
" zettelkasten"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7449d5e587b5a1f4415fef74fc8d809b09ec333f24ff40bd143e8b36d37d0da6",
"md5": "6aceedcafb075e09c0fbdbe819c3d0d9",
"sha256": "d6b286743934933f3e210f8937c11cd3e12bd35db37f2be65025d8a128b8234c"
},
"downloads": -1,
"filename": "readingbricks-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6aceedcafb075e09c0fbdbe819c3d0d9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 28572,
"upload_time": "2024-07-06T11:02:36",
"upload_time_iso_8601": "2024-07-06T11:02:36.392485Z",
"url": "https://files.pythonhosted.org/packages/74/49/d5e587b5a1f4415fef74fc8d809b09ec333f24ff40bd143e8b36d37d0da6/readingbricks-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a235f00e55fde2c7ad51935b14be5c128ce46dcd9837833a6ffae8353431b422",
"md5": "986a73c71ceb06b99df2f1b937210002",
"sha256": "cc1a5c2f8843f38678e0ed6dd20d088d3750e09951ede29f15f7ce76332d4bc0"
},
"downloads": -1,
"filename": "readingbricks-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "986a73c71ceb06b99df2f1b937210002",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 28701,
"upload_time": "2024-07-06T11:02:39",
"upload_time_iso_8601": "2024-07-06T11:02:39.075819Z",
"url": "https://files.pythonhosted.org/packages/a2/35/f00e55fde2c7ad51935b14be5c128ce46dcd9837833a6ffae8353431b422/readingbricks-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-07-06 11:02:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Nikolay-Lysenko",
"github_project": "readingbricks",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"tox": true,
"lcname": "readingbricks"
}