Example #1
0
       'b':0,
       'hs':0,
       'jhs':0,
       'el':0,
       'none':0,
       'other':0,
       'unk':0
       }
        
csv.field_size_limit(1000000000)
clName = sys.argv[1]
ufile = utils.getFileName('user file')
ufin = csv.reader(open(ufile, 'r'))
profile_file = utils.getFileName('student profiles')
infile = csv.reader(open(profile_file, 'r'))
profiles = prof.builddict(infile)
countryFile = utils.getFileName('username and country file')
countryDict = makeCountryDict(ufin, countryFile)
outName = raw_input("enter file name for output; nothing for stdout : ")
if outName == '':
    outp = sys.stdout.write
else:
    outFile = open(outName, 'w')
    outp = outFile.write
outfile = csv.writer(open('anon'+sys.argv[1], 'w'))

students = profiles.keys()

for s in students:
    if profiles[s].gender == 'm':
        male += 1
Example #2
0
import certificates as cs
import ipGeoloc as geo

if (len(sys.argv) < 2):
    print(
        'Usage: buildAnonProfile.py courseName profileFile userFile countryFile certFile'
    )
    sys.exit()

csv.field_size_limit(1000000)

out_name = sys.argv[1] + 'anonProfile.csv'
o1 = csv.writer(open(out_name, 'w'))

ufile = csv.reader(open(sys.argv[2], 'r'))
uprof = prof.builddict(ufile)

udfile = csv.reader(open(sys.argv[3], 'r'))
udict = user.builddict(udfile)

countryFile = csv.reader(open(sys.argv[4], 'r'))
locDict = geo.builddict(countryFile)

certs = False
if (len(sys.argv) > 5):
    certfile = csv.reader(open(sys.argv[5], 'r'))
    certDict = cs.builddict(certfile)
    certs = True

students = uprof.keys()
for s in students:
Example #3
0
        gender = profiles[uid].gender
        if day not in retdict:
            retdict[day] = enrollday()
        if gender == 'm':
            retdict[day].m += 1
        elif gender == 'f':
            retdict[day].f += 1
        else:
            retdict[day].n += 1
        retdict[day].t += 1
    return retdict


csv.field_size_limit(1000000000)
f = csv.reader(open(sys.argv[1], 'r'))
profdict = userprofile.builddict(f)
e = csv.reader(open(sys.argv[2], 'r'))
enrdict = buildenrolldict(e, profdict)
it = sorted(enrdict.keys())
outfile = csv.writer(open(sys.argv[3], 'w'))
mt = ft = nt = 0
outfile.writerow(['Enroll Date', 'Male', 'Female', 'Unspecified', 'Total'])
for date in it:
    rec = enrdict[date]
    outfile.writerow([date, rec.m, rec.f, rec.n, rec.t])
    mt += rec.m
    ft += rec.f
    nt += rec.n

outfile.writerow(['', mt, ft, nt, mt + ft + nt])
Example #4
0
import user
import certificates as cs
import ipGeoloc as geo


if (len(sys.argv) < 2):
    print('Usage: buildAnonProfile.py courseName profileFile userFile countryFile certFile')
    sys.exit()
    
csv.field_size_limit(1000000)

out_name = sys.argv[1] + 'anonProfile.csv'
o1 = csv.writer(open(out_name, 'w'))

ufile = csv.reader(open(sys.argv[2], 'r'))
uprof = prof.builddict(ufile)

udfile = csv.reader(open(sys.argv[3], 'r'))
udict = user.builddict(udfile)

countryFile = csv.reader(open(sys.argv[4], 'r'))
locDict = geo.builddict(countryFile)

certs = False
if (len(sys.argv) > 5):
    certfile = csv.reader(open(sys.argv[5], 'r'))
    certDict = cs.builddict(certfile)
    certs = True
    

students = uprof.keys()
Example #5
0
    'b': 0,
    'hs': 0,
    'jhs': 0,
    'el': 0,
    'none': 0,
    'other': 0,
    'unk': 0
}

csv.field_size_limit(1000000000)
clName = sys.argv[1]
ufile = utils.getFileName('user file')
ufin = csv.reader(open(ufile, 'r'))
profile_file = utils.getFileName('student profiles')
infile = csv.reader(open(profile_file, 'r'))
profiles = prof.builddict(infile)
countryFile = utils.getFileName('username and country file')
countryDict = makeCountryDict(ufin, countryFile)
outName = raw_input("enter file name for output; nothing for stdout : ")
if outName == '':
    outp = sys.stdout.write
else:
    outFile = open(outName, 'w')
    outp = outFile.write
outfile = csv.writer(open('anon' + sys.argv[1], 'w'))

students = profiles.keys()

for s in students:
    if profiles[s].gender == 'm':
        male += 1
Example #6
0
        gender = profiles[uid].gender
        if day not in retdict:
            retdict[day]= enrollday()
        if gender == 'm':
            retdict[day].m += 1
        elif gender == 'f':
            retdict[day].f += 1
        else :
            retdict[day].n += 1
        retdict[day].t += 1
    return retdict
            
        
csv.field_size_limit(1000000000)
f = csv.reader(open(sys.argv[1], 'r'))
profdict = userprofile.builddict(f)
e = csv.reader(open(sys.argv[2], 'r'))
enrdict = buildenrolldict(e, profdict)
it = sorted(enrdict.keys())
outfile = csv.writer(open(sys.argv[3], 'w'))
mt = ft = nt = 0
outfile.writerow(['Enroll Date', 'Male', 'Female', 'Unspecified', 'Total'])
for date in it:
    rec = enrdict[date]
    outfile.writerow([date, rec.m, rec.f, rec.n, rec.t])
    mt += rec.m
    ft += rec.f
    nt += rec.n
    
outfile.writerow(['', mt, ft, nt, mt+ft+nt])