Repository navigation
feat(document): draw the document as paper, and say which page every excerpt is on (E13-T12) - #108
Merged
Merged
Conversation
…excerpt is on E13-T12. The product says "this is in your document" and the person looks at the paper in her hand. On paper there are numbered pages; on screen there was a single block of twenty-five thousand characters and no way to tie one to the other. The extractor has been writing ===== PÁGINA n ===== between sheets all along, in core/pdf_extract.py, and nothing used it. MarkedText now draws each page as a sheet with "Página 3 de 14", and every excerpt says which page it is on: the topics in the journey, the marked items in the lawyer's review. Where the page is computed matters. It belongs to the service, not the screen, because the page is a fact about the document and the document is on that side; computing it in the journey would mean shipping the whole extracted text to a screen that only needs a label. lib/pages.ts still exists and is still tested, because splitting into sheets to draw them is a different job from attributing one position, and the drawing side genuinely has the text. A document with no separator gets null, never "page 1". Inventing the number would fabricate exactly the datum this is here to carry, and an older document extracted before the separator existed is precisely the case that would get a confident wrong answer. Two details the marks needed. An item crossing a page break stays on the sheet where it starts, because cutting it in two would give the person two marks for one excerpt. And the sheet's text is the raw slice, never trimmed: the marks are drawn against document positions, and trimming would shift every mark on that sheet. Measured on the real 14-page agravo: 40 marked items spread across pages 1, 2, 3, 4, 6, 8, 11, 12 and 14. The five published topics all land on page 1, which is right for a recursal piece, whose opening carries the parties and what is being asked.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Sexta fatia do E13 (#23).
O problema
O produto diz "isto está no seu documento" e a pessoa olha para o papel na mão dela. No papel há páginas numeradas; na tela havia um bloco de vinte e cinco mil caracteres e nenhuma forma de ligar um ao outro.
Afirmação cara demais de conferir não é conferível na prática: num agravo de catorze folhas, achar uma frase custa varrer as catorze.
O dado já existia
O extrator escreve
===== PÁGINA n =====entre as folhas desde sempre, emcore/pdf_extract.py, e nada usava. Agora oMarkedTextdesenha cada página como folha com "Página 3 de 14", e todo trecho diz em que página está: os tópicos da jornada e os itens marcados na revisão do advogado.Onde a página é calculada importa
No serviço, não na tela. A página é fato do documento e o documento está daquele lado; calcular na jornada exigiria mandar o texto extraído inteiro para uma tela que só precisa de um rótulo.
O
lib/pages.tscontinua existindo e testado, porque separar em folhas para desenhá-las é trabalho diferente de atribuir uma posição, e o lado que desenha genuinamente tem o texto.Documento sem separador recebe
null, nunca "página 1"Inventar o número fabricaria exatamente o dado que isto existe para trazer. E documento antigo, extraído antes de o separador existir, é justamente o caso que receberia uma resposta errada com cara de certa.
Dois detalhes que a marcação exigiu
Item que atravessa a virada de página fica na folha onde começa. Recortá-lo em dois daria à pessoa duas marcações para um trecho.
O texto da folha é a fatia crua, nunca aparada. As marcações são desenhadas contra as posições do documento, e aparar deslocaria toda marcação daquela folha.
Medido no agravo real de 14 páginas
40 itens marcados, distribuídos pelas páginas 1, 2, 3, 4, 6, 8, 11, 12 e 14. Os cinco tópicos publicados caem todos na página 1, o que está certo para uma peça recursal: a abertura carrega as partes e o que está sendo pedido.
210 testes no serviço, 96 no aplicativo, lint e build limpos.