Skip to content

Commit

Permalink
feat: test uploadFileMapping
Browse files Browse the repository at this point in the history
  • Loading branch information
lmanelphe committed Jan 2, 2024
1 parent cac0bc4 commit 72ee697
Show file tree
Hide file tree
Showing 2 changed files with 196 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@

import static org.junit.Assert.assertEquals;

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.sql.SQLException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;

import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;

import fr.insee.arc.core.dataobjects.ArcPreparedStatementBuilder;
import fr.insee.arc.core.dataobjects.ColumnEnum;
Expand All @@ -24,6 +33,7 @@
import fr.insee.arc.web.gui.norme.model.ViewCalendrier;
import fr.insee.arc.web.gui.norme.model.ViewChargement;
import fr.insee.arc.web.gui.norme.model.ViewJeuxDeRegles;
import fr.insee.arc.web.gui.norme.model.ViewMapping;
import fr.insee.arc.web.gui.norme.model.ViewNorme;

public class GererNormeDaoTest extends InitializeQueryTest {
Expand All @@ -33,16 +43,20 @@ public class GererNormeDaoTest extends InitializeQueryTest {
private static GererNormeDao pdao;

@BeforeClass
public static void setup() throws ArcException {
public static void setup() throws ArcException, SQLException {

buildPropertiesWithoutScalability(null);

BddPatcherTest.createDatabase();
BddPatcherTest.insertTestDataLight();
BddPatcherTest.insertTestDataSiera();
vObjectService = new VObjectService();
vObjectService.setConnection(c);
vObjectService.setSession(new Session());
dao = new DataObjectService();
dao.setSandboxSchema(BddPatcherTest.testSandbox1);
pdao = new GererNormeDao();
pdao.initialize(vObjectService, dao);

}

@Test
Expand All @@ -61,7 +75,7 @@ public void initializeViewNorme() {
assertEquals(0, viewColumns.size());

// in test data, must return two norms
assertEquals(2, viewNorme.getContent().t.size());
assertEquals(1, viewNorme.getContent().t.size());

}

Expand All @@ -72,7 +86,7 @@ public void initializeViewCalendar() throws ArcException {

// select the first record of viewNorm and set it as the selected record
ArcPreparedStatementBuilder query = new ArcPreparedStatementBuilder();
query.build(SQL.SELECT, "*", SQL.FROM, pdao.getDataObjectService().getView(ViewEnum.IHM_NORME), SQL.WHERE, "id_norme='v2016-02'");
query.build(SQL.SELECT, "*", SQL.FROM, pdao.getDataObjectService().getView(ViewEnum.IHM_NORME), SQL.WHERE, "id_norme='PHASE3V1'");
Map<String, List<String>> viewNormSelectedRecords = new GenericBean(UtilitaireDao.get(0).executeRequest(c, query)).mapContent();
pdao.setSelectedRecords(viewNormSelectedRecords);

Expand All @@ -99,7 +113,7 @@ public void initializeViewRulesSet() throws ArcException {

// select the first record of viewCalendar and set it as the selected record
ArcPreparedStatementBuilder query = new ArcPreparedStatementBuilder();
query.build(SQL.SELECT, "*", SQL.FROM, pdao.getDataObjectService().getView(ViewEnum.IHM_CALENDRIER), SQL.WHERE, "id_norme='v2008-11'");
query.build(SQL.SELECT, "*", SQL.FROM, pdao.getDataObjectService().getView(ViewEnum.IHM_CALENDRIER), SQL.WHERE, "id_norme='PHASE3V1'");
Map<String, List<String>> viewCalendarSelectedRecords = new GenericBean(UtilitaireDao.get(0).executeRequest(c, query)).mapContent();
pdao.setSelectedRecords(viewCalendarSelectedRecords);

Expand All @@ -126,7 +140,7 @@ public void initializeViewChargement() throws ArcException {
// select the first record of viewRulesSet and set it as the selected record
ArcPreparedStatementBuilder query = new ArcPreparedStatementBuilder();
query.build(SQL.SELECT, "*", SQL.FROM, pdao.getDataObjectService().getView(ViewEnum.IHM_JEUDEREGLE));
query.build(SQL.WHERE, "id_norme='v2008-11'", SQL.AND, "version='vConformite'");
query.build(SQL.WHERE, "id_norme='PHASE3V1'", SQL.AND, "version='v002'");
Map<String, List<String>> viewRulesSetSelectedRecords = new GenericBean(UtilitaireDao.get(0).executeRequest(c, query)).mapContent();
pdao.setSelectedRecords(viewRulesSetSelectedRecords);

Expand All @@ -144,5 +158,48 @@ public void initializeViewChargement() throws ArcException {
assertEquals(1, viewChargement.getContent().t.size());

}

@Test
public void uploadFileMapping() throws ArcException, IOException {

String path = "src/test/resources/fr/insee/testfiles/ihm_mapping_regle_siera_test.csv";
File file = new File(path);
byte[] fileBytes = Files.readAllBytes(file.toPath());
MultipartFile multipartFile = new MockMultipartFile("file", file.getName(), "text/plain", fileBytes);

VObject viewMapping = new ViewMapping();
VObject viewRulesSet = new ViewJeuxDeRegles();
VObject viewNorme = new ViewNorme();


pdao.initializeViewRulesSet(viewRulesSet);
pdao.initializeViewNorme(viewNorme);
viewMapping.setTable(pdao.getDataObjectService().getView(ViewEnum.IHM_MAPPING_REGLE));

// select the first line of norme
viewNorme.setSelectedLines(Arrays.asList(true));

// select the first line of ruleset
viewRulesSet.setSelectedLines(Arrays.asList(true));

// execute query
pdao.uploadFileMapping(viewMapping, viewRulesSet, viewNorme, multipartFile);

// test the content of ihm_mapping_regle
ArcPreparedStatementBuilder queryAssert = new ArcPreparedStatementBuilder();
queryAssert.build(SQL.SELECT, ColumnEnum.VARIABLE_SORTIE, ", ", ColumnEnum.EXPR_REGLE_COL, SQL.FROM, pdao.getDataObjectService().getView(ViewEnum.IHM_MAPPING_REGLE));


Map<String, List<String>> viewMappingUpload = new GenericBean(UtilitaireDao.get(0).executeRequest(c, queryAssert)).mapContent();
assertEquals(131, viewMappingUpload.get(ColumnEnum.VARIABLE_SORTIE.toString())
.size()); // number of variables


assertEquals(3, viewMappingUpload.get(ColumnEnum.EXPR_REGLE_COL.toString())
.stream()
.filter(Objects::isNull)
.collect(Collectors.toList())
.size()); // number of metadata absent from the file
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
id_regle;id_norme;validite_inf;validite_sup;version;periodicite;variable_sortie;expr_regle_col;commentaire;colonne_sup
int8;text;date;date;text;text;varchar;text;text;text
46;PHASE3V1;2015-01-01;2050-12-31;v002;M;ligne_incorrecte_1;{pk:mapping_dsn_employeur_ok};;
115;PHASE3V1;2015-01-01;2050-12-31;v002;M;ligne_incorrecte_2;coalesce(concat(coalesce({v_s21_g00_06_001},'NOTSIREN'),coalesce({v_s21_g00_11_001},'NOTNIC')),'S'||to_char(clock_timestamp(),'SSSS')||to_char(clock_timestamp(),'US')||'#'||(random()*1000)::integer);;
55;PHASE3V1;2015-01-01;2050-12-31;v002;M;ligne_incorrecte_3;{v_s21_g00_40_061};;
1;PHASE3V1;2015-01-01;2050-12-31;v002;M;adresse_etab;trim(concat(trim({v_s21_g00_11_003}),' ',trim({v_s21_g00_11_006}),' ',trim({v_s21_g00_11_007})));;
2;PHASE3V1;2015-01-01;2050-12-31;v002;M;adresse_sal;trim(concat(trim({v_s21_g00_30_008}),' ',trim({v_s21_g00_30_016}),' ',trim({v_s21_g00_30_017})));;
3;PHASE3V1;2015-01-01;2050-12-31;v002;M;adresse_siege;trim(concat(trim({v_s21_g00_06_004}),' ',trim({v_s21_g00_06_007}),' ',trim({v_s21_g00_06_008})));;
4;PHASE3V1;2015-01-01;2050-12-31;v002;M;an_penibilite;{{1}{v_s21_g00_34_003}};;
5;PHASE3V1;2015-01-01;2050-12-31;v002;M;apen;COALESCE({v_s21_g00_06_003},'0000Z');;
6;PHASE3V1;2015-01-01;2050-12-31;v002;M;apet;COALESCE({v_s21_g00_11_002},'0000Z');;
7;PHASE3V1;2015-01-01;2050-12-31;v002;M;apet_lieu_trav;{v_s21_g00_85_002};;
8;PHASE3V1;2015-01-01;2050-12-31;v002;M;ccpayes;'NON';;
9;PHASE3V1;2015-01-01;2050-12-31;v002;M;cj;{v_s21_g00_11_012};;
10;PHASE3V1;2015-01-01;2050-12-31;v002;M;code_categservice_fp;{v_s21_g00_40_056};;
11;PHASE3V1;2015-01-01;2050-12-31;v002;M;code_ccp;{v_s21_g00_40_022};;
12;PHASE3V1;2015-01-01;2050-12-31;v002;M;code_risque_acc;{v_s21_g00_40_040};;
13;PHASE3V1;2015-01-01;2050-12-31;v002;M;codification_ue;{v_s21_g00_30_013};;
14;PHASE3V1;2015-01-01;2050-12-31;v002;M;commune_lieu_trav;{v_s21_g00_85_011};;
15;PHASE3V1;2015-01-01;2050-12-31;v002;M;compl_rem_oblig;{v_s21_g00_40_016};;
16;PHASE3V1;2015-01-01;2050-12-31;v002;M;convcoll;{v_s21_g00_40_017};;
17;PHASE3V1;2015-01-01;2050-12-31;v002;M;cpost_etab;COALESCE({v_s21_g00_11_004},'VIIDE');;
18;PHASE3V1;2015-01-01;2050-12-31;v002;M;cpost_lieu_trav;{v_s21_g00_85_004};;
19;PHASE3V1;2015-01-01;2050-12-31;v002;M;cpost_sal;{v_s21_g00_30_009};;
20;PHASE3V1;2015-01-01;2050-12-31;v002;M;cpost_siege;{v_s21_g00_06_005};;
21;PHASE3V1;2015-01-01;2050-12-31;v002;M;cumul_empl_retr;{v_s21_g00_30_023};;
22;PHASE3V1;2015-01-01;2050-12-31;v002;M;date_debut_arret;{{1}{v_s21_g00_60_002}::date + '1 day'::interval}{{2}{v_s21_g00_65_002}::date}{{3}{v_s21_g00_66_001}::date};;
23;PHASE3V1;2015-01-01;2050-12-31;v002;M;date_debut_contrat;to_date({v_s21_g00_40_001}, 'YYYY-MM-DD');;
24;PHASE3V1;2015-01-01;2050-12-31;v002;M;date_debut_rem;{{1}to_date({v_s21_g00_51_001}, 'YYYY-MM-DD')}{{2}to_date({v_s21_g00_52_003}, 'YYYY-MM-DD')}{{3}to_date({v_s21_g00_54_003}, 'YYYY-MM-DD')}{{4}to_date({v_s21_g00_50_001},'YYYY-MM-DD')}{{5}to_date({v_s21_g00_50_001},'YYYY-MM-DD')}{{6}to_date({v_s21_g00_78_002}, 'YYYY-MM-DD')};;
25;PHASE3V1;2015-01-01;2050-12-31;v002;M;date_fin_arret;{{1}{v_s21_g00_60_010}::date - '1 day'::interval}{{2}{v_s21_g00_65_003}::date}{{3}{v_s21_g00_66_002}::date};;
26;PHASE3V1;2015-01-01;2050-12-31;v002;M;date_fin_contrat;to_date({v_s21_g00_62_001},'YYYY-MM-DD');;
27;PHASE3V1;2015-01-01;2050-12-31;v002;M;date_fin_rem;{{1}to_date({v_s21_g00_51_002}, 'YYYY-MM-DD')}{{2}to_date({v_s21_g00_52_004}, 'YYYY-MM-DD')}{{3}to_date({v_s21_g00_54_004}, 'YYYY-MM-DD')}{{4}to_date({v_s21_g00_50_001},'YYYY-MM-DD')}{{5} to_date({v_s21_g00_50_001},'YYYY-MM-DD')}{{6}to_date({v_s21_g00_78_003}, 'YYYY-MM-DD')};;
28;PHASE3V1;2015-01-01;2050-12-31;v002;M;date_finprev_contrat;to_date({v_s21_g00_40_010}, 'YYYY-MM-DD');;
29;PHASE3V1;2015-01-01;2050-12-31;v002;M;date_versement;to_date({v_s21_g00_50_001},'YYYY-MM-DD');;
30;PHASE3V1;2015-01-01;2050-12-31;v002;M;dateinteg;{date_integration};;
31;PHASE3V1;2015-01-01;2050-12-31;v002;M;datenais;to_date(coalesce({v_s21_g00_30_006},'1800-01-01'), 'YYYY-MM-DD');;
32;PHASE3V1;2015-01-01;2050-12-31;v002;M;datenais_sngi;case when {v_s21_g00_30_305} IN ('00','10') then to_date({v_s21_g00_30_301},'YYYY-MM-DD') end;;
33;PHASE3V1;2015-01-01;2050-12-31;v002;M;depnais;COALESCE(CASE WHEN LENGTH(TRIM({v_s21_g00_30_014})) = 1 THEN CONCAT('0',TRIM({v_s21_g00_30_014})) ELSE TRIM({v_s21_g00_30_014}) END , '00');;
34;PHASE3V1;2015-01-01;2050-12-31;v002;M;detaches_expatries;{v_s21_g00_40_024};;
35;PHASE3V1;2015-01-01;2050-12-31;v002;M;dispol;{v_s21_g00_40_008};;
36;PHASE3V1;2015-01-01;2050-12-31;v002;M;editeur;{v_s10_g00_00_002};;
37;PHASE3V1;2015-01-01;2050-12-31;v002;M;eff_finperiode_empl;{v_s21_g00_11_008};;
38;PHASE3V1;2015-01-01;2050-12-31;v002;M;emploi_mult;case when trim({v_s21_g00_40_036}) ='02' then 'OUI' when trim({v_s21_g00_40_036})='01' then 'NON' end;;
39;PHASE3V1;2015-01-01;2050-12-31;v002;M;employeur_mult;case when trim({v_s21_g00_40_037}) in ('02') then 'OUI' when trim({v_s21_g00_40_037}) in ('01') then 'NON' end;;
40;PHASE3V1;2015-01-01;2050-12-31;v002;M;fichier_source;{id_source};;
41;PHASE3V1;2015-01-01;2050-12-31;v002;M;formation;{v_s21_g00_30_024};;
42;PHASE3V1;2015-01-01;2050-12-31;v002;M;grparr;{{1}'ARR'||{i_s21_g00_60}}{{2}'SUS'||{i_s21_g00_65}}{{3}'TPT'||{i_s21_g00_66}};;
43;PHASE3V1;2015-01-01;2050-12-31;v002;M;grppen;{{1}'PEN'||{i_s21_g00_34}};;
44;PHASE3V1;2015-01-01;2050-12-31;v002;M;grprem;{{1}'REM'||coalesce({i_s21_g00_51}::text,'')}{{2}'PRI'||coalesce({i_s21_g00_52}::text,''){{3}'ARV'||coalesce({i_s21_g00_54}::text,'')}{{4}'VFV'||coalesce({i_s21_g00_50}::text,'')}{{5}'VPE'||coalesce({i_s21_g00_50}::text,'')}{{6}'BAS'||coalesce({i_s21_g00_78}::text,'')};;
45;PHASE3V1;2015-01-01;2050-12-31;v002;M;id_arret;{pk:mapping_dsn_arret_ok};;
47;PHASE3V1;2015-01-01;2050-12-31;v002;M;id_penibilite;{pk:mapping_dsn_penibilite_ok};;
48;PHASE3V1;2015-01-01;2050-12-31;v002;M;id_personne;{pk:mapping_dsn_personne_ok};;
49;PHASE3V1;2015-01-01;2050-12-31;v002;M;id_poste;{pk:mapping_dsn_poste_ok};;
50;PHASE3V1;2015-01-01;2050-12-31;v002;M;id_remuneration;{pk:mapping_dsn_remuneration_ok};;
51;PHASE3V1;2015-01-01;2050-12-31;v002;M;id_source;{id_source};;
52;PHASE3V1;2015-01-01;2050-12-31;v002;M;indicebrut_ancienorange_fp;{v_s21_g00_40_062};;
53;PHASE3V1;2015-01-01;2050-12-31;v002;M;indicebrut_ancienposte_fp;{v_s21_g00_40_063};;
54;PHASE3V1;2015-01-01;2050-12-31;v002;M;indicebrut_contractueltitu_fp;{v_s21_g00_40_065};;
56;PHASE3V1;2015-01-01;2050-12-31;v002;M;indicebrut_fp;{v_s21_g00_40_057};;
57;PHASE3V1;2015-01-01;2050-12-31;v002;M;indicebrut_origine_fp;{v_s21_g00_40_060};;
58;PHASE3V1;2015-01-01;2050-12-31;v002;M;indicebrut_originespp_fp;{v_s21_g00_40_064};;
59;PHASE3V1;2015-01-01;2050-12-31;v002;M;indicemajore;{v_s21_g00_40_058};;
60;PHASE3V1;2015-01-01;2050-12-31;v002;M;libcom_etab;TRIM({v_s21_g00_11_005});;
61;PHASE3V1;2015-01-01;2050-12-31;v002;M;libcom_sal;Trim({v_s21_g00_30_010});;
62;PHASE3V1;2015-01-01;2050-12-31;v002;M;libcom_siege;trim({v_s21_g00_06_006});;
63;PHASE3V1;2015-01-01;2050-12-31;v002;M;libemploi;trim({v_s21_g00_40_006});;
64;PHASE3V1;2015-01-01;2050-12-31;v002;M;lieu_travail; coalesce({v_s21_g00_40_019},'NR');;
65;PHASE3V1;2015-01-01;2050-12-31;v002;M;localite_lieu_trav;{v_s21_g00_85_005};;
66;PHASE3V1;2015-01-01;2050-12-31;v002;M;logiciel;{v_s10_g00_00_001};;
67;PHASE3V1;2015-01-01;2050-12-31;v002;M;mesureactv;{{1}(public.array_agg_distinct(row({i_s21_g00_53},{v_s21_g00_53_002})::public.cle_valeur) over (partition by {i_s21_g00_51}))};;
68;PHASE3V1;2015-01-01;2050-12-31;v002;M;mod_tp_trav;{v_s21_g00_40_014};;
69;PHASE3V1;2015-01-01;2050-12-31;v002;M;montant;{{1}{v_s21_g00_51_013}}{{2}{v_s21_g00_52_002}}{{3}{v_s21_g00_54_002}}{{4}{v_s21_g00_50_002}}{{5}{v_s21_g00_50_004}}{{6}{v_s21_g00_78_004}};;
70;PHASE3V1;2015-01-01;2050-12-31;v002;M;motif_exclu;{v_s21_g00_40_025};;
71;PHASE3V1;2015-01-01;2050-12-31;v002;M;motif_reprise;{{1}{v_s21_g00_60_011}};;
72;PHASE3V1;2015-01-01;2050-12-31;v002;M;motifcdd; {v_s21_g00_40_021};;
73;PHASE3V1;2015-01-01;2050-12-31;v002;M;motifin;{v_s21_g00_62_002};;
74;PHASE3V1;2015-01-01;2050-12-31;v002;M;nat_contrat;{v_s21_g00_40_007};;
75;PHASE3V1;2015-01-01;2050-12-31;v002;M;nat_jur_employeur;{v_s21_g00_11_017};;
76;PHASE3V1;2015-01-01;2050-12-31;v002;M;nat_lieu_trav;{V_S21_G00_85_010};;
77;PHASE3V1;2015-01-01;2050-12-31;v002;M;nat_poste_fp;{v_s21_g00_40_053};;
78;PHASE3V1;2015-01-01;2050-12-31;v002;M;nat_siret_util;{V_S21_G00_85_010_siretutil};;
79;PHASE3V1;2015-01-01;2050-12-31;v002;M;nbhrsup;{{1}{v_s21_g00_51_012}};;
80;PHASE3V1;2015-01-01;2050-12-31;v002;M;nbi_fp;{v_s21_g00_40_059};;
81;PHASE3V1;2015-01-01;2050-12-31;v002;M;nir_sngi;case when {v_s21_g00_30_305} IN ('00','10') then {v_s21_g00_30_300} end;;
82;PHASE3V1;2015-01-01;2050-12-31;v002;M;nom_sal;TRIM({v_s21_g00_30_002});;
83;PHASE3V1;2015-01-01;2050-12-31;v002;M;nom_usage;TRIM({v_s21_g00_30_003});;
84;PHASE3V1;2015-01-01;2050-12-31;v002;M;norme;{id_norme};;
85;PHASE3V1;2015-01-01;2050-12-31;v002;M;ntt;{v_s21_g00_30_020};;
86;PHASE3V1;2015-01-01;2050-12-31;v002;M;num_contrat;{v_s21_g00_40_009};;
87;PHASE3V1;2015-01-01;2050-12-31;v002;M;num_versement;{v_s21_g00_50_003};;
88;PHASE3V1;2015-01-01;2050-12-31;v002;M;numpersonne;coalesce({v_s21_g00_30_001},{v_s21_g00_30_020},'N'||to_char(clock_timestamp(),'SSSS')||to_char(clock_timestamp(),'US')||'#'||(random()*1000)::integer);;
89;PHASE3V1;2015-01-01;2050-12-31;v002;M;payer;{{1}(public.array_agg_distinct(row({i_s21_g00_53},case when trim({v_s21_g00_53_001}) IN ('01','03') Then 'OUI' when trim({v_s21_g00_53_001})='02' then 'NON' end)::public.cle_valeur) over (partition by {i_s21_g00_51}))};;
90;PHASE3V1;2015-01-01;2050-12-31;v002;M;pays_lieu_trav;{v_s21_g00_85_006};;
91;PHASE3V1;2015-01-01;2050-12-31;v002;M;pays_naissance_insee;case when {v_s21_g00_30_014}='99' then coalesce((select code1 from nmcl_code_pays_etranger_2017 a WHERE {v_s21_g00_30_015}=a.code0),'99000') else {v_s21_g00_30_015} end;;
92;PHASE3V1;2015-01-01;2050-12-31;v002;M;pays_residence_sal;COALESCE ({v_s21_g00_30_011},'FR');;
93;PHASE3V1;2015-01-01;2050-12-31;v002;M;pcs;COALESCE ({v_s21_g00_40_004},'000X');;
94;PHASE3V1;2015-01-01;2050-12-31;v002;M;pcs_complement;{v_s21_g00_40_005};;
95;PHASE3V1;2015-01-01;2050-12-31;v002;M;pcs_complement_ese_fp;{v_s21_g00_40_052};;
96;PHASE3V1;2015-01-01;2050-12-31;v002;M;penibilite;{{1}{v_s21_g00_34_001}};;
97;PHASE3V1;2015-01-01;2050-12-31;v002;M;periodicite;{periodicite};;
98;PHASE3V1;2015-01-01;2050-12-31;v002;M;perte_tpt;{{3}{v_s21_g00_66_003}};;
99;PHASE3V1;2015-01-01;2050-12-31;v002;M;pos_detach_fp;{{2}{v_s21_g00_65_004}};;
100;PHASE3V1;2015-01-01;2050-12-31;v002;M;positionnement_convcoll;{v_s21_g00_40_041};;
101;PHASE3V1;2015-01-01;2050-12-31;v002;M;pourboire;{v_s21_g00_40_045};;
102;PHASE3V1;2015-01-01;2050-12-31;v002;M;prenom_sal;TRIM({v_s21_g00_30_004});;
103;PHASE3V1;2015-01-01;2050-12-31;v002;M;presence;{{1}(public.array_agg_distinct(row({i_s21_g00_53},case when TRIM({v_s21_g00_53_001}) = '01' Then 'OUI' when TRIM({v_s21_g00_53_001}) IN ('02','03') then 'NON' end)::public.cle_valeur) over (partition by {i_s21_g00_51}))};;
104;PHASE3V1;2015-01-01;2050-12-31;v002;M;quotite;{v_s21_g00_40_013};;
105;PHASE3V1;2015-01-01;2050-12-31;v002;M;quotite_ref;{v_s21_g00_40_012};;
106;PHASE3V1;2015-01-01;2050-12-31;v002;M;quotite_ref_fp;{v_s21_g00_40_054};;
107;PHASE3V1;2015-01-01;2050-12-31;v002;M;raisonabsence;{{1}'ARR'||{v_s21_g00_60_001}}{{2}'SUS'||{v_s21_g00_65_001}}{{3}'TPT'};;
108;PHASE3V1;2015-01-01;2050-12-31;v002;M;regmal; {v_s21_g00_40_018};;
109;PHASE3V1;2015-01-01;2050-12-31;v002;M;regviel; {v_s21_g00_40_020};;
110;PHASE3V1;2015-01-01;2050-12-31;v002;M;resid_etab;coalesce({v_s21_g00_11_015},'FR');;
111;PHASE3V1;2015-01-01;2050-12-31;v002;M;resid_siege;coalesce({v_s21_g00_06_010},'FR');;
112;PHASE3V1;2015-01-01;2050-12-31;v002;M;rs_etab;{v_s21_g00_11_904};;
113;PHASE3V1;2015-01-01;2050-12-31;v002;M;rs_ul;{v_s21_g00_06_903};;
114;PHASE3V1;2015-01-01;2050-12-31;v002;M;sexe;COALESCE(CASE WHEN {v_s21_g00_30_005} IS NOT NULL THEN LTRIM({v_s21_g00_30_005},'0') WHEN {v_s21_g00_30_001} IS NOT NULL THEN SUBSTR({v_s21_g00_30_001},1,1) ELSE SUBSTR({v_s21_g00_30_020},1,1) END, '0');;
116;PHASE3V1;2015-01-01;2050-12-31;v002;M;siret_utilisateur;coalesce({v_s21_g00_40_046},'NR');;
117;PHASE3V1;2015-01-01;2050-12-31;v002;M;srcrem;public.curr_val('arc.number_generator');;
118;PHASE3V1;2015-01-01;2050-12-31;v002;M;statcat;CASE WHEN {v_s21_g00_40_018}='300' then 'MSA'||{v_s21_g00_40_042} else 'RGG'||{v_s21_g00_40_003} end;;
119;PHASE3V1;2015-01-01;2050-12-31;v002;M;statconv;{v_s21_g00_40_002};;
120;PHASE3V1;2015-01-01;2050-12-31;v002;M;statempl;{v_s21_g00_40_026};;
121;PHASE3V1;2015-01-01;2050-12-31;v002;M;statut_boeth;{v_s21_g00_40_072};;
122;PHASE3V1;2015-01-01;2050-12-31;v002;M;statut_etranger;{v_s21_g00_30_022};;
123;PHASE3V1;2015-01-01;2050-12-31;v002;M;tx_cotis_acc;{v_s21_g00_40_043};;
124;PHASE3V1;2015-01-01;2050-12-31;v002;M;tx_remun_fp;{{1}{v_s21_g00_51_014}};;
125;PHASE3V1;2015-01-01;2050-12-31;v002;M;txfraisprof;{v_s21_g00_40_023};;
126;PHASE3V1;2015-01-01;2050-12-31;v002;M;txtempspartiel_fp;{v_s21_g00_40_055};;
127;PHASE3V1;2015-01-01;2050-12-31;v002;M;type_detachement_fp;{v_s21_g00_40_066};;
128;PHASE3V1;2015-01-01;2050-12-31;v002;M;typrem;{{1}'REM'||{v_s21_g00_51_011}}{{2}'PRI'||{v_s21_g00_52_001}}{{3}'ARV'||{v_s21_g00_54_001}}{{4}'VFV'}{{5}'VPE'}{{6}'BAS'||{v_s21_g00_78_001}};;
129;PHASE3V1;2015-01-01;2050-12-31;v002;M;unitmesureactv;{{1}(public.array_agg_distinct(row({i_s21_g00_53},{v_s21_g00_53_003})::public.cle_valeur) over (partition by {i_s21_g00_51}))};;
130;PHASE3V1;2015-01-01;2050-12-31;v002;M;unitmesureref;{v_s21_g00_40_011};;
131;PHASE3V1;2015-01-01;2050-12-31;v002;M;validite;coalesce(CASE WHEN EXTRACT (DAY FROM ({validite} :: TIMESTAMP)) <> '1' THEN date_trunc('month', {validite} :: TIMESTAMP)::text ELSE {validite} END,'2000-01-01');;

0 comments on commit 72ee697

Please sign in to comment.