peopledoc / OPE

One Page for Equity
3 stars 0 forks source link

Factorize file interpretation and counting #29

Open sophie-ulti opened 4 years ago

sophie-ulti commented 4 years ago

After writing two indicator, we had a glance of how we could factorize the code to count every man and women for each indicator.

A good format will be to have two dictionaries, by gender. Where the keys will be the id of the indicator. The values will be another dictionary. The keys will be the label (for exemple, type of contracts), and the keys will be the number of women for this specific kind of contract.

For example

women = {
   'type_of_contracts': { 
        'contrat_pro' : 60,
        'cdi' : 700, 
        'stage' : 15
    },
    'type_of_categories': {
        'cadre 2.1' : 89,
        'non définie' : 2,
        'cadre 4.4' : 15
    }
}

Should we sort the value ? I don't know, maybe it's better to sort them before displaying it.