Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/neuromat/nes into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
sueli committed Apr 1, 2016
2 parents 7665ecf + ea74e31 commit ea5b2e3
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@


GroupTableTranslate = {
"Administrador": "Administrator",
"Atendente": "Attendant",
"Fisioterapeuta": "Physiotherapist",
"Médico": "Doctor",
"Pesquisador júnior": "Junior researcher",
"Pesquisador sênior": "Senior researcher",
"Administrador": "Administrator",
"Atendente": "Attendant",
"Fisioterapeuta": "Physiotherapist",
"Médico": "Doctor",
"Pesquisador júnior": "Junior researcher",
"Pesquisador sênior": "Senior researcher",
}


def backwards_data(apps, schema_editor):
print("backwards data")


def update_goup_data(apps, schema_editor):
def update_group_data(apps, schema_editor):

groups = Group.objects.all()
for group in groups:
Expand All @@ -35,5 +35,5 @@ class Migration(migrations.Migration):
]

operations = [
migrations.RunPython(update_goup_data, backwards_data)
migrations.RunPython(update_group_data, backwards_data)
]
16 changes: 7 additions & 9 deletions patientregistrationsystem/qdc/custom_user/tests.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
# -*- coding: UTF-8 -*-
from django.test import TestCase
import re

from django.shortcuts import get_object_or_404
from django.test.client import RequestFactory
from django.contrib.auth.models import Group

from custom_user.models import User, UserProfile
from custom_user.views import user_update

from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.shortcuts import get_current_site
from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from django.template import loader
from django.test import TestCase
from django.test.client import RequestFactory
from django.utils.http import int_to_base36
from django.core.urlresolvers import reverse

import re
from custom_user.models import User, UserProfile
from custom_user.views import user_update

# Constantes para testes de User
USER_EDIT = 'user_edit'
Expand Down
9 changes: 5 additions & 4 deletions patientregistrationsystem/qdc/experiment/forms.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# coding=utf-8
from experiment.models import Experiment, QuestionnaireResponse, SubjectOfGroup, Group, \
Component, Stimulus, Block, Instruction, ComponentConfiguration, ResearchProject, EEGData, DataFile

from django.forms import ModelForm, TextInput, Textarea, Select, DateInput, TypedChoiceField, RadioSelect,\
ValidationError, Form, IntegerField, NumberInput, CharField, DateTimeInput, TimeInput, FileInput
ValidationError, Form, IntegerField, NumberInput, CharField
from django.utils.translation import ugettext_lazy as _
from django.contrib.admin import widgets

from experiment.models import Experiment, QuestionnaireResponse, SubjectOfGroup, Group, \
Component, Stimulus, Block, Instruction, ComponentConfiguration, ResearchProject, EEGData


class ExperimentForm(ModelForm):
Expand Down
12 changes: 7 additions & 5 deletions patientregistrationsystem/qdc/experiment/tests.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
# coding=utf-8
import datetime

from django.http import Http404
from django.test import TestCase
from django.test.client import RequestFactory
from django.core.urlresolvers import reverse
from django.core.files.uploadedfile import SimpleUploadedFile
from django.shortcuts import get_object_or_404

from experiment.models import Experiment, Group, Subject, \
from .models import Experiment, Group, Subject, \
QuestionnaireResponse, SubjectOfGroup, ComponentConfiguration, ResearchProject, Keyword, StimulusType, \
Component, Task, TaskForTheExperimenter, Stimulus, Instruction, Pause, Questionnaire, Block, \
EEG, FileFormat, EEGData
from .views import experiment_update, upload_file, research_project_update

from patient.models import ClassificationOfDiseases
from experiment.views import experiment_update, upload_file, research_project_update, group_update
from survey.abc_search_engine import Questionnaires
from patient.tests import UtilTests
from custom_user.views import User

from survey.models import Survey
from survey.abc_search_engine import Questionnaires

from custom_user.views import User

LIME_SURVEY_ID = 828636
LIME_SURVEY_ID_WITHOUT_ACCESS_CODE_TABLE = 563235
Expand Down
10 changes: 4 additions & 6 deletions patientregistrationsystem/qdc/experiment/views.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# coding=utf-8
from functools import partial
import re
import datetime

