Skip to content

Commit 5858ab0

Browse files
vladd-bitmart-r
andauthored
RelCAT tutorials v1 (CogStack/MedCATtutorials#31)
* RelCAT tutorials v1. * Updated RelCAT notebooks (incl html version). * Updated README.md * Workflow update to incl RelCAT. * Update MedCAT requirement to 1.16 * Allow nbmake>=1.4 for compatibility with pydantic 2. pydantic was dropped as a requirement in nbmake==1.4.3 * Make workflow run on ubuntu-24.04 * Bump all install targets to 1.16 * Updated RelCAT tutorial to include tutorial model links. * Allow later pandas versions * Revert "Allow later pandas versions" This reverts commit e794964. * Force usage of full path for model * Add some debug information regarding issues when loading model * Do archive unpack in pytho nrather than in a subprocess * Unpack model in part 6.2 to a distinct path * Undo debug output / exception handling * Make sure to use correct paths when downloading and unzipping * Remove unused import * Use relative paths again for downloaded model * Fix usage of undefined variable * Fix loadable model path * Add further information to exception * Specfiy unzip path explicitly --------- Co-authored-by: mart-r <[email protected]>
1 parent 29a0a12 commit 5858ab0

25 files changed

+30997
-85
lines changed

medcat-v1-tutorials/.github/workflows/main.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
jobs:
1010
main:
1111

12-
runs-on: macos-latest
12+
runs-on: ubuntu-24.04
1313
strategy:
1414
matrix:
1515
part: [
@@ -18,6 +18,7 @@ jobs:
1818
introductory/Part_4_*.ipynb,
1919
introductory/Part_5_*.ipynb,
2020
introductory/Part_1_*.ipynb,
21+
introductory/Part_6_*.ipynb,
2122
specialised/Comparing_Models_with_RegressionSuite.ipynb # this should work still
2223
# specialised/*.ipynb # To make it run, the SnomedCT file needs to be mocked
2324
]

medcat-v1-tutorials/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ In this tutorial, we will walk you through each stage of a basic MedCAT project.
1818
| 4.2 | [Supervised training and fine-tuning + Meta-annotations](https://htmlpreview.github.io/?https://github.com/CogStack/MedCATtutorials/blob/main/notebooks/introductory/Part_4_2_Supervised_Training_and_Meta_annotations.html) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/CogStack/MedCATtutorials/blob/main/notebooks/introductory/Part_4_2_Supervised_Training_and_Meta_annotations.ipynb) | - |
1919
| 4.3 | [Annotating documents with the full MedCAT pipeline with MetaAnnotations](https://htmlpreview.github.io/?https://github.com/CogStack/MedCATtutorials/blob/main/notebooks/introductory/Part_4_3_Annotating_documents_with_the_full_MedCAT_pipeline_with_MetaAnnotations.html) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/CogStack/MedCATtutorials/blob/main/notebooks/introductory/Part_4_3_Annotating_documents_with_the_full_MedCAT_pipeline_with_MetaAnnotations.ipynb) | - |
2020
| 5 | [Analysing the results](https://htmlpreview.github.io/?https://github.com/CogStack/MedCATtutorials/blob/main/notebooks/introductory/Part_5_Prevalence_of_Physical_and_Mental_Diseases.html) | [![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/CogStack/MedCATtutorials/blob/main/notebooks/introductory/Part_5_Prevalence_of_Physical_and_Mental_Diseases.ipynb) | [TDS](https://medium.com/@w_is_h/prevalence-of-physical-and-mental-diseases-450c0f4f5851) |
21-
21+
| 6.1 | [Supervised training Relation-annotations](https://htmlpreview.github.io/?https://github.com/CogStack/MedCATtutorials/blob/rel_cat_tutorials/notebooks/introductory/Part_6_1_Supervised_Training_Relation_Extraction.html) | - | - |
22+
| 6.2 | [Infering relationships from annotations](https://htmlpreview.github.io/?https://github.com/CogStack/MedCATtutorials/blob/rel_cat_tutorials/notebooks/introductory/Part_6_2_Infering_relations_from_annotations_with_Relation_toolkit.html) | - | - |
2223

2324
## Specialised tutorials
2425

medcat-v1-tutorials/notebooks/introductory/Part_1_1_OPTIONAL_Logging_With_MedCAT.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13095,7 +13095,7 @@ <h1 id="MedCAT-tutorial---logging-with-MedCAT">MedCAT tutorial - logging with Me
1309513095
<div class="inner_cell">
1309613096
<div class="input_area">
1309713097
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># Install medcat</span>
13098-
<span class="o">!</span> pip install medcat~<span class="o">=</span><span class="m">1</span>.14.0
13098+
<span class="o">!</span> pip install medcat~<span class="o">=</span><span class="m">1</span>.16.0
1309913099
<span class="k">try</span><span class="p">:</span>
1310013100
<span class="kn">from</span> <span class="nn">medcat.cat</span> <span class="kn">import</span> <span class="n">CAT</span>
1310113101
<span class="k">except</span><span class="p">:</span>

medcat-v1-tutorials/notebooks/introductory/Part_1_1_OPTIONAL_Logging_With_MedCAT.ipynb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"outputs": [],
2020
"source": [
2121
"# Install medcat\n",
22-
"! pip install medcat~=1.14.0\n",
22+
"! pip install medcat~=1.16.0\n",
2323
"try:\n",
2424
" from medcat.cat import CAT\n",
2525
"except:\n",
@@ -189,7 +189,7 @@
189189
],
190190
"metadata": {
191191
"kernelspec": {
192-
"display_name": "Python 3.9.6 ('venv': venv)",
192+
"display_name": "tvenv",
193193
"language": "python",
194194
"name": "python3"
195195
},
@@ -204,11 +204,6 @@
204204
"nbconvert_exporter": "python",
205205
"pygments_lexer": "ipython3",
206206
"version": "3.9.6"
207-
},
208-
"vscode": {
209-
"interpreter": {
210-
"hash": "0d20877e080635f7c4968c49fce8aa5e74c8d7837295e20d04554edce953f9c6"
211-
}
212207
}
213208
},
214209
"nbformat": 4,

medcat-v1-tutorials/notebooks/introductory/Part_3_1_Building_a_Concept_Database_and_Vocabulary.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13095,11 +13095,11 @@ <h3 id="First-we-need-to-install-MedCAT">First we need to install MedCAT<a class
1309513095
</div>
1309613096
<div class="cell border-box-sizing code_cell rendered">
1309713097
<div class="input">
13098-
<div class="prompt input_prompt">In&nbsp;[1]:</div>
13098+
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div>
1309913099
<div class="inner_cell">
1310013100
<div class="input_area">
1310113101
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># Install MedCAT</span>
13102-
<span class="o">!</span> pip install medcat~<span class="o">=</span><span class="m">1</span>.14.0
13102+
<span class="o">!</span> pip install medcat~<span class="o">=</span><span class="m">1</span>.16.0
1310313103
<span class="c1"># Get the scispacy model</span>
1310413104
<span class="o">!</span> python -m spacy download en_core_web_md
1310513105
<span class="k">try</span><span class="p">:</span>

medcat-v1-tutorials/notebooks/introductory/Part_3_1_Building_a_Concept_Database_and_Vocabulary.ipynb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": 1,
25+
"execution_count": null,
2626
"metadata": {
2727
"colab": {
2828
"base_uri": "https://localhost:8080/",
@@ -322,7 +322,7 @@
322322
],
323323
"source": [
324324
"# Install MedCAT\n",
325-
"! pip install medcat~=1.14.0\n",
325+
"! pip install medcat~=1.16.0\n",
326326
"# Get the scispacy model\n",
327327
"! python -m spacy download en_core_web_md\n",
328328
"try:\n",
@@ -1371,7 +1371,7 @@
13711371
"provenance": []
13721372
},
13731373
"kernelspec": {
1374-
"display_name": "Python 3.8.5 ('.venv': venv)",
1374+
"display_name": "Python 3",
13751375
"language": "python",
13761376
"name": "python3"
13771377
},
@@ -1386,11 +1386,6 @@
13861386
"nbconvert_exporter": "python",
13871387
"pygments_lexer": "ipython3",
13881388
"version": "3.9.6"
1389-
},
1390-
"vscode": {
1391-
"interpreter": {
1392-
"hash": "60954f76b319195d8b66f263176ecf047c3a086773bff2d42e03144b47421836"
1393-
}
13941389
}
13951390
},
13961391
"nbformat": 4,

medcat-v1-tutorials/notebooks/introductory/Part_3_2_Extracting_Diseases_from_Electronic_Health_Records.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13088,11 +13088,11 @@ <h1 id="Now-let's-start-extracting-concepts-from-unstructured-text!">Now let's s
1308813088
</div>
1308913089
<div class="cell border-box-sizing code_cell rendered">
1309013090
<div class="input">
13091-
<div class="prompt input_prompt">In&nbsp;[1]:</div>
13091+
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div>
1309213092
<div class="inner_cell">
1309313093
<div class="input_area">
1309413094
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># Install medcat</span>
13095-
<span class="o">!</span> pip install medcat~<span class="o">=</span><span class="m">1</span>.14.0
13095+
<span class="o">!</span> pip install medcat~<span class="o">=</span><span class="m">1</span>.16.0
1309613096
<span class="c1"># install seaborn</span>
1309713097
<span class="o">!</span> pip install seaborn
1309813098
<span class="k">try</span><span class="p">:</span>
@@ -14706,10 +14706,10 @@ <h2 id="Use-Multiprocessing">Use Multiprocessing<a class="anchor-link" href="#Us
1470614706

1470714707

1470814708

14709-
<div id="9de888b0-4c6d-44f7-bd70-b4316f888f78"></div>
14709+
<div id="22300e60-822a-4878-b1d9-b57e2581a4b9"></div>
1471014710
<div class="output_subarea output_widget_view ">
1471114711
<script type="text/javascript">
14712-
var element = $('#9de888b0-4c6d-44f7-bd70-b4316f888f78');
14712+
var element = $('#22300e60-822a-4878-b1d9-b57e2581a4b9');
1471314713
</script>
1471414714
<script type="application/vnd.jupyter.widget-view+json">
1471514715
{"model_id": "05b18c97da9d4d05b9280df006a5fb82", "version_major": 2, "version_minor": 0}

medcat-v1-tutorials/notebooks/introductory/Part_3_2_Extracting_Diseases_from_Electronic_Health_Records.ipynb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 1,
15+
"execution_count": null,
1616
"metadata": {
1717
"colab": {
1818
"base_uri": "https://localhost:8080/",
@@ -275,7 +275,7 @@
275275
],
276276
"source": [
277277
"# Install medcat\n",
278-
"! pip install medcat~=1.14.0\n",
278+
"! pip install medcat~=1.16.0\n",
279279
"# install seaborn\n",
280280
"! pip install seaborn\n",
281281
"try:\n",
@@ -2847,7 +2847,7 @@
28472847
"provenance": []
28482848
},
28492849
"kernelspec": {
2850-
"display_name": "Python 3.8.5 ('.venv': venv)",
2850+
"display_name": "Python 3",
28512851
"language": "python",
28522852
"name": "python3"
28532853
},
@@ -2862,11 +2862,6 @@
28622862
"nbconvert_exporter": "python",
28632863
"pygments_lexer": "ipython3",
28642864
"version": "3.9.6"
2865-
},
2866-
"vscode": {
2867-
"interpreter": {
2868-
"hash": "60954f76b319195d8b66f263176ecf047c3a086773bff2d42e03144b47421836"
2869-
}
28702865
}
28712866
},
28722867
"nbformat": 4,

medcat-v1-tutorials/notebooks/introductory/Part_3_3_Model_technical_optimisations.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13088,11 +13088,11 @@ <h1 id="Now-let's-look-at-ways-to-optimise-the-model-for-our-specific-use-case">
1308813088
</div>
1308913089
<div class="cell border-box-sizing code_cell rendered">
1309013090
<div class="input">
13091-
<div class="prompt input_prompt">In&nbsp;[8]:</div>
13091+
<div class="prompt input_prompt">In&nbsp;[&nbsp;]:</div>
1309213092
<div class="inner_cell">
1309313093
<div class="input_area">
1309413094
<div class=" highlight hl-ipython3"><pre><span></span><span class="c1"># Install medcat</span>
13095-
<span class="o">!</span> pip install medcat~<span class="o">=</span><span class="m">1</span>.14.0
13095+
<span class="o">!</span> pip install medcat~<span class="o">=</span><span class="m">1</span>.16.0
1309613096
<span class="k">try</span><span class="p">:</span>
1309713097
<span class="kn">from</span> <span class="nn">medcat.cat</span> <span class="kn">import</span> <span class="n">CAT</span>
1309813098
<span class="k">except</span><span class="p">:</span>

medcat-v1-tutorials/notebooks/introductory/Part_3_3_Model_technical_optimisations.ipynb

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
{
1414
"cell_type": "code",
15-
"execution_count": 8,
15+
"execution_count": null,
1616
"metadata": {
1717
"colab": {
1818
"base_uri": "https://localhost:8080/",
@@ -165,7 +165,7 @@
165165
],
166166
"source": [
167167
"# Install medcat\n",
168-
"! pip install medcat~=1.14.0\n",
168+
"! pip install medcat~=1.16.0\n",
169169
"try:\n",
170170
" from medcat.cat import CAT\n",
171171
"except:\n",
@@ -413,7 +413,7 @@
413413
"provenance": []
414414
},
415415
"kernelspec": {
416-
"display_name": "Python 3.8.5 ('.venv': venv)",
416+
"display_name": "tvenv",
417417
"language": "python",
418418
"name": "python3"
419419
},
@@ -428,11 +428,6 @@
428428
"nbconvert_exporter": "python",
429429
"pygments_lexer": "ipython3",
430430
"version": "3.9.6"
431-
},
432-
"vscode": {
433-
"interpreter": {
434-
"hash": "60954f76b319195d8b66f263176ecf047c3a086773bff2d42e03144b47421836"
435-
}
436431
}
437432
},
438433
"nbformat": 4,

0 commit comments

Comments
 (0)