Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F102751195
getAnnotationNames.php
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
Sun, Feb 23, 19:51
Size
931 B
Mime Type
text/x-php
Expires
Tue, Feb 25, 19:51 (2 d)
Engine
blob
Format
Raw Data
Handle
24414030
Attached To
R4897 i2b2-webclient
getAnnotationNames.php
View Options
<?php
// case insensitive with regex
// todo correct?
//select annotation_name
//from shrine_ont.annotation_names
//where annotation_name ~* '.*a1.*'
//LIMIT 20
$conn
=
pg_connect
(
"host=localhost port=5432 dbname=i2b2 user=shrine_ont password=demouser"
);
if
(!
$conn
)
{
echo
"Error while connecting to the postgres database"
;
exit
;
}
// get the row which contains all the values of the passed annotation
$query
=
"SELECT annotation_name
FROM shrine_ont.annotation_names
WHERE annotation_name ~* '.*"
.
$_GET
[
"annotation_name"
]
.
".*'
LIMIT "
.
$_GET
[
"limit"
];
$result
=
pg_query
(
$conn
,
$query
);
if
(!
$result
)
{
echo
"An error occurred.
\n
"
;
exit
;
}
// In json format return the list of annotation names
$annotationList
=
""
;
while
(
$row
=
pg_fetch_row
(
$result
))
{
$annotationList
.=
"
\"
$row[0]
\"
,"
;
}
// drop the last comma and concatenate in json format
echo
"["
.
substr
(
$annotationList
,
0
,
-
1
)
.
"]"
;
Event Timeline
Log In to Comment