Class QueryManager
- java.lang.Object
-
- in.cdac.medinfo.csnotk.csnolib.db.QueryManager
-
public class QueryManager extends java.lang.ObjectEstablishes a connection to fetch data from SNOMED CT database.
-
-
Constructor Summary
Constructors Constructor Description QueryManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreatecRefsetdb(java.lang.String refsetId, java.lang.String refFilePath, java.util.Set<java.lang.String> moduleIdSet)This method will create database for cRefsetvoidcreateExtensiondb(java.util.Set<java.lang.String> moduleIdSet, java.lang.String conceptFile, java.lang.String descriptionFile, java.lang.String relationshipFile, java.lang.String refsetLangFile, java.lang.String concreteRelationshipFile, java.lang.String identifierFile)This method will create SNOMED CT extension databasevoidcreateRefsetdb(java.lang.String refsetId, java.lang.String refFilePath, java.util.Set<java.lang.String> moduleIdSet)This method will create database for RefsetbooleancreateSimpleMapdb(java.lang.String moduleId, java.lang.String simpleMapFilePath)This method will create database for simpleMapvoidcreateSNOMEDdb(java.lang.String conceptFile, java.lang.String descriptionFile, java.lang.String relationshipFile, java.lang.String refsetLangFile, java.lang.String textdefinitionFile, java.lang.String concreteRelationshipFile)This method will create SNOMED CT databasevoiddeleteRelationshipTempFile(java.lang.String filePath)This method will delete temporary relationship file created for TC table generationjava.lang.StringexportRelationshipTableAndDeleteTCTable()This method will export relationship table into a tsv file (for TC table creation)java.lang.StringgetAcceptabilityId(java.lang.String descriptionId)Returns acceptability Id for specified description id.java.util.List<Description>getDescriptions(java.lang.String conceptId)Returns list ofDescriptions associated for a given concept identifier and which is other than FSN.java.lang.StringgetPreferredName(java.lang.String conceptId, EnumLangRefset enumLangRefset)Returns list of preferred names in US refset associated with correspondingConceptidentifier.java.util.List<Relationship>getRelationships(java.lang.String ConceptId, java.lang.String relationshipType, EnumDirection direction)Returns unique Inward/Outward latest relationships with active status.voidloadClosureTable(java.io.File ct_file)This function loads the closure table in the database.voidpopulateConcept(java.lang.String id, Concept concept)Returns a SNOMED CTConceptassociated for a given concept identifier.java.util.Set<Concept>searchConcepts(java.lang.String searchTerm)Searches for concepts in the SNOMED CT repository for the given search term.
-
-
-
Method Detail
-
populateConcept
public void populateConcept(java.lang.String id, Concept concept) throws java.sql.SQLException, java.text.ParseExceptionReturns a SNOMED CTConceptassociated for a given concept identifier.- Parameters:
id- identifier of the concept.concept- SNOMED CTConceptwhich is to be populated.- Throws:
java.sql.SQLExceptionjava.text.ParseException
-
getDescriptions
public java.util.List<Description> getDescriptions(java.lang.String conceptId) throws java.sql.SQLException, java.text.ParseException
Returns list ofDescriptions associated for a given concept identifier and which is other than FSN.- Parameters:
conceptId- SNOMED CTConceptidentifier.- Returns:
- List of
Descriptions . - Throws:
java.sql.SQLException- if any error occurs while accessing database.java.text.ParseException
-
searchConcepts
public java.util.Set<Concept> searchConcepts(java.lang.String searchTerm) throws java.sql.SQLException
Searches for concepts in the SNOMED CT repository for the given search term.- Parameters:
searchTerm-Stringterm/text to be searched .- Returns:
- Set of
Concepts. - Throws:
java.sql.SQLException- if any error occurs while accessing database.
-
getRelationships
public java.util.List<Relationship> getRelationships(java.lang.String ConceptId, java.lang.String relationshipType, EnumDirection direction) throws java.sql.SQLException, java.text.ParseException
Returns unique Inward/Outward latest relationships with active status.- Parameters:
ConceptId- identifier of theConcept.enumRelationshipType- specifies the type of relationship.direction- specifies the direction(source / destination)EnumDirection.- Returns:
- Set of
Relationships . - Throws:
java.sql.SQLException- if any error occurs while accessing database.java.text.ParseException
-
getPreferredName
public java.lang.String getPreferredName(java.lang.String conceptId, EnumLangRefset enumLangRefset) throws java.sql.SQLExceptionReturns list of preferred names in US refset associated with correspondingConceptidentifier.- Parameters:
enumLangRefset- specifies the Language RefsetEnumLangRefset}.conceptId- identifier of theConcept.- Returns:
- Preferred name of
Concept. - Throws:
java.sql.SQLException
-
loadClosureTable
public void loadClosureTable(java.io.File ct_file) throws java.sql.SQLException, java.io.IOExceptionThis function loads the closure table in the database.- Parameters:
ct_file- File associated with the closure table.- Throws:
java.sql.SQLExceptionjava.io.IOException
-
getAcceptabilityId
public java.lang.String getAcceptabilityId(java.lang.String descriptionId) throws java.sql.SQLExceptionReturns acceptability Id for specified description id. acceptability id indicates whether particular description is Preferred Term or not.- Parameters:
descriptionId-Stringidentifier of theDescription.- Returns:
Stringvalue that specifies the acceptability id.- Throws:
java.sql.SQLException
-
createSNOMEDdb
public void createSNOMEDdb(java.lang.String conceptFile, java.lang.String descriptionFile, java.lang.String relationshipFile, java.lang.String refsetLangFile, java.lang.String textdefinitionFile, java.lang.String concreteRelationshipFile) throws java.sql.SQLExceptionThis method will create SNOMED CT database- Parameters:
conceptFile- file path for Concept FiledescriptionFile- file path for Description FilerelationshipFile- file path for Relationship FilerefsetLangFile- file path for Language Refset File- Throws:
java.sql.SQLException
-
createExtensiondb
public void createExtensiondb(java.util.Set<java.lang.String> moduleIdSet, java.lang.String conceptFile, java.lang.String descriptionFile, java.lang.String relationshipFile, java.lang.String refsetLangFile, java.lang.String concreteRelationshipFile, java.lang.String identifierFile) throws java.sql.SQLExceptionThis method will create SNOMED CT extension database- Parameters:
conceptFile- file path for Concept FiledescriptionFile- file path for Description FilerelationshipFile- file path for Relationship FilerefsetLangFile- file path for Language Refset FileSet- of moduleId- Throws:
java.sql.SQLException
-
createRefsetdb
public void createRefsetdb(java.lang.String refsetId, java.lang.String refFilePath, java.util.Set<java.lang.String> moduleIdSet) throws java.sql.SQLExceptionThis method will create database for Refset- Parameters:
refsetId-refFilePath-- Throws:
java.sql.SQLException
-
createcRefsetdb
public void createcRefsetdb(java.lang.String refsetId, java.lang.String refFilePath, java.util.Set<java.lang.String> moduleIdSet) throws java.sql.SQLExceptionThis method will create database for cRefset- Parameters:
refsetId-refFilePath-moduleIdSet-- Throws:
java.sql.SQLException
-
createSimpleMapdb
public boolean createSimpleMapdb(java.lang.String moduleId, java.lang.String simpleMapFilePath) throws java.sql.SQLExceptionThis method will create database for simpleMap- Parameters:
moduleId-simpleMapFilePath-- Throws:
java.sql.SQLException
-
exportRelationshipTableAndDeleteTCTable
public java.lang.String exportRelationshipTableAndDeleteTCTable() throws java.sql.SQLException, java.io.IOExceptionThis method will export relationship table into a tsv file (for TC table creation)- Throws:
java.sql.SQLExceptionjava.io.IOException
-
deleteRelationshipTempFile
public void deleteRelationshipTempFile(java.lang.String filePath)
This method will delete temporary relationship file created for TC table generation
-
-