What is math behind calculation of field completion percentage?

Dear Altruist,

I am using dhis2 android capture app for collection of a event capture program data. It is showing field completion percentage at top right corner (inside a round circle showing a number percentile). What is math behind calculation of field completion percentage? I just complete a single question it is showing 11% according to my calculation it should be less than this.

1 Like

Thanks for your question @sohel - I am tagging the @dhis2-android team to help you with this query.

2 Likes

Hi @sohel,

This is the exact code that calculates the percentage:

private float calculateCompletionPercentage() {
        float wValues = 0f;
        float totals = 0f;
        for (EventSectionModel sectionModel : items) {
            wValues += (float) sectionModel.numberOfCompletedFields();
            totals += (float) sectionModel.numberOfTotalFields();
        }
        if (totals == 0){
            return  100;
        }
        percentage = wValues / totals;
        return percentage;
    }

So it is just using the total number of available fields (not counting those that have been hidden by program rules) and the fields that have a value.

2 Likes

@Pablo thanks you very much for clarifying this.

1 Like

@Pablo,
Is same method used for showing percentile in every activities? With same number of completed fields, I can see different percentile while I am in particular section than it is is in …> Details> tap on percentile circle

1 Like