Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: loanbook_demo and abcd_demo have no non-NA values for lei_direct_loantaker or lei respectively #349

Closed
jdhoffa opened this issue Mar 6, 2024 · 5 comments · Fixed by #354
Labels
feature a feature request or enhancement

Comments

@jdhoffa
Copy link
Member

jdhoffa commented Mar 6, 2024

Expected behaviour:
At least one non-NA value for the lei relevant column.

Observed behaviour:

library(r2dii.data)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

nrow(dplyr::filter(loanbook_demo, !is.na(lei_direct_loantaker)))
#> [1] 0

nrow(dplyr::filter(abcd_demo, !is.na(lei)))
#> [1] 0

Created on 2024-03-06 with reprex v2.1.0

@jdhoffa jdhoffa added the bug an unexpected problem or unintended behavior label Mar 6, 2024
@jdhoffa jdhoffa changed the title bug: loanbook_demo and abcd_demo have no non-NA values for lei_direct_loantaker or lei respectively feat: loanbook_demo and abcd_demo have no non-NA values for lei_direct_loantaker or lei respectively Mar 14, 2024
@jdhoffa jdhoffa added feature a feature request or enhancement and removed bug an unexpected problem or unintended behavior labels Mar 14, 2024
@jdhoffa
Copy link
Member Author

jdhoffa commented Mar 14, 2024

Weirdly, the lei columns seem to have been removed purposefully in #316

@cjyetman any idea why this was done? The LEI calculating functionality produces entirely fake LEIs and adds them to a subset of entries. It is particularly critical now that RMI-PACTA/r2dii.match#460 is merged.

@cjyetman
Copy link
Member

Weirdly, the lei columns seem to have been removed purposefully in #316

@cjyetman any idea why this was done? The LEI calculating functionality produces entirely fake LEIs and adds them to a subset of entries. It is particularly critical now that RMI-PACTA/r2dii.match#460 is merged.

Pretty sure I just started from https://github.com/RMI-PACTA/r2dii.data/blob/main/data-raw/loanbook_demo.csv and modified things to make it all fake... I guess I did not know to add LEIs to it.

@jdhoffa
Copy link
Member Author

jdhoffa commented Mar 14, 2024

But that's the thing, the LEI's were already calculated, and then they were explicitly removed in this line:

# remove LEIs
abcd_demo <- mutate(abcd_demo, lei = NA)

I was just curious if this was done intentionally/ why. But it sounds like there isn't a reason for it?

@cjyetman
Copy link
Member

But that's the thing, the LEI's were already calculated, and then they were explicitly removed in this line:

# remove LEIs
abcd_demo <- mutate(abcd_demo, lei = NA)

I was just curious if this was done intentionally/ why. But it sounds like there isn't a reason for it?

hmmm.... now that you point that out, I vaguely remember this being a last minute request from George (to avoid sharing anything sensitive?). Maybe @jacobvjk or George would remember?

@jdhoffa
Copy link
Member Author

jdhoffa commented Mar 14, 2024

Yeah, I had a feeling it was that.

In any case, there was never anything sensitive in the data, since those values are calculated programmatically/ randomly earlier on:

generate_lei <- function(id) {
# function to generate random but reproducible LEIs
# 4 characters, 2 zeroes, 12 characters, 2 check digits
alpha_num <- c(0:9, LETTERS)
withr::with_seed(
id,
{
four <- do.call(
paste0,
replicate(4, sample(0:9, 1, TRUE), FALSE)
)
twelve <- do.call(
paste0,
replicate(12, sample(alpha_num, 1, TRUE), FALSE)
)
two <- do.call(
paste0,
replicate(2, sample(0:9, 1, TRUE), FALSE)
)
}
)
paste0(four, "00", twelve, two)
}
vgenerate_lei <- Vectorize(generate_lei)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants