ecotaxa / ecopart

A web application dedicated to particle data from UVP and LISST.
Other
0 stars 1 forks source link

Ecopart issues misleading messages when several EcoTaxa samples match during automatch #5

Open grololo06 opened 4 years ago

grololo06 commented 4 years ago

Linked with ecotaxa/ecotaxa_dev#404

def ComputeZooMatch(psampleid, projid):
    if projid is not None:
        ecosample = database.GetAll("""select samples.sampleid from samples
                                        join part_samples ps on psampleid=%s
                                        where samples.projid=%s and samples.orig_id=ps.profileid""",
                                    ( psampleid,int(projid)))
        if len(ecosample) == 1:
            database.ExecSQL("update part_samples set sampleid=%s where psampleid=%s",
                             (ecosample[0]['sampleid'], psampleid))
            return " Matched"
        else:
            return " <span style='color: orange;'>No match found in Ecotaxa</span>"

We have the case when len(....) is 2 or more, thus the message is wrong. It should be e.g. "Many matches found, nightly job should remove this duplicate"

Even more clever we should filter here the empty samples and link only when there is data.

jiho commented 4 years ago

In addition, there will be empty samples in EcoTaxa at some point: to compute concentrations we also need the zeroes and cannot exclude that some samples will be completely empty. So a more general solution than just "remove all empty samples" is needed.