Skip to content

Commit

Permalink
Merge branch 'release/1.0.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Jan 21, 2025
2 parents b3a53c6 + 1c1ae5e commit bfbe657
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 90 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ exclude: tests/etc/user-*

repos:
- repo: https://github.com/PyCQA/bandit
rev: 1.7.10
rev: 1.8.2
hooks:
- id: bandit
args:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from edc_constants.choices import YES_NO_NA
from edc_constants.constants import NOT_APPLICABLE
from edc_model import models as edc_models
Expand All @@ -14,10 +15,13 @@ class ClinicalReviewCholModelMixin(models.Model):
choices=YES_NO_NA,
default=NOT_APPLICABLE,
help_text=format_html(
"Note: Select `not applicable` if diagnosis previously reported. <BR>"
"`Since last seen` includes today.<BR>"
"If `yes', complete the initial review CRF<BR>"
"If `not applicable`, complete the review CRF."
"{}",
mark_safe(
"Note: Select `not applicable` if diagnosis previously reported. <BR>"
"`Since last seen` includes today.<BR>"
"If `yes', complete the initial review CRF<BR>"
"If `not applicable`, complete the review CRF."
), # nosec B308, B703
),
)

Expand All @@ -38,7 +42,7 @@ class ClinicalReviewCholModelMixin(models.Model):

chol_dx = models.CharField(
verbose_name=format_html(
"As of today, was the patient <u>newly</u> diagnosed with high cholesterol?"
"As of today, was the patient <u>{}</u> diagnosed with high cholesterol?", "newly"
),
max_length=15,
choices=YES_NO_NA,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from edc_constants.choices import YES_NO_NA
from edc_constants.constants import NOT_APPLICABLE
from edc_model import models as edc_models
Expand All @@ -14,10 +15,13 @@ class ClinicalReviewDmModelMixin(models.Model):
choices=YES_NO_NA,
default=NOT_APPLICABLE,
help_text=format_html(
"Note: Select `not applicable` if diagnosis previously reported. <BR>"
"`Since last seen` includes today.<BR>"
"If `yes', complete the initial review CRF<BR>"
"If `not applicable`, complete the review CRF."
"{}",
mark_safe(
"Note: Select `not applicable` if diagnosis previously reported. <BR>"
"`Since last seen` includes today.<BR>"
"If `yes', complete the initial review CRF<BR>"
"If `not applicable`, complete the review CRF."
), # nosec B308, B703
),
)

Expand All @@ -38,7 +42,7 @@ class ClinicalReviewDmModelMixin(models.Model):

dm_dx = models.CharField(
verbose_name=format_html(
"As of today, was the patient <u>newly</u> diagnosed with diabetes?"
"As of today, was the patient <u>{}</u> diagnosed with diabetes?", "newly"
),
max_length=15,
choices=YES_NO_NA,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from edc_constants.choices import YES_NO_NA
from edc_constants.constants import NOT_APPLICABLE
from edc_model import models as edc_models
Expand All @@ -14,10 +15,13 @@ class ClinicalReviewHivModelMixin(models.Model):
choices=YES_NO_NA,
default=NOT_APPLICABLE,
help_text=format_html(
"Note: Select `not applicable` if diagnosis previously reported. <BR>"
"`Since last seen` includes today.<BR>"
"If `yes', complete the initial review CRF<BR>"
"If `not applicable`, complete the review CRF."
"{}",
mark_safe(
"Note: Select `not applicable` if diagnosis previously reported. <BR>"
"`Since last seen` includes today.<BR>"
"If `yes', complete the initial review CRF<BR>"
"If `not applicable`, complete the review CRF."
), # nosec B308, B703
),
)

Expand All @@ -38,7 +42,7 @@ class ClinicalReviewHivModelMixin(models.Model):

hiv_dx = models.CharField(
verbose_name=format_html(
"As of today, was the patient <u>newly</u> diagnosed with HIV infection?"
"As of today, was the patient <u>{}</u> diagnosed with HIV infection?", "newly"
),
max_length=15,
choices=YES_NO_NA,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models
from django.utils.html import format_html
from django.utils.safestring import mark_safe
from edc_constants.choices import YES_NO_NA
from edc_constants.constants import NOT_APPLICABLE
from edc_model import models as edc_models
Expand All @@ -14,10 +15,13 @@ class ClinicalReviewHtnModelMixin(models.Model):
choices=YES_NO_NA,
default=NOT_APPLICABLE,
help_text=format_html(
"Note: Select `not applicable` if diagnosis previously reported. <BR>"
"`Since last seen` includes today.<BR>"
"If `yes', complete the initial review CRF<BR>"
"If `not applicable`, complete the review CRF."
"{}",
mark_safe(
"Note: Select `not applicable` if diagnosis previously reported. <BR>"
"`Since last seen` includes today.<BR>"
"If `yes', complete the initial review CRF<BR>"
"If `not applicable`, complete the review CRF."
), # nosec B308, B703
),
)

Expand All @@ -38,7 +42,10 @@ class ClinicalReviewHtnModelMixin(models.Model):

