Subversion Repositories eFlore/Projets.eflore-projets

Compare Revisions

Ignore whitespace Rev 892 → Rev 893

/trunk/scripts/modules/cel/Makefile
173,7 → 173,8
#$(mysqlcmd) -N $(alterdb) <<<'SELECT distinct ce_utilisateur FROM `cel_obs` GROUP BY ce_utilisateur, ordre HAVING COUNT(*) > 1'|grep -q . || $(mysqlcmd) < dedup-ordre-201307.sql
$(mysqlcmd) -N $(alterdb) <<<"SHOW INDEX FROM cel_obs"|grep -q couple_user_ordre || $(mysqlcmd) < dedup-ordre-201307.sql
o_dedup-ordre-201307: check_cel_obs
$(mysqlcmd) -N $(alterdb) <<<"SHOW INDEX FROM cel_obs"|grep -q couple_user_ordre || $(call do_subst,dedup-ordre-201307.sql) > $@.comp.sql
# l'index doit sur cel_obs doit avoir deux lignes dont le champs "non_unique" = 0
$(mysqlcmd) -N $(alterdb) <<<"SHOW INDEX FROM cel_obs"|grep -w id_obs|awk '{print $$2}'|tr -d "\n"|grep -q 00 || $(call do_subst,dedup-ordre-201307.sql) > $@.comp.sql
 
# maj-referentiel-201307.sql: # pas de test aisé et rapide
# doit passer APRÈS o_maj-cleanup-201307 (pas de nom_ret_nn = 0)
/trunk/scripts/modules/cel/referonosaure.sql
54,9 → 54,10
nom_sel_nn IS NOT NULL AND nom_ret_nn IS NOT NULL AND nom_ret_nn != 0
AND nom_referentiel = 'bdtfx'
AND nom_ret_nn = num_nom
AND (LOWER(c.famille) = LOWER(b.famille) OR c.famille IS NULL)
/* AND (LOWER(c.famille) = LOWER(b.famille) OR c.famille IS NULL) */
);
-- 339
-- 339 + 41373
SELECT ROW_COUNT() AS "BDTFX upd après correction sur nom_ret_nn + nom_sel_nn";
 
/* test:
SELECT c.nom_ret_nn, c.nom_ret, bLAST.num_nom, bLAST.nom_sci, bLAST.auteur, c.famille, bLAST.famille, c.nt, bLAST.num_taxonomique
84,7 → 85,8
AND (LOWER(c.famille) = LOWER(b.famille) OR c.famille IS NULL)
AND SUBSTRING_INDEX(c.nom_sel, ' ', 1) = SUBSTRING_INDEX(b.nom_sci, ' ', 1)
);
-- 251 avec indirection num_nom_retenu
-- 251 + 45649 avec indirection num_nom_retenu
SELECT ROW_COUNT() AS "BDTFX upd après correction sur nom_sel_nn";
 
 
-- l'update BDTXA avec nom_sel_nn et nom_ret_nn corrects --
98,27 → 100,27
AND nom_ret_nn = num_nom
AND (LOWER(c.famille) = LOWER(a.famille) OR c.famille IS NULL)
);
-- 1
-- 1 + 49
SELECT ROW_COUNT() AS "BDTXA upd après correction sur nom_ret_nn + nom_sel_nn";
 
/*TODO
-- l'update BDTXA avec nom_sel_nn seul
UPDATE `BASEEDIT`.`cel_obs` c, `BASESOURCE`.`TABLEBDTXA` a SET
c.nom_ret = CONCAT(a.nom_sci, ' ', a.auteur),
UPDATE `BASEEDIT`.`cel_obs` c, `BASESOURCE`.`TABLEBDTXA` a, `BASESOURCE`.`TABLEBDTXA` a_nom_ret SET
c.nom_ret = CONCAT(a_nom_ret.nom_sci, ' ', a_nom_ret.auteur),
c.nom_ret_nn = a.num_nom,
c.nt = a.num_tax,
c.famille = a.famille
WHERE (
nom_sel_nn IS NOT NULL
a_nom_ret.num_nom = a.num_nom_retenu
AND nom_sel_nn IS NOT NULL
AND nom_referentiel = 'bdtxa'
AND nom_sel_nn = num_nom
AND nom_sel_nn = a.num_nom
AND (LOWER(c.famille) = LOWER(a.famille) OR c.famille IS NULL)
AND SUBSTRING_INDEX(c.nom_sel, ' ', 1) = SUBSTRING_INDEX(a.nom_sci, ' ', 1)
);
-- 49 sans les restrictions sur famille et SUBSTRING_INDEX()
-- 47 avec les restrictions sur famille et SUBSTRING_INDEX()
*/
-- 47 + 49 avec les restrictions sur famille et SUBSTRING_INDEX()
-- 48 sans les restrictions sur famille et SUBSTRING_INDEX()
SELECT ROW_COUNT() AS "BDTXA upd après correction sur nom_sel_nn";
 
 
-- l'update ISFAN avec nom_sel_nn et nom_ret_nn corrects --
UPDATE `BASEEDIT`.`cel_obs` c, `BASESOURCE`.`TABLEISFAN` i SET
c.nom_ret = CONCAT(i.nom_sci, ' ', i.auteur),
131,21 → 133,23
AND (LOWER(c.famille) = LOWER(i.famille) OR c.famille IS NULL)
);
-- 2
SELECT ROW_COUNT() AS "ISFAN upd après correction sur nom_ret_nn + nom_sel_nn";
 
/*TODO
-- l'update ISFAN avec nom_sel_nn seul
UPDATE `BASEEDIT`.`cel_obs` c, `BASESOURCE`.`TABLEISFAN` i SET
c.nom_ret = CONCAT(i.nom_sci, ' ', i.auteur),
UPDATE `BASEEDIT`.`cel_obs` c, `BASESOURCE`.`TABLEISFAN` i, `BASESOURCE`.`TABLEISFAN` i_nom_ret SET
c.nom_ret = CONCAT(i_nom_ret.nom_sci, ' ', i_nom_ret.auteur),
c.nom_ret_nn = i.num_nom,
c.nt = i.num_taxonomique,
c.famille = i.famille
WHERE (
nom_sel_nn IS NOT NULL
i_nom_ret.num_nom = i.num_nom_retenu
AND nom_sel_nn IS NOT NULL
AND nom_referentiel = 'isfan'
AND nom_sel_nn = num_nom
AND nom_sel_nn = i.num_nom
AND (LOWER(c.famille) = LOWER(i.famille) OR c.famille IS NULL)
);
*/
-- 0
SELECT ROW_COUNT() AS "ISFAN upd après correction sur nom_sel_nn";
 
/*
Pour observer les différences:
/trunk/scripts/modules/cel/maj-referentiel-201307.sql
40,12 → 40,12
d'où GROUP BY id_observation HAVING count(id_observation) = 1,
ce qui ne produit plus que 51359 matches (soit 22734 dups) */
/*
SELECT id_observation, nom_referentiel, nom_sel, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille
SELECT id_observation, valid_ref, nom_sel, nom, nom_sel_nn, nom_ret, nom_ret_nn, nt, c.famille
FROM `BASEEDIT`.`cel_obs` c
INNER JOIN T_bis b
ON (b.num_nom = c.nom_sel_nn)
WHERE nom_referentiel IS NULL AND nom_sel_nn IS NOT NULL GROUP BY id_observation HAVING count(id_observation) = 1;
-- 51359, tous bdtfx...
-- 63941, tous bdtfx...
*/
 
 
74,3 → 74,5
|
 
delimiter ;
 
CALL majreferentiel;