Skip to content

Atualizar a lista de tipos de documentos com valores @article-type, DOCTOPIC e novos atributos#203

Open
Copilot wants to merge 8 commits intomasterfrom
copilot/update-document-types-list
Open

Atualizar a lista de tipos de documentos com valores @article-type, DOCTOPIC e novos atributos#203
Copilot wants to merge 8 commits intomasterfrom
copilot/update-document-types-list

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 10, 2026

O que esse PR faz?

Adiciona os valores @article-type do SciELO Publishing Schema e do dicionário DOCTOPIC (SPS 1.10) como mapeamentos de identidade no dicionário article_types. Isso permite que o campo v71 contenha tanto códigos legados (e.g. 'oa', 'ct') quanto valores JATS @article-type diretamente (e.g. 'research-article', 'retraction'), sem cair em 'undefined'.

Foram corrigidos os mapeamentos de códigos legados com base na correspondência do DOCTOPIC (novo → velho):

  • an (announcements): newsannouncement
  • in (interview): editorialinterview (confirmado por 'interview': 'in' no DOCTOPIC)
  • mt (methodology): research-articlereview-article
  • pr (press release): press-releasein-brief (confirmado por 'in-brief': 'pr' no DOCTOPIC)
  • sc (brief communication): rapid-communicationrapid-communication (confirmado por 'rapid-communication': 'sc' no DOCTOPIC; revertido à correspondência original)
  • up (update): undefinedrapid-communication

Códigos legados adicionados: reretraction, zzother.

Valores @article-type adicionados como mapeamentos de identidade (41 valores): abstract, addendum, announcement, article-commentary, book-review, books-received, brief-report, calendar, case-report, clinical-instruction, clinical-trial, collection, correction, data-article, discussion, dissertation, editorial, editorial-material, expression-of-concern, guideline, in-brief, interview, introduction, letter, meeting-report, news, obituary, oration, other, partial-retraction, product-review, rapid-communication, referee-report, reply, reprint, research-article, retraction, review-article, reviewer-report, technical-report, translation.

Além disso, foi adicionado o dicionário DOCTOPIC em choices.py com a correspondência do novo para o velho (SPS 1.10), e dois novos atributos na classe Article:

  • sps_doctype: retorna o valor SPS @article-type correspondente ao campo v71, ou None se não disponível.
  • legacy_doctype: retorna o código legado correspondente ao campo v71 usando o mapeamento reverso do DOCTOPIC, ou None se não disponível.

Onde a revisão poderia começar?

  • xylose/choices.py — dicionário article_types atualizado e novo dicionário DOCTOPIC.
  • xylose/scielodocument.py — novos atributos sps_doctype e legacy_doctype na classe Article.

Como este poderia ser testado manualmente?

from xylose.choices import article_types, DOCTOPIC

# Códigos legados continuam funcionando
assert article_types['oa'] == 'research-article'

# Códigos legados corrigidos conforme DOCTOPIC
assert article_types['an'] == 'announcement'            # announcements → announcement
assert article_types['in'] == 'interview'               # interview (DOCTOPIC: 'interview': 'in')
assert article_types['mt'] == 'review-article'           # methodology → review-article
assert article_types['pr'] == 'in-brief'                 # press release → in-brief (DOCTOPIC: 'in-brief': 'pr')
assert article_types['sc'] == 'rapid-communication'      # brief communication → rapid-communication
assert article_types['up'] == 'rapid-communication'      # update → rapid-communication
assert article_types['re'] == 'retraction'               # retraction (novo)

# Valores @article-type resolvem para si mesmos
assert article_types['retraction'] == 'retraction'
assert article_types['data-article'] == 'data-article'
assert article_types['interview'] == 'interview'
assert article_types['clinical-trial'] == 'clinical-trial'

# DOCTOPIC: mapeamento reverso (@article-type → código legado)
assert DOCTOPIC['research-article'] == 'oa'
assert DOCTOPIC['retraction'] == 're'
assert DOCTOPIC['interview'] == 'in'
assert DOCTOPIC['in-brief'] == 'pr'

