def test_metrics(self):
        print("")
        school = SemesterException()
        df1 = pd.read_sql_query(school.school_wise, self.connection)
        df1 = df1[['school_id', 'school_name', 'total_schools_not_received']]
        df1.sort_values(by=['school_id'], inplace=True)
        pd.set_option("display.max_rows", None, "display.max_columns", None)

        file = cqube()
        result = file.openfile(
            config['jsondata']['semester_exception_school_wise'])
        df2 = pd.DataFrame(result['data'])
        df2 = df2[[
            'school_id', 'school_name', 'total_schools_with_missing_data'
        ]]
        df2.rename(columns={
            'total_schools_with_missing_data':
            'total_schools_not_received'
        },
                   inplace=True)
        df2.sort_values(by=['school_id'], inplace=True)
        df_diff = pd.concat([df1, df2]).drop_duplicates(keep=False)
        assert df_diff.empty, "Found difference between s3 bucket metrics and the metrics generated outside cqube for school wise total_schools_not_received"
        print(
            "No Difference between s3 bucket metrics and the metrics generated outside cqube for school wise total_schools_not_received for semester exception"
        )
Exemple #2
0
    def test_metrics(self):
        print("")
        query = CompletionError()
        df1 = pd.read_sql_query(query.school, self.connection)
        df1 = df1[[
            'ff_uuid', 'exception_type', 'school_id', 'school_name',
            'block_id', 'district_id', 'cluster_id', 'school_latitude',
            'school_longitude', 'created_on'
        ]]
        df1.sort_values(by=['school_id'], inplace=True)
        pd.set_option("display.max_rows", None, "display.max_columns", None)
        print(df1.count())

        file = cqube()
        result = file.openfile(config['jsondata']['exception_list'])
        df2 = pd.DataFrame(result)

        df2 = df2[[
            'ff_uuid', 'exception_type', 'school_id', 'school_name',
            'block_id', 'district_id', 'cluster_id', 'school_latitude',
            'school_longitude', 'created_on'
        ]]
        df2.sort_values(by=['school_id'], inplace=True)
        df_diff = pd.concat([df1, df2]).drop_duplicates(keep=False)
        assert df_diff.empty, "Found difference between s3 bucket metrics and the metrics generated outside cqube for school wise completion error "
        print(
            "No Difference between s3 bucket metrics and the metrics generated outside cqube for school wise completion error"
        )
Exemple #3
0
    def test_metrics(self):
        print("")
        cluster = SemesterException()
        df1 = pd.read_sql_query(cluster.cluster_wise, self.connection)
        df1 = df1[[
            'cluster_id', 'cluster_name',
            'percentage_schools_with_missing_data'
        ]]
        df1.sort_values(by=['cluster_id'], inplace=True)
        pd.set_option("display.max_rows", None, "display.max_columns", None)
        file = cqube()
        result = file.openfile(
            config['jsondata']['semester_exception_cluster_wise'])
        df2 = pd.DataFrame(result['data'])
        df2 = df2[[
            'cluster_id', 'cluster_name',
            'percentage_schools_with_missing_data'
        ]]
        df2['percentage_schools_with_missing_data'] = df2[
            'percentage_schools_with_missing_data'].astype(float)
        df2.sort_values(by=['cluster_id'], inplace=True)

        df_diff = pd.concat([df1, df2]).drop_duplicates(keep=False)
        assert df_diff.empty, "Found difference between s3 bucket metrics and the metrics generated outside cqube for block_wise percentage_schools_with_missing_data "
        print(
            "No Difference between s3 bucket metrics and the metrics generated outside cqube for block wise percentage_schools_with_missing_data for semester exception"
        )
 def test_metrics(self):
     print("")
     district = SemesterException()
     df1 = pd.read_sql_query(district.district_wise, self.connection)
     df1=df1[['district_id','district_name','total_schools_with_missing_data']]
     df1.sort_values(by=['district_id'], inplace=True)
     file = cqube()
     result=file.openfile(config['jsondata']['semester_exception_district_wise'])
     df2=pd.DataFrame(result['data'])
     df2=df2[['district_id','district_name','total_schools_with_missing_data']]
     df2['total_schools_with_missing_data']=df2['total_schools_with_missing_data'].astype(float)
     df2.sort_values(by=['district_id'], inplace=True)
     df_diff = pd.concat([df1, df2]).drop_duplicates(keep=False)
     assert df_diff.empty , "Found difference between s3 bucket metrics and the metrics generated outside cqube for district wise total_schools_with_missing_data "
     print("No Difference between s3 bucket metrics and the metrics generated outside cqube for district wise total_schools_with_missing_data for semester exception")
Exemple #5
0
 def setUp(self):
     con = cqube()
     self.connection = con.connect_to_postgres()