Example #1
0
def grader(itemResult,totalQ):
    print('entering APM module')
    if 'apm_total' not in g:
        g.apm_total = 0

    if 'apm_max_score' not in g:
        g.apm_max_score = 0

    if 'apm_correct' not in g:
        g.apm_correct = 0

    if 'apm_incorrect' not in g:
        g.apm_incorrect = 0

    if 'apm_empty' not in g:
        g.apm_empty = 0

    itemGrade = {}
    score = 0
    max_score = 0
    response = None

    for subelem in itemResult:
        sub_identifier = subelem.attrib['identifier']
        sub_split = sub_identifier.split('_')
        if subelem.attrib['identifier'] == 'SCORE' :
            for subelem2 in subelem:
                score = int(subelem2.text)
                #g.apm_total += score
                g.apm_correct += score
        elif subelem.attrib['identifier'] == 'MAXSCORE' :
            for subelem2 in subelem:
                max_score = int(subelem2.text)
                g.apm_max_score += max_score
        elif sub_split[0] == 'RESPONSE' :
            for subelem2 in subelem:
                for subelem3 in subelem2:
                    response = subelem3.text
                    if response == None :
                        g.apm_empty += 1
                    itemGrade["candidate_response"] = response

    g.apm_incorrect = totalQ - g.apm_correct - g.apm_empty
    print("correct = " + str(g.apm_correct))
    print("total Q = " + str(totalQ))
    print("empty = " + str(g.apm_empty))
    data = {}
    data["type"] = 'apm'
    data["scores"] = {}
    data["scores"]["scale20"] = scale.scale('apm20', g.apm_correct)
    data["scores"]["scale6"] = scale.scale('20to6', data["scores"]["scale20"])
    #data["scores"]["total"] = g.apm_total
    #data["scores"]["max_score"] = g.apm_max_score
    data["answers"] = {}
    data["answers"]["correct"] = g.apm_correct
    data["answers"]["incorrect"] = g.apm_incorrect
    data["answers"]["empty"] = g.apm_empty
    data["attributes"] = itemGrade
    return data
Example #2
0
def grader(itemResult,totalQ):
    print('entering CFIT module')

    if 'cfit_total' not in g:
        g.cfit_total = 0

    if 'cfit_max_score' not in g:
        g.cfit_max_score = 0

    if 'cfit_correct' not in g:
        g.cfit_correct = 0

    if 'cfit_incorrect' not in g:
        g.cfit_incorrect = 0

    if 'cfit_empty' not in g:
        g.cfit_empty = 0

    itemGrade = {}
    score = 0
    max_score = 0
    response = None

    for subelem in itemResult:
        sub_identifier = subelem.attrib['identifier']
        sub_split = sub_identifier.split('_')
        if subelem.attrib['identifier'] == 'SCORE' :
            for subelem2 in subelem:
                score = int(subelem2.text)
                print(sub_identifier, ' : ' ,score)
                g.cfit_correct += score
        elif subelem.attrib['identifier'] == 'MAXSCORE' :
            for subelem2 in subelem:
                max_score = int(subelem2.text)
                g.cfit_max_score += max_score
        elif sub_split[0] == 'RESPONSE' :
            for subelem2 in subelem:
                for subelem3 in subelem2:
                    response = subelem3.text
                    print(response)
                    if response == None :
                        g.cfit_empty += 1
                    itemGrade["candidate_response"] = response


    g.cfit_incorrect = totalQ - g.cfit_correct - g.cfit_empty
    data = {}
    data["type"] = 'cfit'
    data["scores"] = {}
    data["scores"]["scaled-6"] = scale.scale('cfit-to-6', g.cfit_correct)
    data["scores"]["scaled-20"] = scale.scale('cfit-to-20', g.cfit_correct)
    #data["scores"]["total"] = g.apm_total
    #data["scores"]["max_score"] = g.apm_max_score
    data["answers"] = {}
    data["answers"]["correct"] = g.cfit_correct
    data["answers"]["incorrect"] = g.cfit_incorrect
    data["answers"]["empty"] = g.cfit_empty
    data["attributes"] = itemGrade
    return data
