Skip to content

Commit

Permalink
[thesaurus] Exportação em formato ID para conversão em ISIS #613
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio Brito committed Mar 29, 2019
1 parent 627dc9d commit bbe6b0b
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 28 deletions.
20 changes: 12 additions & 8 deletions bireme/api/thesaurus_api_desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def dehydrate(self, bundle):
# 776
thesaurus_id = IdentifierDesc.objects.filter(id=bundle.obj.id)
for field in thesaurus_id:
bundle.data['identifier'] = bundle.obj.id
bundle.data['identifier'] = str(bundle.obj.id).zfill(6)

id_concept = IdentifierConceptListDesc.objects.filter(identifier_id=bundle.obj.id,preferred_concept='Y')

Expand Down Expand Up @@ -136,22 +136,22 @@ def dehydrate(self, bundle):
# 'scope_note_en': '005',
scope_note_en = ConceptListDesc.objects.filter(identifier_concept_id=id_concept,language_code='en')
for field in scope_note_en:
bundle.data['scope_note_en'] = field.scope_note
bundle.data['scope_note_en'] = '^n' + field.scope_note

# # 'scope_note_es': '006',
scope_note_es = ConceptListDesc.objects.filter(identifier_concept_id=id_concept,language_code='es')
for field in scope_note_es:
bundle.data['scope_note_es'] = field.scope_note
bundle.data['scope_note_es'] = '^n' + field.scope_note

# # 'scope_note_pt_br': '007',
scope_note_pt_br = ConceptListDesc.objects.filter(identifier_concept_id=id_concept,language_code='pt-br')
for field in scope_note_pt_br:
bundle.data['scope_note_pt_br'] = field.scope_note
bundle.data['scope_note_pt_br'] = '^n' + field.scope_note

# # 'scope_note_es_es': '008',
scope_note_es_es = ConceptListDesc.objects.filter(identifier_concept_id=id_concept,language_code='es-es')
for field in scope_note_es_es:
bundle.data['scope_note_es_es'] = field.scope_note
bundle.data['scope_note_es_es'] = '^n' + field.scope_note



Expand Down Expand Up @@ -258,14 +258,14 @@ def dehydrate(self, bundle):
# 'term_string_see_related_en': '060', # ^i
term_string_see_related_en = SeeRelatedListDesc.objects.filter(identifier_id=bundle.obj.id)
for field in term_string_see_related_en:
bundle.data['term_string_see_related_en'] = field.term_string
bundle.data['term_string_see_related_en'] = '^i' + field.term_string



# 'decs_code': '099',
decs_code = IdentifierDesc.objects.filter(id=bundle.obj.id)
for field in decs_code:
bundle.data['decs_code'] = field.decs_code
bundle.data['decs_code'] = str(field.decs_code).zfill(6)



Expand Down Expand Up @@ -374,7 +374,11 @@ def dehydrate(self, bundle):
if field.history_note:
bundle.data['history_note_en'] = '^n' + field.history_note


# 'pharmacologicalaction_en': '192',
pharmacologicalaction_en = PharmacologicalActionList.objects.filter(identifier_id=bundle.obj.id,language_code='en')
for field in pharmacologicalaction_en:
if field.term_string:
bundle.data['pharmacologicalaction_en'] = field.term_string

# 'annotation_es': '210',
annotation_es = DescriptionDesc.objects.filter(identifier_id=bundle.obj.id,language_code='es')
Expand Down
44 changes: 29 additions & 15 deletions bireme/api/thesaurus_api_qualif.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,56 +140,70 @@ def dehydrate(self, bundle):
# 'scope_note_en': '005',
scope_note_en = ConceptListQualif.objects.filter(identifier_concept_id=id_concept,language_code='en')
for field in scope_note_en:
bundle.data['scope_note_en'] = field.scope_note
bundle.data['scope_note_en'] = '^n' + field.scope_note

# # 'scope_note_es': '006',
scope_note_es = ConceptListQualif.objects.filter(identifier_concept_id=id_concept,language_code='es')
for field in scope_note_es:
bundle.data['scope_note_es'] = field.scope_note
bundle.data['scope_note_es'] = '^n' + field.scope_note

# # 'scope_note_pt_br': '007',
scope_note_pt_br = ConceptListQualif.objects.filter(identifier_concept_id=id_concept,language_code='pt-br')
for field in scope_note_pt_br:
bundle.data['scope_note_pt_br'] = field.scope_note
bundle.data['scope_note_pt_br'] = '^n' + field.scope_note

# # 'scope_note_es_es': '008',
scope_note_es_es = ConceptListQualif.objects.filter(identifier_concept_id=id_concept,language_code='es-es')
for field in scope_note_es_es:
bundle.data['scope_note_es_es'] = field.scope_note
bundle.data['scope_note_es_es'] = '^n' + field.scope_note



# 'tree_number': '010',
tree_number_list = []
tree_number_arr = TreeNumbersListQualif.objects.filter(identifier_id=bundle.obj.id)
for field in tree_number_arr:
item = field.tree_number
tree_number_list.append(item)
letter_chk = field.tree_number[0:1]
if letter_chk == 'Q':
item = field.tree_number
tree_number_list.append(item)
bundle.data['tree_number'] = tree_number_list

# 'tree_number_201': '201',
tree_number_list = []
tree_number_arr = TreeNumbersListQualif.objects.filter(identifier_id=bundle.obj.id)
for field in tree_number_arr:
letter_chk = field.tree_number[0:1]
if letter_chk != 'Q':
item = field.tree_number
tree_number_list.append(item)
bundle.data['tree_number_201'] = tree_number_list


# Usado para mostrar EntryVersion
# en
# 'entry_version_en': '011',
entry_version_en = TermListQualif.objects.filter(identifier_concept_id=id_concept,language_code='en',concept_preferred_term='Y',record_preferred_term='Y',status='1')
entry_version_en = TermListQualif.objects.filter(identifier_concept_id=id_concept,language_code='en',status='1')
for field in entry_version_en:
item = '/' + field.entry_version
bundle.data['entry_version_en'] = item.lower()
if field.entry_version:
item = '/' + field.entry_version
bundle.data['entry_version_en'] = item.lower()

# es
# 'entry_version_es': '012',
entry_version_es = TermListQualif.objects.filter(identifier_concept_id=id_concept,language_code='es',concept_preferred_term='Y',record_preferred_term='Y',status='1')
entry_version_es = TermListQualif.objects.filter(identifier_concept_id=id_concept,language_code='es',status='1')
for field in entry_version_es:
item = '/' + field.entry_version
bundle.data['entry_version_es'] = item.lower()
if field.entry_version:
item = '/' + field.entry_version
bundle.data['entry_version_es'] = item.lower()

# pt-br
# 'entry_version_pt_br': '013',
entry_version_pt_br = TermListQualif.objects.filter(identifier_concept_id=id_concept,language_code='pt-br',concept_preferred_term='Y',record_preferred_term='Y',status='1')
entry_version_pt_br = TermListQualif.objects.filter(identifier_concept_id=id_concept,language_code='pt-br',status='1')
for field in entry_version_pt_br:
item = '/' + field.entry_version
bundle.data['entry_version_pt_br'] = item.lower()
if field.entry_version:
item = '/' + field.entry_version
bundle.data['entry_version_pt_br'] = item.lower()



Expand Down
4 changes: 2 additions & 2 deletions bireme/templates/thesaurus/qualifier_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ <h2>
{% if actions.visited %}

<thead>
<th>
<th width="90%">
<a href="javascript:orderby('term_string');" id="id_term_string">
{% if not actions.filter_fields == 'term_string' %}
{% trans "Qualifier Name" %}
Expand All @@ -137,7 +137,7 @@ <h2>
<!-- <th><a href="javascript:orderby('abbreviation');" id="id_abbreviation">{% trans "Abbreviation" %}</a></th> -->
<!-- <th><a href="javascript:orderby('qualifier_ui');" id="id_qualifier_ui">{% trans "MESH Qualifier UI" %}</a></th> -->
<!-- <th><a href="javascript:orderby('decs_code');" id="id_decs_code">{% trans "DeCS Qualifer UI" %}</a></th> -->
<th><a href="javascript:orderby('status');" id="id_status">{% trans "Status" %}</a></th>
<th width="10%"><a href="javascript:orderby('status');" id="id_status">{% trans "Status" %}</a></th>
</thead>
<tbody>
{% for obj in registers %}
Expand Down
6 changes: 3 additions & 3 deletions bireme/templates/thesaurus/thesaurus_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,12 @@ <h2>
<div class="tab-content">
<div class="tab-pane active" id="tab-descriptor">

<table class='table'>
<table class="table">
<thead>

{% if actions.visited %}

<th>
<th width="90%">
<a href="javascript:orderby('term_string');" id="id_term_string">
{% if actions.filter_fields == 'term_string' or actions.filter_fields == '' %}
{% trans "Term name" %}
Expand All @@ -132,7 +132,7 @@ <h2>
</a>
</th>

<th><a href="javascript:orderby('status');" id="id_status">{% trans "Status" %}</a></th>
<th width="10%"><a href="javascript:orderby('status');" id="id_status">{% trans "Status" %}</a></th>

</thead>
<tbody>
Expand Down
2 changes: 2 additions & 0 deletions bireme/thesaurus/field_definitions_desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
'online_note_en': '117',
'history_note_en': '119',

'pharmacologicalaction_en': '192',

'annotation_es': '210',
'online_note_es': '217',
'history_note_es': '219',
Expand Down
1 change: 1 addition & 0 deletions bireme/thesaurus/field_definitions_qualif.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
'scope_note_es_es': '008',

'tree_number': '010',
'tree_number_201': '201',

# Usado para mostrar EntryVersion
# en
Expand Down

0 comments on commit bbe6b0b

Please sign in to comment.