# Novos atributos (requer instância de Article)
# article.sps_doctype → retorna o @article-type do v71
# article.legacy_doctype → retorna o código legado do v71

Algum cenário de contexto que queira dar?

Documentos no formato JATS/XML usam o atributo @article-type diretamente (e.g. article-type="retraction"). Quando esse valor é armazenado no campo v71, o document_type property retornava 'undefined' para tipos como retraction, data-article, reply, etc., que não estavam no dicionário.

A issue foi atualizada para incluir o dicionário DOCTOPIC do SPS 1.10, que define a correspondência bidirecional entre valores @article-type e códigos legados. Os mapeamentos de códigos legados foram corrigidos para alinhar com essa correspondência (e.g. scrapid-communication, prin-brief).

Os novos atributos sps_doctype e legacy_doctype permitem obter o tipo de documento em ambos os formatos (SPS e legado) a partir do campo v71, facilitando a compatibilidade entre os sistemas.

Screenshots

N/A

Quais são tickets relevantes?

Referências

  • SciELO Publishing Schema — <article> — tabela de valores permitidos para @article-type
  • Dicionário DOCTOPIC do SPS 1.10 — correspondência do novo para o velho para manter a compatibilidade
Original prompt

This section details on the original issue you should resolve

<issue_title>Atualizar a lista de tipos de documentos</issue_title>
<issue_description>Complete os tipos de documentos com os valores da coluna @article-type

addendum adendo Um trabalho publicado que agrega informação ou esclarecimento a outro trabalho (é diferente do tipo "errata" que corrige um erro em um material publicado previamente).
research-article artigo de pesquisa Artigo que comunica uma pesquisa original.
data-article artigo de dados Artigo que descreve dados de pesquisa no texto do artigo ou disponibilizados em um repositório de dados.
review-article artigo de revisão Artigo que sumariza criticamente o conhecimento científico sobre um determinado tema. Também conhecido como revisão de literatura.
letter carta Carta dirigida ao periódico, tipicamente comentando um trabalho publicado.
article-commentary comentário de artigo Um documento cujo objeto ou foco é(são) outro(s) documentos; documento que comenta outros documentos. Este tipo de documento pode ser usado quando o(a) editor(a) de uma publicação convida um(a) autor(a) com uma opinião oposta para comentar um documento controverso e então publica os dois documentos juntos. O tipo "editorial" que tem similaridade é reservado para comentários escritos pelo(a) editor(a) ou membro da equipe editorial ou autor(a) convidado(a).
brief-report comunicação breve Comunicação sucinta de resultados de pesquisa.
rapid-communication comunicação rápida Atualização de uma pesquisa ou outros itens noticiosos.
clinical-instruction diretrizes ou normas Documento de um guia ou diretriz estabelecida por uma autoridade biomédica ou de outra área como um comitê, sociedade, ou agência do governo.
oration discurso Documento de uma fala ou apresentação oral.
discussion discussão Discussão convidada relacionado com um documento específico ou um número do periódico.
editorial editorial ou introdução Peça de opinião, declaração política ou comentário geral escrito por membro da equipe editorial (com autoria e título próprio diferente do título da seção).
review-article ensaio Reflexão circunstanciada, com maior liberdade por parte do(a) autor(a) para defender determinada posição, que vise a aprofundar a discussão ou que apresente nova contribuição/abordagem a respeito de tema relevante.
other entrevista Ato de entrevistar ou ser entrevistado(a). É uma conversa entre duas ou mais pessoas com um fim determinado com perguntas feitas pelo(a) entrevistador(a) de modo a obter informação necessária por parte do(a) entrevistado(a).
correction errata Modificação ou correção de material publicado previamente. Em inglês é chamado também de "correction". (O tipo "adendo" aplica-se apenas para material adicionado a um material publicado previamente).
other Expediente Anual(Ad Hoc) Documento de publicação anual que apresenta a composição completa do corpo editorial, incluindo editores de seção e conselho editorial, bem como a lista de pareceristas ad hoc que colaboraram com o processo de revisão por pares ao longo do ano. Este documento visa a registrar e agradecer a contribuição de todos os envolvidos na publicação do periódico, reforçando o compromisso com a transparência editorial.
expression-of-concern Manifestação de Preocupação Documento publicado pelo periódico para alertar os leitores sobre possíveis problemas em um documento previamente publicado, como indícios de má conduta ou erros graves ainda em investigação. A manifestação não confirma as suspeitas, mas informa a comunidade científica até a conclusão da apuração.
review-article métodos Documento que descreve avanços metodológicos, incluindo métodos inovadores e aprimoramento de métodos existentes. O documento deve incluir evidências da eficácia do método e comparações com os métodos anteriormente disponíveis.
obituary obituário, registro Anúncio do falecimento ou elogio a um(a) colega falecido(a) recentemente, com análise da obra e da contribuição do autor homenageado com aporte de conteúdo científico.
reviewer-report parecer de artigo aprovado Documento de análise de um manuscrito que comunica pesquisa com avaliação da sua relevância, dos métodos aplicados e apresentação e discussão dos resultados obtidos. O parecer destaca as contribuições da pesquisa que recomendam sua aceitação e as recomendações de correções e aperfeiçoamentos.
article-commentary posicionamento ou pensamento coletivo Documento, posição ou pensamento coletivo elaborado em conjunto com pesquisadores(as) experts em determinados assuntos.
case-report relato de caso Estudo de caso, relato de caso, ou outra descrição de um caso.
book-review resenha crítica de livro Resenha ou análise crítica de um ou mais liv...

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

… Schema

Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
Copilot AI changed the title [WIP] Update document types list with article type values Atualizar a lista de tipos de documentos com valores @article-type Mar 10, 2026
'sc': 'rapid-communication',
'tr': 'research-article',
'up': 'undefined'
'up': 'undefined',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot considere também esta tabela para conferir os valores
ab | abstracts
an | announcements
ax | annex
co | comments
cr | case report
ct | clinical trial
ed | editorial
er | correction
in | interview
le | letter
mt | methodology
oa | original article
pr | press release
pv | point-of-view
ra | review article
rc | recount
rn | research note
sc | brief communication
tr | technical report
up | update

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross-referenced the legacy codes table with the issue's @article-type mapping table and made the following corrections in fb7eda0:

Legacy code mapping fixes:

  • in (interview): editorialother
  • mt (methodology): research-articlereview-article
  • sc (brief communication): rapid-communicationbrief-report

Added missing @article-type identity mappings:

  • clinical-instruction, discussion, expression-of-concern, obituary, oration, reviewer-report

…iewer feedback

Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
'ed': 'editorial',
'er': 'correction',
'in': 'editorial',
'in': 'other',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot in é igual a interview e não other, mt é methodology.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 776740c: 'in': 'interview' and 'mt': 'methodology'.

Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
'sc': 'brief-report',
'tr': 'research-article',
'up': 'undefined'
'up': 'undefined',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot up = rapid-communication

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f556ec4: 'up': 'rapid-communication'.

Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
'ed': 'editorial',
'er': 'correction',
'in': 'editorial',
'in': 'interview',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot 'in' deve ser other, pois entrevista não é identificada como tipo relevante; e mt é equivalente a review-article

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 3135883: 'in': 'other' and 'mt': 'review-article'.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 0d3fba8 based on the DOCTOPIC dict from the updated issue: 'in': 'interview' (confirmed by 'interview': 'in' in DOCTOPIC) and 'mt': 'review-article'.

Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Este PR amplia o dicionário article_types para aceitar diretamente valores JATS @article-type (mapeando cada valor para si mesmo) e corrige alguns mapeamentos de códigos legados, evitando que document_type retorne 'undefined' quando v71 já contém um valor JATS válido.

Changes:

  • Corrige mapeamentos de códigos legados (in, mt, sc, up) no dicionário article_types.
  • Adiciona mapeamentos de identidade para valores JATS @article-type do SciELO Publishing Schema.
  • Adiciona teste para garantir que document_type suporte valores JATS armazenados diretamente em v71.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
