# csnolib
***************************************************************************************
	         How to use SNOMED CT library (CSNOLib)
***************************************************************************************
CSNOLib Directory Structure:

CSNOLib provides following directory structure:
- lib: Jar files required for CSNOtk including third party jars
- sampleSrc: Sample test codes for CSNOLib API
- Copyrightnotice.txt: A Copyright notice for CSNOtk
- README.txt: A readme (or read me) file contains information about other files in the directory and also how to configure and use CSNOLib


***************************************************************************************
	         Pre-Requisite Software and other settings
***************************************************************************************
1. OPEN JDK 11 should be installed on the machine for CSNOtk application.

2. Append the path value for JAVA in the PATH environment variable.
	e.g. :  C:\Program Files\openjdk\jdk11\bin


3. Set the environment variables for Java.
	e.g. :  JAVA_HOME - C:\Program Files\openjdk\jdk11 (System Environment Variable in case of Windows)
		JAVA_HOME - export JAVA_HOME=/usr/java/jdk11 (modify '/etc/profile' - in case of LINUX)


********************************************************************************
		Create SNOMED CT database and Lucene Index
********************************************************************************
Please follow the instructions given below to setup the SNOMED CT database and Lucene Index

1. SNOMED CT codes can be obtained from SNOMED International website or the National Release Center (NRC) of your country.

2. Include jars placed in lib directory in your java application.

3. Refer below lines of code 
	
	SNOMEDAgent agent = new SNOMEDAgent();
	agent.init();
	agent.createSNOMEDdb(String snomedIntDirPath, boolean overridedb);

	init() method initialize / set the required properties to default.

	init(dataDir, errorLogDir, searchReturnlimit, suggestReturnlimit, topSuggestReturnlimit) method can be used to set properties as per your requirement. 


-	dataDir : Directory where SNOMED CT database and index files will be created.
-	errorLogDir : Directory where CSNOtk logs will be generated.
-	searchReturnlimit :  Maximum number of matching terms to be searched. example: 10000
-	suggestReturnlimit :  Maximum number of matching terms to be suggested. example: 500
-	topSuggestReturnlimit :  Maximum number of top matching terms to be suggested. example: 50


createSNOMEDdb(String snomedIntDirPath, boolean overridedb) method creates the SNOMED CT database.  

snomedIntDirPath - Directory path for release type (Snapshot) of SNOMED CT International Release files.  example: G:\SnomedCT_InternationalRF2_PRODUCTION_20170731T150000Z\Snapshot

overridedb � 
-	true: for database creation/ updation
-	false: for production environment after database creation/ updation

_Note: csnolib.jar provides core API for SNOMED CT._


********************************************************************************
		SNOMED CT to ICD-10 Mapping (Optional)
********************************************************************************

--------------------------------------------------------------------------------
		Create SNOMED CT to ICD-10 Mapping Database
--------------------------------------------------------------------------------

After performing above steps for creating SNOMED CT database, follow the instructions given below to setup the SNOMED CT to ICD-10 Mapping database

1. Get SNOMED CT to ICD-10 map refset from SNOMED International website or the National Release Center (NRC) of your country.

2. Refer below lines of code 
	
	ICDMapAgent mapAgent = new ICDMapAgent();
	mapAgent. createICDMapdb(String snomedIntDirPath, boolean overridedb); 


createICDMapdb(snomedIntDirPath, overridedb) creates database for SNOMED CT ICD Map.


-	snomedIntDirPath - Directory path of release type (Snapshot) for SNOMED CT International Release. example: G:\SnomedCT_InternationalRF2_PRODUCTION_20170731T150000Z\Snapshot

overridedb � 
-	true: for database creation/ updation
-	false: for production environment after database creation/ updation



_Note: csnoicdmap.jar provides core API for SNOMEDCT to ICD-10 mapping._


--------------------------------------------------------------------------------
		Connect to ICD-10 database required for ICDMap 
--------------------------------------------------------------------------------
Mapping of SNOMED CT to ICD-10 code is provided. But, in order to get term, ICD-10 database is required.
It is assumed that ICD-10 database already exists on user's machine.
After performing above steps for creating SNOMED CT to ICD-10 Mapping database, follow the instructions given below to connect to ICD-10 database

1. Download database connector library (.jar) as per user configured ICD-10 database for loading driver and executing sql statement. Place in 'lib' directory.

2. Refer below lines of code.

	ICDMapAgent mapAgent = new ICDMapAgent();
	mapAgent. initICDDB( String icdDB_jdbc_url, String  icdDB_username, String  icdDB_password , String  icdDB_jdbc_driver_class, String  icdDB_jdbc_connector_jar_name, String  icdDB_sql_query);


