Skip to content

Commit

Permalink
fix: Include DynamicModel get value by key
Browse files Browse the repository at this point in the history
  • Loading branch information
dlangst committed Mar 24, 2022
1 parent 48d4fad commit 8be35b1
Show file tree
Hide file tree
Showing 58 changed files with 1,357 additions and 86 deletions.
9 changes: 8 additions & 1 deletion modules/annotator-for-clinical-data/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
Expand All @@ -20,18 +21,24 @@
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path=".apt_generated_tests">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
1 change: 1 addition & 0 deletions modules/annotator-for-clinical-data/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.apt_generated/
6 changes: 3 additions & 3 deletions modules/annotator-for-clinical-data/.project
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sf.eclipsecs.core.CheckstyleBuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package com.ibm.watson.health.acd.v1.model;

import java.lang.reflect.Field;
import java.util.List;

import com.google.gson.annotations.SerializedName;
Expand Down Expand Up @@ -133,5 +134,26 @@ public Boolean isHypothetical() {
public List<MedicationAnnotation> getMedication() {
return this.medication;
}

/**
* Returns the value from AllergyMedicationInd annotation by specified key.
*
* @param key the name of the field to get
*/
@Override
public Object get(String key) {
Object value = super.get(key);
if (value == null) {
try {
Field field = AllergyMedicationInd.class.getDeclaredField(key);
value = field.get(this);
} catch (NoSuchFieldException e) {
return null;
} catch (Exception e1) {
e1.printStackTrace();
}
}
return value;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*/
package com.ibm.watson.health.acd.v1.model;

import java.lang.reflect.Field;

import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.ibm.cloud.sdk.core.service.model.DynamicModel;
Expand Down Expand Up @@ -90,5 +92,26 @@ public Long getEnd() {
public String getCoveredText() {
return this.coveredText;
}

/**
* Returns the value from Annotation by specified key.
*
* @param key the name of the field to get
*/
@Override
public Object get(String key) {
Object value = super.get(key);
if (value == null) {
try {
Field field = Annotation.class.getDeclaredField(key);
value = field.get(this);
} catch (NoSuchFieldException e) {
return null;
} catch (Exception e1) {
e1.printStackTrace();
}
}
return value;
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*/
package com.ibm.watson.health.acd.v1.model;

import java.lang.reflect.Field;

import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.ibm.cloud.sdk.core.service.model.DynamicModel;
Expand Down Expand Up @@ -175,4 +177,25 @@ public String getSectionNormalizedName() {
public String getSectionSurfaceForm() {
return this.sectionSurfaceForm;
}

/**
* Returns the value from AssistanceAnnotation by specified key.
*
* @param key the name of the field to get
*/
@Override
public Object get(String key) {
Object value = super.get(key);
if (value == null) {
try {
Field field = AssistanceAnnotation.class.getDeclaredField(key);
value = field.get(this);
} catch (NoSuchFieldException e) {
return null;
} catch (Exception e1) {
e1.printStackTrace();
}
}
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package com.ibm.watson.health.acd.v1.model;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -717,4 +718,24 @@ public void setEvidenceSpans(final List<Reference> evidenceSpans) {
this.evidenceSpans = evidenceSpans;
}

/**
* Returns the value from AttributeValueAnnotation by specified key.
*
* @param key the name of the field to get
*/
@Override
public Object get(String key) {
Object value = super.get(key);
if (value == null) {
try {
Field field = AttributeValueAnnotation.class.getDeclaredField(key);
value = field.get(this);
} catch (NoSuchFieldException e) {
return null;
} catch (Exception e1) {
e1.printStackTrace();
}
}
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package com.ibm.watson.health.acd.v1.model;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -214,4 +215,25 @@ public CustomCollection getCancer(int index) {
CustomCollection customCollection = new CustomCollection();
return customCollection.convertToCustomCollection(listCancer.get(index));
}

/**
* Returns the value from CancerDiagnosis annotation by specified key.
*
* @param key the name of the field to get
*/
@Override
public Object get(String key) {
Object value = super.get(key);
if (value == null) {
try {
Field field = CancerDiagnosis.class.getDeclaredField(key);
value = field.get(this);
} catch (NoSuchFieldException e) {
return null;
} catch (Exception e1) {
e1.printStackTrace();
}
}
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package com.ibm.watson.health.acd.v1.model;

import java.lang.reflect.Field;
import java.util.List;

import com.google.gson.annotations.SerializedName;
Expand Down Expand Up @@ -625,4 +626,24 @@ public void setValueIndex(final Integer valueIndex) {
this.valueIndex = valueIndex;
}

/**
* Returns the value from Concept annotation by specified key.
*
* @param key the name of the field to get
*/
@Override
public Object get(String key) {
Object value = super.get(key);
if (value == null) {
try {
Field field = Concept.class.getDeclaredField(key);
value = field.get(this);
} catch (NoSuchFieldException e) {
return null;
} catch (Exception e1) {
e1.printStackTrace();
}
}
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
*/
package com.ibm.watson.health.acd.v1.model;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -291,4 +292,25 @@ public String getRangeEnd() {
return this.rangeEnd;
}

/**
* Returns the value from ConceptValue annotation by specified key.
*
* @param key the name of the field to get
*/
@Override
public Object get(String key) {
Object value = super.get(key);
if (value == null) {
try {
Field field = ConceptValue.class.getDeclaredField(key);
value = field.get(this);
} catch (NoSuchFieldException e) {
return null;
} catch (Exception e1) {
e1.printStackTrace();
}
}
return value;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
*/
package com.ibm.watson.health.acd.v1.model;

import java.lang.reflect.Field;

import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.ibm.cloud.sdk.core.service.model.DynamicModel;
Expand Down Expand Up @@ -242,4 +244,24 @@ public String getSectionSurfaceForm() {
return this.sectionSurfaceForm;
}

/**
* Returns the value from EjectionFractionAnnotation by specified key.
*
* @param key the name of the field to get
*/
@Override
public Object get(String key) {
Object value = super.get(key);
if (value == null) {
try {
Field field = EjectionFractionAnnotation.class.getDeclaredField(key);
value = field.get(this);
} catch (NoSuchFieldException e) {
return null;
} catch (Exception e1) {
e1.printStackTrace();
}
}
return value;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

package com.ibm.watson.health.acd.v1.model;

import java.lang.reflect.Field;

import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;
import com.ibm.cloud.sdk.core.service.model.DynamicModel;
Expand Down Expand Up @@ -93,4 +95,24 @@ public Float getTreatmentScore() {
return this.treatmentScore;
}

/**
* Returns the value from InsightModelAlcohol annotation by specified key.
*
* @param key the name of the field to get
*/
@Override
public Object get(String key) {
Object value = super.get(key);
if (value == null) {
try {
Field field = InsightModelAlcohol.class.getDeclaredField(key);
value = field.get(this);
} catch (NoSuchFieldException e) {
return null;
} catch (Exception e1) {
e1.printStackTrace();
}
}
return value;
}
}
Loading

0 comments on commit 8be35b1

Please sign in to comment.