xylose/choices.py Ajusta mapeamentos legados e adiciona entradas de identidade para valores JATS @article-type.
tests/test_document.py Adiciona teste cobrindo resolução de document_type quando v71 contém valores JATS diretamente.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

]:
article.data['article']['v71'] = [{u'_': article_type}]
self.assertEqual(article.document_type, article_type)

Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test only covers the new identity mappings (e.g. v71='retraction' -> 'retraction') but it doesn’t assert the corrected legacy-code mappings introduced in this PR (in/mt/sc/up). Add assertions for v71 values 'in', 'mt', 'sc', and 'up' mapping to 'other', 'review-article', 'brief-report', and 'rapid-communication' respectively, so the behavior change is protected by unit tests.

Suggested change
def test_document_type_from_legacy_v71_values(self):
article = self.article
legacy_mappings = {
u'in': u'other',
u'mt': u'review-article',
u'sc': u'brief-report',
u'up': u'rapid-communication',
}
for legacy_value, expected_type in legacy_mappings.items():
article.data['article']['v71'] = [{u'_': legacy_value}]
self.assertEqual(article.document_type, expected_type)

Copilot uses AI. Check for mistakes.
article.data['article']['v71'] = [{u'_': u'invalid'}]
self.assertEqual(article.document_type, u'undefined')

def test_document_type_from_article_type_attribute(self):
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test name mentions an "article_type attribute", but the test is setting the legacy field v71 directly. Renaming it to reflect what it actually validates (e.g., that document_type accepts JATS @article-type values stored in v71) would avoid confusion for future maintainers.

Suggested change
def test_document_type_from_article_type_attribute(self):
def test_document_type_accepts_jats_article_type_values_from_v71(self):

Copilot uses AI. Check for mistakes.
@robertatakenaka robertatakenaka marked this pull request as ready for review March 10, 2026 22:56
@robertatakenaka
Copy link
Copy Markdown
Member

@copilot leia novamente a descrição do issue, pois há novos detalhes, e refatore as mudanças

…doctype properties

Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
Co-authored-by: robertatakenaka <505143+robertatakenaka@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Mar 11, 2026

@copilot leia novamente a descrição do issue, pois há novos detalhes, e refatore as mudanças

Refactored in 0d3fba8 and 6f0909b based on the updated issue description:

  • Updated article_types legacy mappings to match the DOCTOPIC correspondence (anannouncement, ininterview, prin-brief, scrapid-communication, added reretraction, zzother)
  • Added all @article-type identity mappings from the DOCTOPIC dict (books-received, calendar, clinical-trial, collection, dissertation, editorial-material, guideline, interview, introduction, meeting-report, news, product-review, reprint, technical-report, translation)
  • Added DOCTOPIC dict to choices.py (new → old correspondence)
  • Added sps_doctype and legacy_doctype properties to Article class
  • Added tests for all new functionality (619 tests pass)

Copilot AI changed the title Atualizar a lista de tipos de documentos com valores @article-type Atualizar a lista de tipos de documentos com valores @article-type, DOCTOPIC e novos atributos Mar 11, 2026
@robertatakenaka robertatakenaka requested a review from Copilot March 11, 2026 16:43
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +131 to +158
'addendum': 'addendum',
'book-review': 'rc',
'books-received': 'books-received',
'brief-report': 'rn',
'calendar': 'calendar',
'clinical-trial': 'oa',
'collection': 'zz',
'correction': 'er',
'discussion': 'discussion',
'dissertation': 'dissertation',
'editorial-material': 'ed',
'in-brief': 'pr',
'introduction': 'ed',
'meeting-report': 'meeting-report',
'news': 'news',
'obituary': 'obituary',
'oration': 'oration',
'partial-retraction': 'partial-retraction',
'product-review': 'product-review',
'reply': 'reply',
'reprint': 'reprint',
'retraction': 're',
'translation': 'translation',
'technical-report': 'oa',
'other': 'zz',
'guideline': 'guideline',
'interview': 'in',
'data-article': 'data-article',
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In DOCTOPIC, values are meant to be legacy v71 codes (e.g. ax, rc, rn). However, several entries map to non-legacy strings (e.g. addendum: 'addendum' even though the legacy code already exists as ax). This makes legacy_doctype return values that are not actually legacy codes. Consider mapping only to real legacy codes (e.g. addendum -> ax) and omitting entries that have no legacy equivalent (so callers can get None).

