Update Adv_3 Method to prevent invalid discards#99
Draft
Vanndher wants to merge 1 commit into
Draft
Conversation
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.
Descrição:
Este Pull Request introduz uma atualização lógica no pipeline de identificação longitudinal da PNADC (build_pnadc_panel.R), especificamente no estágio de pareamento Fuzzy (Avançado 3).
A modificação resolve uma vulnerabilidade crítica diagnosticada pela equipe (conforme alinhamento e documento de 15 de julho de 2026), onde o algoritmo descartava indivíduos válidos devido à falha na regra de exclusividade de candidatos (n() == 1).
Problema:
Anteriormente, o Avançado 3 ignorava o histórico de sucesso do indivíduo no Avançado 2. Ao buscar no espectro temporal completo, o código encontrava múltiplos candidatos válidos (incluindo aqueles já pareados com sucesso anteriormente), gerando um "empate fantasma". Como a regra exige apenas um candidato único, o empate forçava o descarte de todas as observações relacionadas àquele indivíduo, inflando artificialmente o atrito do painel nas ondas subsequentes.
Modificações Realizadas:
A solução adotada aplica um filtro de precedência (Regra 2) no fluxo de dados gerado pelo dplyr, executado logo após o self-join (nest) e estritamente antes do filtro de contagem de candidato único: