# Tutorial TWDS - MedCAT & Neo4j

**URL:** <https://discourse.cogstack.org/t/tutorial-twds-medcat-neo4j/45>\
**Category:** MedCAT\
**Created:** [April 12, 2022, 3:35pm UTC](https://discourse.cogstack.org/t/tutorial-twds-medcat-neo4j/45 "2022-04-12T15:35:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pablo](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Pablo](https://discourse.cogstack.org/u/Pablo)\
**Post date:** [April 12, 2022, 3:35pm UTC](https://discourse.cogstack.org/t/tutorial-twds-medcat-neo4j/45/1 "2022-04-12T15:35:41Z")

</div>

I tried using this tutorial on my personal colab but it doesn’t give the same results shown here:

[TWDS - MedCAT & Neo4j Tutorial.ipynb](https://github.com/CogStack/MedCAT/blob/master/notebooks/TWDS%20-%20MedCAT%20%26%20Neo4j%20Tutorial.ipynb)

The script fails at “import patients” showing this error:

> ClientError: [Statement.ExternalResourceFailed] Couldn’t load the external resource at: file:/var/lib/neo4j/import/patients.csv (Transactions committed: 0)

I also add the following cell, but still don’t work:

```auto
!mkdir /var/lib/neo4j
!mkdir /var/lib/neo4j/import
!mkdir /var/lib/neo4j/conf
!sudo chmod 777 /var/lib/neo4j
!sudo chmod 777 /var/lib/neo4j/import
!sudo chmod 777 /var/lib/neo4j/conf
!echo 'dbms.directories.import=/var/lib/import' | tee /var/lib/neo4j/conf/neo4j.conf
!echo 'dbms.security.allow_csv_import_from_file_urls=true' | tee /var/lib/neo4j/conf/neo4j.conf
!sudo chmod 640 /var/lib/neo4j/conf/neo4j.conf
!set NEO4J_HOME=/var/lib/neo4j
!set NEO4J_CONF=/var/lib/neo4j/conf

```

I try also to implement a local project on my laptop with pycharm and neo4j desktop. The script goes a little bit futher, but the first query return un empty set and the second raise an error.  
Can somebody help me?

---

<div class="post-metadata">

**Author:** ![zeljko](https://avatars.discourse-cdn.com/v4/letter/z/7ab992/32.png) [@zeljko](https://discourse.cogstack.org/u/zeljko)\
**Post date:** [April 18, 2022, 9:46pm UTC](https://discourse.cogstack.org/t/tutorial-twds-medcat-neo4j/45/2 "2022-04-18T21:46:32Z")

</div>

Hi @Pablo,

can you please give a bit more information, where are you trying to run the scripts and do you have neo4j installed and running there?

Once you run the data preparation script, is the file `/var/lib/neo4j/import/patients.cs` created?

---

<div class="post-metadata">

**Author:** ![Pablo](https://avatars.discourse-cdn.com/v4/letter/p/ad7895/32.png) [@Pablo](https://discourse.cogstack.org/u/Pablo)\
**Post date:** [April 26, 2022, 10:21am UTC](https://discourse.cogstack.org/t/tutorial-twds-medcat-neo4j/45/3 "2022-04-26T10:21:17Z")

</div>

> [@zeljko](#):
>
> here are you tryin

I run the scripts on Colab like the tutorial, but I can’t connect to ‘bolt://localhost:7867’ (I tried with default setting user=‘neo4j’ and password=‘neo4j’) so I created a free Neo4j Sandbox.

Neo4j on colab is not installed in the /var/lib, so I had to create manually the directories.  
Yes, the file `/var/lib/neo4j/import/patients.csv` is created but the scripts can’t laod the file.

---

<div class="post-metadata">

**Author:** ![zeljko](https://avatars.discourse-cdn.com/v4/letter/z/7ab992/32.png) [@zeljko](https://discourse.cogstack.org/u/zeljko)\
**Post date:** [April 27, 2022, 6:37pm UTC](https://discourse.cogstack.org/t/tutorial-twds-medcat-neo4j/45/4 "2022-04-27T18:37:33Z")

</div>

Hi @Pablo, you’ll need to run the Jupyter notebook on a Linux machine where you have neo4j installed. Otherwise, you need to manually move the files onto the machine where neo4j is installed and specify the appropriate IP address or hostname in the Jupyter notebooks.
