Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/python:1-3.12-bullseye",
"image": "mcr.microsoft.com/devcontainers/python:3.13-bookworm",
"features": {
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/va-h/devcontainers-features/uv:1": {
Expand Down
40 changes: 16 additions & 24 deletions medcat-v2-tutorials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,27 @@

The MedCAT Tutorials provide an interactive learning path for using MedCAT.

NOTE: These tutorials are aimed at developers and / or people creating their own models.
For every day usage (e.g inference) the [medcat-scripts](../medcat-scripts) portion would probably be more useful.
See the cogstack documentation site to view these tutorials and all the documentation on [docs.cogstack.org](https://docs.cogstack.org)

## Introductory tutorials
## Developer Readme
The following readmes are around the setup of the tutorials themselves aimed at a tutorial author.

### Migration of v1 models
### Documentation Build

| Part | Title |
| ---- |-----------------------------------------------------------------------------|
| 1. | [Migrate a v1 model to v2](notebooks/introductory/migration/1._Migrate_v1_model_to_v2.ipynb) |
The `medcat-v2` documentation site imports this project’s MkDocs navigation file directly. The relevant plugins are the mkdocs-monorepo-plugin and the mkdocs-jupyter plugin.

### Basic (regex-tokenizer) tutorials
In `medcat-v2/mkdocs.yml` the `Tutorials` section is wired in via an include:

| Part | Title |
| ---- |-----------------------------------------------------------------------------|
| 1. | [Building a Concept Database and a Vocab](notebooks/introductory/basic/1._Build_a_Concept_Database_and_a_Vocabulary.ipynb) |
| 2. | [Unsupervised training on model](notebooks/introductory/basic/2._Unsupervised_training_on_model.ipynb) |
| 3. | [Supervised training on model](notebooks/introductory/basic/3._Supervised_training_on_model.ipynb) |
| 4. | [Evaluating perfromance on dataset](notebooks/introductory/basic/4._Evaluating_performance_on_dataset.ipynb) |
```yaml
nav:
- Tutorials: '!include ../medcat-v2-tutorials/mkdocs.yml'
```

### MetaCAT (meta-annotation) tutorials
#### Run the docs locally (rendered site)

| Part | Title |
| ---- |-----------------------------------------------------------------------------|
| 1. | [Add a MetaCAT to a Model](notebooks/introductory/meta/1._Add_a_MetaCat_to_a_Model.ipynb) |
To preview the rendered docs site locally:

## Advanced tutorials

| Part | Title |
| ---- |-----------------------------------------------------------------------------|
| 1. | [Creating and using a custom tokenizer](notebooks/advanced/1._Creating_and_using_a_custom_tokenizer.ipynb) |
| 2. | [Create and use component](notebooks/advanced/2._Create_and_use_component.ipynb) |
```bash
cd cogstack-nlp/medcat-v2-tutorials
uv run mkdocs serve
```
74 changes: 74 additions & 0 deletions medcat-v2-tutorials/mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# yaml-language-server: $schema=https://squidfunk.github.io/mkdocs-material/schema.json
site_name: MedCAT Tutorials
site_url: https://docs.cogstack.org/

theme:
name: material
favicon: _static/img/cat-logo.svg
logo: _static/img/cat-logo.svg
icon:
logo: _static/img/cat-logo.svg
palette:
primary: white

features:
- navigation.tabs
- navigation.sections
- navigation.top
- navigation.indexes
- navigation.tracking
- navigation.footer
- header.autohide
- content.tooltips
- search.highlight
- search.share
- search.suggest
- toc.follow
- attr_list

repo_url: https://github.com/CogStack/cogstack-nlp
repo_name: cogstack-nlp

docs_dir: notebooks

nav:
- Home: index.md
- Introductory Tutorials:
- Basic:
- README: introductory/basic/README.md
- 1. Build a Concept Database and a Vocabulary: introductory/basic/1._Build_a_Concept_Database_and_a_Vocabulary.ipynb
Comment thread
mart-r marked this conversation as resolved.
- 2. Unsupervised training on model: introductory/basic/2._Unsupervised_training_on_model.ipynb
- 3. Supervised training on model: introductory/basic/3._Supervised_training_on_model.ipynb
- 4. Evaluating performance on dataset: introductory/basic/4._Evaluating_performance_on_dataset.ipynb
- MetaCAT:
- README: introductory/meta/README.md
- 1. Add a MetaCat to a Model: introductory/meta/1._Add_a_MetaCat_to_a_Model.ipynb
- RelCAT:
- 1. Supervised Training Relation Extraction: introductory/relcat/1._Supervised_Training_Relation_Extraction.ipynb
- 2. Infering relations from annotations with Relation toolkit: introductory/relcat/2._Infering_relations_from_annotations_with_Relation_toolkit.ipynb

- Advanced Tutorials:
- 1. Creating and using a custom tokenizer: advanced/1._Creating_and_using_a_custom_tokenizer.ipynb
- 2. Create and use component: advanced/2._Create_and_use_component.ipynb
- Custom Components:
- README: introductory/custom/README.md
- 1. Create Modelpack with 2step linker: introductory/custom/1._Create_Modelpack_with_2step_linker.ipynb
- Migration:
- README: introductory/migration/README.md
- 1. Migrate v1 model to v2: introductory/migration/1._Migrate_v1_model_to_v2.ipynb

plugins:
- search
- termynal
- autorefs # Resolves cross-refs from mkdocstrings so type links work across pages
- mkdocs-jupyter:
ignore_h1_titles: True

markdown_extensions:
- admonition
- attr_list
- pymdownx.details
- pymdownx.superfences
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
32 changes: 32 additions & 0 deletions medcat-v2-tutorials/notebooks/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# MedCAT Tutorials
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just another comment that I think we need a link to the tutorials in the docs page. Otherwise someone looking at the repo will have no idea where to go from here.


The MedCAT Tutorials provide an interactive learning path for using MedCAT.

These tutorials are aimed at developers and / or people creating their own models.
For every day usage (e.g inference) the [medcat-scripts](https://github.com/CogStack/cogstack-nlp/tree/main/medcat-scripts) portion would probably be more useful.

## Learning Path

Get started by going to the [basic tutorials](introductory/basic/). Here you will learn about Concept Databases, Vocabularies, and perform supervised and unsupervised training.

After that you can continue to see the other features of medcat, such as configuring MetaCAT and RelCAT.

Finally you can look at advanced tutorials where you will dig into the internals of MedCAT.

## Interactive Usage

!!! tip

These tutorials are written as real, executable code in jupyter notebooks. The version on docs.cogstack.org is read only, but you could instead choose to follow along and run the code as you go.

To get set up to run the tutorials interactively, clone the repo and install the tutorial dependencies.

```bash
git clone https://github.com/CogStack/cogstack-nlp.git
cd cogstack-nlp/medcat-v2-tutorials

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```
You can now open the notebook in vscode and run the tutorials. Alternatively you could use `pip install jupyter` and run `jupyter lab` to do this on the command line.
20 changes: 20 additions & 0 deletions medcat-v2-tutorials/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[project]
name = "medcat-v2-documentation"
version = "0.1.0"
description = "MedCAT v2 Documentation"
requires-python = ">=3.10"
dependencies = [
"mkdocs-api-autonav>=0.4.0",
"mkdocs-material>=9.7.0",
"mkdocstrings-python>=2.0.3",
"termynal>=0.13.1",
"mkdocs-jupyter>=0.26.1",
]

[project.optional-dependencies]
dev = [
"ruff>=0.12.11",
]

[tool.ruff]
line-length = 120
Loading
Loading