initICDDB(icdDB_jdbc_url, icdDB_username, icdDB_password , icdDB_jdbc_driver_class, icdDB_jdbc_connector_jar_name, icdDB_sql_query) method can be used to set properties as per your requirement.

-	icdDB_jdbc_url - jdbc url for ICD database
-	icdDB_username - username for ICD database
-	icdDB_password - password for ICD database
-	icdDB_jdbc_driver_class - jdbc driver class for ICD database
-	icdDB_jdbc_connector_jar_name - name of jdbc connector jar for ICD database
-	icdDB_sql_query - select query to get term from ICD database table for a code

for example- select icdterm_columnname from icd_tablename where icdcode_columnname = ?


********************************************************************************
		Create SNOMED CT Extension database (Optional)
********************************************************************************
After performing the steps for creating SNOMED CT database, follow the instructions given below to setup the SNOMED CT Extension database

1. Get SNOMED CT National Extension file from SNOMED International website or the National Release Center (NRC) of your country.

2. Refer below lines of code 
	
	SNOMEDAgent agent = new SNOMEDAgent();
	agent. createExtensiondb(String snomedExtDirPath, boolean overridedb);

createExtensiondb(snomedExtDirPath, overridedb) method creates database for extension.
	
-	snomedExtDirPath -	file path for extension example: G:/xSnomedCT_IndiaDrugExtensionRF2_BETA_20180105T120000Z/Snapshot

overridedb � 
-	true: for database creation/ updation
-	false: for production environment after database creation/ updation


********************************************************************************
		Create SNOMED CT Refset database (Optional)
********************************************************************************

After performing the steps for creating SNOMED CT database, follow the instructions given below to setup the SNOMED CT Refset database

1. Get SNOMED CT refset from SNOMED International website or the National Release Center (NRC) of your country.

2. Refer below lines of code 
	
	SNOMEDAgent agent = new SNOMEDAgent();
	agent. createRefsetdb( String refsetFilePath, boolean overridedb);

createRefsetdb(refsetFilePath, overridedb) method creates database for refset.
	
-	refsetFilePath -	file path for refset example: G:/SnomedCT_GPFPICPC2_PRODUCTION_20171018T120000Z/Snapshot/Refset/Content/der2_Refset_SimpleSnapshot_INT_20170731.txt

overridedb � 
-	true: for database creation/ updation
-	false: for production environment after database creation/ updation


********************************************************************************
		Configure DISB(Drug Information Service Bundle) (Optional)
********************************************************************************	
**DISB (Drug Information Service Bundle): **
Drug Information Service Bundle is a set of restful services that provides information about substances, generics, and branded medicines which can be useful for reference/knowledge while prescribing.
The information provided by DISB refer to Flat List Common Drug Codes for India.
For more details about DISB, please refer the following link given below
link:  https://nrces.in/services/national-releases


After performing the steps for creating SNOMED CT database, follow the instructions given below to setup the DISB utility.

1. For configuring DISB refer README.txt of DISB executables, you can download it from https://nrces.in/services/national-releases under Drug Information Service Bundle section

2.  Refer below lines of code 
	IDISBAgent disbAgent = new DISBAgent();
		disbAgent.init() 
		disbAgent.testDISBConnection();



		init()  method initialize / set the required properties to default. For configuring DISB into CSNOLib with default values like protocol: http, hostname: localhost, port: 9090, context: dis, errolLogDirectory: user directory
		init(protocol,hostname,port,context,errorLogDir)  method can be used to set properties as per your requirement. 
		testDISBConnection() method will be used to connection with provided details or default details.


-	protocol for sending request to DISB on given protocol (default: http) 
-	hostname where DISB application is hosted (default: localhost)
-	port for accessing DISB (default: 9090)
-	context for requesting to DISB (default: dis)
-	errorLogDir location for logs. (default: user directory/ same directory which have given at the time of configuring csnolib)
 

_Note: csnodisb.jar provides core API for fetching details from DISB (Drug Information Service Bundle)._


********************************************************************************
		Create SNOMED CT Simple Map database (Optional)
********************************************************************************
After performing the steps for creating SNOMED CT database, follow the instructions given below to setup the SNOMED CT Simple Map database

1. Get SNOMED CT National Extension file from SNOMED International website or the National Release Center (NRC) of your country.

2. Refer below lines of code 
	
	SNOMEDAgent agent = new SNOMEDAgent();
	agent.createSimpleMapdb(String snomedExtDirPath, boolean overridedb);


createSimpleMapdb(snomedExtDirPath, overridedb) method creates database for simple map table.
	
-	snomedDirPath -	file path for extension example: G:/SnomedCT_IndiaGeographicalLocationExtensionRF2_Production_IN1000189_20200811T120000Z/Snapshot

overridedb � 
-	true: for database creation/ updation
-	false: for production environment after database creation/ updation


********************************************************************************
				FINISH
********************************************************************************