htn_dx = models.CharField(
verbose_name=format_html(
"As of today, was the patient <u>newly</u> diagnosed with hypertension?"
"{}",
mark_safe(
"As of today, was the patient <u>newly</u> diagnosed with hypertension?"
), # nosec B308, B703
),
max_length=15,
choices=YES_NO_NA,
Expand Down
66 changes: 66 additions & 0 deletions edc_dx_review/tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/env python
import sys
from pathlib import Path

from edc_constants.constants import CHOL, DM, HIV, HTN
from edc_test_settings.default_test_settings import DefaultTestSettings

app_name = "edc_dx_review"

base_dir = Path(__file__).absolute().parent.parent.parent

project_settings = DefaultTestSettings(
calling_file=__file__,
BASE_DIR=base_dir,
APP_NAME=app_name,
ETC_DIR=base_dir / app_name / "tests" / "etc",
SUBJECT_SCREENING_MODEL="edc_metadata.subjectscreening",
SUBJECT_CONSENT_MODEL="edc_metadata.subjectconsent",
SUBJECT_VISIT_MODEL="edc_visit_tracking.subjectvisit",
SUBJECT_VISIT_MISSED_MODEL="edc_metadata.subjectvisitmissed",
SUBJECT_REQUISITION_MODEL="edc_metadata.subjectrequisition",
EDC_SITES_REGISTER_DEFAULT=True,
LIST_MODEL_APP_LABEL="edc_dx_review",
EDC_DX_LABELS={
HIV: "HIV",
DM: "Diabetes",
HTN: "Hypertension",
CHOL: "High Cholesterol",
},
INSTALLED_APPS=[
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
"django_crypto_fields.apps.AppConfig",
"django_revision.apps.AppConfig",
"multisite",
"edc_appointment.apps.AppConfig",
"edc_action_item.apps.AppConfig",
"edc_consent.apps.AppConfig",
"edc_device.apps.AppConfig",
"edc_facility.apps.AppConfig",
"edc_lab.apps.AppConfig",
"edc_list_data.apps.AppConfig",
"edc_metadata.apps.AppConfig",
"edc_crf.apps.AppConfig",
"edc_offstudy.apps.AppConfig",
"edc_registration.apps.AppConfig",
"edc_identifier.apps.AppConfig",
"edc_notification.apps.AppConfig",
"edc_sites.apps.AppConfig",
"edc_timepoint.apps.AppConfig",
"edc_visit_schedule.apps.AppConfig",
"edc_visit_tracking.apps.AppConfig",
"edc_dx_review.apps.AppConfig",
],
RANDOMIZATION_LIST_PATH=base_dir / app_name / "tests" / "test_randomization_list.csv",
add_dashboard_middleware=True,
use_test_urls=True,
).settings

for k, v in project_settings.items():
setattr(sys.modules[__name__], k, v)
71 changes: 2 additions & 69 deletions runtests.py
Original file line number Diff line number Diff line change
@@ -1,72 +1,5 @@
#!/usr/bin/env python
import logging
from pathlib import Path

from edc_constants.constants import CHOL, DM, HIV, HTN
from edc_test_utils import DefaultTestSettings, func_main

app_name = "edc_dx_review"

base_dir = Path(__file__).absolute().parent

project_settings = DefaultTestSettings(
calling_file=__file__,
BASE_DIR=base_dir,
APP_NAME=app_name,
ETC_DIR=str(base_dir / app_name / "tests" / "etc"),
SUBJECT_SCREENING_MODEL="edc_metadata.subjectscreening",
SUBJECT_CONSENT_MODEL="edc_metadata.subjectconsent",
SUBJECT_VISIT_MODEL="edc_visit_tracking.subjectvisit",
SUBJECT_VISIT_MISSED_MODEL="edc_metadata.subjectvisitmissed",
SUBJECT_REQUISITION_MODEL="edc_metadata.subjectrequisition",
EDC_SITES_REGISTER_DEFAULT=True,
LIST_MODEL_APP_LABEL="edc_dx_review",
EDC_DX_LABELS={
HIV: "HIV",
DM: "Diabetes",
HTN: "Hypertension",
CHOL: "High Cholesterol",
},
INSTALLED_APPS=[
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"django.contrib.sites",
"django_crypto_fields.apps.AppConfig",
"django_revision.apps.AppConfig",
"multisite",
"edc_appointment.apps.AppConfig",
"edc_action_item.apps.AppConfig",
"edc_consent.apps.AppConfig",
"edc_device.apps.AppConfig",
"edc_facility.apps.AppConfig",
"edc_lab.apps.AppConfig",
"edc_list_data.apps.AppConfig",
"edc_metadata.apps.AppConfig",
"edc_crf.apps.AppConfig",
"edc_offstudy.apps.AppConfig",
"edc_registration.apps.AppConfig",
"edc_identifier.apps.AppConfig",
"edc_notification.apps.AppConfig",
"edc_sites.apps.AppConfig",
"edc_timepoint.apps.AppConfig",
"edc_visit_schedule.apps.AppConfig",
"edc_visit_tracking.apps.AppConfig",
"edc_dx_review.apps.AppConfig",
],
RANDOMIZATION_LIST_PATH=str(base_dir / app_name / "tests" / "test_randomization_list.csv"),
add_dashboard_middleware=True,
use_test_urls=True,
).settings


def main():
func_main(project_settings, f"{app_name}.tests")

from edc_test_settings.func_main import func_main2

if __name__ == "__main__":
logging.basicConfig()
main()
func_main2("edc_dx_review.tests.test_settings", "edc_dx_review.tests")

0 comments on commit bfbe657

Please sign in to comment.