Instructions database - YannMallegol/Database GitHub Wiki
Information about the database
Instructions for testing the Django project: ( the project uses Django 1.8 and Python3)
If you want to test the project:
- download the python_test/ repository https://github.com/YannMallegol/Database/tree/master/python_test
After this you have to execute these commands in the shell in order to create the database:
-> manage.py makemigrations ( In order to be sure that all classes contained in the models are considered)
-> manage.py migrate (if there are modifications detects in the last command, these modifications are added in the database)
-> manage.py runserver 0.0.0.0:8080 if you want to run the server but it is currently worked : http://10.17.24.138:8080/admin/
login: Rudolph password:Rudolph
or
login: NicolasR password: NicolasR
If you want to create an other super user you can do this by the shell or by the admin interface:
By the shell: -> manage.py createsuperuser
By the admin interface: go to /admin/auth/user/ and use the "Add user" button.
You can see all Series, Studies and patients contained in the database by the shell or by the admin interface
If you want to use the shell :
-> manage.py shell
Now you have to import classes:
In [1]: from polls.models import Patient, Study, Series, MR_Params, US_Params, CT_Params, Review
After this you can try to make queries in order to look the content of the database
Examples of queries :
Try to recover a PatientID whith a PatientName : -> Patient.objects.filter(PatientName='the name of the patient that you want')
Try to recover all patients who have PatientSex='M'. -> Patient.objects.filter(PatientSex='M')
Try to recover all Studies of a Patient who has PatientID='XXXX' -> Series.objects.filter(study__patient__PatientID='XXXX')
Try to recover all Series which Modality='XX' and SeriesNumber=XX -> Series.objects.filter(Modality='XX',SeriesNumber=XX)
It possible to delete information by the admin interface by the red button "delete" or in the shell:
q=Series.objects.filter(SeriesInstanceUID="1.3.12.2.1107.5.2.32.35201.2010060713031076687326519.0.0.0") q.delete()
If you want to see more tests : https://github.com/YannMallegol/DB_test/wiki And the document of django which speaks about queries : https://docs.djangoproject.com/en/1.8/topics/db/queries/