Refatora biblioteca com suporte a acessos a livros nos moldes COUNTER R5.1#57
Merged
pitangainnovare merged 22 commits intoscieloorg:mainfrom May 1, 2026
Merged
Conversation
Co-authored-by: pitangainnovare <158627036+pitangainnovare@users.noreply.github.com>
…arity Co-authored-by: pitangainnovare <158627036+pitangainnovare@users.noreply.github.com>
Co-authored-by: pitangainnovare <158627036+pitangainnovare@users.noreply.github.com>
Co-authored-by: pitangainnovare <158627036+pitangainnovare@users.noreply.github.com>
- Updated requirements.txt to use scielo_log_validator@0.5.1 - Added PATTERN_BUNNYCDN_LOG_FORMAT to values.py for pipe-delimited logs - Created opac_bunnynet.py translator (delegates to OPAC translator) - Updated log_handler.py to detect and parse bunnynet format - Added Unix timestamp date handling in format_date() - Enhanced match_with_best_pattern() to detect pipe-delimited format - Modified parse_line() to handle bunnynet-specific fields - Created test fixture usage.bunnynet.log with sample logs - Added comprehensive tests in test_opac_bunnynet.py and test_log_handler.py - All new tests passing (6/6) Co-authored-by: pitangainnovare <158627036+pitangainnovare@users.noreply.github.com>
Co-authored-by: pitangainnovare <158627036+pitangainnovare@users.noreply.github.com>
…rom logs Co-authored-by: pitangainnovare <158627036+pitangainnovare@users.noreply.github.com>
…examples Co-authored-by: pitangainnovare <158627036+pitangainnovare@users.noreply.github.com>
- Replace usage.bunnynet.log with usage.scl.bunnynet.log - Replace test_books_access_examples.py with test_counter_books.py - Add usage.books.log fixture with real Apache and BunnyCDN book log lines - Add scielo_usage_counter/utils/metadata module for document/source indexing
- Remove import of tests.fixtures.books_real_logs in test_log_handler.py and test_books.py - Define BOOKS_LOG_EXPECTED inline with per-test expected values - Read raw log lines from tests/fixtures/usage.books.log - Remove the now-unused books_real_logs.py Python fixture
…or 0.10 - format_client_name: use client_name() instead of removed client_short_name() - format_client_version: replace device.UNKNOWN with 'UNK' fallback - Update processed fixture files with regenerated client names (SF→Safari, CH→Chrome, FF→Firefox, CM→Chrome Mobile) - Update dataverse fixture stats (ignored_lines_static_resources: 1172→1168 due to xml removal from EXTENSIONS_STATIC)
- parse_log.py: translate log messages, argparse help, fix shebang, fix contradictory --validate help text (was 'Disable' but action stores True), fix argparse splat to use vars(args) instead of args.__dict__ - download_geomap.py: translate exception messages and argparse help
- values.py: remove duplicate 'tbz' entry in EXTENSIONS_DOWNLOAD, remove 'xml' from EXTENSIONS_STATIC (was also in EXTENSIONS_DOWNLOAD) - file_utils.py: remove unused translate_path() referencing non-existent LOG_PATH_TRANSLATOR, remove unused import - opac_alpha.py: fix typo _extract_artifitial_pid → _extract_artificial_pid
- Add __init__ to initialize self.__map = None - Replace getattr(self, '_GeoIp__map', None) with self.map in ip_to_geolocation
- Update scielo_log_validator requirement from 1.0.0 to 2.0.0 - Add scielo_scholarly_data to setup.py install_requires - Add .idea/ to .gitignore
- Add Books URL translator for scielo.org/id/<book>/<chapter> patterns - Support HTML, PDF, EPUB and XHTML media formats for books - Add book-level and chapter-level metrics with unique counting - Update counter with Books R5.1 access counting logic - Update URLTranslationManager to dispatch to books translator
- Add publisher_name, subject_area_capes, subject_area_wos, year_of_publication to classic, opac, opac_alpha, dataverse and preprints translators - Update translator tests with new expected fields - Add BunnyCDN format test cases for opac translator
This was
linked to
issues
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
O que esse PR faz?
Este PR prepara o release v2.0.0 do scielo-usage-counter com suporte a formato BunnyCDN, tradutor de URLs do SciELO Books com contagem R5.1 de livros e capítulos, módulo de metadados para indexação de documentos e fontes no OpenSearch, correção de compatibilidade do
device-detector0.10, tradução de strings de português para inglês em todos os scripts CLI, limpeza de código, correção do GeoIp, melhoria de fixtures e atualização de dependências.O README foi reescrito com env vars, CLI atualizado, library usage, seção de features
Onde a revisão poderia começar?
scielo_usage_counter/log_handler.py:397-409— mudança emformat_client_nameeformat_client_version(compatibilidade device-detector)scielo_usage_counter/translator/books.py— novo tradutor de URLs do SciELO Booksscielo_usage_counter/values.py—PATTERN_BUNNYCDN_LOG_FORMAT+ limpeza de duplicatasscielo_usage_counter/utils/metadata/— novo módulo de metadadosComo este poderia ser testado manualmente?
Algum cenário de contexto que queira dar?
Este PR é parte do esforço de modernização das bibliotecas SciELO, em conjunto com:
As mudanças de compatibilidade com device-detector 0.10 são breaking changes para o formato de saída: nomes de client agora são completos (Chrome em vez de CH, Firefox em vez de FF). As fixtures processadas foram regeneradas.
Screenshots
N/A
Quais são tickets relevantes?
#53
#55
Referências
N/A