Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #5

Merged
merged 12 commits into from
Jun 24, 2013
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ opentrials/settings_local.include
*.komodoproject
.DS_STORE
opentrials/logs/*
opentrials/custom/ecgovbr/static/attachments/*
8 changes: 8 additions & 0 deletions opentrials/custom/ecgovbr/templates/base_columns.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ <h2>{% trans 'Scoreboard' %}</h2>
{% trans "No clinical trials registered." %}
{%endif%}

{% if score.not_published_trials %}
{% blocktrans count score.not_published_trials as notpublished %}
<p>There is <span>{{ notpublished }}</span> in analysis.</p>
{% plural %}
<p>There are <span>{{ notpublished }}</span> in analysis.</p>
{% endblocktrans %}
{%endif%}

{% if score.number_recruiting_trials %}
{% blocktrans count score.number_recruiting_trials as recruiting %}
<p>There is <span>{{ recruiting }}</span> recruiting trial.</p>
Expand Down
Binary file modified opentrials/locale/pt_BR/LC_MESSAGES/django.mo
Binary file not shown.
48 changes: 31 additions & 17 deletions opentrials/locale/pt_BR/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ msgstr ""
"Project-Id-Version: 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-04-01 17:50-0300\n"
"PO-Revision-Date: 2013-04-01 18:15\n"
"PO-Revision-Date: 2013-06-12 16:52\n"
"Last-Translator: Jonatas C D <[email protected]>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -231,10 +231,10 @@ msgid_plural ""
" "
msgstr[0] ""
"\n"
"<p>Existe <span>%(registered)s</span> ensaio registrado.</p>"
"<p>Existe <span>%(registered)s</span> ensaio publicado.</p>"
msgstr[1] ""
"\n"
"<p>Existem <span>%(registered)s</span> ensaios registrados.</p>"
"<p>Existem <span>%(registered)s</span> ensaios publicados.</p>"

#: custom/ecgovbr/templates/base_columns.html:29
#: templates/base_columns.html:30
Expand All @@ -243,6 +243,23 @@ msgid "No clinical trials registered."
msgstr "Nenhum ensaio clínico foi registrado."

#: custom/ecgovbr/templates/base_columns.html:33
#, fuzzy, python-format
msgid ""
"\n"
" <p>There is <span>%(notpublished)s</span> in analysis.</p>\n"
" "
msgid_plural ""
"\n"
" <p>There are <span>%(notpublished)s</span> in analysis.</p>\n"
" "
msgstr[0] ""
"\n"
"<p>Existe <span>%(notpublished)s</span> ensaio em análise.</p>"
msgstr[1] ""
"\n"
"<p>Existem <span>%(notpublished)s</span> ensaios em análise.</p>"

#: custom/ecgovbr/templates/base_columns.html:41
#, python-format
msgid ""
"\n"
Expand Down Expand Up @@ -572,13 +589,11 @@ msgstr "Ambos"
msgid "male"
msgstr "masculino"

#: repository/choices.py:41
#: repository/choices.py:82
#: repository/choices.py:41 repository/choices.py:82
msgid "Male"
msgstr "Masculino"

#: repository/choices.py:41
#: repository/choices.py:81
#: repository/choices.py:41 repository/choices.py:81
msgid "Female"
msgstr "Feminino"

Expand Down Expand Up @@ -644,8 +659,7 @@ msgstr "DeCS: Descritores em Ciências da Saúde"
msgid "ICD-10: International Classification of Diseases (10th. rev.)"
msgstr "CID-10: Classificação Internacional de Doenças"

#: repository/choices.py:71
#: repository/choices.py:80
#: repository/choices.py:71 repository/choices.py:80
msgid "Do not inform"
msgstr "Não declarar"

Expand Down Expand Up @@ -2054,13 +2068,11 @@ msgstr "resubmeter"
msgid "Preferred language"
msgstr "Idioma preferido"

#: reviewapp/models.py:54
#: reviewapp/forms.py:144
#: reviewapp/models.py:54 reviewapp/forms.py:144
msgid "Color/Race"
msgstr "Cor/Raça"

#: reviewapp/models.py:57
#: reviewapp/forms.py:147
#: reviewapp/models.py:57 reviewapp/forms.py:147
msgid "Genre"
msgstr "Gênero"

Expand Down Expand Up @@ -2458,10 +2470,10 @@ msgid_plural ""
" "
msgstr[0] ""
"\n"
"<p>Existe <span>%(registered)s</span> ensaio registrado.</p>"
"<p>Existe <span>%(registered)s</span> ensaio publicado.</p>"
msgstr[1] ""
"\n"
"<p>Existem <span>%(registered)s</span> ensaios registrados.</p>"
"<p>Existem <span>%(registered)s</span> ensaios publicados.</p>"

#: templates/base_columns.html:34
#, fuzzy, python-format
Expand All @@ -2482,8 +2494,10 @@ msgstr[1] ""

#: templates/base_columns.html:40
#, python-format
msgid "There are <span>%(score.participating)s</span> participating countries.<br>"
msgstr "<p>Existem <span>%(score.participating)s</span> países participantes.</p>"
msgid ""
"There are <span>%(score.participating)s</span> participating countries.<br>"
msgstr ""
"<p>Existem <span>%(score.participating)s</span> países participantes.</p>"

#: templates/registration/registration_form.html:20
msgid "resend the activation e-mail"
Expand Down
24 changes: 23 additions & 1 deletion opentrials/repository/choices.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,26 @@
('-',_('Do not inform')),
('F',_('Female')),
('M',_('Male')),
]
]

# fields to be imported from Plataforma Brasil's XML file
XMLPB = ["public_title",
"acronym",
"scientific_title",
"scientific_acronym",
"target_size",
"recruitment_status",
"date_enrolment",
"type_enrolment",
"study_type",
"study_design",
"hc_freetext",
"i_freetext",
"country",
"inclusion_criteria",
"agemin",
"agemax",
"gender",
"exclusion_criteria",
"prim_outcome",
"sec_outcome"]
5 changes: 5 additions & 0 deletions opentrials/repository/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ class TrialsPublished(NotDeletedManager):
def get_query_set(self):
return super(TrialsPublished, self).get_query_set().filter(status__exact='published')

class TrialsNotPublished(NotDeletedManager):
def get_query_set(self):
return super(TrialsNotPublished, self).get_query_set().filter(status__exact='processing')

class ClinicalTrialManager(NotDeletedManager):
def deserialize_for_fossil(self, data, persistent=False):
return deserialize_trial(data, persistent)
Expand Down Expand Up @@ -231,6 +235,7 @@ def get_object_fossil(self, force_load=False):
class ClinicalTrial(TrialRegistrationDataSetModel):
objects = ClinicalTrialManager()
published = TrialsPublished()
notpublished = TrialsNotPublished()
fossils = TrialsFossilManager()

# TRDS 1
Expand Down
11 changes: 11 additions & 0 deletions opentrials/repository/templates/repository/trial_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,16 @@
</div>
</td>
</tr>
<tr>
<td colspan=2>
<form name="xml_pb" action="./" method="post" enctype="multipart/form-data">
<br />
{% csrf_token %}
{{ form_xmlpb.title }}
{{ form_xmlpb.xmlpb }}
<input type="submit" value="Enviar">
</form>
</td>
</tr>
</table>
{% endblock %}
29 changes: 29 additions & 0 deletions opentrials/repository/templates/repository/xmlpb.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{% extends "base.html" %}
{% load i18n %}
{% block body_title %}{% trans "Trial Summary" %}{% endblock %}

{% block stepmenu_top %}
{{ block.super }}
<small>
/ <a href="{% url reviewapp.submissionlist %}">{% trans 'Submissions' %}</a>
</small>
<big>/ {% trans 'Trial Summary' %}</big>
<div style="float:right; margin-right:20px;">
<small><a href="{% url repository.trialview trial_pk %}">{% trans 'Preview' %}</a></small>
</div>
{% endblock %}
{% block body %}

<h2>{% trans "XML files imported with success!" %}</h2>
<p>Foram importados os seguintes campos:<br />
<ul>
{% for field in imported_fields %}
<li>{% trans field %}</li>
{% endfor %}
</ul>
</p>
<p>
<a href="{% url repository.edittrial trial_pk %}">Continuar</a>
</p>

{% endblock %}
4 changes: 3 additions & 1 deletion opentrials/repository/templatetags/scoreboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,12 @@ def render(self, context):

number_recruiting_trials = len(ClinicalTrial.fossils.recruiting())
number_registered_trials = len(ClinicalTrial.fossils.published())
not_published_trials = len(ClinicalTrial.notpublished.all())
scoreboard_text = "Deprecated!"

scoreboard_result = {'number_recruiting_trials': number_recruiting_trials,
'number_registered_trials': number_registered_trials}
'number_registered_trials': number_registered_trials,
'not_published_trials': not_published_trials}

context[self.varname] = scoreboard_result #scoreboard_text
return ''
Expand Down
19 changes: 15 additions & 4 deletions opentrials/repository/trds_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

import urllib
import urllib2
from BeautifulSoup import BeautifulSoup as BS

class ReviewModelForm(MultilingualBaseForm):

Expand Down Expand Up @@ -175,12 +176,22 @@ def utrn_number_validate(data):
raise forms.ValidationError(_("Invalid format. Example: U1111-1111-1111"))
else:
# validate UTN against ICTRP database

who_url = 'http://apps.who.int/trialsearch/utnvalid.aspx'
soup = BS(urllib2.urlopen(who_url).read())

hidden = {}
hidden['TextBox1'] = data
hidden['Button1'] = 'Validate'
for field in soup('input', {'type': 'hidden'}):
value = ''
nome = field['name']
if field.has_key('value'):
value = field['value']
hidden[field['name']] = value

fields = urllib.urlencode(hidden)

utn_validation_form_fields = urllib.urlencode({'TextBox1':data , '__EVENTVALIDATION':'/wEWBQKV4PvCBgLs0bLrBgKM54rGBgK7q7GGCAKL9pj0AqnSGqfaXMCcBgts7fhxyo6iDG1N','ToolkitScriptManager_HiddenField':'','__VIEWSTATE':'/wEPDwUKMTc5NjQ1Mzc3Ng8WAh4FaXBhZHIFDDE1Ny44Ni45OS41MxYCAgMPZBYCAgcPD2QPEBYBZhYBFgIeDlBhcmFtZXRlclZhbHVlBQ1VMTExMTAwMDAxMTExFgECAmRkZDmZVDmizq8DBof7aT/dfBsS1sw+','Button1':'Validate','TextBoxWatermarkExtender1_ClientState': ''})
r = urllib2.urlopen(who_url, utn_validation_form_fields)

r = urllib2.urlopen(who_url, fields)
if 'This utn number is valid' not in r.read():
raise forms.ValidationError(_("Invalid UTN number. Please verify your UTN number."))
return data
Expand Down
3 changes: 2 additions & 1 deletion opentrials/repository/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from repository.models import ClinicalTrial

from repository.views import edit_trial_index, full_view, index, step_1, step_2, step_3
from repository.views import step_4, step_5, step_6, step_7, step_8, step_9, new_institution
from repository.views import step_4, step_5, step_6, step_7, step_8, step_9, new_institution, all_trials_xls
from repository.views import trial_registered, trial_view, recruiting, trial_ictrp, trial_otxml
from repository.views import all_trials_ictrp, contacts, advanced_search, multi_otxml, custom_otcsv

Expand Down Expand Up @@ -35,6 +35,7 @@
url(r'^all/xml/ictrp$', all_trials_ictrp),
url(r'^multi/xml/ot', multi_otxml, name='repository.multi_otxml'),
url(r'^multi/csv/ot', custom_otcsv, name='repository.custom_otcsv'),
url(r'^all/xls$', all_trials_xls),
url(r'^(?P<trial_fossil_id>[0-9A-Za-z-]+)/([\w|\W]+)?$', trial_registered, name='repository.trial_registered'),
url(r'^$', index, name='repository.index'),
)
Loading