What are HAL publications?
The multidisciplinary open archive HAL (Hyper Articles Online) allows users to submit and share research scientific articles, whether published or not, and theses originating from French or foreign educational and research institutions, as well as public or private laboratories.
This online platform was developed in 2001 by the Centre for Direct Scientific Communication (CCSD) of the CNRS, and more specifically, on the initiative of the French physicist Franck Laloë.
This platform showcases the largest research database from institutions and French-speaking researchers worldwide. In 2019, it contained around 1,900,000 references and 600,000 scientific documents.
The role and its use by the scientific community
HAL Publication offers a Portal service. This service is specifically dedicated to institutions and organizations wishing to promote the publications and scientific data of their researchers and faculty. It acts as a repository designed to store and disseminate scientific communications/publications. These are typically submitted by their authors and made available to the general public without restriction. The use of common protocols, particularly the Open Archives Initiative Protocol for Metadata Harvesting (OAI-PMH), enables different open archives to make their content searchable and makes it possible to aggregate them using specialized search engines (via metadata).
HAL also provides an API (Application Programming Interface). This groups together a specific set of rules ("code") and specifications that software can follow to communicate with each other. This makes it possible to access and sort resources.
HAL open archives also offer a unique identifier, which allows an authenticated user, recognized as an author in HAL, to group all of their publications, regardless of the different forms in which their name may have been entered. This is called the idHAL. The idHAL is linked to the profile, and is updated along with it. It is also used as a CV.
The Drupal connector
Context with SESSTIM
The agency bluedrop.fr took over, during 2019, the maintenance of the Drupal site for the SESSTIM Laboratory at La Timone in Marseille. The Joint Research Unit 1252 SESSTIM Economic and Social Sciences of Health & Medical Information Processing (Inserm/ IRD/ Aix Marseille University) was created on January 1, 2012. It strives to produce excellent, multidisciplinary, and interdisciplinary research in the humanities, social sciences, and public health, which can lead to changes in the various areas of predictive, personalized, preemptive, and participatory medicine.
SESSTIM wanted it to be possible to display the profiles of participating researchers and their publications in three different ways:
- By researcher in a tab of their profile;
- By all the researchers on a team in a tab on the pages;
- All SESSTIM researchers on the same page.
The technical solution previously used was imperfect. It relied on the Drupal Biblio module on one hand (for the first two features), but without being connected to the HAL open archives. It was in place but not ideal. Two tools were used to meet these requirements: the Drupal biblio module (for the first two criteria), but without any connection to HAL. On the other hand, it offered an iframe that queried the idHALs of the researchers involved.
It was therefore necessary to enable the use of idHAL programmatically to make it possible to display resources by researcher and by team.
Module Update and Corrections
To address this need, we chose to improve the Drupal module developed by Mathieu Dandonneau at AMU (Aix-Marseille University).
The corrections focused on the following features:
- The ability to use a "dynamic" idHal whose value would be retrieved from a field in the user profile. This allows for the display, in a separate "HAL Publication" tab in the user's profile, of publications submitted to the open archives.
- The ability to use a list of idHals dynamically retrieved from all user profiles, thus indicating which research team they belong to. This allows the display of HAL publications for the three research teams on three different pages or blocks, without having to manually enter the idHALs of the researchers of the relevant teams (so that publications are accessible even in case of changes within the team or if a user independently updates their idHAL).
Drupal 7 Contribution
The module is now available on drupal.org. To use the module, some configuration is required:
- The user's "HAL identifier" field;
- The user's "last name" field;
- The user's "first name" field;
- The selection list of the teams to which the user belongs;
- The Chosen JS library is integrated in the module. If the library is already installed on your site, make sure to indicate this in the template file.
Features included in this module update:
- Choice between multiple portals/repositories from which to collect publications;
- Option to add a publications tab to the user’s page on the site;
- Collection of publications by site users;
- Collection of publications by selected teams;
- Filtering of publications by keywords;
- Filtering of publications by author(s);
- Filtering of publications by year(s);
- Display of publications according to the Vancouver standard;
- Export to BibTex format for one or more publications;
- Export to RTF format for one or more publications.
To add a new HAL block:
- Each HAL block represents an "instance"—add a new instance for each new HAL block: Structure > Blocks > Instances > Add instance
- Give a title to the instance in "instance title" and choose HAL Publications from the "Block type" dropdown list.
- Save.
- Configure your block by going to – Structure – Blocks.
- Choose whether or not to display filters.
- Choose between a single or multiple selection list for authors.
- Choose between a single or multiple selection list for years.
- Select the teams whose publications should be displayed (select nothing to display publications from all teams).
To display publications by author(s):
- Check the "Display the publications tab for users" checkbox in the module configuration form. /admin/hal.
- Fill in the "Title of publications on the user page" field as the title for the tab on the user page.
Resources:
- Drupal Module — https://www.drupal.org/project/hal_publications
- The Drupal 8 module is in development. We expect to release it during the first quarter of 2020 — https://www.drupal.org/project/hal_publications/releases/8.x-1.x-dev
- Module sponsors — SESSTIM Lab Aix Marseille University (https://sesstim.univ-amu.fr) — Agency bluedrop.fr (https://www.bluedrop.fr)
Code example - Get result from API
// GET RESULTS FROM API.
$data = _amu_hal_api_request($url);
$theme = $config->display_mode;
$block['subject'] = t('publications');
$block['content'] = theme($theme, [
'docs' => $data->response->docs,
'filters' => $filters,
'display' => 'teaser',
'suffix' => $instanceSuffix,
'config' => $config,
// 'results' => $results,
// uncomment these to have number of results in template.
]);
break;
}
return $block;
}
Example code - HAL Publications block instance
/**
* Retrieve configuration for the HAL Publications block instance.
*
* @param string $instanceSuffix
* : HAL Publications block instance number.
*
* @return object
* : Block configuration.
*/
function _amu_hal_get_configuration($instanceSuffix) {
$config = new stdClass();
// Global module.
$config->retrieval_method_select = variable_get('retrieval_method_select' . $instanceSuffix);
$config->display_mode = variable_get('display_mode' . $instanceSuffix);
$config->filtres = variable_get('filtres' . $instanceSuffix);
$config->multiple_authors = variable_get('multiple_authors' . $instanceSuffix);
$config->multiple_years = variable_get('multiple_years' . $instanceSuffix);
$config->choices = variable_get('choices' . $instanceSuffix);
return $config;
}
Code example - Author's publications
/**
* Gets a specific author's publications.
*
* @param int $arg
* : UID.
*
* @return array|mixed
* : Render array.
*/
function _amu_hal_author_pub($arg) {
// Retrieving the HAL ID field machine name from configuration.
$hal_id_machine_name = variable_get('hal_id_machine_name');
// Hal ID table name.
$hal_id_table = "field_data_$hal_id_machine_name";
// HAL ID column name.
$hal_id_column = $hal_id_machine_name . "_value";
// Query to retrieve a HAL ID from UID.
$hal_id_query = db_query("SELECT $hal_id_column FROM $hal_id_table WHERE entity_id = $arg");
$hal_id_results = $hal_id_query->fetchAll();
if ($hal_id_results) {
$hal_id = $hal_id_results[0]->$hal_id_column;
$portal = variable_get('portal', '');
if ($portal) {
$portal = "$portal/";
}
$url = variable_get('amu_hal_url_ws') . 'search/' . $portal . '?fq=authIdHal_s:' . $hal_id . '&rows=2000&group.field=producedDateY_i&sort=producedDate_tdate%20desc&fl=authLastNameFirstName_s,title_s,journalTitle_s,producedDateY_i,volume_s,issue_s,page_s,publisherLink_s,halId_s,uri_s,files_s,journalSherpaCondition_s,label_xml';
$data = _amu_hal_api_request($url);
$docs = $data->response->docs;
}
// Change page title.
drupal_set_title(t("Publications"));
return theme('vancouver_no_et_al', [
'docs' => $docs,
'display' => 'teaser',
]);
}
Code example - IDS
/**
* Retrieve HAL IDS.
*
* @param array $team_ids
* : Team IDs.
* @param bool $plusNames
* : True: returns authors HAL IDs and names.
*
* @return array
* : HAL IDs and names if $plusNames is TRUE.
*/
function _amu_hal_ids(array $team_ids = [], $plusNames = FALSE) {
// Retrieve the HAL ID field machine name from configuration.
$hal_id_machine_name = variable_get('hal_id_machine_name');
// Hal ID table name.
$hal_id_table = "field_data_$hal_id_machine_name";
// HAL ID column name.
$hal_id_column = $hal_id_machine_name . "_value";
// Array to save the HAL IDs.
$filter_ids = array();
// Retrieve the teams field machine name from configuration.
$team_machine_name = variable_get('team_machine_name');
// Teams table name.
$team_table = "field_data_$team_machine_name";
// Retrieve the user's first name field machine name from configuration.
$firstname_machine_name = variable_get('field_prenom_machine_name');
// The user's first name table name.
$firstname_table = "field_data_$firstname_machine_name";
// The user's first name column name.
$firstname_column = $firstname_machine_name . "_value";
// Retrieve the user's last name field machine name from configuration.
$lastname_machine_name = variable_get('field_nom_machine_name');
// The user's last name table name.
$lastname_table = "field_data_$lastname_machine_name";
// The user's last name column name.
$lastname_column = $lastname_machine_name . "_value";
// Filter HAL IDs by Team IDs if $team_ids is not empty.
if (isset($team_ids) && $team_ids) {
// Teams column name.
$team_column = $team_machine_name . "_target_id";
$team_ids_list = implode(',', $team_ids);
$filtered_query = db_query("SELECT DISTINCT entity_id FROM $team_table WHERE $team_column IN ($team_ids_list)");
}
else {
$filtered_query = db_query("SELECT DISTINCT entity_id FROM $team_table");
}
$filtered_records = $filtered_query->fetchAll();
foreach ($filtered_records as $row) {
$filter_ids[] = $row->entity_id;
}
if (isset($filter_ids) && $filter_ids) {
$filter = implode(',', $filter_ids);
$query = db_query("SELECT $hal_id_column, entity_id FROM $hal_id_table WHERE $hal_id_column > '' AND entity_id IN ($filter) ");
}
else {
$query = db_query("SELECT $hal_id_column, entity_id FROM $hal_id_table WHERE $hal_id_column > '' ");
}
$records = $query->fetchAll();
$all_ids = array();
foreach ($records as $record) {
if ($plusNames) {
$namequery = db_query("SELECT $firstname_table.$firstname_column, $lastname_table.$lastname_column FROM $firstname_table, $lastname_table WHERE $firstname_table.entity_id = $lastname_table.entity_id AND $firstname_table.entity_id = $record->entity_id");
$namequeryResult = $namequery->fetchAll()[0];
$first_name = $namequeryResult->$firstname_column;
$last_name = $namequeryResult->$lastname_column;
$name = $last_name . " " . $first_name;
$all_ids[str_replace(" ", "", $record->$hal_id_column)] = $name;
}
else {
$all_ids[$record->entity_id] = str_replace(" ", "", $record->$hal_id_column);
}
}
asort($all_ids);
return $all_ids;
}
