'Method to read the data
@param r: the S3Request'

@staticmethod
def _extract(r):

    resource = r.resource
    resource.load()
    rows = resource._rows
    if (not len(rows)):
        return None
    db = current.db
    s3db = current.s3db
    itable = s3db.org_capacity_indicator
    indicators = db((itable.deleted == False)).select(itable.id, itable.number, itable.section, itable.name, orderby=itable.number)
    assessments = [row.assessment_id for row in rows]
    atable = s3db.org_capacity_assessment
    assessments = db(atable.id.belongs(assessments)).select(atable.id, atable.organisation_id, orderby=(~ atable.date))
    latest_assessments = {}
    orgs = {}
    for a in assessments:
        o = a.organisation_id
        if (o not in orgs):
            latest_assessments[a.id] = o
            orgs[o] = {}
    consolidated = {}
    for i in indicators:
        consolidated[i.id] = {'A': 0, 'B': 0, 'C': 0, 'D': 0, 'E': 0, 'F': 0}
    for row in rows:
        a = row.assessment_id
        if (a in latest_assessments):
            indicator = row.indicator_id
            rating = row.rating
            consolidated[indicator][row.rating] += 1
            o = latest_assessments[a]
            orgs[o][indicator] = row.rating
    return (indicators, orgs, consolidated)
