You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ctakes.apache.org by se...@apache.org on 2020/04/27 19:06:09 UTC
svn commit: r1877092 - in
/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core:
cr/JCasBuilder.java semantic/SemanticGroup.java semantic/SemanticTui.java
Author: seanfinan
Date: Mon Apr 27 19:06:09 2020
New Revision: 1877092
URL: http://svn.apache.org/viewvc?rev=1877092&view=rev
Log:
Refactoring :
Deprecated classes
Added:
ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cr/JCasBuilder.java
ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/semantic/SemanticGroup.java
ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/semantic/SemanticTui.java
Added: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cr/JCasBuilder.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cr/JCasBuilder.java?rev=1877092&view=auto
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cr/JCasBuilder.java (added)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cr/JCasBuilder.java Mon Apr 27 19:06:09 2020
@@ -0,0 +1,305 @@
+package org.apache.ctakes.core.cr;
+
+
+import org.apache.ctakes.core.util.doc.DocIdUtil;
+import org.apache.ctakes.core.util.doc.NoteSpecs;
+import org.apache.ctakes.core.util.doc.SourceMetadataUtil;
+import org.apache.ctakes.typesystem.type.structured.*;
+import org.apache.uima.UIMAException;
+import org.apache.uima.fit.factory.JCasFactory;
+import org.apache.uima.jcas.JCas;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+/**
+ * Facade to "easily" populate a JCas with creator, patient and note information.
+ *
+ * @author SPF , chip-nlp
+ * @version %I%
+ * @since 9/22/2019
+ * @deprecated Use JCasBuilder in core.util.doc
+ */
+@Deprecated
+final public class JCasBuilder {
+
+ // For compatibility with sql db : Timestamp format must be yyyy-mm-dd hh:mm:ss[.fffffffff]
+ static private final DateFormat DATE_FORMAT = new SimpleDateFormat( "yyyy-MM-dd hh:mm:ss" );
+
+ static private final String UNKNOWN_DATE = "UnknownDate";
+ static private final String UNKNOWN_GENDER = "UnknownGender";
+ static private final String UNKNOWN = "Unknown";
+
+
+ private String _institutionId = UNKNOWN;
+ private String _authorSpecialty = UNKNOWN;
+
+ private String _patientId = SourceMetadataUtil.UNKNOWN_PATIENT;
+ private long _patientNum = SourceMetadataUtil.UNKNOWN_PATIENT_NUM;
+
+ private String _firstName = UNKNOWN;
+ private String _middleName = UNKNOWN;
+ private String _lastName = UNKNOWN;
+
+ private String _birthday = UNKNOWN_DATE;
+ private String _deathday = UNKNOWN_DATE;
+ private String _gender = UNKNOWN_GENDER;
+
+
+ private String _instanceId = "";
+ // private long _instanceNum = -1;
+ private String _encounterId = "";
+// private int _encounterNum = -1;
+
+ private String _docId = DocIdUtil.NO_DOCUMENT_ID;
+ private String _docIdPrefix = DocIdUtil.NO_DOCUMENT_ID_PREFIX;
+ private String _docType = NoteSpecs.ID_NAME_CLINICAL_NOTE;
+ private String _docSubType = "";
+ private String _docStandard = "";
+ private int _docRevisionNum = 1;
+ private String _docTime = ""; //DATE_FORMAT.format( System.currentTimeMillis() );
+ private String _docPath = "";
+
+
+ private String _docText = "";
+
+ private boolean _overwrite = false;
+
+
+ public JCasBuilder overwrite() {
+ _overwrite = true;
+ return this;
+ }
+
+ public JCasBuilder setInstitutionId( final String institutionId ) {
+ _institutionId = institutionId;
+ return this;
+ }
+
+ public JCasBuilder setAuthorSpecialty( final String authorSpecialty ) {
+ _authorSpecialty = authorSpecialty;
+ return this;
+ }
+
+ public JCasBuilder setPatientId( final String patientId ) {
+ _patientId = patientId;
+ return this;
+ }
+
+ public JCasBuilder setPatientNum( final long patientNum ) {
+ _patientNum = patientNum;
+ return this;
+ }
+
+ public JCasBuilder setFirstName( final String firstName ) {
+ _firstName = firstName;
+ return this;
+ }
+
+ public JCasBuilder setMiddleName( final String middleName ) {
+ _middleName = middleName;
+ return this;
+ }
+
+ public JCasBuilder setLastName( final String lastName ) {
+ _lastName = lastName;
+ return this;
+ }
+
+ public JCasBuilder setBirthDay( final String birthday ) {
+ _birthday = birthday;
+ return this;
+ }
+
+ public JCasBuilder setDeathday( final String deathday ) {
+ _deathday = deathday;
+ return this;
+ }
+
+ public JCasBuilder setGender( final String gender ) {
+ _gender = gender;
+ return this;
+ }
+
+ public JCasBuilder setInstanceId( final String instanceId ) {
+ _instanceId = instanceId;
+ return this;
+ }
+
+ public JCasBuilder setEncounterId( final String encounterId ) {
+ _encounterId = encounterId;
+ return this;
+ }
+
+// public JCasBuilder setEncounterNum( final int encounterNum ) {
+// _encounterNum = encounterNum;
+// return this;
+// }
+
+ public JCasBuilder setDocId( final String docId ) {
+ _docId = docId;
+ return this;
+ }
+
+ public JCasBuilder setDocIdPrefix( final String docIdPrefix ) {
+ _docIdPrefix = docIdPrefix;
+ return this;
+ }
+
+ public JCasBuilder setDocType( final String docType ) {
+ _docType = docType;
+ return this;
+ }
+
+ public JCasBuilder setDocSubType( final String docSubType ) {
+ _docSubType = docSubType;
+ return this;
+ }
+
+ public JCasBuilder setDocStandard( final String docStandard ) {
+ _docStandard = docStandard;
+ return this;
+ }
+
+ public JCasBuilder setDocRevisionNum( final int docRevisionNum ) {
+ _docRevisionNum = docRevisionNum;
+ return this;
+ }
+
+ public JCasBuilder setDocTime( final String docTime ) {
+ _docTime = docTime;
+ return this;
+ }
+
+ public JCasBuilder setDocPath( final String docPath ) {
+ _docPath = docPath;
+ return this;
+ }
+
+ public JCasBuilder setDocText( final String docText ) {
+ _docText = docText;
+ return this;
+ }
+
+ /**
+ * @return a jcas created from scratch and populated with data added in this builder.
+ * @throws UIMAException is the fresh jcas cannot be created.
+ */
+ public JCas build() throws UIMAException {
+ return populate( JCasFactory.createJCas() );
+ }
+
+ /**
+ * @param jCas ye olde ...
+ * @return a jcas that has been reset (emptied of previous information) and populated with data added in this builder.
+ */
+ public JCas rebuild( final JCas jCas ) {
+ jCas.reset();
+ return populate( jCas );
+ }
+
+ private boolean ifWrite( final String value, final String defaultValue ) {
+ return _overwrite || !value.equals( defaultValue );
+ }
+
+ private boolean ifWrite( final int value, final int defaultValue ) {
+ return _overwrite || value != defaultValue;
+ }
+
+ private boolean ifWrite( final long value, final long defaultValue ) {
+ return _overwrite || value != defaultValue;
+ }
+
+
+ /**
+ * @param jCas ye olde ...
+ * @return the given jcas populated with the data added in this builder.
+ */
+ public JCas populate( final JCas jCas ) {
+ final Metadata metadata = SourceMetadataUtil.getOrCreateMetadata( jCas );
+
+ if ( ifWrite( _patientId, SourceMetadataUtil.UNKNOWN_PATIENT ) ) {
+ SourceMetadataUtil.setPatientIdentifier( jCas, _patientId );
+ }
+ if ( ifWrite( _patientNum, SourceMetadataUtil.UNKNOWN_PATIENT_NUM ) ) {
+ metadata.setPatientID( _patientNum );
+ }
+
+ final Demographics demographics = new Demographics( jCas );
+ metadata.setDemographics( demographics );
+ if ( ifWrite( _firstName, UNKNOWN ) ) {
+ demographics.setFirstName( _firstName );
+ }
+ if ( ifWrite( _middleName, UNKNOWN ) ) {
+ demographics.setMiddleName( _middleName );
+ }
+ if ( ifWrite( _lastName, UNKNOWN ) ) {
+ demographics.setLastName( _lastName );
+ }
+ if ( ifWrite( _birthday, UNKNOWN_DATE ) ) {
+ demographics.setBirthDate( _birthday );
+ }
+ if ( ifWrite( _deathday, UNKNOWN_DATE ) ) {
+ demographics.setDeathDate( _deathday );
+ }
+ if ( ifWrite( _gender, UNKNOWN_GENDER ) ) {
+ demographics.setGender( _gender );
+ }
+
+ final SourceData sourceData = SourceMetadataUtil.getOrCreateSourceData( jCas );
+ if ( ifWrite( _institutionId, UNKNOWN ) ) {
+ sourceData.setSourceInstitution( _institutionId );
+ }
+ if ( ifWrite( _authorSpecialty, UNKNOWN ) ) {
+ sourceData.setAuthorSpecialty( _authorSpecialty );
+ }
+ if ( ifWrite( _encounterId, "" ) ) {
+ sourceData.setSourceEncounterId( _encounterId );
+ }
+ if ( ifWrite( _instanceId, UNKNOWN ) ) {
+ sourceData.setSourceInstanceId( _instanceId );
+ }
+
+ if ( ifWrite( _docId, DocIdUtil.NO_DOCUMENT_ID ) ) {
+ final DocumentID documentId = new DocumentID( jCas );
+ documentId.setDocumentID( _docId );
+ documentId.addToIndexes();
+ }
+
+ if ( ifWrite( _docIdPrefix, DocIdUtil.NO_DOCUMENT_ID_PREFIX ) ) {
+ final DocumentIdPrefix documentIdPrefix = new DocumentIdPrefix( jCas );
+ documentIdPrefix.setDocumentIdPrefix( _docIdPrefix );
+ documentIdPrefix.addToIndexes();
+ }
+
+ if ( ifWrite( _docType, NoteSpecs.ID_NAME_CLINICAL_NOTE ) ) {
+ sourceData.setNoteTypeCode( _docType );
+ }
+ if ( ifWrite( _docSubType, "" ) ) {
+ sourceData.setNoteSubTypeCode( _docSubType );
+ }
+ if ( ifWrite( _docStandard, "" ) ) {
+ sourceData.setDocumentStandard( _docStandard );
+ }
+
+ if ( ifWrite( _docTime, "" ) ) {
+ sourceData.setSourceRevisionDate( _docTime );
+ }
+ if ( ifWrite( _docRevisionNum, 1 ) ) {
+ sourceData.setSourceRevisionNbr( _docRevisionNum );
+ }
+
+ if ( ifWrite( _docPath, "" ) ) {
+ final DocumentPath documentPath = new DocumentPath( jCas );
+ documentPath.setDocumentPath( _docPath );
+ documentPath.addToIndexes();
+ }
+
+ if ( ifWrite( _docText, "" ) ) {
+ jCas.setDocumentText( _docText );
+ }
+
+ return jCas;
+ }
+
+}
Added: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/semantic/SemanticGroup.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/semantic/SemanticGroup.java?rev=1877092&view=auto
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/semantic/SemanticGroup.java (added)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/semantic/SemanticGroup.java Mon Apr 27 19:06:09 2020
@@ -0,0 +1,87 @@
+package org.apache.ctakes.core.semantic;
+
+import org.apache.ctakes.typesystem.type.textsem.*;
+import org.apache.uima.jcas.JCas;
+
+import java.util.Collection;
+import java.util.function.Function;
+
+import static org.apache.ctakes.typesystem.type.constants.CONST.*;
+
+/**
+ * @deprecated use SemanticGroup in core.util.annotation
+ */
+@Deprecated
+public enum SemanticGroup {
+ DRUG( NE_TYPE_ID_DRUG, "Drug", MedicationMention.class, MedicationMention::new ),
+ DISORDER( NE_TYPE_ID_DISORDER, "Disorder", DiseaseDisorderMention.class, DiseaseDisorderMention::new ),
+ FINDING( NE_TYPE_ID_FINDING, "Finding", SignSymptomMention.class, SignSymptomMention::new ),
+ PROCEDURE( NE_TYPE_ID_PROCEDURE, "Procedure", ProcedureMention.class, ProcedureMention::new ),
+ ANATOMY( NE_TYPE_ID_ANATOMICAL_SITE, "Anatomy", AnatomicalSiteMention.class, AnatomicalSiteMention::new ),
+ CLINICAL_ATTRIBUTE( NE_TYPE_ID_CLINICAL_ATTRIBUTE, "Attribute", SignSymptomMention.class, SignSymptomMention::new ),
+ DEVICE( NE_TYPE_ID_DEVICE, "Device", EntityMention.class, EntityMention::new ),
+ LAB( NE_TYPE_ID_LAB, "Lab", LabMention.class, LabMention::new ),
+ PHENOMENON( NE_TYPE_ID_PHENOMENA, "Phenomenon", EventMention.class, EventMention::new ),
+ SUBJECT( NE_TYPE_ID_SUBJECT_MODIFIER, "Subject", SubjectModifier.class, SubjectModifier::new ),
+ TITLE( NE_TYPE_ID_PERSON_TITLE, "Title", PersonTitleAnnotation.class, PersonTitleAnnotation::new ),
+ EVENT( NE_TYPE_ID_GENERIC_EVENT, "Event", EventMention.class, EventMention::new ),
+ ENTITY( NE_TYPE_ID_GENERIC_ENTITY, "Entity", EntityMention.class, EntityMention::new ),
+ TIME( NE_TYPE_ID_TIME_MENTION, "Time", TimeMention.class, TimeAnnotation::new ),
+ MODIFIER( NE_TYPE_ID_GENERIC_MODIFIER, "Modifier", Modifier.class, Modifier::new ),
+ LAB_MODIFIER( NE_TYPE_ID_LAB_VALUE_MODIFIER, "LabModifier", LabValueModifier.class, LabValueModifier::new ),
+ UNKNOWN( NE_TYPE_ID_UNKNOWN, "Unknown", IdentifiedAnnotation.class, IdentifiedAnnotation::new );
+
+ private final int _code;
+ private final String _name;
+ private final Class<? extends IdentifiedAnnotation> _clazz;
+ private final Function<JCas, ? extends IdentifiedAnnotation> _creator;
+
+ SemanticGroup( final int code, final String name,
+ final Class<? extends IdentifiedAnnotation> clazz,
+ final Function<JCas, ? extends IdentifiedAnnotation> creator ) {
+ _code = code;
+ _name = name;
+ _clazz = clazz;
+ _creator = creator;
+ }
+
+ public int getCode() {
+ return _code;
+ }
+
+ public String getName() {
+ return _name;
+ }
+
+ public Class<? extends IdentifiedAnnotation> getCtakesClass() {
+ return _clazz;
+ }
+
+ public Function<JCas, ? extends IdentifiedAnnotation> getCreator() {
+ return _creator;
+ }
+
+ static public org.apache.ctakes.core.util.annotation.SemanticGroup getGroup( final int code ) {
+ return org.apache.ctakes.core.util.annotation.SemanticGroup.getGroup( code );
+ }
+
+ static public org.apache.ctakes.core.util.annotation.SemanticGroup getGroup( final String name ) {
+ return org.apache.ctakes.core.util.annotation.SemanticGroup.getGroup( name );
+ }
+
+ static public Collection<org.apache.ctakes.core.util.annotation.SemanticGroup> getGroups(
+ final IdentifiedAnnotation annotation ) {
+ return org.apache.ctakes.core.util.annotation.SemanticGroup.getGroups( annotation );
+ }
+
+ static public org.apache.ctakes.core.util.annotation.SemanticGroup getBestGroup(
+ final IdentifiedAnnotation annotation ) {
+ return org.apache.ctakes.core.util.annotation.SemanticGroup.getBestGroup( getGroups( annotation ) );
+ }
+
+ static public org.apache.ctakes.core.util.annotation.SemanticGroup getBestGroup(
+ final Collection<org.apache.ctakes.core.util.annotation.SemanticGroup> groups ) {
+ return org.apache.ctakes.core.util.annotation.SemanticGroup.getBestGroup( groups );
+ }
+
+}
Added: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/semantic/SemanticTui.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/semantic/SemanticTui.java?rev=1877092&view=auto
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/semantic/SemanticTui.java (added)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/semantic/SemanticTui.java Mon Apr 27 19:06:09 2020
@@ -0,0 +1,217 @@
+package org.apache.ctakes.core.semantic;
+
+import org.apache.ctakes.core.util.annotation.SemanticGroup;
+import org.apache.ctakes.typesystem.type.refsem.UmlsConcept;
+import org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation;
+import org.apache.uima.jcas.JCas;
+
+import java.util.Collection;
+import java.util.function.Function;
+
+import static org.apache.ctakes.core.util.annotation.SemanticGroup.*;
+
+/**
+ * @deprecated use SemanticTui in core.util.annotation
+ */
+@Deprecated
+public enum SemanticTui {
+ T116( 116, "Amino Acid, Peptide, or Protein", DRUG ),
+ T020( 20, "Acquired Abnormality", DISORDER ),
+ T052( 52, "Activity", EVENT ),
+ T100( 100, "Age Group", SUBJECT ),
+ T003( 3, "Alga", ENTITY ),
+ T087( 87, "Amino Acid Sequence", DRUG ),
+ T011( 11, "Amphibian", ENTITY ),
+ T190( 190, "Anatomical Abnormality", DISORDER ),
+ T008( 8, "Animal", ENTITY ),
+ T017( 17, "Anatomical Structure", ANATOMY ),
+ T195( 195, "Antibiotic", DRUG ),
+ T194( 194, "Archaeon", ENTITY ),
+ T123( 123, "Biologically Active Substance", DRUG ),
+ T007( 7, "Bacterium", ENTITY ),
+ T031( 31, "Body Substance", FINDING ),
+ T022( 22, "Body System", ANATOMY ),
+ T053( 53, "Behavior", FINDING ),
+ T038( 38, "Biologic Function", PHENOMENON ),
+ T012( 12, "Bird", ENTITY ),
+ T029( 29, "Body Location or Region", ANATOMY ),
+ T091( 91, "Biomedical Occupation or Discipline", TITLE ),
+ T122( 122, "Biomedical or Dental Material", DRUG ),
+ T023( 23, "Body Part, Organ, or Organ Component", ANATOMY ),
+ T030( 30, "Body Space or Junction", ANATOMY ),
+ T118( 118, "Carbohydrate", DRUG ),
+ T026( 26, "Cell Component", ANATOMY ),
+ T043( 43, "Cell Function", FINDING ),
+ T025( 25, "Cell", ANATOMY ),
+ T019( 19, "Congenital Abnormality", DISORDER ),
+ T103( 103, "Chemical", DRUG ),
+ T120( 120, "Chemical Viewed Functionally", DRUG ),
+ T104( 104, "Chemical Viewed Structurally", DRUG ),
+ T185( 185, "Classification", FINDING ),
+ T201( 201, "Clinical Attribute", CLINICAL_ATTRIBUTE ),
+ T200( 200, "Clinical Drug", DRUG ),
+ T077( 77, "Conceptual Entity", FINDING ),
+ T049( 49, "Cell or Molecular Dysfunction", DISORDER ),
+ T088( 88, "Carbohydrate Sequence", DRUG ),
+ T060( 60, "Diagnostic Procedure", PROCEDURE ),
+ T056( 56, "Daily or Recreational Activity", FINDING ),
+ T047( 47, "Disease or Syndrome", DISORDER ),
+ T203( 203, "Drug Delivery Device", DEVICE ),
+ T065( 65, "Educational Activity", PROCEDURE ),
+ T069( 69, "Environmental Effect of Humans", PHENOMENON ),
+ T111( 111, "Eicosanoid", ENTITY ),
+ T196( 196, "Element, Ion, or Isotope", DRUG ),
+ T050( 50, "Experimental Model of Disease", DISORDER ),
+ T018( 18, "Embryonic Structure", ANATOMY ),
+ T071( 71, "Entity", ENTITY ),
+ T126( 126, "Enzyme", DRUG ),
+ T051( 51, "Event", EVENT ),
+ T099( 99, "Family Group", SUBJECT ),
+ T021( 21, "Fully Formed Anatomical Structure", ANATOMY ),
+ T013( 13, "Fish", ENTITY ),
+ T033( 33, "Finding", FINDING ),
+ T004( 4, "Fungus", ENTITY ),
+ T168( 168, "Food", DRUG ),
+ T169( 169, "Functional Concept", FINDING ),
+ // double-check
+ T045( 45, "Genetic Function", FINDING ),
+ T083( 83, "Geographic Area", ENTITY ),
+ T028( 28, "Gene or Genome", FINDING ),
+ T064( 64, "Governmental or Regulatory Activity", EVENT ),
+ T102( 102, "Group Attribute", SUBJECT ),
+ T096( 96, "Group", SUBJECT ),
+ T068( 68, "Human-caused Phenomenon or Process", PHENOMENON ),
+ T093( 93, "Health Care Related Organization", ENTITY ),
+ T058( 58, "Health Care Activity", PROCEDURE ),
+ T131( 131, "Hazardous or Poisonous Substance", DRUG ),
+ T125( 125, "Hormone", DRUG ),
+ T016( 16, "Human", SUBJECT ),
+ T078( 78, "Idea or Concept", FINDING ),
+ T129( 129, "Immunologic Factor", DRUG ),
+ T055( 55, "Individual Behavior", FINDING ),
+ T197( 197, "Inorganic Chemical", DRUG ),
+ T037( 37, "Injury or Poisoning", DISORDER ),
+ T170( 170, "Intellectual Product", FINDING ),
+ // double-check
+ T009( 9, "Invertebrate", ENTITY ),
+ T130( 130, "Indicator, Reagent, or Diagnostic Aid", DRUG ),
+ T171( 171, "Language", ENTITY ),
+ T059( 59, "Laboratory Procedure", PROCEDURE ),
+ T034( 34, "Laboratory or Test Result", LAB ),
+ T119( 119, "Lipid", DRUG ),
+ T015( 15, "Mammal", ENTITY ),
+ T063( 63, "Molecular Biology Research Technique", PROCEDURE ),
+ T066( 66, "Machine Activity", PROCEDURE ),
+ T074( 74, "Medical Device", DEVICE ),
+ T041( 41, "Mental Process", FINDING ),
+ T073( 73, "Manufactured Object", DEVICE ),
+ T048( 48, "Mental or Behavioral Dysfunction", DISORDER ),
+ T044( 44, "Molecular Function", FINDING ),
+ T085( 85, "Molecular Sequence", FINDING ),
+ T191( 191, "Neoplastic Process", DISORDER ),
+ T114( 114, "Nucleic Acid, Nucleoside, or Nucleotide", DRUG ),
+ T070( 70, "Natural Phenomenon or Process", PHENOMENON ),
+ T124( 124, "Neuroreactive Substance or Biogenic Amine", DRUG ),
+ T086( 86, "Nucleotide Sequence", FINDING ),
+ T057( 57, "Occupational Activity", EVENT ),
+ T090( 90, "Occupation or Discipline", SUBJECT ),
+ T115( 115, "Organophosphorous Compound", DRUG ),
+ T109( 109, "Organic Chemical", DRUG ),
+ T032( 32, "Organism Attribute", SUBJECT ),
+ T040( 40, "Organism Function", FINDING ),
+ T001( 1, "Organism", ENTITY ),
+ T092( 92, "Organization", ENTITY ),
+ T042( 42, "Organ or Tissue Function", FINDING ),
+ T046( 46, "Pathologic Function", FINDING ),
+ T072( 72, "Physical Object", ENTITY ),
+ T067( 67, "Phenomenon or Process", PHENOMENON ),
+ T039( 39, "Physiologic Function", FINDING ),
+ T121( 121, "Pharmacologic Substance", DRUG ),
+ T002( 2, "Plant", ENTITY ),
+ T101( 101, "Patient or Disabled Group", SUBJECT ),
+ T098( 98, "Population Group", SUBJECT ),
+ T097( 97, "Professional or Occupational Group", SUBJECT ),
+ T094( 94, "Professional Society", ENTITY ),
+ T080( 80, "Qualitative Concept", MODIFIER ),
+ T081( 81, "Quantitative Concept", LAB_MODIFIER ),
+ T192( 192, "Receptor", FINDING ),
+ T014( 14, "Reptile", ENTITY ),
+ T062( 62, "Research Activity", PROCEDURE ),
+ T075( 75, "Research Device", DEVICE ),
+ T006( 6, "Rickettsia or Chlamydia", DISORDER ),
+ T089( 89, "Regulation or Law", ENTITY ),
+ T167( 167, "Substance", DRUG ),
+ // Double-check
+ T095( 95, "Self-help or Relief Organization", ENTITY ),
+ T054( 54, "Social Behavior", FINDING ),
+ T184( 184, "Sign or Symptom", FINDING ),
+ T082( 82, "Spatial Concept", MODIFIER ),
+ T110( 110, "Steroid", DRUG ),
+ T024( 24, "Tissue", ANATOMY ),
+ T079( 79, "Temporal Concept", TIME ),
+ T061( 61, "Therapeutic or Preventive Procedure", PROCEDURE ),
+ T005( 5, "Virus", DISORDER ),
+ T127( 127, "Vitamin", DRUG ),
+ T010( 10, "Vertebrate", ENTITY ),
+ UNKNOWN( 0, "Unknown", SemanticGroup.UNKNOWN );
+
+ private final int _code;
+ private final String _name;
+ private final SemanticGroup _group;
+
+ SemanticTui( final int code, final String name, final SemanticGroup group ) {
+ _code = code;
+ _name = name;
+ _group = group;
+ }
+
+ public int getCode() {
+ return _code;
+ }
+
+ public String getSemanticType() {
+ return _name;
+ }
+
+ public SemanticGroup getGroup() {
+ return _group;
+ }
+
+ public int getGroupCode() {
+ return _group.getCode();
+ }
+
+ public String getGroupName() {
+ return _group.getName();
+ }
+
+ public Class<? extends IdentifiedAnnotation> getCtakesClass() {
+ return _group.getCtakesClass();
+ }
+
+ public Function<JCas, ? extends IdentifiedAnnotation> getCreator() {
+ return _group.getCreator();
+ }
+
+ static public org.apache.ctakes.core.util.annotation.SemanticTui getTui( final String semanticType ) {
+ return org.apache.ctakes.core.util.annotation.SemanticTui.getTui( semanticType );
+ }
+
+ static public org.apache.ctakes.core.util.annotation.SemanticTui getTui( final int code ) {
+ return org.apache.ctakes.core.util.annotation.SemanticTui.getTui( code );
+ }
+
+ static public org.apache.ctakes.core.util.annotation.SemanticTui getTuiFromCode( final String tuiCode ) {
+ return org.apache.ctakes.core.util.annotation.SemanticTui.getTuiFromCode( tuiCode );
+ }
+
+ static public Collection<org.apache.ctakes.core.util.annotation.SemanticTui> getTuis(
+ final IdentifiedAnnotation annotation ) {
+ return org.apache.ctakes.core.util.annotation.SemanticTui.getTuis( annotation );
+ }
+
+ static public org.apache.ctakes.core.util.annotation.SemanticTui getTui( final UmlsConcept umlsConcept ) {
+ return org.apache.ctakes.core.util.annotation.SemanticTui.getTui( umlsConcept );
+ }
+
+}