Exemplo n.º 1
0
    def data_to_breadth_x_db(self, start_date, x):

        if x == '30':
            breadth = 'thirty'
            digit = 7
            add = '.00'
        elif x == '40':
            breadth = 'forty'
            digit = 6
            add = '0.00'
        elif x == '50':
            breadth = 'fifty'
            digit = 5
            add = '00.00'
        else:
            breadth = 'sixty'
            digit = 4
            add = '000.00'

        count_dictionary = self.create_full_breadth_x_dictionary(x)

        for question in util.get_all_the_questions():
            for row in self.pull_all_non_breadth_data(question, start_date):

                soc = str(row[1])
                soc = soc[:digit] + add
                try:
                    count_dictionary[question][soc]['numerator_count'] = row[2]
                    count_dictionary[question][soc]['bailed_20'] = row[3]
                    count_dictionary[question][soc]['saw_20'] = row[4]
                    count_dictionary[question][soc]['saw_my_payscale'] = row[5]
                    count_dictionary[question][soc]['total_shown'] = row[6]
                except KeyError:
                    continue

        print "Inserting data into breadth " + breadth + " database..."

        conn = sqlite3.connect(self.database_path + "breadth_" + breadth +
                               ".db")
        c = conn.cursor()

        for question in count_dictionary:
            for soc in count_dictionary[question]:
                answers = count_dictionary[question][soc]
                numerator = answers['numerator_count']
                bail = answers['bailed_20']
                saw = answers['saw_20']
                my_payscale = answers['saw_my_payscale']
                total = answers['total_shown']

                question_alt = question.replace("/", "_").replace(" ",
                                                                  "_").replace(
                                                                      "-", "_")
                c.execute(
                    'INSERT INTO ' + question_alt + ' VALUES(?,?,?,?,?,?,?)',
                    (start_date, soc, numerator, bail, saw, my_payscale,
                     total))

        conn.commit()
        conn.close()
Exemplo n.º 2
0
    def data_to_breadth_x_db(self, start_date, x):

        if x == "30":
            breadth = "thirty"
            digit = 7
            add = ".00"
        elif x == "40":
            breadth = "forty"
            digit = 6
            add = "0.00"
        elif x == "50":
            breadth = "fifty"
            digit = 5
            add = "00.00"
        else:
            breadth = "sixty"
            digit = 4
            add = "000.00"

        count_dictionary = self.create_full_breadth_x_dictionary(x)

        for question in util.get_all_the_questions():
            for row in self.pull_all_non_breadth_data(question, start_date):

                soc = str(row[1])
                soc = soc[:digit] + add
                try:
                    count_dictionary[question][soc]["numerator_count"] = row[2]
                    count_dictionary[question][soc]["bailed_20"] = row[3]
                    count_dictionary[question][soc]["saw_20"] = row[4]
                    count_dictionary[question][soc]["saw_my_payscale"] = row[5]
                    count_dictionary[question][soc]["total_shown"] = row[6]
                except KeyError:
                    continue

        print "Inserting data into breadth " + breadth + " database..."

        conn = sqlite3.connect(self.database_path + "breadth_" + breadth + ".db")
        c = conn.cursor()

        for question in count_dictionary:
            for soc in count_dictionary[question]:
                answers = count_dictionary[question][soc]
                numerator = answers["numerator_count"]
                bail = answers["bailed_20"]
                saw = answers["saw_20"]
                my_payscale = answers["saw_my_payscale"]
                total = answers["total_shown"]

                question_alt = question.replace("/", "_").replace(" ", "_").replace("-", "_")
                c.execute(
                    "INSERT INTO " + question_alt + " VALUES(?,?,?,?,?,?,?)",
                    (start_date, soc, numerator, bail, saw, my_payscale, total),
                )

        conn.commit()
        conn.close()
Exemplo n.º 3
0
    def create_full_breadth_x_num_dictionary(self, x):

        count_dictionary = {}

        for question in util.get_all_the_questions():
            count_dictionary[question] = {}
            for soc in self.find_breadth_x_soc_codes(x):
                count_dictionary[question][soc] = 0

        return count_dictionary
Exemplo n.º 4
0
    def create_full_breadth_x_num_dictionary(self, x):

        count_dictionary = {}

        for question in util.get_all_the_questions():
            count_dictionary[question] = {}
            for soc in self.find_breadth_x_soc_codes(x):
                count_dictionary[question][soc] = 0

        return count_dictionary
Exemplo n.º 5
0
    def create_full_breadth_x_dictionary(self, x):

        count_dictionary = {}

        for question in util.get_all_the_questions():
            count_dictionary[question] = {}
            for soc in self.find_breadth_x_soc_codes(x):
                count_dictionary[question][soc] = {}
                for answer in ["numerator_count", "bailed_20", "saw_20", "saw_my_payscale", "total_shown"]:
                    count_dictionary[question][soc][answer] = 0

        return count_dictionary
Exemplo n.º 6
0
    def create_full_breadth_x_dictionary(self, x):

        count_dictionary = {}

        for question in util.get_all_the_questions():
            count_dictionary[question] = {}
            for soc in self.find_breadth_x_soc_codes(x):
                count_dictionary[question][soc] = {}
                for answer in [
                        'numerator_count', 'bailed_20', 'saw_20',
                        'saw_my_payscale', 'total_shown'
                ]:
                    count_dictionary[question][soc][answer] = 0

        return count_dictionary
Exemplo n.º 7
0
    def check_for_data(self):

        conn = sqlite3.connect(self.database_path + "Question_Denominator.db")
        c = conn.cursor()

        for i, question in enumerate(util.get_all_the_questions()):
            if 1 < 10:

                query = "SELECT date FROM " + question.replace("/", "_").replace(" ", "_").replace("-", "_")

                for row in c.execute(str(query)):
                    print row
            else:
                break

        conn.close()
Exemplo n.º 8
0
    def check_for_data(self):

        conn = sqlite3.connect(self.database_path + "Question_Denominator.db")
        c = conn.cursor()

        for i, question in enumerate(util.get_all_the_questions()):
            if 1 < 10:

                query = "SELECT date FROM " + question.replace(
                    "/", "_").replace(" ", "_").replace("-", "_")

                for row in c.execute(str(query)):
                    print row
            else:
                break

        conn.close()