Skip to content

Projects (aka Protocols)

Andrea edited this page Dec 7, 2017 · 1 revision

A Project represents a Trial, a Protocol or something similar. Also in this case, related data are managed both by the biobank (as CollectionProtocols) and by the clinicalManager module (as Projects).

Related tables in MySQL are:

  • biobank: biobanca.collectionprotocol
  • clinicalManager: clinical.coreProject_project

In the neo4j graph, they are represented as nodes labelled as Project. Let's try to get them all:

MATCH (n:Project) RETURN n

How to create a new Project

For creating a medical center you need 3 pieces of information:

  • the title (e.g., The Project Foo)
  • the id (e.g., TheProjectFoo)
  • the owner working group (e.g., rootpi_WG)

NB: the owner working group will not affect the project visibility during collections in biobank. It has been placed there for future improvements.

In order to create all required data, run createProject.sh. Here is an example.

Run the script

$ bash createProject.sh 

You will be prompted for project title. In this example we are going to type: The New Project

Creating a new Project (aka protocol)...

Enter the title of the Project (e.g., The Project Foo) and press [ENTER]: 
The New Project

Then, you will be prompted for project id. In this example we are going to type: The_new_proj

Enter the id of the Project (e.g., TheProjectFoo) and press [ENTER]: 
The_new_proj

Finally, you will be asked to pick the WG which owns the Project. In this example we are going to type: Medico_WG

Enter the wg which owns the Project (e.g., rootpi_WG) and press [ENTER]: 
Medico_WG

A final output message, similar to the one below, should confirm that everithing is fine.

Project created in biobank

/srv/www/clinicalManager/corePatient/models.py:7: RemovedInDjango18Warning: `WgObjectManager.get_query_set` method should be renamed `get_queryset`.
  class WgObjectManager(models.Manager):

Project created in clinicalManager

Please, ignore the warning message. It's due to a deprecation of a Django method.

Mission accomplished!

How to check if everything is fine

In MySQL

mysql> select * from biobanca.collectionprotocol where project = 'The_new_proj';
+----+--------------+-----------------+--------------+--------------------+-----------------+----------------------------+------------------+------------------+--------------+
| id | name         | title           | project      | projectDateRelease | informedConsent | informedConsentDateRelease | ethicalCommittee | approvalDocument | approvalDate |
+----+--------------+-----------------+--------------+--------------------+-----------------+----------------------------+------------------+------------------+--------------+
| 30 | The_new_proj | The New Project | The_new_proj | 2017-12-06         |                 | 2017-12-06                 |                  |                  | 2017-12-06   |
+----+--------------+-----------------+--------------+--------------------+-----------------+----------------------------+------------------+------------------+--------------+
1 row in set (0.00 sec)

mysql> select * from clinical.coreProject_project where identifier='The_new_proj';
+----+--------------+-----------------+
| id | identifier   | name            |
+----+--------------+-----------------+
| 25 | The_new_proj | The New Project |
+----+--------------+-----------------+
1 row in set (0.00 sec)

In neo4j

MATCH (n:Project {identifier :'The_new_proj'})-[r:OwnsData]-(w:WG) RETURN n,r,w

You should get your new Project linked to the WG.

How to Link a Medical Center to a Project

In order to complete the Project creation, you need to link your new Project to one (or more) Medical Center. You can do it directly via Python.

You have to activate venvdj1.7 and to cd to adminScripts.

$ workon venvdj1.7
$ cd adminScripts

Start an interactive Python session

$ ipython # python is also fine

Run utils1_7.centersToProjects(). It takes two arguments: (i) a list of Medical Centers internal names and (ii) a list of Projects ids. It links all passed Projects to all Medical Centers (i.e., Cartesian product). Here an example where we link ZZ to The_new_proj.

In [1]: from utils1_7 import centersToProjects
/srv/www/clinicalManager/corePatient/models.py:7: RemovedInDjango18Warning: `WgObjectManager.get_query_set` method should be renamed `get_queryset`.
  class WgObjectManager(models.Manager):


In [2]: centersToProjects(['ZZ'],['The_new_proj'])
linking hospital: ZZ
		...to project: The_new_proj
Project(s) linked to hospital(s)

Please, ignore the warning message once again.

That's all!

How to check if everything is fine

This operation affects only the graph. Use the Cypher query below to get all relations which bind The_new_proj to Institution nodes

MATCH (i:Institution)-[r:participates]-(n:Project {identifier :'The_new_proj'}) RETURN i,r,n