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

get_clusters fix #108

Merged
merged 5 commits into from
Jun 11, 2019
Merged

get_clusters fix #108

merged 5 commits into from
Jun 11, 2019

Conversation

finlaycampbell
Copy link
Collaborator

See #107

@zkamvar
Copy link
Member

zkamvar commented Jun 10, 2019

@finlaycampbell, can you explain what's happening here and maybe write a test for this?

@finlaycampbell
Copy link
Collaborator Author

The output from igraph in the command below was coercing case IDs to character:

net_nodes <- setNames(data.frame(id =igraph::V(net)$id,
cluster_member = cs$membership,
stringsAsFactors = FALSE),
c("id", member_col))

This caused an error when trying to full_join this with linelist case IDs, if these were not characters. The fix coerces the igraph output IDs to whatever class the linelist case IDs are. I've added some tests that try get_clusters on IDs with different classes.

@zkamvar
Copy link
Member

zkamvar commented Jun 11, 2019

The output from igraph in the command below was coercing case IDs to character:

net_nodes <- setNames(data.frame(id =igraph::V(net)$id,
cluster_member = cs$membership,
stringsAsFactors = FALSE),
c("id", member_col))

This caused an error when trying to full_join this with linelist case IDs, if these were not characters. The fix coerces the igraph output IDs to whatever class the linelist case IDs are. I've added some tests that try get_clusters on IDs with different classes.

Can you add a test that checks if the input is a factor?

@codecov
Copy link

codecov bot commented Jun 11, 2019

Codecov Report

Merging #108 into master will increase coverage by 0.17%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #108      +/-   ##
==========================================
+ Coverage   83.76%   83.93%   +0.17%     
==========================================
  Files          19       19              
  Lines         659      660       +1     
==========================================
+ Hits          552      554       +2     
+ Misses        107      106       -1
Impacted Files Coverage Δ
R/get_clusters.R 100% <100%> (ø) ⬆️
R/make_epicontacts.R 95.74% <0%> (+2.12%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f5f401...992350f. Read the comment docs.

@finlaycampbell
Copy link
Collaborator Author

Done

@zkamvar
Copy link
Member

zkamvar commented Jun 11, 2019

This is failing on push, which might mean that this fix is affecting the new tests added in 7f5f401. Try merging master into this branch and see how the tests fare.

@zkamvar
Copy link
Member

zkamvar commented Jun 11, 2019

Either that, or it means that the tests are failing on this branch because the tests were failing earlier. The PR/push checks really are the USB-socket of checks.

@finlaycampbell
Copy link
Collaborator Author

Ah didn't realise I hadn't merged the master branch fixes - hopefully working now. I also had to update one of the reference rds files because it seemed to have been created using an older version of outbreaks.

@zkamvar
Copy link
Member

zkamvar commented Jun 11, 2019

Ah didn't realise I hadn't merged the master branch fixes - hopefully working now. I also had to update one of the reference rds files because it seemed to have been created using an older version of outbreaks.

In general, I'm against changing these tests because it's difficult to asses exactly what has changed, but IIRC, that particular test doesn't actually run anywhere but on a local machine (see #88), so it's all good.

@finlaycampbell
Copy link
Collaborator Author

In general, I'm against changing these tests because it's difficult to asses exactly what has changed, but IIRC, that particular test doesn't actually run anywhere but on a local machine (see #88), so it's all good.

Yeah agreed - generally I'm not sure how good of an idea referencing saved objects is.

@finlaycampbell finlaycampbell requested a review from zkamvar June 11, 2019 13:15
@zkamvar
Copy link
Member

zkamvar commented Jun 11, 2019

Yeah agreed - generally I'm not sure how good of an idea referencing saved objects is.

[narrator] It wasn't a good idea.

Copy link
Member

@zkamvar zkamvar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@finlaycampbell finlaycampbell merged commit 992350f into master Jun 11, 2019
@finlaycampbell finlaycampbell temporarily deployed to github-pages June 11, 2019 13:41 Inactive
@finlaycampbell finlaycampbell deleted the fix-107 branch April 28, 2020 09:15
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