Commit bcc40dd9 authored by Romain Loth's avatar Romain Loth

OK new formats in comex_shared DB (changed php and explorer consultations)

parent b79f438f
......@@ -6,8 +6,7 @@
echo '
<body>';
include ("analytics.php");
echo ' <script type="text/javascript" src="static/js/jquery/jquery-3.1.1.min.js"></script>
<script type="text/javascript" src="static/js/whoswho.js"></script>
echo '
<div class="container">
<!-- Main hero unit for a primary marketing message or call to action -->
......@@ -23,12 +22,17 @@ $content='';
$lab_list=array();
$orga_list=array();
// $orga_list=array(); // TODO restore separate organizations (right now duplicate with labs)
$loop=0; //nombre de boucles
// ajout des scholars
// NB this array was prepared in print_directory or print_scholar_directory
foreach ($scholars as $scholar) {
// debug
// var_dump($scholar);
if ($loop % 100){
set_time_limit(20);
}
......@@ -39,7 +43,7 @@ foreach ($scholars as $scholar) {
<div class="span9" align="justify">';
$content .= '<div>';
if ($scholar['photo_url'] != null) {
$content .= '<img style="margin: 7px 10px 10px 0px" src="http://main.csregistry.org/' . $scholar['photo_url'] . '" width="' . $imsize . 'px" align="left">';
$content .= '<img style="margin: 7px 10px 10px 0px" src="'. $scholar['photo_url'] . '" width="' . $imsize . 'px" align="left">';
}
// raw binary picture
elseif ($scholar['pic_file'] != null) {
......@@ -105,22 +109,33 @@ foreach ($scholars as $scholar) {
$content .= '<dt>' . $scholar['position'] . '</dt>';
}
$affiliation = '';
if ($scholar['lab'] != null) {
$affiliation.=$scholar['lab'] . ', ';
$lab_list[]=$scholar['lab'];
}
if ($scholar['affiliation'] != null) {
$affiliation.=$scholar['affiliation'];
$orga_list[]=$scholar['affiliation'];
//echo $scholar['affiliation'].'<br/>';
//$lab_query.='OR name="'.$scholar['affiliation'].'" ';
}
if (($scholar['affiliation'] != null) | ($scholar['lab'] != null)) {
// TODO restore lab vs org ---------------------------------------------8<-----------
// new way: already merged in data retrievam in print_*
if ($scholar['affiliation'] != null) {
$affiliation = $scholar['affiliation'];
$lab_list[]=$scholar['affiliation_id'];
$content .= '<dd>' . clean_exp($affiliation) . '</dd> ';
}
// OLD WAY
// if ($scholar['lab'] != null) {
// $affiliation.=$scholar['lab'] . ', ';
// $lab_list[]=$scholar['lab'];
// }
// if ($scholar['affiliation'] != null) {
// $affiliation.=$scholar['affiliation'];
// $orga_list[]=$scholar['affiliation'];
//
// //echo $scholar['affiliation'].'<br/>';
//
// //$lab_query.='OR name="'.$scholar['affiliation'].'" ';
// }
// if (($scholar['affiliation'] != null) | ($scholar['lab'] != null)) {
// $content .= '<dd>' . clean_exp($affiliation) . '</dd> ';
// }
// TODO restore lab vs org ---------------------------------------------8<-----------
// $affiliation2 = '';
// if ($scholar['lab2'] != null) {
......@@ -176,7 +191,10 @@ foreach ($scholars as $scholar) {
$content .= '</div>';
if (($scholar['keywords'] != null) || ($scholar['address'] != null) || ($scholar['phone'] != null)) {
if ($scholar['keywords'] != null) {
// TODO change strategy : add email, check if we want to keep phone
// if (($scholar['keywords'] != null) || ($scholar['address'] != null) || ($scholar['phone'] != null)) {
$content .= '<div class="span3" align="justify">';
if ($scholar['keywords'] != null){
......@@ -213,13 +231,13 @@ $content .= '</div>';
}
if (strcmp(substr($lab_query, 0,2),'OR')==0){
$lab_query=substr($lab_query,2);
}
// if (strcmp(substr($lab_query, 0,2),'OR')==0){
// $lab_query=substr($lab_query,2);
// }
if (strcmp(substr($orga_query, 0,2),'OR')==0){
$orga_query=substr($orga_query,2);
}
// if (strcmp(substr($orga_query, 0,2),'OR')==0){
// $orga_query=substr($orga_query,2);
// }
//////////////////////////
// liste des labs ////////
......@@ -227,84 +245,92 @@ if (strcmp(substr($orga_query, 0,2),'OR')==0){
$labs = array();
sort($lab_list);
foreach ($lab_list as $name) {
if ((trim($name)) != NULL) {
// $sql = 'SELECT * FROM affiliations where team_lab="' . $name . '" OR acronym="' . $name . '"';
$sql = 'SELECT * FROM affiliations WHERE team_lab="' . $name . '"';
//echo $sql.'<br/>';
foreach ($base->query($sql) as $row) {
//echo 'toto';
$info = array();
$info['unique_id'] = $row['affid'];
$info['name'] = $row['team_lab'];
// TODO RESTORE
// $info['acronym'] = $row['acronym'];
// $info['homepage'] = $row['homepage'];
// $info['keywords'] = $row['keywords'];
// $info['country'] = $row['country'];
// $info['address'] = $row['address'];
// $info['organization'] = $row['organization'];
// $info['organization2'] = $row['organization2'];
// $orga_list[] = $row['organization'];
// $orga_list[] = $row['organization2'];
// $info['object'] = $row['object'];
// $info['methods'] = $row['methods'];
// $info['director'] = $row['director'];
// $info['admin'] = $row['admin'];
// $info['phone'] = $row['phone'];
// $info['fax'] = $row['fax'];
// $info['login'] = $row['login'];
//print_r($info);
$labs[$row['id']] = $info;
}
}
}
foreach ($lab_list as $affid) {
// debug
// var_dump($affid);
//print_r($labs);
// old way
// $sql = 'SELECT * FROM affiliations where team_lab="' . $name . '" OR acronym="' . $name . '"';
$sql = 'SELECT * FROM affiliations WHERE affid=' . $affid ;
//echo $sql.'<br/>';
foreach ($base->query($sql) as $row) {
$info = array();
$info['unique_id'] = $row['affid'];
$info['name'] = $row['team_lab'];
$info['organization'] = $row['org'];
// TODO RESTORE more lab-related infos
// (here and its effects in labs_list.php)
//////////////////////////
// liste des organizations ////////
//////////////////////////
$info['acronym'] = $row['acronym'] ?? 'N/A';
$info['homepage'] = $row['homepage'] ?? 'N/A';
$info['country'] = $row['country'] ?? 'N/A';
// debug
// $content .= var_dump($orga_list) ;
$organiz = array();
sort($orga_list);
foreach ($orga_list as $name) {
if ((trim($name))!=NULL){
$sql = "SELECT * FROM affiliations WHERE org='" . $name. "'";
$temp=true;
foreach ($base->query($sql) as $row) {
if ($temp){
$info = array();
$info['unique_id'] = $row['affid'];
$info['name'] = $row['org'];
// TODO RESTORE
// $info['acronym'] = $row['acronym'];
// $info['homepage'] = $row['homepage'];
// $info['keywords'] = $row['keywords'];
// $info['country'] = $row['country'];
// $info['street'] = $row['street'];
// $info['city'] = $row['city'];
// $info['state'] = $row['state'];
// $info['postal_code'] = $row['postal_code'];
// $info['fields'] = $row['fields'];
// $info['address'] = $row['address'];
// $info['organization2'] = $row['organization2'];
// $orga_list[] = $row['organization'];
// $orga_list[] = $row['organization2'];
// $info['object'] = $row['object'];
// $info['methods'] = $row['methods'];
// $info['director'] = $row['director'];
// $info['admin'] = $row['admin'];
// $info['phone'] = $row['phone'];
// $info['fax'] = $row['fax'];
// $info['login'] = $row['login'];
$organiz[$row['affid']] = $info;
$temp=false;
}
}
//print_r($info);
$labs[$row['affid']] = $info;
}
}
// print_r($labs);
//////////////////////////
// liste des organizations ////////
//////////////////////////
// debug
// $content .= var_dump($orga_list) ;
//
// $organiz = array();
// sort($orga_list);
// foreach ($orga_list as $name) {
// if ((trim($name))!=NULL){
// $sql = "SELECT * FROM affiliations WHERE org='" . $name. "'";
//
// $temp=true;
// foreach ($base->query($sql) as $row) {
// if ($temp){
// $info = array();
// $info['unique_id'] = $row['affid'];
// $info['name'] = $row['org'];
// // TODO RESTORE
// // $info['acronym'] = $row['acronym'];
// // $info['homepage'] = $row['homepage'];
// // $info['keywords'] = $row['keywords'];
// // $info['country'] = $row['country'];
// // $info['street'] = $row['street'];
// // $info['city'] = $row['city'];
// // $info['state'] = $row['state'];
// // $info['postal_code'] = $row['postal_code'];
// // $info['fields'] = $row['fields'];
// // $info['admin'] = $row['admin'];
// // $info['phone'] = $row['phone'];
// // $info['fax'] = $row['fax'];
// // $info['login'] = $row['login'];
// $organiz[$row['affid']] = $info;
// $temp=false;
// }
// }
// }
//
// }
//
......@@ -317,15 +343,15 @@ $content .='<br/> <A NAME="labs"> </A>
include('labs_list.php');
// // TODO change strategy: now commented because is fully duplicate of labs_list
//////////////////////////
// liste des orga ////////
//////////////////////////
$content .= '<br/> <A NAME="orga"> </A>
<h1>Organizations by alphabetical order</h1>
<br/>
<p><i>List of organizations to which scholars are affiliated</i></p>';
// TODO RESTORE
include('orga_list.php');
// $content .= '<br/> <A NAME="orga"> </A>
// <h1>Organizations by alphabetical order</h1>
// <br/>
// <p><i>List of organizations to which scholars are affiliated</i></p>';
// include('orga_list.php');
/// ajout des organisations
......
......@@ -23,16 +23,19 @@ foreach ($labs as $lab) {
}
$content.=' <small> - ' . $lab['country'] . '</small></h2>';
// var_dump($lab);
$www = '';
if (substr($lab['homepage'], 0, 3) === 'www') {
$www.=' <a href=' . trim(str_replace('&', ' and ', 'http://' . $lab['homepage'])) . ' target=blank > ' . trim(str_replace('&', ' and ', 'http://' . $lab['homepage'])) . ' </a ><br/>';
} elseif (substr($lab['homepage'], 0, 4) === 'http') {
$www.=' <a href=' . trim(str_replace('&', ' and ', $lab['homepage'])) . ' target=blank > ' . trim(str_replace('&', ' and ', $lab['homepage'])) . ' </a ><br/>';
}
if (array_key_exists('homepage', $lab)) {
if (substr($lab['homepage'], 0, 3) === 'www') {
$www.=' <a href=' . trim(str_replace('&', ' and ', 'http://' . $lab['homepage'])) . ' target=blank > ' . trim(str_replace('&', ' and ', 'http://' . $lab['homepage'])) . ' </a ><br/>';
} elseif (substr($lab['homepage'], 0, 4) === 'http') {
$www.=' <a href=' . trim(str_replace('&', ' and ', $lab['homepage'])) . ' target=blank > ' . trim(str_replace('&', ' and ', $lab['homepage'])) . ' </a ><br/>';
}
if (strcmp($www, '') != 0) {
$content .= '<dl><dd><i class="icon-home"></i>' . $www . '</dd></dl> ';
if (strcmp($www, '') != 0) {
$content .= '<dl><dd><i class="icon-home"></i>' . $www . '</dd></dl> ';
}
}
if ($lab['organization'] != null) {
......@@ -41,76 +44,76 @@ foreach ($labs as $lab) {
}
if (($lab['organization'] != null)) {
if ($lab['organization'] != null) {
$content .= '<dd>' . $lab['organization'] . '</dd> ';
}
if (($lab['organization2'] != null)) {
if (array_key_exists('organization2', $lab) && $lab['organization2'] != null) {
$content .= '<dd>' . $lab['organization2'] . '</dd> ';
}
if (($lab['organization2'] != null) || ($lab['organization2'] != null)) {
if (($lab['organization'] != null)
|| (array_key_exists('organization2', $lab) && $lab['organization2'] != null)) {
$content .= '<br/>';
}
if ($lab['organization'] != null) {
$content .= '</dl>';
}
$content .= '</div>';
if ((trim($lab['object']) != null) || ($lab['methods'] != null)) {
$content .= '<div><p>';
if (trim($lab['methods']) != null) {
$content .= '<b>Methods: </b> ' . str_replace('%%%', ', ',clean_exp($lab['methods'])) . '<br/><br/>';
}
if (trim($lab['object']) != null) {
$content .= '<b>Objects: </b> ' .str_replace('%%%', ', ',clean_exp($lab['object'])) . '<br/><br/>';
}
$content .= '</p></div>';
}
if ($lab['director'] != null) {
$content .= '<div>';
$content .= $content .= '<i class="icon-user"></i> ' . $lab['director'] . '<br/><br/>';
$content .= '</div>';
}
$content .= '</div>';
if (($lab['keywords'] != null) || ($lab['address'] != null) || ($lab['phone'] != null)) {
$content .= '<div class="span3" align="justify">';
if ($lab['keywords'] != null) {
$content .= '<i class="icon-tags"></i> ' . $lab['keywords'] . '<br/><br/>';
}
if ($lab['admin'] != null) {
$content .= '<address><i class="icon-info-sign"></i> Administrative contact: ' . ucwords($lab['admin']) . '<br/></address>';
}
if ($lab['address'] != null) {
$content .= '<address><i class="icon-envelope"></i> ' . $lab['address'] . '<br/></address>';
}
if (($lab['phone'] != null)||($lab['fax'] != null)) {
$content .= '<address><strong>Phone</strong>: '.$lab['phone'] . '<br/>';
if ($lab['fax'] != null) {
$content .='<strong>Fax</strong>: '.$lab['fax'] . '<br/>';
}
}
$content .= '</div>';
}
$content .= '</div>';
$content .= '</div>';
$content .= '</div>';
// LABS MORE INFOS: object, methods, director, keywords, address, phone
//
// if ((trim($lab['object']) != null) || ($lab['methods'] != null)) {
// $content .= '<div><p>';
// if (trim($lab['methods']) != null) {
// $content .= '<b>Methods: </b> ' . str_replace('%%%', ', ',clean_exp($lab['methods'])) . '<br/><br/>';
// }
//
// if (trim($lab['object']) != null) {
// $content .= '<b>Objects: </b> ' .str_replace('%%%', ', ',clean_exp($lab['object'])) . '<br/><br/>';
// }
// $content .= '</p></div>';
// }
// if ($lab['director'] != null) {
// $content .= '<div>';
// $content .= $content .= '<i class="icon-user"></i> ' . $lab['director'] . '<br/><br/>';
// $content .= '</div>';
// }
// $content .= '</div>';
//
// if (($lab['keywords'] != null) || ($lab['address'] != null) || ($lab['phone'] != null)) {
// $content .= '<div class="span3" align="justify">';
//
// if ($lab['keywords'] != null) {
//
// $content .= '<i class="icon-tags"></i> ' . $lab['keywords'] . '<br/><br/>';
// }
//
//
//
// if ($lab['admin'] != null) {
// $content .= '<address><i class="icon-info-sign"></i> Administrative contact: ' . ucwords($lab['admin']) . '<br/></address>';
// }
// if ($lab['address'] != null) {
// $content .= '<address><i class="icon-envelope"></i> ' . $lab['address'] . '<br/></address>';
// }
//
//
// if (($lab['phone'] != null)||($lab['fax'] != null)) {
// $content .= '<address><strong>Phone</strong>: '.$lab['phone'] . '<br/>';
// if ($lab['fax'] != null) {
// $content .='<strong>Fax</strong>: '.$lab['fax'] . '<br/>';
// }
// }
//
// $content .= '</div>';
// }
$content .= '</div></div></div>';
$content .= '
<center><img src="static/img/bar.png"></center>';
......
<?php
// NOT USED ANYMORE: duplicate with labs_list
$content .='<br/>
<br/>
......
......@@ -17,7 +17,7 @@ $other_organization = 0;
$missing_country = 0;
$missing_title = 0;
$missing_position = 0;
$missing_organization = 0;
$missing_affiliation = 0;
// données des pays
foreach ($scholars as $row) {
......@@ -103,7 +103,7 @@ foreach ($scholars as $row) {
}
// traitement des organismes de rattachement
$affiliation = trim($row["affiliation"]);
$affiliation = trim($row["affiliation"] ?? "");
if (strcmp($affiliation, "") == 0) {
$missing_affiliation+=1;
......@@ -116,19 +116,19 @@ foreach ($scholars as $row) {
}
}
$affiliation2 = trim($row["affiliation2"]);
if (strcmp($affiliation2, "") == 0) {
$missing_affiliation+=1;
} else {
if (array_key_exists($affiliation2, $organizations_list)) {
$organizations_list[$affiliation2]+=1;
} else {
$organizations_list[$affiliation2] = 1;
}
}
// $affiliation2 = trim($row["affiliation2"] ?? "");
//
// if (strcmp($affiliation2, "") == 0) {
// $missing_affiliation+=1;
// } else {
//
// if (array_key_exists($affiliation2, $organizations_list)) {
// $organizations_list[$affiliation2]+=1;
// } else {
// $organizations_list[$affiliation2] = 1;
//
// }
// }
}
......@@ -163,6 +163,9 @@ if ($other_country>0){
$country_data.=']';
// données des position
$position_data = "data: [";
foreach ($position_list as $key => $value) {
......@@ -205,10 +208,33 @@ if ($other_title>0){
$title_data.=']';
// données des institutions/affiliations
$organizations_data = "data: [";
foreach ($organizations_list as $key => $value) {
if ($value > min(9, count($organizations_list) / 10)) {
$organizations_data.='["' . $key . '",' . $value . '],';
} else {
$other_organization+=$value;
}
}
if ($missing_affiliation>0){
$organizations_data.='["Missing data",' . $missing_affiliation . '],';
}
if ($other_organization>0){
$organizations_data.='["Others",' . $other_organization . ']';
} else {
$organizations_data = substr($organizations_data, 0, -1);
}
$organizations_data.=']';
$stats = '<script type="text/javascript">
var country;
var position;
var title;
var organization;
$(document).ready(function() {
country= new Highcharts.Chart({
chart: {
......@@ -281,7 +307,7 @@ $(document).ready(function() {
'}]
});
titre= new Highcharts.Chart({
title= new Highcharts.Chart({
chart: {
renderTo: "title",
plotBackgroundColor: null,
......
This diff is collapsed.
......@@ -82,7 +82,7 @@ $base = new PDO($dsn, $user, $pass, $opt);
if ($login) {
if (sizeof($login) > 0) {
// nom du chercheur $target_name
$sql0 = "SELECT last_name,first_name FROM scholars WHERE doors_uid='" . $login . "'";
$sql0 = "SELECT last_name,first_name FROM scholars WHERE luid='" . $login . "'";
foreach ($base->query($sql0) as $row) {
// always one record by design of uid
......@@ -92,7 +92,7 @@ if ($login) {
// liste des chercheurs
// old way in two steps without a scholars <=> keywords table
// $sql1 = "SELECT keywords,last_name,first_name FROM scholars WHERE doors_uid='" . $login . "'";
// $sql1 = "SELECT keywords,last_name,first_name FROM scholars WHERE luid='" . $login . "'";
// $sql2 = "SELECT uid FROM sch_kw JOIN keywords ON sch_kw.kwid = keywords.kwid WHERE kwstr LIKE \"%" . trim($keyword)."%\"";
// new way in one query
......@@ -137,13 +137,13 @@ SELECT
GROUP_CONCAT(kwstr) AS keywords_list
FROM scholars
JOIN sch_kw
ON doors_uid = uid
ON luid = uid
JOIN keywords
ON sch_kw.kwid = keywords.kwid
LEFT JOIN affiliations
ON affiliation_id = affid
WHERE doors_uid = "{$scholar_id}"
GROUP BY doors_uid
WHERE luid = "{$scholar_id}"
GROUP BY luid
END_QUERY;
......@@ -152,7 +152,8 @@ END_QUERY;
//$query = "SELECT * FROM scholars";
foreach ($base->query($sql) as $row) {
$info = array();
$info['unique_id'] = $row['doors_uid'];
$info['unique_id'] = $row['luid'];
$info['doors_uid'] = $row['doors_uid'];
$info['first_name'] = $row['first_name'];
$info['mid_initial'] = (strlen($row['middle_name']) ? substr($row['middle_name'],0,1)."." : "");
$info['last_name'] = $row['last_name'];
......@@ -168,8 +169,16 @@ foreach ($base->query($sql) as $row) {
$info['country'] = $row['country'];
$info['homepage'] = $row['home_url'];
$info['lab'] = $row['team_lab'];
$info['affiliation'] = $row['org'];
// TODO recreate difference between lab and org --------->8--------
// $info['lab'] = $row['team_lab'];
// $info['affiliation'] = $row['org'];
// right now duplicate treatment short-circuited like this
// (effect visible in stat-prep_from_array)
$info['affiliation'] = $row['org'] . $row['team_lab'];
// ----------------------------------------------------->8---------
// $info['lab2'] = $row['lab2'];
// $info['affiliation2'] = $row['affiliation2'];
$info['title'] = $row['hon_title'];
......@@ -184,13 +193,17 @@ foreach ($base->query($sql) as $row) {
// $info['mobile'] = $row['mobile'];
// $info['fax'] = $row['fax'];
// $info['affiliation_acronym'] = $row['affiliation_acronym'];
$scholars[$row['doors_uid']] = $info;
$scholars[$row['luid']] = $info;
}
}
include ('php_library/stat-prep_from_array.php');
/// stats
include ("php_library/stat-prep_from_array.php");
include ('php_library/directory_content.php');
// debug
// $content .= var_dump($scholars) ;
include ("php_library/directory_content.php");
......@@ -198,8 +211,38 @@ include ('php_library/directory_content.php');
$content .= '</div>';
$content .= '</div>
<footer>
GENERATED BY <a href="http://iscpif.fr"><img src="static/css/branding/logo-iscpif_medium.png" alt="iscpif.fr" style="border: none; margin-bottom : -6px;" title="isc-pif" /></a>- <a href="http://sciencemapping.com" target="_BLANK">MOMA</a> - <a href="http://www.crea.polytechnique.fr/LeCREA/" target="_BLANK">CREA</a> - <a href="http://www.cnrs.fr/fr/recherche/index.htm" target="_BLANK">CNRS</a>
<footer style="color:white">
<!-- This directory is maintained by the <a href="http://cssociety.org" target="blank">Complex Systems Society</a>
and the <a href="http://iscpif.fr" target="blank">Complex Systems Institute of Paris Ile-de-France</a>.<br/>-->
<center>
<a href="/about.html"><span class="glyphicon glyphicon-question-sign"></span> About</a> -
<!-- <a href="http://moma.csregistry.org/feedback" target="BLANK"><span class="glyphicon glyphicon-repeat"></span> Feedback</a> - -->
<a href="/privacy.html"> <span class="glyphicon glyphicon-list-alt"></span> Privacy</a>
<br>
Directory maintained by the <a href="http://iscpif.fr/" target="blank">Complex Systems Institute of Paris Ile-de-France</a> (<a href="http://www.cnrs.fr/fr/recherche/index.htm" target="_BLANK">CNRS</a> UPS 3611) in partnership with the <a href="http://cssociety.org/" target="blank"> Complex Systems Society</a>.
<br>
<a href="http://iscpif.fr/">
<img src="/static/img/logo_m_bleu-header.png" title="Institut des Systèmes Complexes de Paris Ile-de-France"
style="border: none; margin: 3px 0 -6px 0; height:30px;">
</a>
&nbsp;&nbsp;
<a href="http://cssociety.org/" target="_BLANK">
<img src="/static/img/logo_cssociety_no_legend.png" alt="http://cssociety.org"
style="border: none; margin: 3px 0 -6px 0; height:30px;"
title="Complex systems society">
</a>
&nbsp;&nbsp;
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/" target="blank">
<img alt="Creative Commons License" style="border: none; margin: 3px 0 -6px 0; height:30px;" src="/static/img/cc.png">
</a>
&nbsp;&nbsp;
<a href="http://www.cnrs.fr/" target="blank">
<img alt="CNRS" style="border: none; margin: 3px 0 -6px 0; height:30px;" src="/static/img/logo_cnrs.png">
</a>
<!-- <a href="http://moma.csregistry.org/" target="_BLANK"> MOMA</a> - -->
</center>
<p>&nbsp;</p>
</footer>
</div>
</body>
......@@ -214,23 +257,24 @@ $header = '<div class="row" id="welcome">
<br/>
<br/>
<p>
This directory presents scholars from the complex systems community who share interest with
'.$target_name.': <a href="#scholars">'. count($scholars).' scholars</a> affiliated to <a href="#labs">'
. count($labs).' labs</a> and <a href="#orga">'.$orga_count.' organizations</a>.
This directory presents the profiles of <a href="#scholars">'. count($scholars).' scholars</a> and <a href="#labs">'. count($labs).' labs</a> in the field of Complex Systems';
Scholars have been selected from the complex systems directory when sharing common keywords with '.$target_name.'.
// TODO restore old version before duplicate lab/orga
// This directory presents the profiles of <a href="#scholars">'. count($scholars).' scholars</a>, <a href="#labs">'. count($labs).' labs</a> and <a href="#orga">'.$orga_count.' organizations</a> in the field of Complex Systems';
</p>
<h4>About the complex systems directory</h4>
<p><ul>
<p>
<ul>
<li><b><i>This directory is open</i></b>. Anybody can have her profile included
provided it is related to Complex Systems science and Complexity science. Personal data are given on a
voluntary basis and people are responsible for the validity and integrity of their data.
<li><i><b>This directory is browsable online</b> on the website of the complex systems society :</i> http://csbrowser.cssociety.org
<li>This directory is edited by the Complex Systems Registry. This initiative is supported by the <i>Complex Systems
<li>This directory is edited by the ISCPIF. This initiative is supported by the <i>Complex Systems
Society</i> (<a href="http://cssociety.org">http://cssociety.org</a>).
Contributions and ideas are welcome to improve this directory.
<a href="http://css.csregistry.org/whoswho+feedback">Please feedback</a></p>
<a href="mailto:sysop AT iscpif.fr">Please feedback</a></p>
</ul>
</p>
......@@ -240,6 +284,7 @@ Contributions and ideas are welcome to improve this directory.
<div id="country" style="width: 800px; height: 300px; margin: 0 auto"></div>
<div id="title" style="width: 800px; height: 300px; margin: 0 auto"></div>
<div id="position" style="width: 800px; height: 300px; margin: 0 auto"></div>
<div id="organizations" style="width: 800px; height: 300px; margin: 0 auto"></div>
<br/>
......
......@@ -29,7 +29,7 @@ if ($category == 'country' || $category == 'countries') {
$query = 'LIKE upper(\''.strtoupper($q).'\')';
}
elseif ($category == 'tag' || $category == 'tags') {
$cat = "community_hashtags";
$cat = "hashtags_list";
$query = 'LIKE upper(\''.strtoupper($q).'\')';
}
elseif (v == 'labs' || $category == 'laboratories' || $category == 'laboratory') {
......@@ -60,20 +60,24 @@ $req = <<<END_QUERY
SELECT
-- we create all needed cats for the outer select
-- ==============================================
scholars.doors_uid,
scholars.luid,
scholars.country,
scholars.community_hashtags,
affiliations.org,
affiliations.team_lab,
GROUP_CONCAT(kwstr) AS keywords_list
GROUP_CONCAT(kwstr) AS keywords_list,
GROUP_CONCAT(htstr) AS hashtags_list
FROM scholars
JOIN sch_kw
ON scholars.doors_uid = sch_kw.uid
JOIN keywords
LEFT JOIN sch_kw
ON sch_kw.uid = luid
LEFT JOIN keywords
ON sch_kw.kwid = keywords.kwid
LEFT JOIN sch_ht
ON sch_ht.uid = luid
LEFT JOIN hashtags
ON sch_ht.htid = hashtags.htid
LEFT JOIN affiliations
ON scholars.affiliation_id = affiliations.affid
GROUP BY doors_uid
GROUP BY luid
) AS full_scholars_info
WHERE {$cat} {$query} -- <== our filter
GROUP BY $cat
......@@ -85,7 +89,7 @@ $results = array();
$i = 0;
foreach ($base->query($req) as $row) {
$nb = $row['value'];
if ($cat == "keywords_list" || $cat == "tags") {
if ($cat == "keywords_list" || $cat == "hashtags_list") {
//echo "in keywords\n";
$words = explode(",", $row["clef"]);
foreach ($words as $word) {
......
......@@ -19,7 +19,7 @@ $q = "%".sanitize_input($login)."%";
$query = 'concat(first_name, " ", IFNULL(middle_name,""), " ", last_name) LIKE "%'.$q.'%"';
$req = "SELECT doors_uid, first_name, middle_name, last_name FROM scholars WHERE ".$query." GROUP BY doors_uid";
$req = "SELECT luid, first_name, middle_name, last_name FROM scholars WHERE ".$query." GROUP BY luid";
// echo "req: ".$req.";";
$results = array();
$i = 0;
......@@ -32,7 +32,7 @@ $completion = array(
foreach($res as $row) {
array_push($completion["results"], array(
'id' => $row["doors_uid"],
'id' => $row["luid"],
'term' => $login,
'firstname' => $row["first_name"],
'lastname' => $row["last_name"],
......
......@@ -243,11 +243,11 @@ def get_full_scholar(uid):
FROM (
SELECT
-- scholars.*,
scholars.*,
-- for debug replace scholars.* by
scholars.luid,
scholars.doors_uid,
scholars.email,
-- scholars.luid,
-- scholars.doors_uid,
-- scholars.email,
-- scholars.last_modified_date,
-- scholars.initials,
......
......@@ -75,17 +75,18 @@ class MyExtractor:
sql_query="""
SELECT
neighbors_by_kw.uid,
scholars.initials,
COUNT(matching.kwid) AS cooc
FROM scholars
-- step 1
JOIN sch_kw AS matching
ON matching.uid = scholars.doors_uid
ON matching.uid = scholars.luid
-- step 2
JOIN sch_kw AS neighbors_by_kw
ON neighbors_by_kw.kwid = matching.kwid
WHERE doors_uid = "%s"
WHERE luid = "%s"
GROUP BY neighbors_by_kw.uid
ORDER BY cooc DESC
""" % unique_id
......@@ -104,7 +105,7 @@ class MyExtractor:
for row in results:
# mlog("DEBUG", "the row:", row)
node_uid = row['uid']
node_shortid = "D::"+node_uid[0:8]
node_shortid = "D::"+row['initials']+"/%05i"%int(node_uid);
# old way: candidate = ( integerID , realSize , #keywords )
# new way: scholars_array[uid] = ( ID , occ size )
......@@ -116,13 +117,12 @@ class MyExtractor:
elif qtype == "filters":
sql_query = None
# debug
mlog("DEBUG", "filters: REST query is", filter_dict)
mlog("INFO", "filters: REST query is", filter_dict)
if "query" in filter_dict and filter_dict["query"] == "*":
# query is "*" <=> all scholars
sql_query = """
SELECT doors_uid
SELECT luid
FROM scholars
"""
......@@ -175,7 +175,7 @@ class MyExtractor:
# use constraints as WHERE-clause
sql_query = """
SELECT
scholars.doors_uid,
scholars.luid,
-- kws info
COUNT(keywords.kwid) AS keywords_nb,
......@@ -186,7 +186,7 @@ class MyExtractor:
-- two step JOIN for keywords
JOIN sch_kw
ON doors_uid = uid
ON uid = luid
JOIN keywords
ON sch_kw.kwid = keywords.kwid
-- LEFT JOIN affiliations
......@@ -194,7 +194,7 @@ class MyExtractor:
-- our filtering constraints fit here
WHERE %s
GROUP BY doors_uid
GROUP BY luid
""" % (" AND ".join(sql_constraints))
......@@ -202,14 +202,14 @@ class MyExtractor:
self.cursor.execute(sql_query)
scholar_rows=self.cursor.fetchall()
for row in scholar_rows:
scholar_array[ row['doors_uid'] ] = 1
scholar_array[ row['luid'] ] = 1
return scholar_array
except Exception as error:
mlog("ERROR", "===== getScholarsList SQL ERROR ====")
if queryargs != None:
mlog("ERROR", "qtype "+qtype+" received REST queryargs:\t"+str(queryargs))
if filter_dict != None:
mlog("ERROR", "qtype "+qtype+" received REST queryargs:\t"+str(filter_dict))
if sql_query != None:
mlog("ERROR", "qtype filter attempted SQL query:\t"+sql_query)
mlog("ERROR", repr(error) + "("+error.__doc__+")")
......@@ -220,6 +220,8 @@ class MyExtractor:
def extract(self,scholar_array):
"""
Adding each connected scholar per unique_id
TODO this should be done by JOINS at previous step (faster but more verbose to program)
"""
# debug
# mlog("DEBUG", "MySQL extract scholar_array:", scholar_array)
......@@ -233,14 +235,14 @@ class MyExtractor:
GROUP_CONCAT(keywords.kwid) AS keywords_ids,
GROUP_CONCAT(kwstr) AS keywords_list
FROM scholars
JOIN sch_kw
ON doors_uid = uid
JOIN keywords
LEFT JOIN sch_kw
ON uid = luid
LEFT JOIN keywords
ON sch_kw.kwid = keywords.kwid
LEFT JOIN affiliations
ON affiliation_id = affid
WHERE doors_uid = "%s"
GROUP BY doors_uid ;
WHERE luid = "%s"
GROUP BY luid ;
''' % scholar_id
# debug
......@@ -250,20 +252,19 @@ class MyExtractor:
self.cursor.execute(sql3)
res3=self.cursor.fetchone()
info = {};
# POSS: semantic short ID
# ex "D::JFK/4913d6c7"
# for now we use uid substring [0:8]
# ex ide="D::4913d6c7"
ide="D::"+res3['doors_uid'][0:8];
# semantic short ID
# ex "D::JFK/00001"
ide="D::"+res3['initials']+("/%05i"%int(res3['luid']));
info['id'] = ide;
info['luid'] = res3['luid'];
info['doors_uid'] = res3['doors_uid'];
info['pic_url'] = res3['pic_url'];
info['first_name'] = res3['first_name'];
info['mid_initial'] = res3['middle_name'][0] if res3['middle_name'] else "" # TODO adapt usage
info['mid_initial'] = res3['middle_name'][0] if res3['middle_name'] else ""
info['last_name'] = res3['last_name'];
info['keywords_nb'] = res3['keywords_nb'];
info['keywords_ids'] = res3['keywords_ids'].split(',');
info['keywords_ids'] = res3['keywords_ids'].split(',') if res3['keywords_ids'] else [];
info['keywords_list'] = res3['keywords_list'];
info['country'] = res3['country'];
# info['ACR'] = res3['org_acronym'] # TODO create
......@@ -281,8 +282,14 @@ class MyExtractor:
self.scholars[ide] = info;
except Exception as error:
mlog("ERROR", "sql3:\t"+sql3)
mlog("ERROR", error)
mlog("ERROR", "===== extract ERROR ====")
mlog("ERROR", "extract on scholar no %s" % str(scholar_id))
if sql3 != None:
mlog("ERROR", "extract attempted SQL query:\t"+sql3)
mlog("ERROR", repr(error) + "("+error.__doc__+")")
mlog("ERROR", "stack (\n\t"+"\t".join(format_tb(error.__traceback__))+"\n)")
mlog("ERROR", "===== /extract ERROR ====")
# génère le gexf
......@@ -298,7 +305,9 @@ class MyExtractor:
scholar_keywords = self.scholars[i]['keywords_ids'];
for k in range(len(scholar_keywords)):
kw_k = scholar_keywords[k]
mlog('INFO', 'extractDataCustom:keyword'+kw_k)
# TODO join keywords and count to do this part already via sql
mlog('DEBUG', 'extractDataCustom:keyword '+kw_k)
if kw_k != None and kw_k!="":
# mlog("DEBUG", kw_k)
......@@ -362,12 +371,12 @@ class MyExtractor:
cont=0
for term_id in self.terms_dict:
sql="SELECT uid FROM sch_kw WHERE kwid=%i" % term_id
sql="SELECT uid, initials FROM sch_kw JOIN scholars ON uid=luid WHERE kwid=%i" % term_id
term_scholars=[]
self.cursor.execute(sql)
rows = self.cursor.fetchall()
for row in rows:
term_scholars.append("D::"+row['uid'][0:8])
term_scholars.append("D::"+row['initials']+"/%05i"%int(row['uid']))
for k in range(len(term_scholars)):
if term_scholars[k] in scholarsMatrix:
......@@ -503,7 +512,7 @@ class MyExtractor:
nodesB+=1
if idNode[0]=='D':#If it is Document
if idNode[0]=='D':#If it is Document (or scholar)
nodeLabel= self.scholars[idNode]['hon_title']+" "+self.scholars[idNode]['first_name']+" "+self.scholars[idNode]['mid_initial']+" "+self.scholars[idNode]['last_name']
color=""
if self.scholars_colors[self.scholars[idNode]['email']]==1:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment