Skip to content

Commit

Permalink
Merge branch 'version-15-hotfix' into mergify/bp/version-15-hotfix/pr…
Browse files Browse the repository at this point in the history
…-535
  • Loading branch information
Sajinsr authored Dec 17, 2024
2 parents 8111be2 + 78444a7 commit 0e82aa8
Show file tree
Hide file tree
Showing 15 changed files with 171 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence.

* @akurungadam @akashkrishna619 @Sajinsr
* @akurungadam @Sajinsr
18 changes: 8 additions & 10 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ body:
Welcome to Marley Health issue tracker! Before creating an issue, please consider the following:
1. This tracker should only be used to report bugs and request features / enhancements to Marley Health
- For questions and general support, checkout the [documentation](https://frappehealth.com/docs) or use the [forum](https://discuss.frappe.io/c/healthcare/58) to get inputs from the open source community.
- For documentation issues, propose edit on the [documentation site](https://frappehealth.com/docs) directly.
2. When making a bug report, make sure you provide all required information. The easier it is for
maintainers to reproduce, the faster it'll be fixed.
- For questions and general support, checkout the [documentation](https://marley.frappe.cloud/docs) or use the [forum](https://discuss.frappe.io/c/healthcare/58) to search for solutions / get inputs from the open source community.
- For documentation issues, propose edit on the [documentation site](https://marley.frappe.cloud/docs) directly.
- You can also post in the Telegram group for Marley Health development work: https://t.me/frappehealth
2. When making a bug report, make sure you provide all required information. The easier it is for maintainers to reproduce, the faster it'll be fixed.
3. If you think you know what the reason for the bug is, share it with us. Maybe put in a PR 😉
- type: textarea
Expand All @@ -34,13 +34,15 @@ body:
options:
- Outpatient Module
- Inpatient ADT
- Laboratory
- Diagnostic Module
- Clinical Procedure
- Rehab & Physiotherapy
- Patient History
- Code Standards
- Setup / Configuration
- Integration with ERPNext modules
- Regional / Other Integrations
- Laboratory (legacy)
validations:
required: true

Expand All @@ -61,10 +63,10 @@ body:
attributes:
label: Installation method
options:
- Frappe Cloud
- docker
- easy-install
- manual install
- FrappeCloud
validations:
required: false

Expand All @@ -80,11 +82,7 @@ body:
attributes:
label: Code of Conduct
description: |
<<<<<<< HEAD
By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/frappe/health/blob/develop/CODE_OF_CONDUCT.md)
=======
By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/earthians/marley/blob/develop/CODE_OF_CONDUCT.md)
>>>>>>> db44419 (chore: fix typo in bug_report.yaml)
options:
- label: I agree to follow this project's Code of Conduct
required: true
Expand Down
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ body:
Welcome to Marley Health issue tracker! Before submitting a request, please consider the following:
1. This tracker should only be used to report bugs and request features / enhancements to Marley Health
- For questions and general support, checkout the [documentation](https://frappehealth.com/docs) or use the [forum](https://discuss.frappe.io/c/healthcare/58) to get inputs from the open source community.
- For questions and general support, checkout the [documentation](https://marley.frappe.cloud/docs) or use the [forum](https://discuss.frappe.io/c/healthcare/58) to get inputs from the open source community.
2. Use the search function before creating a new issue. Duplicates will be closed and directed to
the original discussion.
3. When making a feature request, make sure to be as verbose as possible. The better you convey your message, the greater the drive to make it happen.
Expand All @@ -20,9 +20,9 @@ body:
If you're in urgent need to a feature, please try the following channels to get paid developments done quickly:
1. Certified Frappe partners: https://frappe.io/partners
2. Healthcare Category on Frappe forum: https://discuss.frappe.io/c/healthcare/58
2. Developer community on Frappe forum: https://discuss.frappe.io/c/developers/5
3. Telegram group for Marley Health development work: https://t.me/frappehealth
2. Telegram group for Marley Health development work: https://t.me/frappehealth
3. Healthcare Category on Frappe forum: https://discuss.frappe.io/c/healthcare/58
4. Developer community on Frappe forum: https://discuss.frappe.io/c/developers/5
- type: textarea
id: problem-info
Expand Down
4 changes: 2 additions & 2 deletions .github/helper/documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ def docs_link_exists(body):
for word in line.split():
if word.startswith("http") and uri_validator(word):
parsed_url = urlparse(word)
if parsed_url.netloc == "frappehealth.com" and parsed_url.path.startswith("/docs"):
if parsed_url.netloc == "marley.frappe.cloud" and parsed_url.path.startswith("/wiki"):
return True

if __name__ == "__main__":
pr = sys.argv[1]
response = requests.get("https://api.github.com/repos/frappe/health/pulls/{}".format(pr))
response = requests.get("https://api.github.com/repos/earthians/marley/pulls/{}".format(pr))

if response.ok:
payload = response.json()
Expand Down
119 changes: 98 additions & 21 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,122 @@

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:
Examples of behavior that contributes to a positive environment for our
community include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior by participants include:
Examples of unacceptable behavior include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities
## Enforcement Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@frappe.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
devs@earthianslive.com.
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[FAQ]: https://www.contributor-covenant.org/faq
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ def get_drug_shortage_map(medication_orders, warehouse):

drug_shortage = dict()
for drug, required_qty in drug_requirement.items():
available_qty = get_latest_stock_qty(drug, warehouse)
available_qty = get_latest_stock_qty(drug, warehouse) or 0
if flt(required_qty) > flt(available_qty):
drug_shortage[drug] = flt(flt(required_qty) - flt(available_qty))

Expand Down
8 changes: 2 additions & 6 deletions healthcare/healthcare/doctype/lab_test/test_lab_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ def test_descriptive_lab_test(self):
self.assertRaises(frappe.ValidationError, lab_test.submit)

def test_sample_collection(self):
frappe.db.set_value(
"Healthcare Settings", "Healthcare Settings", "create_sample_collection_for_lab_test", 1
)
frappe.db.set_single_value("Healthcare Settings", "create_sample_collection_for_lab_test", 1)
lab_template = create_lab_test_template()

lab_test = create_lab_test(lab_template)
Expand All @@ -63,9 +61,7 @@ def test_sample_collection(self):
# check sample collection created
self.assertTrue(frappe.db.exists("Sample Collection", {"sample": lab_template.sample}))

frappe.db.set_value(
"Healthcare Settings", "Healthcare Settings", "create_sample_collection_for_lab_test", 0
)
frappe.db.set_single_value("Healthcare Settings", "create_sample_collection_for_lab_test", 0)
lab_test = create_lab_test(lab_template)
lab_test.descriptive_test_items[0].result_value = 12
lab_test.descriptive_test_items[1].result_value = 1
Expand Down
9 changes: 3 additions & 6 deletions healthcare/healthcare/doctype/nursing_task/nursing_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,12 @@

class NursingTask(Document):
def before_insert(self):
# set requested start / end
self.set_task_schedule()

self.title = "{} - {}".format(_(self.patient), _(self.activity))

self.age = frappe.get_doc("Patient", self.patient).get_age()

def validate(self):
if self.status == "Requested":
# auto submit if status is Requested
self.docstatus = 1

def on_submit(self):
Expand All @@ -47,10 +43,11 @@ def on_update_after_submit(self):
self.db_set("task_start_time", now_datetime())

elif self.status == "Completed":
task_end_time = now_datetime()
self.db_set(
{
"task_end_time": now_datetime(),
"task_duration": time_diff_in_seconds(self.task_end_time, self.task_start_time),
"task_end_time": task_end_time,
"task_duration": time_diff_in_seconds(task_end_time, self.task_start_time),
}
)

Expand Down
24 changes: 23 additions & 1 deletion healthcare/healthcare/doctype/nursing_task/test_nursing_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def test_lab_test_submission_should_validate_pending_nursing_tasks(self):
lab_test.descriptive_test_items[2].result_value = 2.3
lab_test.save()

start_nusing_tasks(lab_test)

self.assertRaises(frappe.ValidationError, lab_test.submit)

complete_nusing_tasks(lab_test)
Expand All @@ -70,12 +72,15 @@ def test_start_clinical_procedure_should_validate_pending_nursing_tasks(self):
procedure_template.save()

procedure = create_procedure(procedure_template, self.patient, self.practitioner)
start_nusing_tasks(procedure)

self.assertRaises(frappe.ValidationError, procedure.start_procedure)

complete_nusing_tasks(procedure)
procedure.start_procedure()

def test_admit_inpatient_should_validate_pending_nursing_tasks(self):
def test_admit_discharge_inpatient_should_validate_pending_nursing_tasks(self):
"""nursing tasks on admit and discharge of same ip_record"""
self.settings.allow_discharge_despite_unbilled_services = 1
self.settings.save()

Expand All @@ -86,6 +91,7 @@ def test_admit_inpatient_should_validate_pending_nursing_tasks(self):
NursingTask.create_nursing_tasks_from_template(
ip_record.admission_nursing_checklist_template, ip_record, start_time=now_datetime()
)
start_nusing_tasks(ip_record)

service_unit = get_healthcare_service_unit()
kwargs = {
Expand All @@ -103,6 +109,7 @@ def test_admit_inpatient_should_validate_pending_nursing_tasks(self):
NursingTask.create_nursing_tasks_from_template(
ip_record.admission_nursing_checklist_template, ip_record, start_time=now_datetime()
)
start_nusing_tasks(ip_record)

self.assertRaises(frappe.ValidationError, discharge_patient, inpatient_record=ip_record)

Expand All @@ -116,13 +123,28 @@ def test_submit_therapy_session_should_validate_pending_nursing_tasks(self):

therapy_plan = create_therapy_plan()
therapy_session = create_therapy_session(self.patient, therapy_type.name, therapy_plan.name)
start_nusing_tasks(therapy_session)

self.assertRaises(frappe.ValidationError, therapy_session.submit)

complete_nusing_tasks(therapy_session)
therapy_session.submit()


def start_nusing_tasks(document):
filters = {
"reference_name": document.name,
"mandatory": 1,
"status": ["not in", ["Completed", "Cancelled"]],
}
tasks = frappe.get_all("Nursing Task", filters=filters)
for task_name in tasks:
task = frappe.get_doc("Nursing Task", task_name)
task.submit()
task.status = "In Progress" # should set task_start_time
task.save()


def complete_nusing_tasks(document):
filters = {
"reference_name": document.name,
Expand Down
1 change: 1 addition & 0 deletions healthcare/healthcare/doctype/patient/patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ def make_invoice(patient, company):
uom = frappe.db.exists("UOM", "Nos") or frappe.db.get_single_value("Stock Settings", "stock_uom")
sales_invoice = frappe.new_doc("Sales Invoice")
sales_invoice.customer = frappe.db.get_value("Patient", patient, "customer")
sales_invoice.patient = patient
sales_invoice.due_date = getdate()
sales_invoice.company = company
sales_invoice.is_pos = 0
Expand Down
2 changes: 1 addition & 1 deletion healthcare/healthcare/doctype/patient/test_patient.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
class TestPatient(FrappeTestCase):
def test_customer_created(self):
frappe.db.sql("""delete from `tabPatient`""")
frappe.db.set_value("Healthcare Settings", None, "link_customer_to_patient", 1)
frappe.db.set_single_value("Healthcare Settings", "link_customer_to_patient", 1)
patient = create_patient()
self.assertTrue(frappe.db.get_value("Patient", patient, "customer"))

Expand Down
Loading

0 comments on commit 0e82aa8

Please sign in to comment.