Skip to content

Commit

Permalink
Implement date offsets for Criteria queries. (#183)
Browse files Browse the repository at this point in the history
Fixes #167, #168.
  • Loading branch information
chrisknoll authored Jul 18, 2023
1 parent 8f25631 commit 1bec254
Show file tree
Hide file tree
Showing 71 changed files with 3,582 additions and 358 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Matches multiple files with brace expansion notation
# Set default charset
[*.{java,sql}]
charset = utf-8
indent_style = space
indent_size = 2
29 changes: 12 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,25 +88,20 @@
<repository>
<id>ohdsi</id>
<name>repo.ohdsi.org</name>
<url>https://repo.ohdsi.org/nexus/content/repositories/releases</url>
</repository>
<repository>
<id>ohdsi.thirdparty</id>
<name>repo.ohdsi.org</name>
<url>https://repo.ohdsi.org/nexus/content/repositories/thirdparty</url>
</repository>
<repository>
<id>ohdsi.snapshots</id>
<name>repo.ohdsi.org-snapshots</name>
<url>https://repo.ohdsi.org/nexus/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>https://repo.ohdsi.org/nexus/content/groups/public</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2</url>
</pluginRepository>
<pluginRepository>
<id>ohdsi</id>
<name>repo.ohdsi.org</name>
<url>https://repo.ohdsi.org/nexus/content/groups/public</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ConditionOccurrence extends Criteria {
public Concept[] conditionType;

@JsonProperty("ConditionTypeExclude")
public boolean conditionTypeExclude = false;
public Boolean conditionTypeExclude;

@JsonProperty("StopReason")
public TextFilter stopReason;
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/org/ohdsi/circe/cohortdefinition/Criteria.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
*
* @author Chris Knoll <[email protected]>
*/

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = As.WRAPPER_OBJECT)
@JsonSubTypes({
@JsonSubTypes.Type(value = ConditionEra.class, name = "ConditionEra"),
Expand All @@ -49,13 +48,17 @@
@JsonSubTypes.Type(value = PayerPlanPeriod.class, name = "PayerPlanPeriod")
})
public abstract class Criteria {

public String accept(IGetCriteriaSqlDispatcher dispatcher) {
return this.accept(dispatcher, null);
}

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

@JsonProperty("CorrelatedCriteria")
@JsonProperty("CorrelatedCriteria")
public CriteriaGroup CorrelatedCriteria;


@JsonProperty("DateAdjustment")
public DateAdjustment dateAdjustment;

}
43 changes: 43 additions & 0 deletions src/main/java/org/ohdsi/circe/cohortdefinition/DateAdjustment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2022 cknoll1.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.ohdsi.circe.cohortdefinition;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
*
* @author cknoll1
*/
public class DateAdjustment {

public enum DateType {
@JsonProperty("START_DATE")
START_DATE,
@JsonProperty("END_DATE")
END_DATE
};

@JsonProperty("StartWith")
public DateType startWith = DateType.START_DATE;
@JsonProperty("StartOffset")
public int startOffset = 0;

@JsonProperty("EndWith")
public DateType endWith = DateType.END_DATE;
@JsonProperty("EndOffset")
public int endOffset = 0;

}
Loading

0 comments on commit 1bec254

Please sign in to comment.