Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F80314469
MedCoDatabase.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sat, Aug 31, 02:45
Size
3 KB
Mime Type
text/x-java
Expires
Mon, Sep 2, 02:45 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
20319290
Attached To
R4434 MedCo I2b2 Cell
MedCoDatabase.java
View Options
/*
* Copyright (c) 2006-2007 Massachusetts General Hospital
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the i2b2 Software License v1.0
* which accompanies this distribution.
*
* Contributors:
* Lori Phillips
*/
package
ch.epfl.lca1.medco
;
import
java.util.*
;
import
javax.sql.DataSource
;
import
ch.epfl.lca1.medco.util.Logger
;
import
org.springframework.jdbc.core.support.JdbcDaoSupport
;
import
ch.epfl.lca1.medco.util.MedCoUtil
;
import
edu.harvard.i2b2.common.exception.I2B2Exception
;
import
org.springframework.jdbc.support.rowset.SqlRowSet
;
// TODO: migrate the medco_data.enc_observation_fact to the normal i2b2 observation fact
// todo: do not use the bootstrap datasource, use it according to the user (from PM)
public
class
MedCoDatabase
extends
JdbcDaoSupport
{
public
MedCoDatabase
()
throws
I2B2Exception
{
DataSource
ds
=
null
;
try
{
ds
=
MedCoUtil
.
getInstance
().
getDataSource
(
"java:/MedCoBootStrapDS"
);
Logger
.
debug
(
ds
.
toString
());
}
catch
(
I2B2Exception
e2
)
{
throw
Logger
.
fatal
(
e2
);
}
this
.
setDataSource
(
ds
);
}
/**
* search a concept in the CLINICAL_NON_SENSITIVE TABLE
*/
public
String
searchConceptClinicalNonSensitive
(
String
concept
){
String
sql
=
"select c_fullname "
+
"from shrine_ont.clinical_non_sensitive "
+
"where c_fullname like "
+
"'%"
+
concept
+
"%'"
;
try
{
SqlRowSet
rowSet
=
this
.
getJdbcTemplate
().
queryForRowSet
(
sql
);
String
concept_path
=
""
;
rowSet
.
next
();
concept_path
=
rowSet
.
getString
(
"c_fullname"
);
return
concept_path
;
}
catch
(
Exception
e
)
{
return
""
;
}
}
/**
* search a concept in the CLINICAL_SENSITIVE TABLE
*/
public
String
searchConceptClinicalSensitive
(
String
concept
){
String
sql
=
"select c_basecode "
+
"from shrine_ont.clinical_sensitive "
+
"where c_fullname like "
+
"'%"
+
concept
+
"%'"
;
try
{
SqlRowSet
rowSet
=
this
.
getJdbcTemplate
().
queryForRowSet
(
sql
);
String
concept_path
=
""
;
rowSet
.
next
();
concept_path
=
rowSet
.
getString
(
"c_basecode"
);
return
concept_path
;
}
catch
(
Exception
e
)
{
return
""
;
}
}
/**
* search a concept in the GENOMIC_ANNOTATIONS
*/
public
List
<
String
>
searchConceptGenomic
(
String
key
,
String
value
){
String
sql
=
"select variant_id "
+
"from shrine_ont.genomic_annotations "
+
"where variant_annotations ->> '"
+
key
+
"' = '"
+
value
+
"'"
;
try
{
SqlRowSet
rowSet
=
this
.
getJdbcTemplate
().
queryForRowSet
(
sql
);
List
<
String
>
genomicIDs
=
new
ArrayList
<>(
0
);
while
(
rowSet
.
next
()){
genomicIDs
.
add
(
rowSet
.
getString
(
"variant_id"
));
}
return
genomicIDs
;
}
catch
(
Exception
e
)
{
return
new
ArrayList
<>(
0
);
}
}
}
Event Timeline
Log In to Comment