Skip to content

Commit

Permalink
translated doctorat grantInstrument to HCERES code fixes #384
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgirard committed Mar 27, 2017
1 parent c8c7041 commit b9643b8
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 3 deletions.
19 changes: 16 additions & 3 deletions server/export/hceres.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const {

//const GRADES_INDEX = require('../../specs/export/grades.json');
const GRADES_INDEX = require('../../specs/export/grades2gradesHCERES.json');
const PHD_GRANT_INDEX = require('../../specs/export/docoratGrantInstrument2HCERES.json');

const PERMANENT = 'permanent';
const TEMPORARY = 'temporary';
Expand Down Expand Up @@ -57,6 +58,7 @@ const GENDER_MAP = {
const FILENAME = 'hceres.xlsx';

const HCERES_DATE = '2017-06-30';
const HCERES_PERIOD = {startDate:'2012-01-01', endDate:'2017-06-30'};

/**
* Helpers.
Expand Down Expand Up @@ -645,12 +647,22 @@ const SHEETS = [

results
//Liste des docteurs ayant soutenu depuis le 1/01/2012 et des doctorants présents dans l’unité au 30 juin 2017
.filter(r => !r.endDate || parseDate(r.endDate) >= moment('2012-01-01'))
.filter(r => overlap(r, HCERES_PERIOD))
.forEach(result => {
// get the PHD students from people
const phdStudent = result.people.filter(p => p.role === 'doctorant(role)').map(p => p.people)[0];
const directors = result.people.filter(p => p.role === 'directeur' || p.role === 'codirecteur').map(p => p.people);

let grant = ''
if (result.grants && result.grants.length > 0){
grant = result.grants.map(g => {
if (g.grantType === "doctorat" && g.grantInstrument in PHD_GRANT_INDEX)
return PHD_GRANT_INDEX[g.grantInstrument].HCERES_code;
else
return undefined;
}).filter(g => g).join(', ');
}

const info = {
name: phdStudent.name,
firstName: phdStudent.firstName,
Expand All @@ -659,8 +671,9 @@ const SHEETS = [
//organization
director: directors ? directors.map(d => `${d.name.toUpperCase()} ${_(d.firstName).capitalize()}`).join(',') : '',
startDate: formatDate(result.startDate),
endDate: formatDate(result.endDate)
endDate: formatDate(result.endDate),
//grant
grant: grant
};
if (phdStudent.distinctions) {
const masterAndOthers = _.sortBy(phdStudent
Expand Down Expand Up @@ -728,7 +741,7 @@ const SHEETS = [
return callback(err);
const {people, activities} = data;

const HCERES_PERIOD = {startDate:'2012-01-01', endDate:'2017-06-30'};


// Finding postdocs
const postDocs = _.sortBy(people
Expand Down
82 changes: 82 additions & 0 deletions specs/export/doctoratGrantInstrument2HCERES.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"Ancienne alloc. recherche MESR": {
"STVSOFF_CODE": "T001",
"HCERES_code": "AM",
"HCERES_lab": "Allocataire-moniteur (avant décret 2009)"
},
"Associations et fondations": {
"STVSOFF_CODE": "T002",
"HCERES_code": "ASSOC",
"HCERES_lab": "Bourse association"
},
"Autre allocation": {
"STVSOFF_CODE": "T003",
"HCERES_code": "AUTRE",
"HCERES_lab": "Autre financement"
},
"Bourse doctorale FNSP": {
"STVSOFF_CODE": "T004",
"HCERES_code": "FNSP",
"HCERES_lab": "Bourse doctorale FNSP (spécifique FNSP)"
},
"Bourse gouv. français/étranger": {
"STVSOFF_CODE": "T005",
"HCERES_code": "ETR",
"HCERES_lab": "Bourse pour étudiant étranger"
},
"CIFRE": {
"STVSOFF_CODE": "T006",
"HCERES_code": "CIFRE",
"HCERES_lab": "Convention industrielle de formation par la recherche"
},
"Contrat doct. autre ministère": {
"STVSOFF_CODE": "T007",
"HCERES_code": "CD",
"HCERES_lab": "Contrat doctoral uniquement recherche"
},
"Contrat doct. financé par rég.": {
"STVSOFF_CODE": "T008",
"HCERES_code": "CD",
"HCERES_lab": "Contrat doctoral uniquement recherche"
},
"Contrat doct. MESR hors ScPo": {
"STVSOFF_CODE": "T009",
"HCERES_code": "CD",
"HCERES_lab": "Contrat doctoral uniquement recherche"
},
"Contrat doct. MESR ScPo": {
"STVSOFF_CODE": "T010",
"HCERES_code": "CDE",
"HCERES_lab": "Contrat doctoral avec activités complémentaires (e.g. enseignement)"
},
"Entreprise - Hors CIFRE": {
"STVSOFF_CODE": "T011",
"HCERES_code": "INDUSTR",
"HCERES_lab": "Bourse industrie"
},
"Organismes de recherche": {
"STVSOFF_CODE": "T013",
"HCERES_code": "CTO",
"HCERES_lab": "Contrat de thèse d'autres organismes"
},
"Université étrangère": {
"STVSOFF_CODE": "T014",
"HCERES_code": "ETR",
"HCERES_lab": "Bourse pour étudiant étranger"
},
"SANS FINANCEMENT": {
"STVSOFF_CODE": "T015",
"HCERES_code": "AUCUN",
"HCERES_lab": "Aucun financement"
},
"Salarié(e) secteur privé": {
"STVSOFF_CODE": "T016",
"HCERES_code": "AUTRE",
"HCERES_lab": "Autre financement"
},
"Salarié(e) secteur public": {
"STVSOFF_CODE": "T017",
"HCERES_code": "SECD",
"HCERES_lab": "Enseignant du second degré"
}
}

0 comments on commit b9643b8

Please sign in to comment.