def computeRating(subFolder, sectionId, G) :
    fileName = os.path.join(subFolder, 'Tex', 'table'+sectionId+'.tex')
    print '\nBuilding table ', fileName
    names = extractNames(subFolder)

    # TeX version
    f = open(fileName,'w')
    
    res = []
    for id in G.nodes() :
        fullName = names.get(id,['',''])[0]
        position = names.get(id,['',''])[1]
        score = G.in_degree(id)
        res.append([id,fullName,position,score])

    res.sort(cmp = cmp)

    for t in res :
        resLine = t[0] + ' & ' + t[1] + ' & ' + t[2] + ' & ' + str(t[3]) + '\\\\ \n'
        f.write(resLine)
    f.close()

    resHtml = ''
    for t in res :
        resLineHtml = '<tr><td class="right">'+t[0]+'.&nbsp;</td><td>'+t[1]+'</td><td>'+t[2]+'</td><td class="number">'+str(t[3])+'</td></tr>'
        resHtml = resHtml + resLineHtml 
    templateFileName = os.path.join(subFolder,'Report_template.html')
    BuildTexts.replaceInFile(templateFileName,'rating'+sectionId,resHtml)
def BuildGraphFromSpec(graphData, graph_id, graph_spec, subFolder) :

    graph_type = graph_spec.pop()
    questions = graph_spec
    size = len(graphData)
    file_name = os.path.join(subFolder, 'SVG', 'graph' + graph_id + '.dot')

    edges = []
    dict = {}

    for nodeData in graphData:

        [id, local_id, name, age, edgeGroups] = nodeData
        dict[id] = local_id

    # compute all edges
    for nodeData in graphData:

        [id, local_id, name, age, edgeGroups] = nodeData
        for question in questions:
            targets = edgeGroups[question-1]
            for target in targets:
                edges = edges + [[local_id, dict.get(target,'0')]]

    # compute symmetric edges (pairs of eges)
    if  graph_type == 'pairs' :
        sym_edges = []
        for edge in edges :
            reverse = [edge[1],edge[0]]
            if edges.count(reverse) > 0 :
                sym_edges = sym_edges + [edge]

        edges = sym_edges

    # remove duplicates
    edges = removeDuplicates(edges)

    # build the graph and the visualization
    G = SocioGraph.MakeGraphFromEdges(size, edges, graph_type, file_name)


    # save the graph statistics
    code = 'val' + BuildTexts.encodeNumber(graph_id) + 'links'

    if graph_type == 'pairs' :
        links = len(edges) / 2
    else :
        links = len(edges)

    BuildTexts.addMacro(subFolder, code, links)

    # build the rating table
    if  graph_type == 'directed' :
        BuildRatings.computeRating(subFolder, graph_id, G)

    return G
def compute21a(subFolder, statData): # aggregate
    print '\nComputing values for slide 2.1.1.'
    values = ParseInput.extractAnswers(statData, [38,39])
    values = StatValues.joinLists(values)

    yesNum = values.count('87') + values.count('88')
    noNum = values.count('89') + values.count('90')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTexts.addMacro(subFolder, 'valBAAyesNumP', str(yesNumP))
    BuildTexts.addMacro(subFolder, 'valBAAnoNumP', str(noNumP))

    BuildCharts.YesNoPieSVG(subFolder, 'pie211.svg', yesNumP, noNumP)
def compute22a(subFolder, statData): # aggregate
    print '\nComputing values for slide 2.2.1.'
    values = ParseInput.extractAnswers(statData, [28,29,46,47])
    values = StatValues.joinLists(values)

    yesNum = values.count('83') + values.count('84')
    noNum = values.count('85') + values.count('86')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTexts.addMacro(subFolder, 'valBBAyesNumP', str(yesNumP))
    BuildTexts.addMacro(subFolder, 'valBBAnoNumP', str(noNumP))

    BuildCharts.YesNoPieSVG(subFolder, 'pie221.svg', yesNumP, noNumP)