Example #3
0
def regulerGrader(dataObject):
    # Create a new object
    items = dataObject

    items['output'] = {}

    items['output']['kematangan_sosial'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['s'] +
               items['papi']['scores']['scale20']['b'] +
               items['papi']['scores']['scale20']['o'] +
               items['papi']['scores']['scale20']['e']) / 4))

    items['output']['stabilitas_emosi'] = scale.scale(
        '20to6', round((items['papi']['scores']['scale20']['e']) / 1))
    items['output']['penyesuaian_diri'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['b'] +
               items['papi']['scores']['scale20']['z']) / 2))

    items['output']['pengendalian_diri'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['z'] +
               items['papi']['scores']['scale20']['b'] +
               items['papi']['scores']['scale20']['k'] +
               items['papi']['scores']['scale20']['e']) / 4))

    items['output']['kepercayaan_diri'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['z'] +
               items['papi']['scores']['scale20']['k'] +
               items['papi']['scores']['scale20']['x']) / 3))
    items['output']['penyesuaian_diri'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['v'] +
               items['papi']['scores']['scale20']['a']) / 2))

    items['output']['kerjasama'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['p'] +
               items['papi']['scores']['scale20']['b'] +
               items['papi']['scores']['scale20']['k'] +
               items['papi']['scores']['scale20']['f']) / 4))

    items['output']['hubungan_interpersonal'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['x'] +
               items['papi']['scores']['scale20']['b'] +
               items['papi']['scores']['scale20']['s'] +
               items['papi']['scores']['scale20']['o']) / 4))

    items['output']['sistematika_kerja'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['i'] +
               items['papi']['scores']['scale20']['d'] +
               items['papi']['scores']['scale20']['c'] +
               items['papi']['scores']['scale20']['w']) / 4))

    items['output']['fleksibilitas_kerja'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['z'] +
               items['papi']['scores']['scale20']['i'] +
               items['papi']['scores']['scale20']['w']) / 3))

    items['output']['daya_tahan_kerja_rutin'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['g'] +
               items['papi']['scores']['scale20']['v'] +
               items['papi']['scores']['scale20']['z'] +
               items['papi']['scores']['scale20']['e'] +
               items['papi']['scores']['scale20']['n']) / 5))

    items['output']['daya_tahan_dalam_stress'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['g'] +
               items['papi']['scores']['scale20']['e'] +
               items['papi']['scores']['scale20']['n']) / 3))
    items['output']['motivasi_berprestasi'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['g'] +
               (items['papi']['scores']['scale20']['a'] * 3) +
               items['papi']['scores']['scale20']['v'] +
               items['papi']['scores']['scale20']['n']) / 6))
    items['output']['orientasi_pelayanan'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['k'] +
               items['papi']['scores']['scale20']['f'] +
               items['papi']['scores']['scale20']['n']) / 3))

    items['output']['komitmen_kerja'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['g'] +
               items['papi']['scores']['scale20']['n']) / 2))
    items['output']['konsep_diri'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['a'] +
               items['papi']['scores']['scale20']['v']) / 2))

    items['output']['inisiatif'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['l'] +
               items['papi']['scores']['scale20']['i'] +
               items['papi']['scores']['scale20']['t'] +
               items['papi']['scores']['scale20']['z']) / 4))

    return items
Example #4
0
def grader(itemResult, totalQ):
    print('entering ADKUDAG4 module')

    if 'adkudag4_total' not in g:
        g.adkudag4_total = 0

    if 'adkudag4_max_score' not in g:
        g.adkudag4_max_score = 0

    if 'adkudag4_correct' not in g:
        g.adkudag4_correct = 0

    if 'adkudag4_incorrect' not in g:
        g.adkudag4_incorrect = 0

    if 'adkudag4_empty' not in g:
        g.adkudag4_empty = 0

    itemGrade = {}
    score = 0
    max_score = 0
    response = None

    for subelem in itemResult:
        sub_identifier = subelem.attrib['identifier']
        sub_split = sub_identifier.split('_')
        if subelem.attrib['identifier'] == 'SCORE':
            for subelem2 in subelem:
                score = int(subelem2.text)
                print(sub_identifier, ' : ', score)
                g.adkudag4_total = g.adkudag4_total + score
                g.adkudag4_correct += score
        elif subelem.attrib['identifier'] == 'MAXSCORE':
            for subelem2 in subelem:
                max_score = int(subelem2.text)
                g.adkudag4_max_score += max_score
        elif sub_split[0] == 'RESPONSE':
            for subelem2 in subelem:
                for subelem3 in subelem2:
                    response = subelem3.text
                    if response == None:
                        g.adkudag4_empty += 1
                    #print('response : ' , response)
                    itemGrade["candidate_response"] = response

