Commit a2d9bef1 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Ajout de la colonne V_SYGAL_DOCTORANT_V2.code_apprenant_in_source contenant le...

Ajout de la colonne V_SYGAL_DOCTORANT_V2.code_apprenant_in_source contenant le numéro étudiant (API V3)
parent ef1226c7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
Journal des modifications
=========================

3.0.0
-----
- Passage à PHP 8.0.
- Ajout d'une V3 à l'API ; les V1 et V2 demeurent.
- Ajout de la colonne V_SYGAL_DOCTORANT_V2.code_apprenant_in_source contenant le numéro étudiant (API V3).

2.3.0
-----
- Correction du mapping de l'entité Doctorant.
+9 −7
Original line number Diff line number Diff line
@@ -13,25 +13,27 @@ Docker
- Obtention de l'image de base Unicaen (construite) à jour

```bash
PHP_VERSION=7.4 ;
PHP_VERSION=8.0 \
docker pull registre.unicaen.fr:5000/unicaen-dev-php${PHP_VERSION}-apache
```

- Construction de l'image du web service

```bash
PHP_VERSION=8.0 \
docker build \
--build-arg HTTP_PROXY \
--build-arg HTTPS_PROXY \
--build-arg NO_PROXY \
--build-arg PHP_VERSION \
-t sygal-import-ws-image-php${PHP_VERSION} .
-t sygal-import-ws-image-php${PHP_VERSION} \
.
```

- Lancement du web service

```bash
docker-compose up
docker-compose up sygal-import-ws
```


@@ -47,10 +49,10 @@ Lancement du web service *pour le dévelopement*
Se placer à la racine des sources du ws pour lancer la commande suivante :

```bash
docker-compose up --build
docker-compose up --build sygal-import-ws
```

Vérifier que le container `sygal-import-ws-container` figure bien dans la liste des containers
Vérifier que le container `sygal-import-ws-container-php8.0` figure bien dans la liste des containers
lancés listés par la commande suivante (cf. colonne `NAMES`) :

```bash
@@ -119,9 +121,9 @@ Afin d'obtenir les informations spécifiques à une donnée, il est possible d'a
curl --insecure --header "Accept: application/json" --header "Authorization: Basic xxxx" https://localhost:8443/v2/variable/ETB_LIB_NOM_RESP
```

Pour mettre en forme le JSON retourné et faciliter la lecture, une solution est d'utiliser `python -m json.tool`:
Pour mettre en forme le JSON retourné et faciliter la lecture, une solution est d'utiliser `python`:
```bash
curl --insecure --header "Accept: application/json" --header "Authorization: Basic xxxx" https://localhost:8443/v2/variable | python -m json.tool
curl --insecure --header "Accept: application/json" --header "Authorization: Basic xxxx" https://localhost:8443/v2/variable | python3 -m json.tool
```


+34 −0
Original line number Diff line number Diff line
----------------------------------------------------------
-- Apogée : modification de vues/tables pour l'API V3.
----------------------------------------------------------

--
-- NB : Seules les vues/tables modifiées existent en version "V3" (ex: V_SYGAL_DOCTORANT_V3).
--      Les vues/tables inchangées restent en version "V2".
--

create or replace view V_SYGAL_DOCTORANT_V3 as
    select distinct
        ind.cod_etu as source_code, -- Identifiant unique
        'apogee' as source_id, -- identifiant unique de la source
        ind.cod_etu as id, -- Identifiant du doctorant
        ind.cod_etu as individu_id, -- Identifiant de l'individu
        ind.cod_nne_ind||ind.cod_cle_nne_ind as ine, -- INE du doctorant
        ind.cod_etu as code_apprenant_in_source -- Numero étudiant Apogée <<<<<<<<<<<<< nouvelle colonne
    from these_hdr_sout ths
             join diplome        dip on dip.cod_dip     = ths.cod_dip
             join typ_diplome    tpd on tpd.cod_tpd_etb = dip.cod_tpd_etb
             join individu       ind on ind.cod_ind     = ths.cod_ind --and ind.cod_etu != 21009539 -- Exclusion du compte de test Aaron AAABA
             join pays           pay on pay.cod_pay     = ind.cod_pay_nat
    where ths.cod_ths_trv =  '1' -- Exclusion des travaux
      and dip.cod_tpd_etb in ('39', '40')
      and tpd.eta_ths_hdr_drt = 'T' -- Inscription en these
      and tpd.tem_sante = 'N' -- Exclusion des theses d exercice
      and cod_etu is not null
;



--drop table SYGAL_DOCTORANT_V3;
create table SYGAL_DOCTORANT_V3 as select * from V_SYGAL_DOCTORANT_V3;
alter table SYGAL_DOCTORANT_V3 add source_insert_date date default sysdate;
+25 −0
Original line number Diff line number Diff line
----------------------------------------------------------
-- Physalis : modification de vues/tables pour l'API V3.
----------------------------------------------------------

--
-- NB : Seules les vues/tables modifiées existent en version "V3" (ex: V_SYGAL_DOCTORANT_V3).
--      Les vues/tables inchangées restent en version "V2".
--

CREATE or replace VIEW "API_SCOLARITE"."V_SYGAL_DOCTORANT_V3" ("ID", "SOURCE_CODE", "SOURCE_ID", "INDIVIDU_ID", "INE", "CODE_APPRENANT_IN_SOURCE") AS
select
    i.pers_id  as ID ,
    i.pers_id  as SOURCE_CODE ,
    'physalis' as SOURCE_ID,
    i.pers_id as INDIVIDU_ID ,
    e.ETUD_CODE_INE as ine,
    e.ETUD_NUMERO as CODE_APPRENANT_IN_SOURCE
from RECHERCHE.DOCTORANT d left outer join grhum.INDIVIDU_ULR i on d.no_individu= i.no_individu
                           left outer join grhum.etudiant e on d.ETUD_NUMERO =  e.ETUD_NUMERO;



--drop table "API_SCOLARITE".SYGAL_DOCTORANT_V3;
create table "API_SCOLARITE".SYGAL_DOCTORANT_V3 as select * from "API_SCOLARITE".V_SYGAL_DOCTORANT_V3;
alter table "API_SCOLARITE".SYGAL_DOCTORANT_V3 add source_insert_date date default sysdate;
+31 −0
Original line number Diff line number Diff line
Version 3.0.0
=============

Base de données
---------------

### Apogée
Cf. [3.0.0/apogee.sql](3.0.0/apogee.sql).

### Physalis
Cf. [3.0.0/physalis.sql](3.0.0/physalis.sql).


Serveur d'application
---------------------

- Sur le serveur d'application, placez-vous dans le répertoire du web service (sans doute `/var/www/sygal-import-ws`)
  puis lancez les commandes suivantes pour installer la nouvelle version :
```bash
git fetch && git fetch --tags && git checkout --force 3.0.0 && rm -rf vendor/* && bash install.sh
```

- Rechargez le service PHP-FPM :
```bash
service php7.4-fpm reload
```

- Lancer la mise à jour des tables hébergeant les données importables (cela prend jusqu'à 1 minute) :
```bash
/usr/bin/php ./public/index.php update-service-tables --verbose
```
Loading