Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating CRC Admission form #135

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
960 changes: 480 additions & 480 deletions changemakers/frappe_changemakers/doctype/case/case.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions changemakers/frappe_changemakers/doctype/case/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@


class Case(Document):
def before_save(self):
self.set_created_by()
self.set_total_amount()
def before_save(self):
self.set_created_by()
self.set_total_amount()

def set_created_by(self):
if not self.created_by:
owner = frappe.db.get_value("User", self.owner, "full_name")
self.created_by = owner
def set_created_by(self):
if not self.created_by:
owner = frappe.db.get_value("User", self.owner, "full_name")
self.created_by = owner

def set_total_amount(self):
total_amount = 0
for row in self.payment_details:
total_amount += row.amount
self.total_amount = total_amount
def set_total_amount(self):
total_amount = 0
for row in self.payment_details:
total_amount += row.amount
self.total_amount = total_amount
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Copyright (c) 2023, [email protected] and contributors
// For license information, please see license.txt

frappe.ui.form.on("CRC Admissions", {
// refresh: function(frm) {
// }
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2023-10-20 07:46:14.511574",
"default_view": "List",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"name_of_facility",
"name_of_the_beneficiary",
"file_number",
"date_of_admission",
"column_break_1",
"doctors_name",
"section_break_3p905",
"type_of_admission",
"column_break_2",
"refered_by",
"section_break_hj8kk",
"medical_condition",
"descriptive",
"estimated_duration",
"actual_duration",
"section_break_hyfkr",
"date_of_discharge",
"column_break_3",
"exit_pathway"
],
"fields": [
{
"fieldname": "name_of_facility",
"fieldtype": "Data",
"label": "Name of Facility"
},
{
"fieldname": "doctors_name",
"fieldtype": "Text",
"label": "Doctors name"
},
{
"fieldname": "name_of_the_beneficiary",
"fieldtype": "Link",
"label": "Name of the Beneficiary",
"options": "Beneficiary"
},
{
"fieldname": "file_number",
"fieldtype": "Data",
"label": "File Number"
},
{
"fieldname": "date_of_admission",
"fieldtype": "Date",
"label": "Date of Admission"
},
{
"fieldname": "section_break_3p905",
"fieldtype": "Section Break",
"label": "Types Of Admissions"
},
{
"fieldname": "type_of_admission",
"fieldtype": "Select",
"label": "Type of Admission",
"options": "Voluntary\nInvoluntary"
},
{
"fieldname": "refered_by",
"fieldtype": "Select",
"label": "Reffered By",
"options": "Police\nPS\nPartners,\nself"
},
{
"fieldname": "section_break_hj8kk",
"fieldtype": "Section Break",
"label": "Medical Conditions"
},
{
"fieldname": "medical_condition",
"fieldtype": "Table",
"label": "Medical Condition",
"options": "Patients Medical Condition"
},
{
"fieldname": "descriptive",
"fieldtype": "Text",
"label": "Discriptive(to be filled by Doctor)"
},
{
"fieldname": "estimated_duration",
"fieldtype": "Data",
"label": "Estimated Duration In Days"
},
{
"fieldname": "actual_duration",
"fieldtype": "Data",
"label": "Actual Duration"
},
{
"fieldname": "section_break_hyfkr",
"fieldtype": "Section Break",
"label": "Exit Information"
},
{
"fieldname": "date_of_discharge",
"fieldtype": "Date",
"label": "Date of Discharge"
},
{
"fieldname": "exit_pathway",
"fieldtype": "Select",
"label": "Exit Pathway",
"options": "Family Reintegration\nDeath\nShelter\nHome"
},
{
"fieldname": "column_break_1",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_2",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_3",
"fieldtype": "Column Break"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-10-20 10:15:26.483705",
"modified_by": "Administrator",
"module": "Frappe Changemakers",
"name": "CRC Admissions",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2023, [email protected] and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document


from datetime import datetime
from datetime import datetime


class CRCAdmissions(Document):
def before_save(self):
self.calculate_actual_duration()

def calculate_actual_duration(self):
if self.date_of_admission:
date_of_admission = datetime.strptime(
self.date_of_admission, "%Y-%m-%d")
current_date = datetime.now()
duration = current_date - date_of_admission
actual_duration = duration.days
self.actual_duration = f"{int(actual_duration)} days"
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2023, [email protected] and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TestCRCAdmissions(FrappeTestCase):
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2023-10-20 07:41:41.038263",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"date",
"time",
"category",
"description"
],
"fields": [
{
"fieldname": "date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Date",
"reqd": 1
},
{
"fieldname": "time",
"fieldtype": "Time",
"label": "Time"
},
{
"fieldname": "category",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Category",
"options": "Tests\nmedication",
"reqd": 1
},
{
"fieldname": "description",
"fieldtype": "Text",
"in_list_view": 1,
"label": "Description",
"reqd": 1
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-10-20 08:02:37.086343",
"modified_by": "Administrator",
"module": "Frappe Changemakers",
"name": "Patients Medical Condition",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2023, [email protected] and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document

class PatientsMedicalCondition(Document):
pass
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"charts": [],
"content": "[{\"id\":\"CecwNbV5Aq\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\">Frappe Changemakers</span>\",\"col\":12}},{\"id\":\"I9e4OurK7Y\",\"type\":\"paragraph\",\"data\":{\"text\":\"&nbsp;Manage Beneficiaries\",\"col\":12}},{\"id\":\"JhoJIvxYwo\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"New Beneficiary\",\"col\":3}},{\"id\":\"PMA7sL0zHl\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"All Beneficiaries\",\"col\":3}},{\"id\":\"j_2-NL3927\",\"type\":\"paragraph\",\"data\":{\"text\":\"Daily Visit Update\",\"col\":12}},{\"id\":\"arnB4anEZl\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"New Daily Visit Update\",\"col\":3}},{\"id\":\"lB7YAlkP4m\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"All Daily Visit Update List\",\"col\":3}},{\"id\":\"K20J6BDf9I\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Daily Visit Report View\",\"col\":3}},{\"id\":\"GlS-4ygjkT\",\"type\":\"paragraph\",\"data\":{\"text\":\"Rescues\",\"col\":12}},{\"id\":\"W7ZBgFg0CJ\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"New Rescue\",\"col\":3}},{\"id\":\"TEcaVdnIhr\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"All Rescues\",\"col\":3}},{\"id\":\"g2frCR54Gw\",\"type\":\"paragraph\",\"data\":{\"text\":\"Cases\",\"col\":12}},{\"id\":\"YY4UpDO22w\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"My Cases\",\"col\":3}},{\"id\":\"o-NQxJOqB9\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"New Case\",\"col\":3}},{\"id\":\"1X_H_JUulh\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Open Cases\",\"col\":3}},{\"id\":\"2faOuV0vIj\",\"type\":\"paragraph\",\"data\":{\"text\":\"Entitlements\",\"col\":12}},{\"id\":\"xllISW0jRt\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Entitlements\",\"col\":3}},{\"id\":\"wjYeZ-C3Yj\",\"type\":\"paragraph\",\"data\":{\"text\":\"Food\",\"col\":12}},{\"id\":\"mB90BbrugG\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"New Distribution\",\"col\":3}},{\"id\":\"2Dxn3AA-OY\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"All Distributions\",\"col\":3}},{\"id\":\"2qZW9NgrCQ\",\"type\":\"paragraph\",\"data\":{\"text\":\"Healthcare\",\"col\":12}},{\"id\":\"JYx1hK5EYf\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Hospitalisation Record\",\"col\":3}},{\"id\":\"aGZflLrU8F\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Healthcare Providers\",\"col\":3}},{\"id\":\"SMiDbH7oHO\",\"type\":\"paragraph\",\"data\":{\"text\":\"Shelter Services\",\"col\":12}},{\"id\":\"_zTFcA698A\",\"type\":\"quick_list\",\"data\":{\"quick_list_name\":\"Shelter Homes\",\"col\":4}},{\"id\":\"ZMLz_em53Q\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Create Entry Record\",\"col\":3}},{\"id\":\"j51o5hQMDV\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Create Exit Record\",\"col\":3}},{\"id\":\"hIEZu5hDaF\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"2QJ1oA29Tv\",\"type\":\"paragraph\",\"data\":{\"text\":\"Others\",\"col\":12}},{\"id\":\"a3oRewN8WJ\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Family Reintegrations\",\"col\":3}},{\"id\":\"AtcrGpwYkn\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Awareness Camps\",\"col\":3}},{\"id\":\"vOv18I4R0A\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Health Camps\",\"col\":3}}]",
"content": "[{\"id\":\"CecwNbV5Aq\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\">Frappe Changemakers</span>\",\"col\":12}},{\"id\":\"I9e4OurK7Y\",\"type\":\"paragraph\",\"data\":{\"text\":\"&nbsp;Manage Beneficiaries\",\"col\":12}},{\"id\":\"JhoJIvxYwo\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"New Beneficiary\",\"col\":3}},{\"id\":\"PMA7sL0zHl\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"All Beneficiaries\",\"col\":3}},{\"id\":\"j_2-NL3927\",\"type\":\"paragraph\",\"data\":{\"text\":\"Daily Visit Update\",\"col\":12}},{\"id\":\"arnB4anEZl\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"New Daily Visit Update\",\"col\":3}},{\"id\":\"lB7YAlkP4m\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"All Daily Visit Update List\",\"col\":3}},{\"id\":\"K20J6BDf9I\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Daily Visit Report View\",\"col\":3}},{\"id\":\"GlS-4ygjkT\",\"type\":\"paragraph\",\"data\":{\"text\":\"Rescues\",\"col\":12}},{\"id\":\"W7ZBgFg0CJ\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"New Rescue\",\"col\":3}},{\"id\":\"TEcaVdnIhr\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"All Rescues\",\"col\":3}},{\"id\":\"g2frCR54Gw\",\"type\":\"paragraph\",\"data\":{\"text\":\"Cases\",\"col\":12}},{\"id\":\"YY4UpDO22w\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"My Cases\",\"col\":3}},{\"id\":\"o-NQxJOqB9\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"New Case\",\"col\":3}},{\"id\":\"1X_H_JUulh\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Open Cases\",\"col\":3}},{\"id\":\"2faOuV0vIj\",\"type\":\"paragraph\",\"data\":{\"text\":\"Entitlements\",\"col\":12}},{\"id\":\"xllISW0jRt\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Entitlements\",\"col\":3}},{\"id\":\"wjYeZ-C3Yj\",\"type\":\"paragraph\",\"data\":{\"text\":\"Food\",\"col\":12}},{\"id\":\"mB90BbrugG\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"New Distribution\",\"col\":3}},{\"id\":\"2Dxn3AA-OY\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"All Distributions\",\"col\":3}},{\"id\":\"2qZW9NgrCQ\",\"type\":\"paragraph\",\"data\":{\"text\":\"Healthcare\",\"col\":12}},{\"id\":\"JYx1hK5EYf\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Hospitalisation Record\",\"col\":3}},{\"id\":\"aGZflLrU8F\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Healthcare Providers\",\"col\":3}},{\"id\":\"SMiDbH7oHO\",\"type\":\"paragraph\",\"data\":{\"text\":\"Shelter Services\",\"col\":12}},{\"id\":\"_zTFcA698A\",\"type\":\"quick_list\",\"data\":{\"quick_list_name\":\"Shelter Homes\",\"col\":4}},{\"id\":\"ZMLz_em53Q\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Create Entry Record\",\"col\":3}},{\"id\":\"j51o5hQMDV\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Create Exit Record\",\"col\":3}},{\"id\":\"hIEZu5hDaF\",\"type\":\"spacer\",\"data\":{\"col\":12}},{\"id\":\"2QJ1oA29Tv\",\"type\":\"paragraph\",\"data\":{\"text\":\"Others\",\"col\":12}},{\"id\":\"a3oRewN8WJ\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Family Reintegrations\",\"col\":3}},{\"id\":\"AtcrGpwYkn\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Awareness Camps\",\"col\":3}},{\"id\":\"vOv18I4R0A\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Health Camps\",\"col\":3}},{\"id\":\"5SClhYG8YF\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"CRC Admissions\",\"col\":3}}]",
"creation": "2022-10-13 13:51:43.725589",
"custom_blocks": [],
"docstatus": 0,
Expand All @@ -12,7 +12,7 @@
"is_hidden": 0,
"label": "Changemakers",
"links": [],
"modified": "2023-07-16 16:18:10.088671",
"modified": "2023-10-20 08:44:41.750831",
"modified_by": "Administrator",
"module": "Frappe Changemakers",
"name": "Changemakers",
Expand All @@ -29,6 +29,13 @@
"roles": [],
"sequence_id": 1.0,
"shortcuts": [
{
"color": "Green",
"doc_view": "List",
"label": "Awareness Camps",
"link_to": "Awareness Camp Record",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "New",
Expand All @@ -43,6 +50,13 @@
"link_to": "Case",
"type": "DocType"
},
{
"color": "Green",
"doc_view": "List",
"label": "CRC Admissions",
"link_to": "CRC Admissions",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "List",
Expand Down Expand Up @@ -145,13 +159,6 @@
"stats_filter": "{\"name\":[\"is\",\"set\"]}",
"type": "DocType"
},
{
"color": "Green",
"doc_view": "List",
"label": "Awareness Camps",
"link_to": "Awareness Camp Record",
"type": "DocType"
},
{
"color": "Yellow",
"doc_view": "New",
Expand Down