#    elif score == max_score :
#       g.adkudag4_correct += 1
#  else :
#     g.adkudag4_incorrect += 1

    g.adkudag4_incorrect = totalQ - g.adkudag4_correct - g.adkudag4_empty
    data = {}
    data["type"] = 'adkudag4'
    data["scores"] = {}
    data["scores"]["scale20"] = scale.scale('adkudag4', g.adkudag4_correct)
    data["scores"]["scale6"] = scale.scale('20to6', data["scores"]["scale20"])
    #data["scores"]["scale-20"] = scale.scale('cfit-to-20', g.adkudag4_correct)
    #data["scores"]["total"] = g.apm_total
    #data["scores"]["max_score"] = g.apm_max_score
    data["answers"] = {}
    data["answers"]["correct"] = g.adkudag4_correct
    data["answers"]["incorrect"] = g.adkudag4_incorrect
    data["answers"]["empty"] = g.adkudag4_empty
    data["attributes"] = itemGrade
    print(' TOTAL ADKUDAG4 : ', g.adkudag4_total)
    return data
Example #5
0
def regulerGrader(dataObject):
    # Create a new object
    items = dataObject

    items['output'] = {}
    items['output']['kecepatan20'] = scale.scale(
        'kecepatanketelitian20',
        (items['apm']['answers']['correct'] +
         items['apm']['answers']['incorrect'] +
         items['compre']['answers']['correct'] +
         items['compre']['answers']['incorrect'] +
         items['tkdinfo']['answers']['correct'] +
         items['tkdinfo']['answers']['incorrect'] +
         items['tkdidiot']['answers']['correct'] +
         items['tkdidiot']['answers']['incorrect'] +
         items['tkdanalogiverbal']['answers']['correct'] +
         items['tkdanalogiverbal']['answers']['incorrect'] +
         items['gatb4']['answers']['correct'] +
         items['gatb4']['answers']['incorrect'] +
         items['adkudag4']['answers']['correct'] +
         items['adkudag4']['answers']['incorrect'] +
         items['tese']['answers']['correct'] +
         items['tese']['answers']['incorrect']) * 100.0 / 246)

    items['output']['ketelitian20'] = scale.scale(
        'kecepatanketelitian20',
        (items['apm']['answers']['correct'] +
         items['compre']['answers']['correct'] +
         items['tkdinfo']['answers']['correct'] +
         items['tkdidiot']['answers']['correct'] +
         items['tkdanalogiverbal']['answers']['correct'] +
         items['gatb4']['answers']['correct'] +
         items['adkudag4']['answers']['correct'] +
         items['tese']['answers']['correct']) * 100.0 / 246)

    items['output']['inteligensi_umum'] = scale.scale(
        '20to6',
        round((items['apm']['scores']['scale20'] +
               items['gatb4']['scores']['scale20'] +
               items['tkdidiot']['scores']['scale20']) / 3))
    items['output']['daya_tangkap'] = scale.scale(
        '20to6',
        round((items['compre']['scores']['scale20'] +
               items['tkdanalogiverbal']['scores']['scale20'] +
               items['tese']['scores']['scale20']) / 3))
    items['output']['pemecahan_masalah'] = scale.scale(
        '20to6',
        round((items['apm']['scores']['scale20'] +
               items['tkdidiot']['scores']['scale20'] +
               items['gatb4']['scores']['scale20'] +
               items['tese']['scores']['scale20']) / 4))
    items['output']['kemampuan_analisa_sintesa'] = scale.scale(
        '20to6',
        round(((items['apm']['scores']['scale20'] * 3) +
               items['tkdidiot']['scores']['scale20'] +
               items['gatb4']['scores']['scale20'] +
               items['tese']['scores']['scale20']) / 6))
    items['output']['logika_berpikir'] = scale.scale(
        '20to6',
        round((items['tkdidiot']['scores']['scale20'] +
               items['gatb4']['scores']['scale20'] +
               items['tese']['scores']['scale20']) / 3))
    items['output']['penalaran_verbal'] = scale.scale(
        '20to6',
        round((items['compre']['scores']['scale20'] +
               items['tkdanalogiverbal']['scores']['scale20'] +
               items['tkdidiot']['scores']['scale20']) / 3))
    items['output']['penalaran_numerik'] = scale.scale(
        '20to6',
        round((items['gatb4']['scores']['scale20'] +
               items['tese']['scores']['scale20']) / 2))
    items['output']['wawasan_pengetahuan'] = scale.scale(
        '20to6',
        round((items['compre']['scores']['scale20'] +
               items['tkdinfo']['scores']['scale20']) / 2))
    items['output']['kemampuan_abstrak'] = scale.scale(
        '20to6',
        round(((items['apm']['scores']['scale20'] * 2) +
               items['tkdidiot']['scores']['scale20'] +
               items['tese']['scores']['scale20']) / 4))
    items['output']['kemampuan_praktis'] = scale.scale(
        '20to6',
        round((items['adkudag4']['scores']['scale20'] +
               items['tese']['scores']['scale20']) / 2))
    items['output']['kemampuan_keteknikan'] = scale.scale(
        '20to6', items['tese']['scores']['scale20'])
    items['output']['daya_ingat'] = scale.scale(
        '20to6',
        round(((items['tkdinfo']['scores']['scale20'] * 2) +
               items['compre']['scores']['scale20'] +
               items['adkudag4']['scores']['scale20']) / 4))
    items['output']['kemampuan_dan_proses_belajar'] = scale.scale(
        '20to6',
        round((items['apm']['scores']['scale20'] +
               items['compre']['scores']['scale20'] +
               items['tkdinfo']['scores']['scale20']) / 3))

    items['output']['kematangan_sosial'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['s'] +
               items['papi']['scores']['scale20']['b'] +
               items['papi']['scores']['scale20']['o'] +
               items['papi']['scores']['scale20']['e']) / 4))

    items['output']['stabilitas_emosi'] = scale.scale(
        '20to6', round((items['papi']['scores']['scale20']['e']) / 1))
    items['output']['penyesuaian_diri'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['b'] +
               items['papi']['scores']['scale20']['z']) / 2))

    items['output']['pengendalian_diri'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['z'] +
               items['papi']['scores']['scale20']['b'] +
               items['papi']['scores']['scale20']['k'] +
               items['papi']['scores']['scale20']['e']) / 4))

    items['output']['kepercayaan_diri'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['z'] +
               items['papi']['scores']['scale20']['k'] +
               items['papi']['scores']['scale20']['x']) / 3))
    items['output']['penyesuaian_diri'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['v'] +
               items['papi']['scores']['scale20']['a']) / 2))

    items['output']['kerjasama'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['p'] +
               items['papi']['scores']['scale20']['b'] +
               items['papi']['scores']['scale20']['k'] +
               items['papi']['scores']['scale20']['f']) / 4))

    items['output']['hubungan_interpersonal'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['x'] +
               items['papi']['scores']['scale20']['b'] +
               items['papi']['scores']['scale20']['s'] +
               items['papi']['scores']['scale20']['o']) / 4))

    items['output']['sistematika_kerja'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['i'] +
               items['papi']['scores']['scale20']['d'] +
               items['papi']['scores']['scale20']['c'] +
               items['papi']['scores']['scale20']['w']) / 4))

    items['output']['fleksibilitas_kerja'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['z'] +
               items['papi']['scores']['scale20']['i'] +
               items['papi']['scores']['scale20']['w']) / 3))

    items['output']['tempo_kerja'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['t'] +
               items['papi']['scores']['scale20']['v'] +
               items['output']['kecepatan20'] +
               items['papi']['scores']['scale20']['n']) / 4))
    items['output']['ketekunan'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['d'] +
               items['adkudag4']['scores']['scale20'] +
               items['output']['ketelitian20'] +
               items['papi']['scores']['scale20']['c']) / 4))
    items['output']['ketelitian'] = scale.scale(
        '20to6', items['output']['ketelitian20'])
    items['output']['daya_tahan_kerja_rutin'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['g'] +
               items['papi']['scores']['scale20']['v'] +
               items['papi']['scores']['scale20']['z'] +
               items['papi']['scores']['scale20']['e'] +
               items['papi']['scores']['scale20']['n']) / 5))

    items['output']['daya_tahan_dalam_stress'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['g'] +
               items['papi']['scores']['scale20']['e'] +
               items['papi']['scores']['scale20']['n']) / 3))
    items['output']['motivasi_berprestasi'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['g'] +
               (items['papi']['scores']['scale20']['a'] * 3) +
               items['papi']['scores']['scale20']['v'] +
               items['papi']['scores']['scale20']['n']) / 6))
    items['output']['orientasi_pelayanan'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['k'] +
               items['papi']['scores']['scale20']['f'] +
               items['papi']['scores']['scale20']['n']) / 3))

    items['output']['komitmen_kerja'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['g'] +
               items['papi']['scores']['scale20']['n']) / 2))
    items['output']['konsep_diri'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['a'] +
               items['papi']['scores']['scale20']['v']) / 2))

    items['output']['inisiatif'] = scale.scale(
        '20to6',
        round((items['papi']['scores']['scale20']['l'] +
               items['papi']['scores']['scale20']['i'] +
               items['papi']['scores']['scale20']['t'] +
               items['papi']['scores']['scale20']['z']) / 4))

    items['output']['subtest_rs_total'] = (
        items['apm']['answers']['correct'] +
        items['compre']['answers']['correct'] +
        items['gatb4']['answers']['correct'] +
        items['tkdinfo']['answers']['correct'] +
        items['tkdidiot']['answers']['correct'] +
        items['tkdanalogiverbal']['answers']['correct'] +
        items['adkudag4']['answers']['correct'] +
        items['tese']['answers']['correct'])
    items['output']['subtest_ss_total'] = (
        items['apm']['scores']['scale20'] +
        items['compre']['scores']['scale20'] +
        items['gatb4']['scores']['scale20'] +
        items['tkdinfo']['scores']['scale20'] +
        items['tkdidiot']['scores']['scale20'] +
        items['tkdanalogiverbal']['scores']['scale20'] +
        items['adkudag4']['scores']['scale20'] +
        items['tese']['scores']['scale20'])
    items['output']['kecepatan_percentage'] = (
        (items['apm']['answers']['correct'] +
         items['apm']['answers']['incorrect'] +
         items['compre']['answers']['correct'] +
         items['compre']['answers']['incorrect'] +
         items['tkdinfo']['answers']['correct'] +
         items['tkdinfo']['answers']['incorrect'] +
         items['tkdidiot']['answers']['correct'] +
         items['tkdidiot']['answers']['incorrect'] +
         items['tkdanalogiverbal']['answers']['correct'] +
         items['tkdanalogiverbal']['answers']['incorrect'] +
         items['gatb4']['answers']['correct'] +
         items['gatb4']['answers']['incorrect'] +
         items['adkudag4']['answers']['correct'] +
         items['adkudag4']['answers']['incorrect'] +
         items['tese']['answers']['correct'] +
         items['tese']['answers']['incorrect']) * 1.0 / 246)
    items['output']['ketelitian_percentage'] = (
        (items['apm']['answers']['correct'] +
         items['compre']['answers']['correct'] +
         items['tkdinfo']['answers']['correct'] +
         items['tkdidiot']['answers']['correct'] +
         items['tkdanalogiverbal']['answers']['correct'] +
         items['gatb4']['answers']['correct'] +
         items['adkudag4']['answers']['correct'] +
         items['tese']['answers']['correct']) * 1.0 / 246)
    return items