def computeEducation(subFolder, statData) :
    values = ParseInput.extractAnswers(statData, [15])
    eduValues = []
    for v in values :
        v = v.replace('{','').replace('}','')
        eduList = v.split('=')
        for e in eduList :
            if len(e) > 1 :
                eduValues.append(e)

    keys = [str(i+16) for i in range(7)]
    eduStat = [eduValues.count(key) for key in keys]
    print 'Education values:', eduValues, eduStat
    BuildTexts.addMacrosList(subFolder, 'numEdu', eduStat)
def addNamesListToHtml(subFolder):

    names = extractNames(subFolder)
    
    res = ''

    for id in range(len(names)) :
        number = str(id+1)
        fullName = names[number][0]
        position = names[number][1]
        resLine = '<tr><td>&nbsp;'+number+'.</td><td>'+fullName+'</td><td>'+position+'</td></tr>'
        res = res + resLine

    templateFileName = os.path.join(subFolder,'Report_template.html')
    BuildTexts.replaceInFile(templateFileName,'<td>0</td><td>A</td><td>B</td>',res)
def compute22b(subFolder, statData): # by age
    print '\nComputing values for slide 2.2.2.'
    values = ParseInput.extractAnswers(statData, [14, 28,29,46,47])
    values = StatValues.joinListsByAge(values)

    yesNum = [ val.count('83') + val.count('84') for val in values ]
    noNum = [ val.count('85') + val.count('86') for val in values ]

    BuildTexts.addMacrosList(subFolder, 'valBBByesNum', yesNum)
    BuildTexts.addMacrosList(subFolder, 'valBBBnoNum', noNum)

    BuildCharts.YesNoPieSVG(subFolder, 'pie222a.svg', yesNum[0], noNum[0])
    BuildCharts.YesNoPieSVG(subFolder, 'pie222b.svg', yesNum[1], noNum[1])
    BuildCharts.YesNoPieSVG(subFolder, 'pie222c.svg', yesNum[2], noNum[2])
    BuildCharts.YesNoPieSVG(subFolder, 'pie222d.svg', yesNum[3], noNum[3])
def compute22d(subFolder, statData): # by question
    print '\nComputing values for slide 2.2.4.'
    values = ParseInput.extractAnswers(statData, [28,29,46,47])
    values = StatValues.joinListsByQuestion(values)

    yesNum = [ val.count('83') + val.count('84') for val in values ]
    noNum = [ val.count('85') + val.count('86') for val in values ]

    BuildTexts.addMacrosList(subFolder, 'valBBDyesNum', yesNum)
    BuildTexts.addMacrosList(subFolder, 'valBBDnoNum', noNum)

    BuildCharts.YesNoPieSVG(subFolder, 'pie224a.svg', yesNum[0], noNum[0])
    BuildCharts.YesNoPieSVG(subFolder, 'pie224b.svg', yesNum[1], noNum[1])
    BuildCharts.YesNoPieSVG(subFolder, 'pie224c.svg', yesNum[2], noNum[2])
    BuildCharts.YesNoPieSVG(subFolder, 'pie224d.svg', yesNum[3], noNum[3])
def addSizeComments(subFolder, numOfNodes) :
    
    if numOfNodes <= 7 :
        res = '\socioSizeTextA'
    elif numOfNodes <= 11 :
        res = '\socioSizeTextB'
    elif numOfNodes <= 16 :
        res = '\socioSizeTextC'
    elif numOfNodes <= 21 :
        res = '\socioSizeTextD'
    else :
        res = '\socioSizeTextE'

    fileName = os.path.join(subFolder, 'Tex', 'commands.tex')
    BuildTexts.replaceInFile(fileName, res, '\socioSizeComment')
