Beispiel #1
0
#read old csv to get data.
csvPath = os.path.join(curDir, config.fileName)
arr =  filemanager.readcsv(csvPath)
users = filemanager.arrayToUsers(arr)
precount = 0
#count how many completed surveys there were at the end of the last run
for i in range(0,len(users)):
   if users[i].state == 'c':
      preCount = preCount +1


#query qualtrics for responses
#TODO This part needs to be changed to accomodate more than two surveys
#It's silly to have essentially the same line twice, let's generalize it.
xmlResp1 = quapi.makeRequest(quapi.getLegacyResponseData(
           config.survey1ID, config.survey1Questions))
xmlResp2 = quapi.makeRequest(quapi.getLegacyResponseData(
           config.survey2ID,config.survey2Questions))

#TODO This part needs to be changed to accomodate more than two surveys
#It's silly to have essentially the same line twice, let's generalize it.
arr1 = parsers.parseForEmails(xmlResp1,config.survey1Refs)
arr2 = parsers.parseForEmails(xmlResp2,config.survey2Refs)

#integratge new responses with old data, set repeats and invalids to D, 
#set completed surveys to C, send them thank yous
#TODO Generalize this to more than two surveys
for(d in range(0,2):
   currSurv = arr1
   if(d == 1)
       currSurv = arr2
Beispiel #2
0
validation[0][0] = 'BAD'
filemanager.writecsv(validation, valpath)

#read old csv to get data.
csvpath = os.path.join(curdir, config.filename)
arr =  filemanager.readcsv(csvpath)
users = filemanager.arrayToUsers(arr)
precount = 0
for i in range(0,len(users)):
   if users[i].state == 'c':
      precount = precount +1


#query qualtrics for responses
xmlresp1 = quapi.makeRequest(quapi.getLegacyResponseData(config.survey1id, config.survey1questions))
xmlresp2 = quapi.makeRequest(quapi.getLegacyResponseData(config.survey2id,config.survey2questions))

arr1 = parsers.parseForEmails(xmlresp1,config.survey1refs)
arr2 = parsers.parseForEmails(xmlresp2,config.survey2refs)

#integratge new responses with old data, set repeats and invalids to D, set completed surveys to C, send them thank yous
for i in range(0,len(arr1)):
   for j in range(0,len(users)):
      if arr1[i][0] == users[j].email:
         users[j].state = 'c'
         for k in range(0,len(users[j].childrenID)):
            users[j].childrenID[k] = arr1[i][k+1]
            users[j].childrenID[k] = users[j].childrenID[k].replace(' ', '')
#I know this is dumb, but it's late at night, and I'm confusing passing users by value or reference in my head, so this is what I'm doing.
for l in range(0,len(arr2)):
Beispiel #3
0
import urllib
import config
import quapi
import parsers
import filemanager
import numpy as np
import pandas as pd
config.init()

#print(quapi.makeRequest(quapi.addRecipient(config.seedemail)))
print(quapi.sendSurveyToIndividual( 'MLRP_9YO0nUPyUo5vyDj', config.survey2id))
#print(quapi.makeRequest(quapi.sendSurveyToIndividualSubjectExpiry('MLRP_9YO0nUPyUo5vyDj', config.survey2id, 'poo')))
#print(quapi.sendSurveySubjectExpiry('*****@*****.**', config.survey2id, 'subject'))
#print((quapi.sendSurvey(config.seedemail,config.survey2id)))
filemanager.writecsv(parsers.parseForEmails(quapi.makeRequest(quapi.getLegacyResponseData(config.survey2id, config.survey2questions)),config.survey2refs), 'somefile.csv')

d = filemanager.readcsv('somefile.csv')
print(d[0][0])
filemanager.writecsv(d,'somefile.csv')

#print('\n\n\n')

#print(quapi.makeRequest(quapi.getLegacyResponseData(config.survey2id,config.survey2questions)))

#print(config.survey2questions[2])


#parsers.parseForEmail((quapi.makeRequest(quapi.getLegacyResponseDataOfIndividual('R_1gcgt9z0Oxa1B01', config.survey2id, config.survey2questions))), config.survey2questions)