Example #6
0
    def calculate_disc(tally):
        #print(disc_score)

        d1 = scale.scale('pcas-1-d', g.tally['a'])
        d2 = scale.scale('pcas-2-d', g.tally['b'])
        d3 = scale.scale('pcas-3-d', g.tally['a'] - g.tally['b'])
        i1 = scale.scale('pcas-1-i', g.tally['c'])
        i2 = scale.scale('pcas-2-i', g.tally['d'])
        i3 = scale.scale('pcas-3-i', g.tally['c'] - g.tally['d'])
        s1 = scale.scale('pcas-1-s', g.tally['e'])
        s2 = scale.scale('pcas-2-s', g.tally['f'])
        s3 = scale.scale('pcas-3-s', g.tally['e'] - g.tally['f'])
        c1 = scale.scale('pcas-1-c', g.tally['g'])
        c2 = scale.scale('pcas-2-c', g.tally['h'])
        c3 = scale.scale('pcas-3-c', g.tally['g'] - g.tally['h'])

        g.disc_score['d1'] = d1
        g.disc_score['d2'] = d2
        g.disc_score['d3'] = d3
        g.disc_score['i1'] = i1
        g.disc_score['i2'] = i2
        g.disc_score['i3'] = i3
        g.disc_score['s1'] = s1
        g.disc_score['s2'] = s2
        g.disc_score['s3'] = s3
        g.disc_score['c1'] = c1
        g.disc_score['c2'] = c2
        g.disc_score['c3'] = c3
        g.disc_score['valid_1'] = g.tally['i']
        g.disc_score['valid_2'] = g.tally['j']
Example #7
0
File: papi.py Project: ppsdm/rest
def grader(itemResult, totalQ):
    validity = True
    validity_message = ""
    print('inside PAPI module')

    if 'papi_score' not in g:
        #print("create g.papi_score")
        g.papi_score = {
            'e': 0,
            'n': 0,
            'a': 0,
            'x': 0,
            'b': 0,
            'o': 0,
            'z': 0,
            'k': 0,
            'w': 0,
            'c': 0,
            'l': 0,
            'g': 0,
            'r': 0,
            'd': 0,
            't': 0,
            's': 0,
            'i': 0,
            'v': 0,
            'f': 0,
            'p': 0
        }

    if 'papi_score_scaled' not in g:
        #print("create g.papi_score")
        g.papi_score_scaled = {
            'e': 0,
            'n': 0,
            'a': 0,
            'x': 0,
            'b': 0,
            'o': 0,
            'z': 0,
            'k': 0,
            'w': 0,
            'c': 0,
            'l': 0,
            'g': 0,
            'r': 0,
            'd': 0,
            't': 0,
            's': 0,
            'i': 0,
            'v': 0,
            'f': 0,
            'p': 0
        }

    if 'apm_total' not in g:
        g.apm_total = 0

    if 'apm_max_score' not in g:
        g.apm_max_score = 0

    if 'apm_correct' not in g:
        g.apm_correct = 0

    if 'apm_incorrect' not in g:
        g.apm_incorrect = 0

    if 'apm_empty' not in g:
        g.apm_empty = 0

    itemGrade = {}
    score = 0
    max_score = 0
    response = None

    for subelem in itemResult:
        sub_identifier = subelem.attrib['identifier']
        #print(sub_identifier)
        sub_split = sub_identifier.split('_')
        if subelem.attrib['identifier'] == 'SCORE':
            for subelem2 in subelem:
                score = int(subelem2.text)
                g.apm_total += score
        elif subelem.attrib['identifier'] == 'MAXSCORE':
            for subelem2 in subelem:
                max_score = int(subelem2.text)
                g.apm_max_score += max_score
        elif sub_split[0] == 'RESPONSE':
            #print('inside response')
            for subelem2 in subelem:
                for subelem3 in subelem2:
                    response = subelem3.text
                    print('response : ', response)
                    if response is not None:
                        papi_alpha = response.split('_')

                        if papi_alpha[0].lower() == 'k':
                            #pass
                            g.papi_score[papi_alpha[0].lower(
                            )] = g.papi_score[papi_alpha[0].lower()] + 1
                            prescale = scale.scale(
                                'papikostik_k',
                                g.papi_score[papi_alpha[0].lower()])
                        elif papi_alpha[0].lower() == 'z':
                            #pass
                            g.papi_score[papi_alpha[0].lower(
                            )] = g.papi_score[papi_alpha[0].lower()] + 1
                            prescale = scale.scale(
                                'papikostik_z',
                                g.papi_score[papi_alpha[0].lower()])
                        else:
                            #pass
                            g.papi_score[papi_alpha[0].lower(
                            )] = g.papi_score[papi_alpha[0].lower()] + 1
                            prescale = g.papi_score[papi_alpha[0].lower()]
                            #g.papi_score_scaled[papi_alpha[0].lower()] = scale.scale('papikostik20', g.papi_score[papi_alpha[0].lower()])
                        g.papi_score_scaled[
                            papi_alpha[0].lower()] = scale.scale(
                                'papikostik20', prescale)
                        #print('papi_score : ' , g.papi_score[papi_alpha[0].lower()])
                        #print('papi_score_scaled : ' , papi_score_scaled[papi_alpha[0].lower()])
                    else:
                        g.apm_empty += 1
                        validity = False
                        validity_message = 'there are unanswered questions'
                    itemGrade["candidate_response"] = response

    data = {}
    data["type"] = 'papi'
    data["scores"] = {}
    data["scores"]["raw"] = g.papi_score
    data["scores"]["scale20"] = g.papi_score_scaled
    data["scores"]["total"] = g.apm_total
    data["scores"]["max_score"] = g.apm_max_score
    data["scores"]["validity"] = validity
    data["scores"]["validity_message"] = validity_message
    data["answers"] = {}
    data["answers"]["empty"] = g.apm_empty
    data["attributes"] = itemGrade
    #print (g.papi_score)
    #g.papi['e'] += 1
    #print (g.papi['e'])
    #print (g.papi_score_scaled)
    return data