from functools import partial

from django.conf import settings
from django.contrib import messages
from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.auth import PermissionDenied
from django.core.urlresolvers import reverse
from django.db.models import Q
from django.db.models.deletion import ProtectedError


# from django.forms import HiddenInput
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404, redirect, render, render_to_response
from django.utils.translation import ugettext as _
Expand All @@ -23,15 +21,15 @@
from experiment.forms import ExperimentForm, QuestionnaireResponseForm, FileForm, GroupForm, InstructionForm, \
ComponentForm, StimulusForm, BlockForm, ComponentConfigurationForm, ResearchProjectForm, NumberOfUsesToInsertForm, \
EEGDataForm

from patient.models import Patient, QuestionnaireResponse as PatientQuestionnaireResponse
from survey.abc_search_engine import Questionnaires

from survey.abc_search_engine import Questionnaires
from survey.models import Survey
from survey.views import get_questionnaire_responses, check_limesurvey_access, recursively_create_list_of_steps

from operator import itemgetter


permission_required = partial(permission_required, raise_exception=True)

icon_class = {
Expand Down
17 changes: 11 additions & 6 deletions patientregistrationsystem/qdc/export/export.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
import collections
import json
import re

from csv import writer, reader

from datetime import datetime

from django.conf import settings
from django.core.files import File
from django.utils.encoding import smart_str
from django.utils.translation import ugettext as _

import json
from datetime import datetime
from os import path, makedirs
from csv import writer, reader
from io import StringIO
import collections
import re

from operator import itemgetter

from os import path, makedirs

from patient.models import Patient, QuestionnaireResponse

from survey.abc_search_engine import Questionnaires
Expand Down
32 changes: 6 additions & 26 deletions patientregistrationsystem/qdc/export/tests.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,16 @@
from django.test import TestCase

from datetime import date, datetime

from django.shortcuts import get_object_or_404
from django.test import TestCase, Client
from django.http import Http404
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test.client import RequestFactory
from django.contrib.messages.api import MessageFailure
from django.utils.translation import ugettext as _
from os import path, mkdir
from shutil import rmtree

from patient.models import ClassificationOfDiseases, MedicalRecordData, Diagnosis, ComplementaryExam, ExamFile, \
Gender, Schooling, Patient, AlcoholFrequency, AlcoholPeriod, AmountCigarettes, QuestionnaireResponse
from patient.views import medical_record_view, medical_record_update, diagnosis_create, \
medical_record_create_diagnosis_create, exam_create, exam_view, \
patient_update, patient_view, restore_patient, reverse, check_limesurvey_access
from custom_user.models import User
from experiment.models import Experiment, Group, Subject, \
QuestionnaireResponse as ExperimentQuestionnaireResponse, SubjectOfGroup, ComponentConfiguration, ResearchProject, \
Questionnaire, Block
from patient.validation import CPF
from survey.models import Survey

from django.conf import settings
from survey.abc_search_engine import Questionnaires
from os import mkdir

from custom_user.models import User

from export.views import *
from export.input_export import InputExport
from export.export import is_patient_active

from django.contrib.messages.storage.fallback import FallbackStorage
from patient.models import Gender, Patient

# Constantes para testes de User
USER_EDIT = 'user_edit'
Expand All @@ -42,6 +22,7 @@


class UtilTests:

def create_patient_mock(self, name='Pacient Test', user=None):
""" Cria um participante para ser utilizado durante os testes """
gender = Gender.objects.create(name='Masculino')
Expand Down Expand Up @@ -386,4 +367,3 @@ def test_write_dynamic_json(self):
input_data.build_header()

# self.assertEqual(input_data.data, )

42 changes: 18 additions & 24 deletions patientregistrationsystem/qdc/export/views.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
import json

from django.shortcuts import render
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.contrib import messages
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.http import HttpResponse
from django.utils.encoding import smart_str
from django.utils.translation import ugettext as _
from io import StringIO
from os import path, makedirs
from csv import writer, reader
import re

from os import path
from csv import writer
from sys import modules
from zipfile import ZipFile
from django.http import HttpResponse
from django.http import HttpResponseRedirect
from django.core.urlresolvers import reverse
from patient.models import Patient, QuestionnaireResponse
from patient.views import check_limesurvey_access
from survey.abc_search_engine import Questionnaires
from shutil import rmtree

from django.conf import settings
from shutil import copy, rmtree
import collections
from operator import itemgetter
import json
from datetime import datetime
from django.core.files import File
from .forms import ExportForm
from .models import Export
from .export import ExportExecution, perform_csv_response, create_directory, save_to_csv

from export.input_export import build_complete_export_structure

from export.models import Export
from export.export import ExportExecution, perform_csv_response, create_directory, save_to_csv, is_patient_active
from patient.models import QuestionnaireResponse
from patient.views import check_limesurvey_access

from .forms import ExportForm
from survey.models import Survey
from export.input_export import build_complete_export_structure
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from survey.abc_search_engine import Questionnaires

JSON_FILENAME = "json_export.json"
EXPORT_DIRECTORY = "export"
Expand Down Expand Up @@ -386,7 +380,6 @@ def export_view(request, template_name="export/export_data.html"):

context = {}


# test with pagination
a = [{"b": "2", "c": "3"}, {"d": "7", "e": "8"}]
b = [1, 2, 3, 4, 5]
Expand Down Expand Up @@ -458,7 +451,8 @@ def export_view(request, template_name="export/export_data.html"):
per_participant = export_form.cleaned_data['per_participant']
per_questionnaire = export_form.cleaned_data['per_questionnaire']

# output_filename = "/Users/sueli/PycharmProjects/nes/patientregistrationsystem/qdc/export/json_export_output2.json"
# output_filename =
# "/Users/sueli/PycharmProjects/nes/patientregistrationsystem/qdc/export/json_export_output2.json"

# MEDIA_ROOT/export/username_id/export_id

Expand Down
35 changes: 19 additions & 16 deletions patientregistrationsystem/qdc/patient/tests.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,42 @@
# -*- coding: UTF-8 -*-

import os

from datetime import date, datetime

from django.conf import settings
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.storage.fallback import FallbackStorage
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.management import call_command
from django.core.management.base import CommandError
from django.http import Http404
from django.shortcuts import get_object_or_404
from django.test import TestCase, Client
from django.http import Http404
from django.core.files.uploadedfile import SimpleUploadedFile
from django.test.client import RequestFactory
from django.contrib.messages.api import MessageFailure
from django.utils.translation import ugettext as _

from custom_user.models import User

from experiment.models import Experiment, Group, Subject, \
QuestionnaireResponse as ExperimentQuestionnaireResponse, SubjectOfGroup, ComponentConfiguration, ResearchProject, \
Questionnaire, Block

from patient.management.commands.import_icd import import_classification_of_diseases
from patient.models import ClassificationOfDiseases, MedicalRecordData, Diagnosis, ComplementaryExam, ExamFile, \
Gender, Schooling, Patient, AlcoholFrequency, AlcoholPeriod, AmountCigarettes, QuestionnaireResponse
from patient.views import medical_record_view, medical_record_update, diagnosis_create, \
medical_record_create_diagnosis_create, exam_create, exam_view, \
patient_update, patient_view, restore_patient, reverse, check_limesurvey_access
from custom_user.models import User
from experiment.models import Experiment, Group, Subject, \
QuestionnaireResponse as ExperimentQuestionnaireResponse, SubjectOfGroup, ComponentConfiguration, ResearchProject, \
Questionnaire, Block
from patient.validation import CPF
from survey.models import Survey

from django.conf import settings
from survey.abc_search_engine import Questionnaires
from survey.models import Survey

from django.contrib.messages.storage.fallback import FallbackStorage
from update_english_data import translate_fixtures_into_english, update_translated_data

from patient.management.commands.import_icd import icd_english_translation, import_classification_of_diseases
from xml.etree.ElementTree import XML
from xml.etree import ElementTree
from django.core.management import call_command
from django.core.management.base import CommandError
from update_english_data import translate_fixtures_into_english, update_translated_data

import os

# Constants para testes de User
USER_EDIT = 'user_edit'
Expand Down
Loading

0 comments on commit ea5b2e3

Please sign in to comment.