Cirad-ASTRE / mapMCDA

Produce an epidemiological risk map by weighting multiple risk factors
https://umr-astre.pages.mia.inra.fr/mapMCDA/
1 stars 2 forks source link

my wish list #19

Closed vporphyre closed 5 years ago

vporphyre commented 5 years ago

Hi Facundo, Sylvain,

please find below the points that I would like to suggest for further improvement of the mapMCDA tool. Hope you will agree with them. Thanks again for this great job and the further upgrades! Cheers Vincent

Tab "Files": please add a button to reset the files list

Tab "Risk factors":

Tab "Weigths":

It would be great if you could add the following supplementary tabs (and functions to the package):

Final point: It would be useful to display in console the R code generated in RShiny interface and/or to produce a log report, ie. with layers considered, link used for standardisation, weights computed for each risk factors, consistency ratio, destination references to produced files (for archiving or further modifications)

# function link_fun (à integrer dans risk_layer à la place de lin_fun) BETA VERSION (V.Porphyre) #### 
# arg invert à associer au bouton 'Inverser'
# x1 and x2 Threshold values

lin_fun <- function(r, type="linear", invert=FALSE, x1=0, x2=0, source=scale_source, target=scale_target){
    if (type=="linear"){
        slope <- diff(target)/diff(source)
        ans <- target[1] + slope * (r - source[1])
    } 

    if (type=="crisp"){ tmp <- r
        if (invert==FALSE) {
            tmp[tmp<x1] <- target[1]
            tmp[tmp>=x1] <- target[2]
        }
        if (invert==TRUE){
            tmp[tmp<x1] <- target[2]
            tmp[tmp>=x1] <- target[1]
        }
    ans <- tmp
    }

    if (type=="double"){ tmp <- r
        if(invert==FALSE){  
            tmp[tmp<x1] <- target[1]
            tmp[tmp>=x1 & tmp<x2] <- target[2]
            tmp[tmp>=x2] <- target[1]}
        if(invert==TRUE){
            tmp[tmp<x1] <- target[2]
            tmp[tmp>=x1 & tmp<x2] <- target[1]
            tmp[tmp>=x2] <- target[2]
        }
    ans <- tmp
    }

    # if (type=="fuzzy"){} # to be developped
    # if (type=="sigmoid"){
    #   #ans <- target[2]*(1/(1 + ((1/target[1])-1)*exp(-x1*r)))
    # }  # WRONG

            return(ans)
}
famuvie commented 5 years ago

Dear Vincent,

Thank you so much for taking the time to test the package and write down these valuable suggestions. I just split them into separate issues (#20 -- #25) because we are going to address each one separately, with varying degrees of priority. Thus, I'm closing this issue now. We can continue the discussion of each suggestion in the corresponding issue.