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

fixed reference rds #105

Closed
wants to merge 1 commit into from
Closed

fixed reference rds #105

wants to merge 1 commit into from

Conversation

finlaycampbell
Copy link
Collaborator

@finlaycampbell finlaycampbell commented Jun 6, 2019

See Issue #104 - This looks like previously buggy behaviour that was fixed in the update. The command z[k = nocoords] should only be subsetting columns, but the saved, subsetted reference linelist has 12 rows whereas the original linelist has 13. In the current version both the pre-subsetted and post-subsetted linelists have 13 rows. I've overwritten rds/z.rds with the new output, as this gives the expect output.

@finlaycampbell
Copy link
Collaborator Author

Thoughts @zkamvar? Would be nice to have everything up and running for the Bogota workshop.

@zkamvar
Copy link
Member

zkamvar commented Jun 6, 2019

I don't think this is the appropriate solution to fix #104 for a couple of reasons:

  1. If you look back and check out the files from the history (https://github.com/reconhub/epicontacts/commits/16518beb06bfd467fc517e60b75ae8a833ef195d/tests/testthat/rds/z.rds), they all have 12 rows in the tibble (whereas the current one has 13 where the contact information is completely blank.

  2. The current output is not well-formatted. Dates are numeric values and there is an extra id.1 column.

output from test
library(epicontacts)
ebola_sim <- outbreaks::ebola_sim
x <- make_epicontacts(ebola_sim$linelist,
                      ebola_sim$contacts,
                      id = "case_id",
                      to = "case_id", from = "infector",
                      directed = FALSE)

dates <- as.Date(c("2014-04-08","2015-03-28"))


id <- names(which.max(get_degree(x, "out")))
z <- thin(subset(x, cluster_id = id), 2)
nocoords <- grep("(lat|lon)", names(z$linelist), perl = TRUE, invert = TRUE) - 1
z
#> 
#> /// Epidemiological Contacts //
#> 
#>   // class: epicontacts
#>   // 13 cases in linelist; 12 contacts;  non directed 
#> 
#>   // linelist
#> 
#> # A tibble: 13 x 12
#>    id    generation date_of_infecti… date_of_onset date_of_hospita…
#>    <chr>      <int>            <dbl>         <dbl>            <dbl>
#>  1 a6c6…          5            16226         16237            16239
#>  2 e4be…          6            16238         16243            16246
#>  3 e278…          7            16245         16252            16261
#>  4 916d…          6            16238         16264            16269
#>  5 4c10…          7            16268         16271            16271
#>  6 1f16…          7            16266         16277            16277
#>  7 c259…          7            16265         16275            16281
#>  8 8188…          7            16267         16284            16285
#>  9 ee65…          7            16268         16282            16288
#> 10 9f0c…          8            16276         16289            16290
#> 11 8863…          9            16290         16300            16302
#> 12 6ca9…          7            16267         16297            16306
#> 13 3ff1…         NA               NA            NA               NA
#> # … with 7 more variables: date_of_outcome <dbl>, outcome <chr>,
#> #   gender <chr>, hospital <chr>, lon <dbl>, lat <dbl>, id.1 <chr>
#> 
#>   // contacts
#> 
#> # A tibble: 12 x 3
#>    from   to     source 
#>    <chr>  <chr>  <chr>  
#>  1 a6c614 3ff1bc funeral
#>  2 a6c614 e4bee8 other  
#>  3 e4bee8 e27816 other  
#>  4 a6c614 916d0a other  
#>  5 916d0a 4c1040 other  
#>  6 916d0a 1f1620 other  
#>  7 916d0a c2595d other  
#>  8 916d0a 8188cd other  
#>  9 916d0a ee65e4 other  
#> 10 c2595d 9f0c37 other  
#> 11 9f0c37 88632e other  
#> 12 916d0a 6ca927 other
z$linelist
#>        id generation date_of_infection date_of_onset
#> 1  a6c614          5             16226         16237
#> 2  e4bee8          6             16238         16243
#> 3  e27816          7             16245         16252
#> 4  916d0a          6             16238         16264
#> 5  4c1040          7             16268         16271
#> 6  1f1620          7             16266         16277
#> 7  c2595d          7             16265         16275
#> 8  8188cd          7             16267         16284
#> 9  ee65e4          7             16268         16282
#> 10 9f0c37          8             16276         16289
#> 11 88632e          9             16290         16300
#> 12 6ca927          7             16267         16297
#> 13 3ff1bc         NA                NA            NA
#>    date_of_hospitalisation date_of_outcome outcome gender
#> 1                    16239           16247 Recover      f
#> 2                    16246              NA    <NA>      f
#> 3                    16261           16264 Recover      m
#> 4                    16269              NA    <NA>      f
#> 5                    16271              NA Recover      f
#> 6                    16277           16284   Death      f
#> 7                    16281           16322 Recover      m
#> 8                    16285           16311 Recover      f
#> 9                    16288           16289   Death      m
#> 10                   16290           16295   Death      f
#> 11                   16302           16307 Recover      m
#> 12                   16306           16313 Recover      m
#> 13                      NA              NA    <NA>   <NA>
#>              hospital       lon      lat   id.1
#> 1               other -13.21907 8.477376 a6c614
#> 2               other -13.22992 8.478471 e4bee8
#> 3  Connaught Hospital -13.24715 8.466236 e27816
#> 4               other -13.21633 8.480811 916d0a
#> 5               other -13.23596 8.477045 4c1040
#> 6               other -13.21373 8.468914 1f1620
#> 7   Military Hospital -13.26345 8.464106 c2595d
#> 8  Connaught Hospital -13.26120 8.463342 8188cd
#> 9  Connaught Hospital -13.23375 8.470376 ee65e4
#> 10              other -13.22357 8.483618 9f0c37
#> 11               <NA> -13.25422 8.460642 88632e
#> 12  Military Hospital -13.23645 8.468757 6ca927
#> 13               <NA>        NA       NA 3ff1bc

Created on 2019-06-06 by the reprex package (v0.3.0)

I think what needs to happen here is a re-think of what these tests are trying to accomplish and what the output should be. If we merge this PR, we are no longer testing for the truth, but rather just testing so that the tests pass.

@zkamvar zkamvar closed this Jun 6, 2019
@zkamvar zkamvar mentioned this pull request Jun 6, 2019
@finlaycampbell finlaycampbell deleted the fix-104 branch June 6, 2019 14:39
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.

2 participants