Exemple #10
0
def compute21b(subFolder, statData): # by age - q14
    print '\nComputing values for slide 2.1.2.'
    values = ParseInput.extractAnswers(statData, [14, 38,39])
    values = StatValues.joinListsByAge(values)

    yesNum = [ val.count('87') + val.count('88') for val in values ]
    noNum = [ val.count('89') + val.count('90') for val in values ]

    BuildTexts.addMacrosList(subFolder, 'valBAByesNum', yesNum)
    BuildTexts.addMacrosList(subFolder, 'valBABnoNum', noNum)

    BuildCharts.YesNoPieSVG(subFolder, 'pie212a.svg', yesNum[0], noNum[0])
    BuildCharts.YesNoPieSVG(subFolder, 'pie212b.svg', yesNum[1], noNum[1])
    BuildCharts.YesNoPieSVG(subFolder, 'pie212c.svg', yesNum[2], noNum[2])
    BuildCharts.YesNoPieSVG(subFolder, 'pie212d.svg', yesNum[3], noNum[3])
Exemple #11
0
def compute21d(subFolder, statData): # by question
    print '\nComputing values for slide 2.1.4.'
    values = ParseInput.extractAnswers(statData, [35,38,39,50,55])
    values = StatValues.joinListsByQuestion(values)

    yesNum = [ val.count('87') + val.count('88') for val in values ]
    noNum = [ val.count('89') + val.count('90') for val in values ]

    BuildTexts.addMacrosList(subFolder, 'valBADyesNum', yesNum)
    BuildTexts.addMacrosList(subFolder, 'valBADnoNum', noNum)

    BuildCharts.YesNoPieSVG(subFolder, 'pie214a.svg', yesNum[0], noNum[0])
    BuildCharts.YesNoPieSVG(subFolder, 'pie214b.svg', yesNum[1], noNum[1])
    BuildCharts.YesNoPieSVG(subFolder, 'pie214c.svg', yesNum[2], noNum[2])
    BuildCharts.YesNoPieSVG(subFolder, 'pie214d.svg', yesNum[3], noNum[3])
    BuildCharts.YesNoPieSVG(subFolder, 'pie214e.svg', yesNum[4], noNum[4])
Exemple #12
0
def compute22c(subFolder, statData): # by category - q19
    print '\nComputing values for slide 2.2.3.'
    values = ParseInput.extractAnswers(statData, [19, 28,29,46,47])
    values = StatValues.joinListsByCategory(values)

    yesNum = [ val.count('83') + val.count('84') for val in values ]
    noNum = [ val.count('85') + val.count('86') for val in values ]

    BuildTexts.addMacrosList(subFolder, 'valBBCyesNum', yesNum)
    BuildTexts.addMacrosList(subFolder, 'valBBCnoNum', noNum)

    BuildCharts.YesNoPieSVG(subFolder, 'pie223a.svg', yesNum[0], noNum[0])
    BuildCharts.YesNoPieSVG(subFolder, 'pie223b.svg', yesNum[1], noNum[1])
    BuildCharts.YesNoPieSVG(subFolder, 'pie223c.svg', yesNum[2], noNum[2])
    BuildCharts.YesNoPieSVG(subFolder, 'pie223d.svg', yesNum[3], noNum[3])
    BuildCharts.YesNoPieSVG(subFolder, 'pie223e.svg', yesNum[4], noNum[4])
Exemple #13
0
def compute21c(subFolder, statData): # by category - q19
    print '\nComputing values for slide 2.1.3.'
    values = ParseInput.extractAnswers(statData, [19, 38,39])
    values = StatValues.joinListsByCategory(values)

    yesNum = [ val.count('87') + val.count('88') for val in values ]
    noNum = [ val.count('89') + val.count('90') for val in values ]

    BuildTexts.addMacrosList(subFolder, 'valBACyesNum', yesNum)
    BuildTexts.addMacrosList(subFolder, 'valBACnoNum', noNum)

    BuildCharts.YesNoPieSVG(subFolder, 'pie213a.svg', yesNum[0], noNum[0])
    BuildCharts.YesNoPieSVG(subFolder, 'pie213b.svg', yesNum[1], noNum[1])
    BuildCharts.YesNoPieSVG(subFolder, 'pie213c.svg', yesNum[2], noNum[2])
    BuildCharts.YesNoPieSVG(subFolder, 'pie213d.svg', yesNum[3], noNum[3])
    BuildCharts.YesNoPieSVG(subFolder, 'pie213e.svg', yesNum[4], noNum[4])
Exemple #14
0
def computeWorkHereYears(subFolder, statData):
    values = ParseInput.extractAnswers(statData, [17])
    years = map(StatValues.toNumber, values)
    print '\nExperience:', values, years
    [expA, expB, expC, expD] = [0,0,0,0]
    for y in years :
        if y<0 :
            expA = expA
        elif y < 5 :
            expA += 1
        elif y < 11 :
            expB += 1
        elif y < 21 :
            expC += 1
        elif y>=21 and y<100:
            expD += 1 
    res = [expA, expB, expC, expD]
    BuildTexts.addMacrosList(subFolder, 'numExpHere', res)
Exemple #15
0
def compute23d(subFolder, statData): # aggregate
    print '\nComputing values for slide 2.3.4.'
    values = ParseInput.extractAnswers(statData, [30])

    yesNum = values.count('83') + values.count('84')
    noNum = values.count('85') + values.count('86')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTexts.addMacro(subFolder, 'valBCDyesNum', str(yesNum))
    BuildTexts.addMacro(subFolder, 'valBCDnoNum', str(noNum))
    BuildTexts.addMacro(subFolder, 'valBCDyesNP', str(yesNumP))
    BuildTexts.addMacro(subFolder, 'valBCDnoNP', str(noNumP))

    BuildCharts.YesNoPieSVG(subFolder, 'pie234.svg', yesNumP, noNumP)
Exemple #16
0
def compute23b(subFolder, statData): # aggregate
    print '\nComputing values for slide 2.3.2.'
    values = ParseInput.extractAnswers(statData, [52])

    yesNum = values.count('99') + values.count('100')
    noNum = values.count('101') + values.count('102')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTexts.addMacro(subFolder, 'valBCByesNum', str(yesNum))
    BuildTexts.addMacro(subFolder, 'valBCBnoNum', str(noNum))
    BuildTexts.addMacro(subFolder, 'valBCByesNP', str(yesNumP))
    BuildTexts.addMacro(subFolder, 'valBCBnoNP', str(noNumP))

    BuildCharts.YesNoPieSVG(subFolder, 'pie232.svg', yesNumP, noNumP)
Exemple #17
0
def compute23a(subFolder, statData): # aggregate
    print '\nComputing values for slide 2.3.1.'
    values = ParseInput.extractAnswers(statData, [23])

    yesNum = values.count('61')
    noNum = values.count('62')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTexts.addMacro(subFolder, 'valBCAyesNum', str(yesNum))
    BuildTexts.addMacro(subFolder, 'valBCAnoNum', str(noNum))
    BuildTexts.addMacro(subFolder, 'valBCAyesNP', str(yesNumP))
    BuildTexts.addMacro(subFolder, 'valBCAnoNP', str(noNumP))

    BuildCharts.YesNoPieSVG(subFolder, 'pie231.svg', yesNumP, noNumP)
Exemple #18
0
def compute31a(subFolder, statData): # aggregate
    print '\nComputing values for slide 3.1.1.'
    values = ParseInput.extractAnswers(statData, [43])

    yesNum = values.count('103') + values.count('104')
    noNum = values.count('105') + values.count('106')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTexts.addMacro(subFolder, 'valCAAyesNum', str(yesNum))
    BuildTexts.addMacro(subFolder, 'valCAAnoNum', str(noNum))
    BuildTexts.addMacro(subFolder, 'valCAAyesNP', str(yesNumP))
    BuildTexts.addMacro(subFolder, 'valCAAnoNP', str(noNumP))

    BuildCharts.YesNoPieSVG(subFolder, 'pie311.svg', yesNumP, noNumP)
Exemple #19
0
def computeParticipatedManWomen(subFolder, statData) :
    values = ParseInput.extractAnswers(statData, [9])
    men = values.count('14')
    women = values.count('15')
    BuildTexts.addMacro(subFolder, 'nParticipated', str(men+women))
    BuildTexts.addMacro(subFolder, 'numMen', str(men))
    BuildTexts.addMacro(subFolder, 'numWomen', str(women))
Exemple #20
0
def compute42c(subFolder, statData): # one question 
    print '\nComputing values for slide 4.2.c.'
    values = ParseInput.extractAnswers(statData, [54])

    yesNum = values.count('87') + values.count('88')
    noNum = values.count('89') + values.count('90')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTexts.addMacro(subFolder, 'valDBCyesNum', str(yesNum))
    BuildTexts.addMacro(subFolder, 'valDBCnoNum', str(noNum))
    BuildTexts.addMacro(subFolder, 'valDBCyesNP', str(yesNumP))
    BuildTexts.addMacro(subFolder, 'valDBCnoNP', str(noNumP))

    BuildCharts.YesNoPieSVG(subFolder,'pie423.svg', yesNumP, noNumP)
Exemple #21
0
def compute54(subFolder, statData): # by question
    print '\nComputing values for slide 5.4.'
    values = ParseInput.extractAnswers(statData, [56,57])
    values = StatValues.joinListsByQuestion(values)

    yesNum = [ val.count('87') + val.count('88') for val in values ]
    noNum = [ val.count('89') + val.count('90') for val in values ]

    BuildTexts.addMacro(subFolder, 'valGDyesNumA', str(yesNum[0]))
    BuildTexts.addMacro(subFolder, 'valGDyesNumB', str(yesNum[1]))
    BuildTexts.addMacro(subFolder, 'valGDnoNumA', str(noNum[0]))
    BuildTexts.addMacro(subFolder, 'valGDnoNumB', str(noNum[1]))

    BuildCharts.YesNoPieSVG(subFolder,'pie54a.svg', yesNum[0], noNum[0])
    BuildCharts.YesNoPieSVG(subFolder,'pie54b.svg', yesNum[1], noNum[1])
Exemple #22
0
def computeAllBossTeacher(subFolder, statData) :
    values = ParseInput.extractAnswers(statData, [8])
    boss = values.count('201') + values.count('202')
    teacher = values.count('203')

    BuildTexts.addMacro(subFolder, 'nTotal', str(len(statData)))
    BuildTexts.addMacro(subFolder, 'numBoss', str(boss))
    BuildTexts.addMacro(subFolder, 'numTeacher', str(teacher))
Exemple #23
0
def compute32a(subFolder, statData): # aggregate
    print '\nComputing values for slide 3.2.1.'
    values = ParseInput.extractAnswers(statData, [40,41,42])
    values = StatValues.joinLists(values)

    yesNum = values.count('99') + values.count('100')
    noNum = values.count('101') + values.count('102')
    [yesNumP, noNumP] = StatValues.percent([yesNum,noNum])

    BuildTexts.addMacro(subFolder, 'valCBAyesNum', str(yesNum))
    BuildTexts.addMacro(subFolder, 'valCBAnoNum', str(noNum))
    BuildTexts.addMacro(subFolder, 'valCBAyesNP', str(yesNumP))
    BuildTexts.addMacro(subFolder, 'valCBAnoNP', str(noNumP))

    BuildCharts.YesNoPieSVG(subFolder, 'pie321.svg', yesNumP, noNumP)
Exemple #24
0
def computeAge(subFolder, statData) :
    values = ParseInput.extractAnswers(statData, [14])
    years = map(StatValues.toNumber, values)
    print '\nYears:', years
    ages = [(2014 - y) for y in years]
    print 'Ages:', ages
    [young, mid, senior, old] = [0,0,0,0]
    for age in ages :
        if age < 25 and age > 12:
            young += 1
        elif age < 36 :
            mid += 1
        elif age < 56 :
            senior += 1
        elif age >= 56 and age < 120:
            old += 1 
    BuildTexts.addMacro(subFolder, 'numYoung', str(young))
    BuildTexts.addMacro(subFolder, 'numMidAge', str(mid))
    BuildTexts.addMacro(subFolder, 'numSenior', str(senior))
    BuildTexts.addMacro(subFolder, 'numOld', str(old))
Exemple #25
0
def compute42b(subFolder, statData): # one question 
    print '\nComputing values for slide 4.2.b.'
    values = ParseInput.extractAnswers(statData, [45])
    ansA = values.count('107') 
    ansB = values.count('108')
    ansC = values.count('109') 
    ansD = values.count('110')
    ansE = values.count('111')
    [ansAp, ansBp, ansCp, ansDp, ansEp] = StatValues.percent([ansA, ansB, ansC, ansD, ansE])

    BuildTexts.addMacro(subFolder, 'valDBBansAv', str(ansA))
    BuildTexts.addMacro(subFolder, 'valDBBansBv', str(ansB))
    BuildTexts.addMacro(subFolder, 'valDBBansCv', str(ansC))
    BuildTexts.addMacro(subFolder, 'valDBBansDv', str(ansD))
    BuildTexts.addMacro(subFolder, 'valDBBansEv', str(ansE))
    BuildTexts.addMacro(subFolder, 'valDBBansAp', str(ansAp))
    BuildTexts.addMacro(subFolder, 'valDBBansBp', str(ansBp))
    BuildTexts.addMacro(subFolder, 'valDBBansCp', str(ansCp))
    BuildTexts.addMacro(subFolder, 'valDBBansDp', str(ansDp))
    BuildTexts.addMacro(subFolder, 'valDBBansEp', str(ansEp))
    
    BuildCharts.Pie(subFolder,'pie422.svg', [ansAp, ansBp, ansCp, ansDp, ansEp])
Exemple #26
0
def compute42a(subFolder, statData): # one question 
    print '\nComputing values for slide 4.2.a'
    values = ParseInput.extractAnswers(statData, [37])
    ansA = values.count('95') 
    ansB = values.count('96')
    ansC = values.count('97') 
    ansD = values.count('98')
    [ansAp, ansBp, ansCp, ansDp] = StatValues.percent([ansA, ansB, ansC, ansD])

    BuildTexts.addMacro(subFolder, 'valDBAansAv', str(ansA))
    BuildTexts.addMacro(subFolder, 'valDBAansBv', str(ansB))
    BuildTexts.addMacro(subFolder, 'valDBAansCv', str(ansC))
    BuildTexts.addMacro(subFolder, 'valDBAansDv', str(ansD))
    BuildTexts.addMacro(subFolder, 'valDBAansAp', str(ansAp))
    BuildTexts.addMacro(subFolder, 'valDBAansBp', str(ansBp))
    BuildTexts.addMacro(subFolder, 'valDBAansCp', str(ansCp))
    BuildTexts.addMacro(subFolder, 'valDBAansDp', str(ansDp))
    
    BuildCharts.Pie(subFolder,'pie421.svg', [ansAp, ansBp, ansCp, ansDp])
Exemple #27
0
def compute53(subFolder, statData): # by category - q19
    print '\nComputing values for slide 5.3.'
    values = ParseInput.extractAnswers(statData, [19, 56,57])
    values = StatValues.joinListsByCategory(values)

    yesNum = [ val.count('87') + val.count('88') for val in values ]
    noNum = [ val.count('89') + val.count('90') for val in values ]

    BuildTexts.addMacro(subFolder, 'valGCyesNumA', str(yesNum[0]))
    BuildTexts.addMacro(subFolder, 'valGCyesNumB', str(yesNum[1]))
    BuildTexts.addMacro(subFolder, 'valGCyesNumC', str(yesNum[2]))
    BuildTexts.addMacro(subFolder, 'valGCyesNumD', str(yesNum[3]))
    BuildTexts.addMacro(subFolder, 'valGCyesNumE', str(yesNum[4]))
    BuildTexts.addMacro(subFolder, 'valGCnoNumA', str(noNum[0]))
    BuildTexts.addMacro(subFolder, 'valGCnoNumB', str(noNum[1]))
    BuildTexts.addMacro(subFolder, 'valGCnoNumC', str(noNum[2]))
    BuildTexts.addMacro(subFolder, 'valGCnoNumD', str(noNum[3]))
    BuildTexts.addMacro(subFolder, 'valGCnoNumE', str(noNum[4]))

    BuildCharts.YesNoPieSVG(subFolder,'pie53a.svg', yesNum[0], noNum[0])
    BuildCharts.YesNoPieSVG(subFolder,'pie53b.svg', yesNum[1], noNum[1])
    BuildCharts.YesNoPieSVG(subFolder,'pie53c.svg', yesNum[2], noNum[2])
    BuildCharts.YesNoPieSVG(subFolder,'pie53d.svg', yesNum[3], noNum[3])
    BuildCharts.YesNoPieSVG(subFolder,'pie53e.svg', yesNum[4], noNum[4])
Exemple #28
0
def compute22e(subFolder, statData): # aggregate (1 question)
    print '\nComputing values for slide 2.2.5.'
    values = ParseInput.extractAnswers(statData, [49])

    ansA = values.count('115') 
    ansB = values.count('116')
    ansC = values.count('117') 
    ansD = values.count('118')
    [ansAp, ansBp, ansCp, ansDp] = StatValues.percent([ansA, ansB, ansC, ansD])

    BuildTexts.addMacro(subFolder, 'valBBEansA', str(ansA))
    BuildTexts.addMacro(subFolder, 'valBBEansB', str(ansB))
    BuildTexts.addMacro(subFolder, 'valBBEansC', str(ansC))
    BuildTexts.addMacro(subFolder, 'valBBEansD', str(ansD))
    BuildTexts.addMacro(subFolder, 'valBBEansAp', str(ansAp))
    BuildTexts.addMacro(subFolder, 'valBBEansBp', str(ansBp))
    BuildTexts.addMacro(subFolder, 'valBBEansCp', str(ansCp))
    BuildTexts.addMacro(subFolder, 'valBBEansDp', str(ansDp))
    
    BuildCharts.Pie(subFolder, 'pie225.svg', [ansAp, ansBp, ansCp, ansDp])
Exemple #29
0
def computeTeachCat(subFolder, statData) :
    values = ParseInput.extractAnswers(statData, [19])
    keys = [str(i+55) for i in range(5)]
    stat = [values.count(key) for key in keys]
    print '\nTeacher categories:', values, stat
    BuildTexts.addMacrosList(subFolder, 'numTechCat', stat)
Exemple #30
0
def compute23c(subFolder, statData): # aggregate (1 question)
    print '\nComputing values for slide 2.3.3.'
    values = ParseInput.extractAnswers(statData, [53])

    ansA = values.count('120') 
    ansB = values.count('121')
    ansC = values.count('122') 
    [ansAp, ansBp, ansCp] = StatValues.percent([ansA, ansB, ansC])

    BuildTexts.addMacro(subFolder, 'valBCCansA', str(ansA))
    BuildTexts.addMacro(subFolder, 'valBCCansB', str(ansB))
    BuildTexts.addMacro(subFolder, 'valBCCansC', str(ansC))
    BuildTexts.addMacro(subFolder, 'valBCCanAp', str(ansAp))
    BuildTexts.addMacro(subFolder, 'valBCCanBp', str(ansBp))
    BuildTexts.addMacro(subFolder, 'valBCCanCp', str(ansCp))
    
    BuildCharts.Pie(subFolder, 'pie233.svg', [ansAp, ansBp, ansCp])