Suggested change
'addendum': 'addendum',
'book-review': 'rc',
'books-received': 'books-received',
'brief-report': 'rn',
'calendar': 'calendar',
'clinical-trial': 'oa',
'collection': 'zz',
'correction': 'er',
'discussion': 'discussion',
'dissertation': 'dissertation',
'editorial-material': 'ed',
'in-brief': 'pr',
'introduction': 'ed',
'meeting-report': 'meeting-report',
'news': 'news',
'obituary': 'obituary',
'oration': 'oration',
'partial-retraction': 'partial-retraction',
'product-review': 'product-review',
'reply': 'reply',
'reprint': 'reprint',
'retraction': 're',
'translation': 'translation',
'technical-report': 'oa',
'other': 'zz',
'guideline': 'guideline',
'interview': 'in',
'data-article': 'data-article',
'addendum': 'ax',
'book-review': 'rc',
'brief-report': 'rn',
'clinical-trial': 'oa',
'collection': 'zz',
'correction': 'er',
'editorial-material': 'ed',
'in-brief': 'pr',
'introduction': 'ed',
'retraction': 're',
'technical-report': 'oa',
'other': 'zz',
'interview': 'in',

Copilot uses AI. Check for mistakes.
Comment on lines +2263 to +2264
# Otherwise return the value as-is (it may be a legacy code)
return article_type_code
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

legacy_doctype currently returns article_type_code as-is when it is not found in choices.DOCTOPIC. That means an invalid/unrecognized v71 value (e.g. 'invalid') will be returned instead of None, and some non-legacy @article-type strings can also be returned depending on DOCTOPIC contents. Consider returning None when v71 is neither a known legacy code nor mappable via DOCTOPIC (and, if needed, explicitly validate legacy codes against a whitelist such as the 2-letter keys in choices.article_types).

Suggested change
# Otherwise return the value as-is (it may be a legacy code)
return article_type_code
# If the v71 value is already a known legacy code, return it
if article_type_code in choices.article_types:
return article_type_code
# Unknown or invalid v71 value
return None

Copilot uses AI. Check for mistakes.
def test_legacy_doctype_article_type_self_mapped(self):
article = self.article
article.data['article']['v71'] = [{u'_': u'data-article'}]
self.assertEqual(article.legacy_doctype, u'data-article')
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test locks in the behavior that legacy_doctype returns the input @article-type ('data-article') when there is no legacy mapping. That conflicts with the intent implied by the property name and docstring (returning a legacy v71 code). If the desired behavior is “legacy code or None when not available”, update this test accordingly and adjust legacy_doctype/DOCTOPIC so unmapped @article-type values yield None.

Suggested change
self.assertEqual(article.legacy_doctype, u'data-article')
self.assertIsNone(article.legacy_doctype)

Copilot uses AI. Check for mistakes.
Comment on lines +2804 to +2817
def test_legacy_doctype(self):
article = self.article
self.assertEqual(article.legacy_doctype, u'oa')

def test_legacy_doctype_from_article_type(self):
article = self.article
article.data['article']['v71'] = [{u'_': u'retraction'}]
self.assertEqual(article.legacy_doctype, u're')

def test_legacy_doctype_from_legacy_code(self):
article = self.article
article.data['article']['v71'] = [{u'_': u'er'}]
self.assertEqual(article.legacy_doctype, u'er')

Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There’s no test covering legacy_doctype when v71 contains an invalid/unrecognized value (similar to the existing test_invalid_document_type / test_sps_doctype_invalid). Adding an explicit test for this case will help lock in the intended behavior (likely None).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Atualizar a lista de tipos de documentos

3 participants