Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incohérence dans la base de données #43

Open
grololo06 opened this issue Nov 17, 2021 · 3 comments
Open

Incohérence dans la base de données #43

grololo06 opened this issue Nov 17, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@grololo06
Copy link
Member

grololo06 commented Nov 17, 2021

En francais: Un projet EcoPart doit être lié à un projet EcoTaxa si au moins un de ses samples est lié à un sample EcoTaxa.
En SQL:
select * from part_projects pp where pp.projid is null and exists (select 1 from part_samples ps where ps.pprojid = pp.pprojid and ps.sampleid is not null);
Résultat sur la prod' (anonymisé à la main):

 pprojid |                 ptitle                 |                            rawfolder                            | ownerid | projid | instrumtype |      op_name      |           op_email            |         cs_name          |       cs_email        |    do_name    |         do_email          | prj_info |  prj_acronym  |    cruise     |   ship   | default_instrumsn | default_depthoffset |  oldestsampledate   | public_partexport_deferral_month | public_visibility_deferral_month | public_zooexport_deferral_month | remote_type | remote_directory | remote_password | remote_url | remote_user | remote_vectorref | enable_descent_filter 
---------+----------------------------------------+-----------------------------------------------------------------+---------+--------+-------------+-------------------+-------------------------------+--------------------------+-----------------------+---------------+---------------------------+----------+---------------+---------------+----------+-------------------+---------------------+---------------------+----------------------------------+----------------------------------+---------------------------------+-------------+------------------+-----------------+------------+-------------+------------------+-----------------------
     284 | uvp6_sn000125hf_20201022_rade_test_cdt | local_plankton/uvp/uvp_c/uvp6_sn000125hf_20201022_rade_test_cdt |     768 |        | uvp6        | xxxxx  |                          |                       |               |                           |          | rade test cdt | rade test cdt | sagitta3 | sn000125hf        |                     | 2020-10-22 11:11:18 |                               24 |                                2 |                              36 |             |                  |                 |            |             |                  |  
      33 | uvp5_sn002zd_cascade2011               | local_plankton/uvp/uvp_b/uvp5_sn002zd_cascade2011               |      18 |        | uvp5        | xxxxx |          | cascade 2011  | cascade2011   | atalante | sn002zd           |                 1.2 | 2011-03-02 15:54:50 |                               24 |                                2 |                              36 |             |                  |                 |            |             |                  |  
     286 | uvp6_sn000125hf_20201015_rade_testctd  | local_plankton/uvp/uvp_c/uvp6_sn000125hf_20201015_rade_testctd  |     768 |        | uvp6        | xxxxx |                          |                       |               |                           |          | rade_testctd  | rade_testCTD  | sagitta3 | sn000125hf        |                     | 2020-10-15 07:47:14 |                               24 |                                2 |                              36 |             |                  |                 |            |             |                  |  
(3 lignes)

Ces 3 projets contiennent des samples liés mais ne sont pas liés eux-même.

@grololo06 grololo06 added the bug Something isn't working label Nov 17, 2021
@jiho
Copy link

jiho commented Nov 17, 2021

Si je me souviens bien, j'ai aussi remarqué l'inverse: projets liés mais aucun sample lié.

@jiho
Copy link

jiho commented Nov 17, 2021

Et il faudrait aussi tester le cas où des samples ecopart sont liés à plusieurs projets EcoTaxa. Normalement la règle pour les liens de projets était

EcoPart | EcoTaxa
----------------- 
1       | 1       = OK
n       | 1       = OK
1       | n       = Not OK

@grololo06
Copy link
Member Author

Projets EcoTaxa avec n projets EcoPart:

ecotaxa=# select prj.projid, count(pp.pprojid) as cnt from projects prj, part_projects pp where pp.projid = prj.projid group by prj.projid having count(pp.pprojid) > 1;
 projid | cnt 
--------+-----
     22 |   2
     30 |   6
     35 |   6
     41 |   3
     43 |   2
     45 |   3
     63 |   2
    149 |   2
    579 |   6
   3039 |   2
   3581 |   2
(11 lignes)

L'inverse ne me semble pas possible structurellement: un projet EcoPart a un seul champ projid donc c'est 0 ou 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants