fix: add default filters in Dashboard Charts

This commit is contained in:
Rucha Mahabal 2020-05-18 18:59:59 +05:30
parent 24477d5d06
commit 5162faa7df

View File

@ -44,6 +44,7 @@ def get_dashboards():
}] }]
def get_charts(): def get_charts():
company = get_company()
return [ return [
{ {
"doctype": "Dashboard Chart", "doctype": "Dashboard Chart",
@ -51,7 +52,10 @@ def get_charts():
"name": "Patient Appointments", "name": "Patient Appointments",
"chart_name": "Patient Appointments", "chart_name": "Patient Appointments",
"timespan": "Last Month", "timespan": "Last Month",
"filters_json": json.dumps({}), "filters_json": json.dumps([
["Patient Appointment", "company", "=", company, False],
["Patient Appointment", "status", "!=", "Cancelled"]
]),
"chart_type": "Count", "chart_type": "Count",
"timeseries": 1, "timeseries": 1,
"based_on": "appointment_datetime", "based_on": "appointment_datetime",
@ -68,6 +72,10 @@ def get_charts():
"document_type": "Patient Appointment", "document_type": "Patient Appointment",
"group_by_type": "Count", "group_by_type": "Count",
"group_by_based_on": "department", "group_by_based_on": "department",
"filters_json": json.dumps([
["Patient Appointment", "company", "=", company, False],
["Patient Appointment", "status", "!=", "Cancelled"]
]),
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"type": "Bar", "type": "Bar",
@ -82,6 +90,10 @@ def get_charts():
"document_type": "Lab Test", "document_type": "Lab Test",
"group_by_type": "Count", "group_by_type": "Count",
"group_by_based_on": "template", "group_by_based_on": "template",
"filters_json": json.dumps([
["Lab Test", "company", "=", company, False],
["Lab Test", "docstatus", "=", 1]
]),
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"type": "Bar", "type": "Bar",
@ -96,6 +108,9 @@ def get_charts():
"document_type": "Inpatient Record", "document_type": "Inpatient Record",
"group_by_type": "Count", "group_by_type": "Count",
"group_by_based_on": "status", "group_by_based_on": "status",
"filters_json": json.dumps([
["Inpatient Record", "company", "=", company, False]
]),
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"type": "Bar", "type": "Bar",
@ -109,6 +124,10 @@ def get_charts():
"document_type": "Clinical Procedure", "document_type": "Clinical Procedure",
"group_by_type": "Count", "group_by_type": "Count",
"group_by_based_on": "status", "group_by_based_on": "status",
"filters_json": json.dumps([
["Clinical Procedure", "company", "=", company, False],
["Clinical Procedure", "docstatus", "=", 1]
]),
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"type": "Pie", "type": "Pie",
@ -122,6 +141,7 @@ def get_charts():
"document_type": "Patient Encounter Symptom", "document_type": "Patient Encounter Symptom",
"group_by_type": "Count", "group_by_type": "Count",
"group_by_based_on": "complaint", "group_by_based_on": "complaint",
"filters_json": json.dumps({}),
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"type": "Percentage", "type": "Percentage",
@ -135,6 +155,7 @@ def get_charts():
"document_type": "Patient Encounter Diagnosis", "document_type": "Patient Encounter Diagnosis",
"group_by_type": "Count", "group_by_type": "Count",
"group_by_based_on": "diagnosis", "group_by_based_on": "diagnosis",
"filters_json": json.dumps({}),
'is_public': 1, 'is_public': 1,
"owner": "Administrator", "owner": "Administrator",
"type": "Percentage", "type": "Percentage",
@ -143,6 +164,7 @@ def get_charts():
] ]
def get_number_cards(): def get_number_cards():
company = get_company()
return [ return [
{ {
"name": "Total Patients", "name": "Total Patients",
@ -179,7 +201,7 @@ def get_number_cards():
"doctype": "Number Card", "doctype": "Number Card",
"document_type": "Patient Appointment", "document_type": "Patient Appointment",
"filters_json": json.dumps( "filters_json": json.dumps(
[["Patient Appointment","company","=",get_company(),False], [["Patient Appointment","company","=",company,False],
["Patient Appointment","status","=","Open",False]] ["Patient Appointment","status","=","Open",False]]
), ),
"is_public": 1, "is_public": 1,
@ -194,7 +216,7 @@ def get_number_cards():
"doctype": "Number Card", "doctype": "Number Card",
"document_type": "Patient Appointment", "document_type": "Patient Appointment",
"filters_json": json.dumps( "filters_json": json.dumps(
[["Patient Appointment","company","=",get_company(),False], [["Patient Appointment","company","=",company,False],
["Patient Appointment","invoiced","=",0,False]] ["Patient Appointment","invoiced","=",0,False]]
), ),
"is_public": 1, "is_public": 1,