Skip to content

Commit

Permalink
Merge pull request #786 from gitnnolabs/fix_oaipmh_metadata
Browse files Browse the repository at this point in the history
Adiciona o ORCID para os autores no protocolo OAI-PMH. Adiciona o pid_v2, pid_v3 e URL do artigo como identificador. Garante que tenha duplicidade nos autores, palavras-chave, resumo, idiomas, identificadores.
  • Loading branch information
gitnnolabs authored Jun 27, 2024
2 parents 483bf2a + 021c823 commit fe48fc6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 16 deletions.
28 changes: 14 additions & 14 deletions article/search_indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,14 @@ def prepare_communities(self, obj):
"""The ISSN is on SciELO Journal models.SciELOJournal.objects.filter(journal=j)[0].issn_scielo"""
# set com os issns
if obj.journal:
return [
j.issn_scielo for j in SciELOJournal.objects.filter(journal=obj.journal)
]
return set([
"com_%s" % j.issn_scielo for j in SciELOJournal.objects.filter(journal=obj.journal)
])

def prepare_titles(self, obj):
"""The list of titles."""
if obj.titles:
return [title.plain_text for title in obj.titles.all()]
return set([title.plain_text for title in obj.titles.all()])

def prepare_creator(self, obj):
"""The list of authors is the researchers on the models that related with
Expand All @@ -373,24 +373,24 @@ class PersonName, so we used ``select_related`` to ensure that
researchers = obj.researchers.select_related("person_name").filter(
person_name__isnull=False
)
return [str(researcher.person_name) for researcher in researchers]
return set([str(researcher.person_name) for researcher in researchers])

def prepare_collab(self, obj):
"""This is the instituional author."""
if obj.collab:
return [collab.collab for collab in obj.collab.all()]
return set([collab.collab for collab in obj.collab.all()])

def prepare_kw(self, obj):
"""The keywords of the article."""
if obj.keywords:
return [keyword.text for keyword in obj.keywords.all()]
return set([keyword.text for keyword in obj.keywords.all()])

def prepare_description(self, obj):
"""The abstracts of the articles
This is a property that filter by article ``DocumentAbstract.objects.filter(article=self)``
"""
if obj.abstracts:
return [abs.plain_text for abs in obj.abstracts.all()]
return set([abs.plain_text for abs in obj.abstracts.all()])

def prepare_dates(self, obj):
"""This the publication date, that is format by YYYY-MM-DD
Expand All @@ -409,7 +409,7 @@ def prepare_dates(self, obj):
def prepare_la(self, obj):
"""The language of the article."""
if obj.languages:
return [language.code2 for language in obj.languages.all()]
return set([language.code2 for language in obj.languages.all()])

def prepare_identifier(self, obj):
"""Add the all identifier to the article:
Expand All @@ -419,13 +419,13 @@ def prepare_identifier(self, obj):
URL old format:
Example: https://www.scielo.br/scielo.php?script=sci_arttext&pid=S0102-311X2019000104001&lang=pt
"""
idents = []
idents = set()

if obj.journal:
collections = obj.collections
for collection in collections:
for lang in obj.languages.all():
idents.append(
idents.add(
"http://%s/scielo.php?script=sci_arttext&pid=%s&tlng=%s"
% (
collection.domain,
Expand All @@ -435,13 +435,13 @@ def prepare_identifier(self, obj):
)

if obj.doi:
idents.extend([doi.value for doi in obj.doi.all()])
idents.update([doi.value for doi in obj.doi.all()])

if obj.pid_v2:
idents.append(obj.pid_v2)
idents.add(obj.pid_v2)

if obj.pid_v3:
idents.append(obj.pid_v3)
idents.add(obj.pid_v3)

return idents

Expand Down
19 changes: 17 additions & 2 deletions article/templates/search/indexes/article/article_compile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@
<element name="creator">
<element name="none">
{% for research in object.researchers.all %}
<field name="value">{{research.person_name}}</field>
{% if research.orcid %}
<field name="value" orcid="{{research.orcid}}">{{research.person_name}}</field>
{% else %}
<field name="value">{{research.person_name}}</field>
{% endif %}
{% endfor %}
</element>
</element>
Expand Down Expand Up @@ -47,9 +51,20 @@
</element>
<element name="identifier">
<element name="none">

{% for doi in object.doi.all %}
<field name="value">{{ doi.value }}</field>
{% endfor %}

<field name="value">{{ object.pid_v2 }}</field>
<field name="value">{{ object.pid_v3 }}</field>

{% for collection in object.collections %}
{% for lang in object.languages.all %}
<field name="value">http://{{collection.domain}}/scielo.php?script=sci_arttext&amp;pid={{object.pid_v2}}&amp;tlng={{lang.code2}}</field>
{% endfor %}
{% endfor %}

</element>
</element>
<element name="language">
Expand All @@ -74,7 +89,7 @@
<element name="bundles"/>
<element name="others">
<field name="handle"/>
<field name="identifier">{{ object.id }}</field>
<field name="identifier">{{ object.pid_v2 }}</field>
<field name="lastModifyDate">{{ object.updated|date:"c" }}</field>
</element>
<element name="repository">
Expand Down

0 comments on commit fe48fc6

Please sign in to comment.