Skip to content

Commit 1bec254

Browse files
authored
Implement date offsets for Criteria queries. (#183)
Fixes #167, #168.
1 parent 8f25631 commit 1bec254

File tree

71 files changed

+3582
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+3582
-358
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Matches multiple files with brace expansion notation
7+
# Set default charset
8+
[*.{java,sql}]
9+
charset = utf-8
10+
indent_style = space
11+
indent_size = 2

pom.xml

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -88,25 +88,20 @@
8888
<repository>
8989
<id>ohdsi</id>
9090
<name>repo.ohdsi.org</name>
91-
<url>https://repo.ohdsi.org/nexus/content/repositories/releases</url>
92-
</repository>
93-
<repository>
94-
<id>ohdsi.thirdparty</id>
95-
<name>repo.ohdsi.org</name>
96-
<url>https://repo.ohdsi.org/nexus/content/repositories/thirdparty</url>
97-
</repository>
98-
<repository>
99-
<id>ohdsi.snapshots</id>
100-
<name>repo.ohdsi.org-snapshots</name>
101-
<url>https://repo.ohdsi.org/nexus/content/repositories/snapshots</url>
102-
<releases>
103-
<enabled>false</enabled>
104-
</releases>
105-
<snapshots>
106-
<enabled>true</enabled>
107-
</snapshots>
91+
<url>https://repo.ohdsi.org/nexus/content/groups/public</url>
10892
</repository>
10993
</repositories>
94+
<pluginRepositories>
95+
<pluginRepository>
96+
<id>central</id>
97+
<url>https://repo.maven.apache.org/maven2</url>
98+
</pluginRepository>
99+
<pluginRepository>
100+
<id>ohdsi</id>
101+
<name>repo.ohdsi.org</name>
102+
<url>https://repo.ohdsi.org/nexus/content/groups/public</url>
103+
</pluginRepository>
104+
</pluginRepositories>
110105
<dependencies>
111106
<dependency>
112107
<groupId>com.fasterxml.jackson.core</groupId>

src/main/java/org/ohdsi/circe/cohortdefinition/ConditionOccurrence.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class ConditionOccurrence extends Criteria {
4747
public Concept[] conditionType;
4848

4949
@JsonProperty("ConditionTypeExclude")
50-
public boolean conditionTypeExclude = false;
50+
public Boolean conditionTypeExclude;
5151

5252
@JsonProperty("StopReason")
5353
public TextFilter stopReason;

src/main/java/org/ohdsi/circe/cohortdefinition/Criteria.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
*
2929
* @author Chris Knoll <cknoll@ohdsi.org>
3030
*/
31-
3231
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = As.WRAPPER_OBJECT)
3332
@JsonSubTypes({
3433
@JsonSubTypes.Type(value = ConditionEra.class, name = "ConditionEra"),
@@ -49,13 +48,17 @@
4948
@JsonSubTypes.Type(value = PayerPlanPeriod.class, name = "PayerPlanPeriod")
5049
})
5150
public abstract class Criteria {
51+
5252
public String accept(IGetCriteriaSqlDispatcher dispatcher) {
5353
return this.accept(dispatcher, null);
5454
}
5555

5656
public abstract String accept(IGetCriteriaSqlDispatcher dispatcher, BuilderOptions options);
5757

58-
@JsonProperty("CorrelatedCriteria")
58+
@JsonProperty("CorrelatedCriteria")
5959
public CriteriaGroup CorrelatedCriteria;
60-
60+
61+
@JsonProperty("DateAdjustment")
62+
public DateAdjustment dateAdjustment;
63+
6164
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2022 cknoll1.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.ohdsi.circe.cohortdefinition;
17+
18+
import com.fasterxml.jackson.annotation.JsonProperty;
19+
20+
/**
21+
*
22+
* @author cknoll1
23+
*/
24+
public class DateAdjustment {
25+
26+
public enum DateType {
27+
@JsonProperty("START_DATE")
28+
START_DATE,
29+
@JsonProperty("END_DATE")
30+
END_DATE
31+
};
32+
33+
@JsonProperty("StartWith")
34+
public DateType startWith = DateType.START_DATE;
35+
@JsonProperty("StartOffset")
36+
public int startOffset = 0;
37+
38+
@JsonProperty("EndWith")
39+
public DateType endWith = DateType.END_DATE;
40+
@JsonProperty("EndOffset")
41+
public int endOffset = 0;
42+
43+
}

0 commit comments

Comments
 (0)