Skip to content
This repository has been archived by the owner on Aug 23, 2022. It is now read-only.

Time bug fix #165

Closed
wants to merge 3 commits into from
Closed

Time bug fix #165

wants to merge 3 commits into from

Conversation

DocEd
Copy link
Collaborator

@DocEd DocEd commented Jul 27, 2018

This segment of the code caused a problem with allocation of memory.
It looks like findMaxTime() was the culprit returning a very high number (possibly the number of hours since 1900??)

This modification works, but may effect legacy ccRecords that were created outside the Postgres pipeline. I'm not very familiar with that aspect, so this needs review in the context of preserving legacy features.

I have removed reference to is.na(tadm) because this field is always present in the new system (A record can't exist without an admission time)

Many thanks in advance for input.

DocEd added 2 commits July 27, 2018 10:22
The new anonymised ccRecords were causing R to crash when using create_cctable(). This is because the findMaxTime function was returning the number of hours since 1970 and forcing vector allocation to this amount. This fixes the issue
@DocEd
Copy link
Collaborator Author

DocEd commented Jul 27, 2018

Not sure. I'll check with Roma a little later on today

further conditional logic added to account for null return from findMaxTime()
@@ -3,3 +3,5 @@ Makefile
.travis.yml
appveyor.yml
paper.md
^.*\.Rproj$
^\.Rproj\.user$
Copy link
Collaborator

Choose a reason for hiding this comment

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

You don't need to add these to the PR. It should just be the things needed to fix the issue you are worried about.

@@ -24,3 +24,5 @@ vignettes/*.pdf

# OAuth2 token, see https://github.com/hadley/httr/releases/tag/v0.3
*.httr-oauth
.Rproj.user
*.Rproj
Copy link
Collaborator

Choose a reason for hiding this comment

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

You wouldn't normally add these to the git repo either. There is a tendency to put IDE / editor specific ignore stuff in your system gitignore to prevent it from getting too crazy. That said, this has the same, you probably wouldn't add it to a PR as it isn't relevant property as above.

@@ -466,6 +474,8 @@ getEpisodePeriod <- function (e, unit="hours") {
if (period_length == 0)
period_length <- period_length + 1
}


Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you adding two blank lines here? What are they for?

if (is.na(tadm) || is.na(tdisc))
period_length <- findMaxTime(e)
else {
if (is.na(tdisc)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

tadm can probably be NA in general. It is only a specific property of the dataset you have that it cannot.

as.POSIXct.numeric(findMaxTime(e), origin = "1970-01-01 00:00:00"), tadm, units = unit)
))
}
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you finding max time twice?

@klapaukh
Copy link
Collaborator

The failing tests are actually things which are using getEpisodePeriod which you have been modifying. So I think that yes, those failing tests could be relevant.

@maelle maelle closed this Aug 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants