diff --git a/optmanagementprod/kol_databases.py b/optmanagementprod/kol_databases.py index 6dcc786..eff58cd 100644 --- a/optmanagementprod/kol_databases.py +++ b/optmanagementprod/kol_databases.py @@ -38,7 +38,7 @@ def fetch_records(config): if connection.is_connected(): cursor = connection.cursor(dictionary=True) - cursor.execute(f"SELECT '{ config['instance'] }' as instance, kols.npi_num,kols.id,CONCAT_WS(' ',kols.first_name,kols.middle_name,kols.last_name) as kol_name, GROUP_CONCAT(DISTINCT projects.name) as project_name, clients.name as client_name,CONCAT(client_users.first_name,client_users.last_name) as user_name, GROUP_CONCAT(DISTINCT log_activities.transaction_name,':',date(log_activities.created_on)) as project_details,case when user_kols.opt_in_out_status = 3 then 'Opted Out' when user_kols.opt_in_out_status = 4 then 'Opted In' else '' end as status FROM kols left join user_kols on user_kols.kol_id = kols.id inner join opt_inout_statuses on opt_inout_statuses.id = user_kols.opt_in_out_status left join log_activities on log_activities.miscellaneous1 = user_kols.kol_id left join client_users on client_users.id = user_kols.user_id left join clients on client_users.client_id = clients.id left join project_kols on project_kols.kol_id = user_kols.kol_id left join projects on projects.id = project_kols.project_id where log_activities.module ='opt_in_out' and log_activities.transaction_name in ('New','Opt-in Requested','Opt-out','Opt-in Approved','Opt-in Expired','Opt-in Received','Opt-in') group by kols.id;") + cursor.execute(f"SELECT '{ config['instance'] }' as instance, kols.npi_num,kols.id,CONCAT_WS(' ',kols.first_name,kols.middle_name,kols.last_name) as kol_name, projects.name as project_name, clients.name as client_name,CONCAT(client_users.first_name,' ',client_users.last_name) as user_name, GROUP_CONCAT(DISTINCT log_activities.transaction_name,':',date(log_activities.created_on)) as project_details,case when user_kols.opt_in_out_status = 3 then 'Opted Out' when user_kols.opt_in_out_status = 4 then 'Opted In' else '' end as status , date(kols.data_updated) as data_processed_date,countries.Country as user_country,CONCAT(poc.first_name,' ',poc.last_name) as client_poc FROM kols left join user_kols on user_kols.kol_id = kols.id left join countries on countries.CountryId = kols.country_id inner join opt_inout_statuses on opt_inout_statuses.id = user_kols.opt_in_out_status left join log_activities on log_activities.miscellaneous1 = user_kols.kol_id left join client_users on client_users.id = user_kols.user_id left join clients on client_users.client_id = clients.id left join client_users as poc on poc.id = clients.created_by left join project_clients on project_clients.client_id = clients.id left join projects on project_clients.project_id = projects.id where log_activities.module ='opt_in_out' and log_activities.transaction_name in ('New','Opt-in Requested','Opt-out','Opt-in Approved','Opt-in Expired','Opt-in Received','Opt-in') group by kols.id;") records = cursor.fetchall() return records diff --git a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json index 3eccf1a..9def62e 100644 --- a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json +++ b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.json @@ -14,11 +14,12 @@ "optin_received_date", "optin_approved_date", "status", - "cs_assigned_poc", + "user_name", "optin_type", "data_processed_date", "instance", - "npi_id" + "npi_id", + "country" ], "fields": [ { @@ -65,11 +66,6 @@ "fieldtype": "Data", "label": "Status" }, - { - "fieldname": "cs_assigned_poc", - "fieldtype": "Data", - "label": "CS Assigned POC" - }, { "fieldname": "optin_type", "fieldtype": "Data", @@ -89,12 +85,22 @@ "fieldname": "npi_id", "fieldtype": "Data", "label": "Npi ID" + }, + { + "fieldname": "user_name", + "fieldtype": "Data", + "label": "User Name" + }, + { + "fieldname": "country", + "fieldtype": "Data", + "label": "Country" } ], "index_web_pages_for_search": 1, "is_virtual": 1, "links": [], - "modified": "2024-06-20 15:03:39.506553", + "modified": "2024-06-27 12:26:42.877560", "modified_by": "Administrator", "module": "Opt management production", "name": "optlistprod", diff --git a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py index 9717963..6eb6787 100644 --- a/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py +++ b/optmanagementprod/opt_management_production/doctype/optlistprod/optlistprod.py @@ -24,10 +24,13 @@ class optlistprod(Document): "kol_name" : str(client["kol_name"]), "project_name" : str(client["project_name"]), "client_name" : str(client["client_name"]), - "client_poc" : str(client["user_name"]), + "client_poc" : str(client["client_poc"]), "status" : str(client["status"]), "instance" : str(client["instance"]), "npi_id": str(client["npi_num"]), + "data_processed_date": str(client["data_processed_date"]), + "country": str(client["user_country"]), + "user_name": str(client["user_name"]), "optin_received_date" : optinReceived(str(client["project_details"]),"Opt-in Received"), "optin_approved_date" : optinReceived(str(client["project_details"]),"Opt-in Approved"), @@ -117,10 +120,13 @@ def getValues(): "kol_name" : str(client["kol_name"]), "project_name" : str(client["project_name"]), "client_name" : str(client["client_name"]), - "client_poc" : str(client["user_name"]), + "client_poc" : str(client["client_poc"]), "status" : str(client["status"]), "instance" : str(client["instance"]), "npi_id": str(client["npi_num"]), + "data_processed_date": str(client["data_processed_date"]), + "country": str(client["user_country"]), + "user_name": str(client["user_name"]), "optin_received_date" : optinReceived(str(client["project_details"]),"Opt-in Received"), "optin_approved_date" : optinReceived(str(client["project_details"]),"Opt-in Approved"), diff --git a/optmanagementprod/www/optanalystview.html b/optmanagementprod/www/optanalystview.html index ee77b86..957c92e 100644 --- a/optmanagementprod/www/optanalystview.html +++ b/optmanagementprod/www/optanalystview.html @@ -118,8 +118,7 @@ document.addEventListener('DOMContentLoaded', function() { for(var rec in data) { tableData.push({ - kol_id:rec.kol_id, kol_name:rec["kol_name"],project_name: rec["project_name"], client_name:rec["client_name"], client_poc:rec["client_poc"],optin_received_date:rec["optin_received_date"],optin_approved_date:rec["optin_approved_date"],status:rec["status"],instance:rec["instance"],npi_id:rec["npi_id"] - // cs_Assigned_poc:rec["cs_Assigned_poc"],optin_type:rec["optin_type"],data_processed_date:rec["data_processed_date"] + kol_id:rec.kol_id, kol_name:rec["kol_name"],project_name: rec["project_name"], client_name:rec["client_name"], client_poc:rec["client_poc"],optin_received_date:rec["optin_received_date"],optin_approved_date:rec["optin_approved_date"],status:rec["status"],instance:rec["instance"],npi_id:rec["npi_id"],user_name:rec["user_name"],country:rec["country"],data_processed_date:rec["data_processed_date"] }); } // console.log(tableData); @@ -144,18 +143,24 @@ document.addEventListener('DOMContentLoaded', function() { paginationCounter: "rows", columns:[ // Define table columns {title:"Instance", field:"instance",headerFilterPlaceholder: "Search", headerFilter: true,width:100}, - {title:"Client Name", field:"client_name",headerFilterPlaceholder: "Search", headerFilter: true,tooltip:true}, - {title:"NPI ID", field:"npi_id",headerFilterPlaceholder: "Search", headerFilter: true,width:100}, + {title:"NPI", field:"npi_id",headerFilterPlaceholder: "Search", headerFilter: true,width:100}, {title:"KOL ID", field:"kol_id",headerFilterPlaceholder: "Search", headerFilter: true,width:100}, {title:"KOL Name", field:"kol_name",headerFilterPlaceholder: "Search", headerFilter: true,}, - {title:"Status", field:"status",headerFilterPlaceholder: "Search", headerFilter: true,}, + {title:"Country", field:"country",headerFilterPlaceholder: "Search", headerFilter: true,}, + {title:"Project Name", field:"project_name",headerFilterPlaceholder: "Search", headerFilter: true,width:250,tooltip:true}, + {title:"Client Name", field:"client_name",headerFilterPlaceholder: "Search", headerFilter: true,tooltip:true}, + + + {title:"Client User Name", field:"user_name",headerFilterPlaceholder: "Search", headerFilter: true,}, {title:"Requested Date", field:"optin_received_date",headerFilterPlaceholder: "Search", headerFilter: true,}, {title:"Approved Date", field:"optin_approved_date",headerFilterPlaceholder: "Search", headerFilter: true,}, - {title:"Project Name", field:"project_name",headerFilterPlaceholder: "Search", headerFilter: true,width:250,tooltip:true}, + + {title:"Data Processed Date", field:"data_processed_date",headerFilterPlaceholder: "Search", headerFilter: true}, + {title:"Status", field:"status",headerFilterPlaceholder: "Search", headerFilter: true,}, + {title:"Client POC", field:"client_poc",headerFilterPlaceholder: "Search", headerFilter: true,}, - // {title:"CS Assigned POC", field:"cs_assigned_poc",headerFilterPlaceholder: "Search", headerFilter: true,}, - // {title:"Opt-In Type", field:"optin_type",headerFilterPlaceholder: "Search", headerFilter: true,}, - // {title:"Data Processed Date", field:"data_processed_date",headerFilterPlaceholder: "Search", headerFilter: true} + + ], }); document.getElementById("download-csv").addEventListener("click", function(){ diff --git a/optmanagementprod/www/optanalystview.py b/optmanagementprod/www/optanalystview.py index f266a81..cd63b6e 100644 --- a/optmanagementprod/www/optanalystview.py +++ b/optmanagementprod/www/optanalystview.py @@ -17,6 +17,8 @@ def fetch_data(): "status" : str(client["status"]), "instance" : str(client["instance"]), "npi_id": str(client["npi_id"]), - + "country" : str(client["country"]), + "data_processed_date" : str(client["data_processed_date"]), + "user_name": str(client["user_name"]), } for client in records]