From b51517bfb43fbfece0a3a72e7cdbe76d1c34a22c Mon Sep 17 00:00:00 2001 From: Varsha Mahuli Date: Fri, 3 May 2024 16:25:24 +0530 Subject: [PATCH] total_kp renamed to no_of_karma_points --- .../dashboard/report/user/UserReportModel.scala | 2 +- .../dashboard/report/warehouse/DataWarehouseModel.scala | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/batch-models/src/main/scala/org/ekstep/analytics/dashboard/report/user/UserReportModel.scala b/batch-models/src/main/scala/org/ekstep/analytics/dashboard/report/user/UserReportModel.scala index 0d516342..7e1b78f8 100644 --- a/batch-models/src/main/scala/org/ekstep/analytics/dashboard/report/user/UserReportModel.scala +++ b/batch-models/src/main/scala/org/ekstep/analytics/dashboard/report/user/UserReportModel.scala @@ -81,7 +81,7 @@ object UserReportModel extends AbsDashboardModel { col("userID").alias("user_id"), col("userOrgID").alias("mdo_id"), col("userStatus").alias("status"), - col("total_points").alias("total_kp"), + col("total_points").alias("no_of_karma_points"), col("fullName").alias("full_name"), col("professionalDetails.designation").alias("designation"), col("personalDetails.primaryEmail").alias("email"), diff --git a/batch-models/src/main/scala/org/ekstep/analytics/dashboard/report/warehouse/DataWarehouseModel.scala b/batch-models/src/main/scala/org/ekstep/analytics/dashboard/report/warehouse/DataWarehouseModel.scala index 97843928..cf40b30a 100644 --- a/batch-models/src/main/scala/org/ekstep/analytics/dashboard/report/warehouse/DataWarehouseModel.scala +++ b/batch-models/src/main/scala/org/ekstep/analytics/dashboard/report/warehouse/DataWarehouseModel.scala @@ -4,6 +4,7 @@ import org.apache.spark.SparkContext import org.apache.spark.sql.SparkSession import org.apache.spark.sql.functions._ import org.ekstep.analytics.dashboard.DashboardUtil._ +import org.ekstep.analytics.dashboard.DataUtil._ import org.ekstep.analytics.dashboard.{AbsDashboardModel, DashboardConfig} import org.ekstep.analytics.framework.FrameworkContext @@ -26,7 +27,7 @@ object DataWarehouseModel extends AbsDashboardModel { var user_details = spark.read.option("header", "true") .csv(s"${conf.localReportDir}/${conf.userReportPath}/${today}-warehouse") user_details = user_details.withColumn("status", col("status").cast("int")) - .withColumn("total_kp", col("total_kp").cast("int")) + .withColumn("no_of_karma_points", col("no_of_karma_points").cast("int")) truncateWarehouseTable(conf.dwUserTable) saveDataframeToPostgresTable_With_Append(user_details, dwPostgresUrl, conf.dwUserTable, conf.dwPostgresUsername, conf.dwPostgresCredential) @@ -99,6 +100,12 @@ object DataWarehouseModel extends AbsDashboardModel { truncateWarehouseTable(conf.dwOrgTable) saveDataframeToPostgresTable_With_Append(orgDwDf, dwPostgresUrl, conf.dwOrgTable, conf.dwPostgresUsername, conf.dwPostgresCredential) + + var content_resource_details = spark.read.option("header", "true") + .csv(s"${conf.localReportDir}/${conf.courseReportPath}/${today}-resource-warehouse") + + truncateWarehouseTable(conf.dwCourseResourceTable) + saveDataframeToPostgresTable_With_Append(content_resource_details, dwPostgresUrl, conf.dwCourseResourceTable, conf.dwPostgresUsername, conf.dwPostgresCredential) } }