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

check format of vague numbers. fixed yearsuffix equal to 0. fixed tru… #35

Closed
wants to merge 1 commit into from

Conversation

EgoLaparra
Copy link
Contributor

  • Some numbers in the clincal data have the format "1-2" and produce match errors. I have added an exception when the number does not have a numeric format.

  • When a two digit year is equal to 00, YearSuffix produces a division by 0 error. I have tried to handle this.

  • If dayoftheyear - dayofthweek is less than 0 the truncation produces invalid values for dayofyear. If that happens I truncate to the day 1 of the year.

@@ -54,7 +54,8 @@ class AnaforaReader(val DCT: Interval)(implicit data: Data) {
} else if (value.forall(_.isDigit)) {
IntNumber(value.toInt)
} else {
VagueNumber(value)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand why this should be an error. Even if it's "2-3", isn't VagueNumber still an accurate description? If VagueNumber is giving you a problem in the scorer, maybe throw the exception in the scorer?

@@ -619,8 +622,10 @@ private[formal] object RepeatingInterval {
case IsoFields.QUARTER_YEARS =>
ldt.withMonth((ldt.getMonthValue - 1) / 4 + 1).withDayOfMonth(1).truncatedTo(ChronoUnit.DAYS)
case ChronoUnit.MONTHS => ldt.withDayOfMonth(1).truncatedTo(ChronoUnit.DAYS)
case ChronoUnit.WEEKS =>
ldt.withDayOfYear(ldt.getDayOfYear - ldt.getDayOfWeek.getValue + 1).truncatedTo(ChronoUnit.DAYS)
case ChronoUnit.WEEKS => ldt.getDayOfYear - ldt.getDayOfWeek.getValue compare 0 match {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems like this could be something simpler like

ldt.withDayOfYear((ldt.getDayOfYear - ldt.getDayOfWeek.getValue + 1) max 1).truncatedTo(ChronoUnit.DAYS)

Would that achieve the same thing?

@EgoLaparra EgoLaparra closed this Dec 22, 2017
@EgoLaparra EgoLaparra deleted the dev branch December 22, 2017 20:29
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