diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8711a35..b4e9d94 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- - image: circleci/python:2.7.15-jessie-browsers
+ - image: circleci/python:3.6.8-stretch-browsers
steps:
- checkout
- run: mkdir test-reports
diff --git a/api/test.py b/api/test.py
index 2c989be..86d8a1a 100644
--- a/api/test.py
+++ b/api/test.py
@@ -18,14 +18,15 @@ class APITest(APITestCase):
def setUp(self):
workupModels.ClinicType.objects.create(name="Basic Care Clinic")
workupModels.ClinicDate.objects.create(
- clinic_type=workupModels.ClinicType.objects.all()[0],
+ clinic_type=workupModels.ClinicType.objects.first(),
clinic_date=now().date() + datetime.timedelta(days=1))
workupModels.ClinicDate.objects.create(
- clinic_type=workupModels.ClinicType.objects.all()[0],
+ clinic_type=workupModels.ClinicType.objects.first(),
clinic_date=now().date() - datetime.timedelta(days=1))
workupModels.ClinicDate.objects.create(
- clinic_type=workupModels.ClinicType.objects.all()[0],
+ clinic_type=workupModels.ClinicType.objects.first(),
clinic_date=now().date() - datetime.timedelta(days=5))
+
log_in_provider(self.client, build_provider(["Attending"]))
pt1 = models.Patient.objects.get(pk=1)
@@ -41,9 +42,9 @@ def setUp(self):
state='BA',
zip_code='63108',
pcp_preferred_zip='63018',
- date_of_birth=datetime.date(1990, 01, 01),
+ date_of_birth=datetime.date(1990, 1, 1),
patient_comfortable_with_english=False,
- preferred_contact_method=models.ContactMethod.objects.all()[0],
+ preferred_contact_method=models.ContactMethod.objects.first(),
)
pt3 = models.Patient.objects.create(
@@ -51,15 +52,15 @@ def setUp(self):
last_name="Lkjh",
middle_name="Bayer",
phone='+49 178 236 5288',
- gender=models.Gender.objects.all()[0],
+ gender=models.Gender.objects.first(),
address='Schulstrasse 9',
city='Munich',
state='BA',
zip_code='63108',
pcp_preferred_zip='63018',
- date_of_birth=datetime.date(1990, 01, 01),
+ date_of_birth=datetime.date(1990, 1, 1),
patient_comfortable_with_english=False,
- preferred_contact_method=models.ContactMethod.objects.all()[0],
+ preferred_contact_method=models.ContactMethod.objects.first(),
)
pt4 = models.Patient.objects.create(
@@ -67,26 +68,26 @@ def setUp(self):
last_name="Action",
middle_name="Item",
phone='+12 345 678 9000',
- gender=models.Gender.objects.all()[0],
+ gender=models.Gender.objects.first(),
address='Schulstrasse 9',
city='Munich',
state='BA',
zip_code='63108',
pcp_preferred_zip='63018',
- date_of_birth=datetime.date(1990, 01, 01),
+ date_of_birth=datetime.date(1990, 1, 1),
patient_comfortable_with_english=False,
- preferred_contact_method=models.ContactMethod.objects.all()[0],
+ preferred_contact_method=models.ContactMethod.objects.first(),
)
# Give pt2 a workup one day later.
workupModels.Workup.objects.create(
- clinic_day=workupModels.ClinicDate.objects.all()[0], # one day later
+ clinic_day=workupModels.ClinicDate.objects.first(), # one day later
chief_complaint="SOB",
diagnosis="MI",
HPI="", PMH_PSH="", meds="", allergies="", fam_hx="", soc_hx="",
ros="", pe="", A_and_P="",
- author=models.Provider.objects.all()[0],
- author_type=models.ProviderType.objects.all()[0],
+ author=models.Provider.objects.first(),
+ author_type=models.ProviderType.objects.first(),
patient=pt2)
# Give pt3 a workup one day ago.
@@ -96,8 +97,8 @@ def setUp(self):
diagnosis="MI",
HPI="", PMH_PSH="", meds="", allergies="", fam_hx="", soc_hx="",
ros="", pe="", A_and_P="",
- author=models.Provider.objects.all()[0],
- author_type=models.ProviderType.objects.all()[0],
+ author=models.Provider.objects.first(),
+ author_type=models.ProviderType.objects.first(),
patient=pt3)
@@ -108,8 +109,8 @@ def setUp(self):
diagnosis="MI",
HPI="", PMH_PSH="", meds="", allergies="", fam_hx="", soc_hx="",
ros="", pe="", A_and_P="",
- author=models.Provider.objects.all()[0],
- author_type=models.ProviderType.objects.all()[0],
+ author=models.Provider.objects.first(),
+ author_type=models.ProviderType.objects.first(),
patient=pt1,
signer=models.Provider.objects.all().filter(
clinical_roles=models.ProviderType.objects.all().filter(
@@ -117,9 +118,9 @@ def setUp(self):
# make pt1 have and AI due tomorrow
pt1_ai = models.ActionItem.objects.create(
- author=models.Provider.objects.all()[0],
- author_type=models.ProviderType.objects.all()[0],
- instruction=models.ActionInstruction.objects.all()[0],
+ author=models.Provider.objects.first(),
+ author_type=models.ProviderType.objects.first(),
+ instruction=models.ActionInstruction.objects.first(),
due_date=now().date()+datetime.timedelta(days=1),
comments="",
priority=True,
@@ -127,9 +128,9 @@ def setUp(self):
# make pt2 have an AI due yesterday
pt2_ai = models.ActionItem.objects.create(
- author=models.Provider.objects.all()[0],
- author_type=models.ProviderType.objects.all()[0],
- instruction=models.ActionInstruction.objects.all()[0],
+ author=models.Provider.objects.first(),
+ author_type=models.ProviderType.objects.first(),
+ instruction=models.ActionInstruction.objects.first(),
due_date=now().date()-datetime.timedelta(days=1),
comments="",
priority=True,
@@ -137,9 +138,9 @@ def setUp(self):
# make pt3 have an AI that during the test will be marked done
pt3_ai = models.ActionItem.objects.create(
- author=models.Provider.objects.all()[0],
- author_type=models.ProviderType.objects.all()[0],
- instruction=models.ActionInstruction.objects.all()[0],
+ author=models.Provider.objects.first(),
+ author_type=models.ProviderType.objects.first(),
+ instruction=models.ActionInstruction.objects.first(),
due_date=now().date()-datetime.timedelta(days=15),
comments="",
patient=pt3)
@@ -149,16 +150,19 @@ def test_api_list_patients_by_last_name(self):
url = reverse("pt_list_api") # Way to have this here and not repeat this line? Reverse is called in every test now
# Test last_name ordering
- data = {'sort':'last_name'}
+ data = {'sort': 'last_name'}
response = self.client.get(reverse("pt_list_api"), data, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
- self.assertLessEqual(response.data[0]['last_name'],response.data[1]['last_name'])
- self.assertLessEqual(response.data[1]['last_name'],response.data[2]['last_name'])
- self.assertLessEqual(response.data[2]['last_name'],response.data[3]['last_name'])
+ self.assertLessEqual(response.data[0]['last_name'],
+ response.data[1]['last_name'])
+ self.assertLessEqual(response.data[1]['last_name'],
+ response.data[2]['last_name'])
+ self.assertLessEqual(response.data[2]['last_name'],
+ response.data[3]['last_name'])
def test_api_list_patients_by_latest_activity(self):
# Test workup/intake ordering.
- data = {'sort':'latest_workup'}
+ data = {'sort': 'latest_workup'}
response = self.client.get(reverse("pt_list_api"), data, format='json')
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertNotEqual(response.data[0]['latest_workup'], None) # pt2, workup date now()+1day
@@ -167,9 +171,15 @@ def test_api_list_patients_by_latest_activity(self):
self.assertNotEqual(response.data[3]['latest_workup'], None) # pt1, workup date now()-5days
# Check that dates are correcly sorted
- self.assertGreaterEqual(response.data[0]['latest_workup']['clinic_day']['clinic_date'],response.data[1]['history']['last']['history_date'])
- self.assertGreaterEqual(response.data[1]['history']['last']['history_date'],response.data[2]['latest_workup']['clinic_day']['clinic_date'])
- self.assertGreaterEqual(response.data[2]['latest_workup']['clinic_day']['clinic_date'],response.data[3]['latest_workup']['clinic_day']['clinic_date'])
+ self.assertGreaterEqual(
+ response.data[0]['latest_workup']['clinic_day']['clinic_date'],
+ response.data[1]['history']['last']['history_date'])
+ self.assertGreaterEqual(
+ response.data[1]['history']['last']['history_date'],
+ response.data[2]['latest_workup']['clinic_day']['clinic_date'])
+ self.assertGreaterEqual(
+ response.data[2]['latest_workup']['clinic_day']['clinic_date'],
+ response.data[3]['latest_workup']['clinic_day']['clinic_date'])
def test_api_list_patients_with_unsigned_workup(self):
# Test for unsigned_workup
@@ -225,7 +235,7 @@ def test_api_list_patients_with_inactive_action_item(self):
self.assertEqual(len(response.data), 1)
self.assertEqual(response.data[0]['id'], pt1.id)
- pt3_ai.mark_done(models.Provider.objects.all()[0])
+ pt3_ai.mark_done(models.Provider.objects.first())
pt3_ai.save()
# Test now only has pt2
diff --git a/appointment/models.py b/appointment/models.py
index 9c55cca..6c89d40 100644
--- a/appointment/models.py
+++ b/appointment/models.py
@@ -47,7 +47,7 @@ class Meta:
history = HistoricalRecords()
- def __unicode__(self):
+ def __str__(self):
return "Appointment ({type}) for {name} on {date}".format(
type=self.verbose_appointment_type(),
name=self.patient.name(),
diff --git a/appointment/templates/appointment/appointment_list.html b/appointment/templates/appointment/appointment_list.html
index f81c749..a6da3b9 100644
--- a/appointment/templates/appointment/appointment_list.html
+++ b/appointment/templates/appointment/appointment_list.html
@@ -15,7 +15,7 @@
Appointment List
{% block content %}
- {% for date, app_list in appointments_by_date.iteritems %}
+ {% for date, app_list in appointments_by_date.items %}
«
'''),
- dewhitespace(response.content))
+ dewhitespace(response.content.decode('ascii')))
# since there's only one page, the "forward" pagination button
# should be disabled
self.assertIn(
@@ -167,7 +167,7 @@ def test_dashboard_pagination(self):
»
'''),
- dewhitespace(response.content))
+ dewhitespace(response.content.decode('ascii')))
# since there's only one page, only one page marker should be shown
self.assertContains(
@@ -206,7 +206,7 @@ def test_dashboard_pagination(self):
«
'''),
- dewhitespace(response.content))
+ dewhitespace(response.content.decode('ascii')))
# since there's only one page, the "forward" pagination button
# should be disabled
self.assertIn(
@@ -214,7 +214,7 @@ def test_dashboard_pagination(self):
»
'''),
- dewhitespace(response.content))
+ dewhitespace(response.content.decode('ascii')))
@override_settings(OSLER_CLINIC_DAYS_PER_PAGE=3)
def test_dashboard_page_out_of_range(self):
@@ -253,7 +253,7 @@ def test_dashboard_page_out_of_range(self):
«
''' % n_pages),
- dewhitespace(response.content))
+ dewhitespace(response.content.decode('ascii')))
# since there's only one page, the "forward" pagination button
# should be disabled
self.assertIn(
@@ -261,4 +261,4 @@ def test_dashboard_page_out_of_range(self):
»
'''),
- dewhitespace(response.content))
+ dewhitespace(response.content.decode('ascii')))
diff --git a/demographics/migrations/0001_squashed_0003_auto_20170623_1048.py b/demographics/migrations/0001_squashed_0003_auto_20170623_1048.py
index 360ba78..9647b14 100644
--- a/demographics/migrations/0001_squashed_0003_auto_20170623_1048.py
+++ b/demographics/migrations/0001_squashed_0003_auto_20170623_1048.py
@@ -6,7 +6,9 @@
class Migration(migrations.Migration):
- replaces = [(b'demographics', '0001_initial'), (b'demographics', '0002_auto_20160328_1425'), (b'demographics', '0003_auto_20170623_1048')]
+ replaces = [('demographics', '0001_initial'),
+ ('demographics', '0002_auto_20160328_1425'),
+ ('demographics', '0003_auto_20170623_1048')]
dependencies = [
('pttrack', '0001_squashed_0010_auto_20170623_1300'),
@@ -70,7 +72,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='demographics',
name='chronic_condition',
- field=models.ManyToManyField(to=b'demographics.ChronicCondition', blank=True),
+ field=models.ManyToManyField(to='demographics.ChronicCondition', blank=True),
),
migrations.AddField(
model_name='demographics',
@@ -85,7 +87,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='demographics',
name='resource_access',
- field=models.ManyToManyField(to=b'demographics.ResourceAccess', verbose_name=b'Access to Resources', blank=True),
+ field=models.ManyToManyField(to='demographics.ResourceAccess', verbose_name=b'Access to Resources', blank=True),
),
migrations.AddField(
model_name='demographics',
diff --git a/demographics/models.py b/demographics/models.py
index 57a81d9..6c636c7 100644
--- a/demographics/models.py
+++ b/demographics/models.py
@@ -9,14 +9,14 @@
class IncomeRange(models.Model):
name = models.CharField(max_length=50, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
class EducationLevel(models.Model):
name = models.CharField(max_length=50, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -27,7 +27,7 @@ class Meta:
name = models.CharField(max_length=50, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -38,21 +38,21 @@ class Meta:
name = models.CharField(max_length=50, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
class ChronicCondition(models.Model):
name = models.CharField(max_length=50, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
class TransportationOption(models.Model):
name = models.CharField(max_length=50, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
diff --git a/demographics/urls.py b/demographics/urls.py
index 45a67ef..5e9d90a 100644
--- a/demographics/urls.py
+++ b/demographics/urls.py
@@ -18,4 +18,4 @@
]
wrap_config = {}
-urlpatterns = [wrap_url(url, **wrap_config) for url in unwrapped_urlconf]
\ No newline at end of file
+urlpatterns = [wrap_url(url, **wrap_config) for url in unwrapped_urlconf]
diff --git a/followup/models.py b/followup/models.py
index f08d538..82ee7b3 100644
--- a/followup/models.py
+++ b/followup/models.py
@@ -12,7 +12,7 @@ class NoShowReason(models.Model):
name = models.CharField(max_length=100, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -22,7 +22,7 @@ class NoAptReason(models.Model):
name = models.CharField(max_length=100, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -38,7 +38,7 @@ class ContactResult(models.Model):
default=True,
help_text="True if outcome means they reached the patient")
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -83,7 +83,7 @@ def written_date(self):
'''Returns a python date object for when this followup was written.'''
return self.written_datetime.date()
- def __unicode__(self):
+ def __str__(self):
return " ".join(["Followup for ", self.patient.name(), " on ",
str(self.written_date())])
diff --git a/followup/tests.py b/followup/tests.py
index 80c53d4..d2710ac 100644
--- a/followup/tests.py
+++ b/followup/tests.py
@@ -208,7 +208,7 @@ def setUp(self):
state='BA',
zip_code='63108',
pcp_preferred_zip='63018',
- date_of_birth=datetime.date(1990, 01, 01),
+ date_of_birth=datetime.date(1990, 1, 1),
patient_comfortable_with_english=False,
preferred_contact_method=self.contact_method,
)
diff --git a/followup/urls.py b/followup/urls.py
index 7cbf373..334d6ba 100644
--- a/followup/urls.py
+++ b/followup/urls.py
@@ -32,4 +32,4 @@
]
wrap_config = {}
-urlpatterns = [wrap_url(url, **wrap_config) for url in unwrapped_urlconf]
\ No newline at end of file
+urlpatterns = [wrap_url(url, **wrap_config) for url in unwrapped_urlconf]
diff --git a/pttrack/migrations/0001_squashed_0010_auto_20170623_1300.py b/pttrack/migrations/0001_squashed_0010_auto_20170623_1300.py
index 9ab3456..6e46d5e 100644
--- a/pttrack/migrations/0001_squashed_0010_auto_20170623_1300.py
+++ b/pttrack/migrations/0001_squashed_0010_auto_20170623_1300.py
@@ -10,7 +10,16 @@
class Migration(migrations.Migration):
- replaces = [(b'pttrack', '0001_initial'), (b'pttrack', '0002_providertype_is_staff'), (b'pttrack', '0003_auto_20160119_1459'), (b'pttrack', '0004_auto_20160328_1425'), (b'pttrack', '0005_auto_20160628_1852'), (b'pttrack', '0006_rm_ssn'), (b'pttrack', '0007_needs_workup_default_true'), (b'pttrack', '0008_add_case_manager'), (b'pttrack', '0009_auto_20170502_1103'), (b'pttrack', '0010_auto_20170623_1300')]
+ replaces = [('pttrack', '0001_initial'),
+ ('pttrack', '0002_providertype_is_staff'),
+ ('pttrack', '0003_auto_20160119_1459'),
+ ('pttrack', '0004_auto_20160328_1425'),
+ ('pttrack', '0005_auto_20160628_1852'),
+ ('pttrack', '0006_rm_ssn'),
+ ('pttrack', '0007_needs_workup_default_true'),
+ ('pttrack', '0008_add_case_manager'),
+ ('pttrack', '0009_auto_20170502_1103'),
+ ('pttrack', '0010_auto_20170623_1300')]
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
@@ -206,9 +215,9 @@ class Migration(migrations.Migration):
('alternate_phone_4_owner', models.CharField(max_length=40, null=True, blank=True)),
('alternate_phone_4', models.CharField(max_length=40, null=True, blank=True)),
('needs_workup', models.BooleanField(default=True)),
- ('ethnicities', models.ManyToManyField(to=b'pttrack.Ethnicity')),
+ ('ethnicities', models.ManyToManyField(to='pttrack.Ethnicity')),
('gender', models.ForeignKey(to='pttrack.Gender')),
- ('languages', models.ManyToManyField(help_text=b'Specify here languages that are spoken at a level sufficient to be used for medical communication.', to=b'pttrack.Language')),
+ ('languages', models.ManyToManyField(help_text=b'Specify here languages that are spoken at a level sufficient to be used for medical communication.', to='pttrack.Language')),
('preferred_contact_method', models.ForeignKey(blank=True, to='pttrack.ContactMethod', null=True)),
('email', models.EmailField(max_length=254, null=True, blank=True)),
],
@@ -256,7 +265,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='provider',
name='clinical_roles',
- field=models.ManyToManyField(to=b'pttrack.ProviderType'),
+ field=models.ManyToManyField(to='pttrack.ProviderType'),
),
migrations.AddField(
model_name='provider',
@@ -266,7 +275,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='provider',
name='languages',
- field=models.ManyToManyField(help_text=b'Specify here languages that are spoken at a level sufficient to be used for medical communication.', to=b'pttrack.Language'),
+ field=models.ManyToManyField(help_text=b'Specify here languages that are spoken at a level sufficient to be used for medical communication.', to='pttrack.Language'),
),
migrations.AddField(
model_name='historicaldocument',
diff --git a/pttrack/models.py b/pttrack/models.py
index 2519188..9107f39 100644
--- a/pttrack/models.py
+++ b/pttrack/models.py
@@ -15,27 +15,23 @@
# pylint: disable=I0011,missing-docstring,E1305
-def make_filepath(instance, filename):
- '''
- Produces a unique file path for the upload_to of a FileField. This is
- important because any URL is 1) transmitted unencrypted and 2)
- automatically referred to any libraries we include (i.e. Bootstrap,
- AngularJS).
- The produced path is of the form:
- "[model name]/[field name]/[random name].[filename extension]".
+def make_filepath(instance, filename):
+ """Produces a unique file path for the upload_to of a FileField. This is
+ important because any URL is 1) transmitted unencrypted and 2)
+ automatically referred to any libraries we include (i.e. Bootstrap,
+ AngularJS).
- Copypasta from https://djangosnippets.org/snippets/2819/
- '''
+ The produced path is of the form:
+ "[model name]/[field name]/[random name].[filename extension]".
+ Copypasta from https://djangosnippets.org/snippets/2819/
+ """
- field_name = 'image'
carry_on = True
while carry_on:
new_filename = "%s.%s" % (User.objects.make_random_password(48),
filename.split('.')[-1])
- #path = '/'.join([instance.__class__.__name__.lower(),field_name, new_filename])
-
path = new_filename
# if the file already exists, try again to generate a new filename
@@ -50,7 +46,7 @@ class ContactMethod(models.Model):
name = models.CharField(max_length=50, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -61,7 +57,7 @@ class ReferralType(models.Model):
is_fqhc = models.BooleanField(default=False)
is_active = models.BooleanField(default=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
def slugify(self):
@@ -75,7 +71,7 @@ class ReferralLocation(models.Model):
address = models.TextField()
care_availiable = models.ManyToManyField(ReferralType)
- def __unicode__(self):
+ def __str__(self):
if self.address:
return self.name + " (" + self.address.splitlines()[0] + ")"
else:
@@ -85,7 +81,7 @@ def __unicode__(self):
class Language(models.Model):
name = models.CharField(max_length=50, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -96,7 +92,7 @@ class Meta:
name = models.CharField(max_length=50, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -104,7 +100,7 @@ class ActionInstruction(models.Model):
instruction = models.CharField(max_length=50, primary_key=True)
active = models.BooleanField(default=True)
- def __unicode__(self):
+ def __str__(self):
return self.instruction
@@ -114,7 +110,7 @@ class ProviderType(models.Model):
signs_charts = models.BooleanField(default=False)
staff_view = models.BooleanField(default=False)
- def __unicode__(self):
+ def __str__(self):
return self.short_name
@@ -122,13 +118,13 @@ class Gender(models.Model):
long_name = models.CharField(max_length=30, primary_key=True)
short_name = models.CharField(max_length=1)
- def __unicode__(self):
+ def __str__(self):
return self.long_name
class Outcome(models.Model):
name = models.CharField(max_length=50, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -184,7 +180,7 @@ class Provider(Person):
def username(self):
return self.associated_user.username
- def __unicode__(self):
+ def __str__(self):
return self.name()
@@ -205,13 +201,13 @@ class Patient(Person):
country = models.CharField(max_length=100,
default="USA")
-
pcp_preferred_zip = models.CharField(max_length=5,
validators=[validators.validate_zip],
blank=True,
null=True)
- date_of_birth = models.DateField(help_text='MM/DD/YYYY',
+ date_of_birth = models.DateField(
+ help_text='MM/DD/YYYY',
validators=[validators.validate_birth_date])
patient_comfortable_with_english = models.BooleanField(default=True)
@@ -248,9 +244,9 @@ class Patient(Person):
history = HistoricalRecords()
def age(self):
- return (now().date() - self.date_of_birth).days//365
+ return (now().date() - self.date_of_birth).days // 365
- def __unicode__(self):
+ def __str__(self):
return self.name()
def active_action_items(self):
@@ -261,7 +257,7 @@ def active_action_items(self):
ActionItem.objects.filter(patient=self.pk)\
.filter(completion_author=None)\
.filter(due_date__lte=now().date()),
- key=lambda(ai): ai.due_date)
+ key=lambda ai: ai.due_date)
def done_action_items(self):
'''return the set of action items that are done, sorted
@@ -270,7 +266,7 @@ def done_action_items(self):
return sorted(
ActionItem.objects.filter(patient=self.pk)\
.exclude(completion_author=None),
- key=lambda(ai): ai.completion_date)
+ key=lambda ai: ai.completion_date)
def inactive_action_items(self):
'''return a list of action items that aren't done, but aren't
@@ -280,7 +276,7 @@ def inactive_action_items(self):
ActionItem.objects.filter(patient=self.pk)\
.filter(completion_author=None)\
.filter(due_date__gt=now().date()),
- key=lambda(ai): ai.due_date)
+ key=lambda ai: ai.due_date)
def status(self):
# The active_action_items, done_action_items, and inactive_action_items
@@ -341,7 +337,7 @@ def notes(self):
note_list.extend(self.followup_set())
note_list.extend(self.document_set.all())
- return sorted(note_list, key=lambda(k): k.written_datetime)
+ return sorted(note_list, key=lambda k: k.written_datetime)
def all_phones(self):
'''Returns a list of tuples of the form (phone, owner) of all the
@@ -396,7 +392,7 @@ class Meta:
class DocumentType(models.Model):
name = models.CharField(max_length=50, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -528,6 +524,6 @@ def admin_url(self):
return reverse('admin:pttrack_actionitem_change',
args=(self.id,))
- def __unicode__(self):
- return " ".join(["AI for", str(self.patient)+":",
+ def __str__(self):
+ return " ".join(["AI for", str(self.patient) + ":",
str(self.instruction), "due on", str(self.due_date)])
diff --git a/pttrack/test.py b/pttrack/test.py
index b76bcc7..43438cb 100644
--- a/pttrack/test.py
+++ b/pttrack/test.py
@@ -1,6 +1,6 @@
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
-from selenium.webdriver.chrome.webdriver import WebDriver
+from selenium.webdriver.chrome import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
@@ -13,7 +13,12 @@ class SeleniumLiveTestCase(StaticLiveServerTestCase):
@classmethod
def setUpClass(cls):
super(SeleniumLiveTestCase, cls).setUpClass()
- cls.selenium = WebDriver()
+
+ opt = webdriver.ChromeOptions()
+ opt.add_experimental_option('w3c', False)
+ cls.selenium = webdriver.Chrome(chrome_options=opt)
+
+ # cls.selenium = WebDriver()
cls.selenium.implicitly_wait(cls.DEFAULT_WAIT_TIME)
cls.selenium.set_page_load_timeout(cls.DEFAULT_WAIT_TIME)
diff --git a/pttrack/test_forms.py b/pttrack/test_forms.py
index 355e7ee..c210a6d 100644
--- a/pttrack/test_forms.py
+++ b/pttrack/test_forms.py
@@ -69,7 +69,7 @@ def setUp(self):
'country': 'Germany',
'zip_code': '63108',
'pcp_preferred_zip': '63018',
- 'date_of_birth': datetime.date(1990, 01, 01),
+ 'date_of_birth': datetime.date(1990, 1, 1),
'patient_comfortable_with_english': False,
'ethnicities': [Ethnicity.objects.create(name="Klingon")],
'preferred_contact_method':
diff --git a/pttrack/test_utils.py b/pttrack/test_utils.py
index 07332b5..9c83dd1 100644
--- a/pttrack/test_utils.py
+++ b/pttrack/test_utils.py
@@ -83,7 +83,7 @@ def create_pts():
'zip_code': '63108',
'gender': models.Gender(long_name="Male", short_name="m"),
'pcp_preferred_zip': '63018',
- 'date_of_birth': datetime.date(1990, 01, 01),
+ 'date_of_birth': datetime.date(1990, 1, 1),
'patient_comfortable_with_english': False,
'preferred_contact_method': models.ContactMethod.objects.first(),
}
diff --git a/pttrack/test_validators.py b/pttrack/test_validators.py
index c7aa7a2..8d9a56e 100644
--- a/pttrack/test_validators.py
+++ b/pttrack/test_validators.py
@@ -66,4 +66,4 @@ def test_validate_name(self):
with self.assertRaises(ValidationError):
validators.validate_name(" Name ") # tab then space
with self.assertRaises(ValidationError):
- validators.validate_name(" Name ") # space then tab
\ No newline at end of file
+ validators.validate_name(" Name ") # space then tab
diff --git a/pttrack/test_views.py b/pttrack/test_views.py
index 866205b..2652ba1 100644
--- a/pttrack/test_views.py
+++ b/pttrack/test_views.py
@@ -1,5 +1,3 @@
-from __future__ import print_function, division
-
import datetime
import json
@@ -407,7 +405,7 @@ def setUp(self):
'state': 'BA',
'zip_code': '63108',
'pcp_preferred_zip': '63018',
- 'date_of_birth': datetime.date(1990, 01, 01),
+ 'date_of_birth': datetime.date(1990, 1, 1),
'patient_comfortable_with_english': False,
'preferred_contact_method': models.ContactMethod.objects.first(),
}
@@ -755,7 +753,7 @@ def test_document_urls(self):
title="who done it?",
comments="Pictured: silliness",
document_type=dtype,
- image=File(open(self.test_img)),
+ image=File(file=open(self.test_img, 'rb')),
patient=models.Patient.objects.get(id=1),
author=models.Provider.objects.get(id=1),
author_type=models.ProviderType.objects.first())
@@ -767,8 +765,8 @@ def test_document_urls(self):
self.assertEqual(doc.image.path, p)
self.assertTrue(os.path.isfile(p))
- # Checking to make sure the path is 48 characters (the length of the random password
-
+ # Checking to make sure the path is 48 characters (the length of
+ # the random password
self.assertEqual(len(random_name), 48)
url = reverse('document-detail', args=(1,))
@@ -778,10 +776,10 @@ def test_document_urls(self):
# test the creation of many documents, just in case.
for i in range(101):
doc = models.Document.objects.create(
- title="who done it? "+str(i),
+ title="who done it? %s" % i,
comments="Pictured: silliness",
document_type=dtype,
- image=File(open(self.test_img)),
+ image=File(open(self.test_img, 'rb')),
patient=models.Patient.objects.get(id=1),
author=models.Provider.objects.get(id=1),
author_type=models.ProviderType.objects.first())
@@ -793,7 +791,8 @@ def test_document_urls(self):
self.assertEqual(doc.image.path, p)
self.assertTrue(os.path.isfile(p))
- # Checking to make sure the path is 48 characters (the length of the random password
+ # Checking to make sure the path is 48 characters (the length
+ # of the random password
self.assertEqual(len(random_name), 48)
@@ -941,7 +940,7 @@ def setUp(self):
'country': 'Germany',
'zip_code': '63108',
'pcp_preferred_zip': '63018',
- 'date_of_birth': datetime.date(1990, 01, 01),
+ 'date_of_birth': datetime.date(1990, 1, 1),
'patient_comfortable_with_english': False,
'ethnicities': [models.Ethnicity.objects.first()],
'preferred_contact_method':
@@ -1217,7 +1216,7 @@ def setUp(self):
state='BA',
zip_code='63108',
pcp_preferred_zip='63018',
- date_of_birth=datetime.date(1990, 01, 01),
+ date_of_birth=datetime.date(1990, 1, 1),
patient_comfortable_with_english=False,
preferred_contact_method=self.contact_method,
)
@@ -1379,9 +1378,6 @@ def test_patient_detail(self):
response = self.client.get(url)
self.assertEqual(response.status_code, 200)
- with open('tmp.html', 'w') as f:
- f.write(response.content)
-
expected_status = "Action items 1, 0, 0 days past due"
self.assertContains(response, expected_status)
diff --git a/referral/forms.py b/referral/forms.py
index ef95ed1..75db133 100644
--- a/referral/forms.py
+++ b/referral/forms.py
@@ -167,7 +167,7 @@ def clean(self):
"pt_showed": "patient showed",
"has_appointment": "has appointment"}
- for param, param_verbose in detail_params.iteritems():
+ for param, param_verbose in detail_params.items():
if cleaned_data.get(param):
self.add_error(
param,
diff --git a/referral/models.py b/referral/models.py
index 92fd4bf..eb122f8 100644
--- a/referral/models.py
+++ b/referral/models.py
@@ -33,7 +33,7 @@ class Referral(Note):
help_text="The kind of care the patient should recieve at the "
"referral location.")
- def __unicode__(self):
+ def __str__(self):
"""Provides string to display on front end for referral.
For FQHC referrals, returns referral kind and date.
@@ -96,7 +96,7 @@ def admin_url(self):
args=(self.id,)
)
- def __unicode__(self):
+ def __str__(self):
formatted_date = self.due_date.strftime("%D")
return 'Followup with %s on %s about %s' % (self.patient,
formatted_date,
diff --git a/referral/tests.py b/referral/tests.py
index cf28a80..1fc054b 100644
--- a/referral/tests.py
+++ b/referral/tests.py
@@ -42,7 +42,7 @@ def setUp(self):
state='BA',
zip_code='63108',
pcp_preferred_zip='63018',
- date_of_birth=datetime.date(1990, 01, 01),
+ date_of_birth=datetime.date(1990, 1, 1),
patient_comfortable_with_english=False,
preferred_contact_method=self.contact_method,
)
@@ -66,7 +66,7 @@ def setUp(self):
self.followup_request = models.FollowupRequest.objects.create(
referral=self.referral,
contact_instructions="Call him",
- due_date=datetime.date(2018, 9, 01),
+ due_date=datetime.date(2018, 9, 1),
author=Provider.objects.first(),
author_type=ProviderType.objects.first(),
patient=self.pt
@@ -333,7 +333,7 @@ def setUp(self):
state='BA',
zip_code='63108',
pcp_preferred_zip='63018',
- date_of_birth=datetime.date(1990, 01, 01),
+ date_of_birth=datetime.date(1990, 1, 1),
patient_comfortable_with_english=False,
preferred_contact_method=self.contact_method,
)
@@ -396,7 +396,7 @@ def setUp(self):
state='BA',
zip_code='63108',
pcp_preferred_zip='63018',
- date_of_birth=datetime.date(1990, 01, 01),
+ date_of_birth=datetime.date(1990, 1, 1),
patient_comfortable_with_english=False,
preferred_contact_method=self.contact_method,
)
@@ -494,7 +494,7 @@ def setUp(self):
state='BA',
zip_code='63108',
pcp_preferred_zip='63018',
- date_of_birth=datetime.date(1990, 01, 01),
+ date_of_birth=datetime.date(1990, 1, 1),
patient_comfortable_with_english=False,
preferred_contact_method=self.contact_method,
)
@@ -524,7 +524,7 @@ def test_referral_list(self):
models.FollowupRequest.objects.create(
referral=referral1,
contact_instructions="Call him",
- due_date=datetime.date(2018, 11, 01),
+ due_date=datetime.date(2018, 11, 1),
author=Provider.objects.first(),
author_type=ProviderType.objects.first(),
patient=self.pt
@@ -558,7 +558,7 @@ def test_referral_list(self):
state='BA',
zip_code='63108',
pcp_preferred_zip='63018',
- date_of_birth=datetime.date(1994, 01, 22),
+ date_of_birth=datetime.date(1994, 1, 22),
patient_comfortable_with_english=False,
preferred_contact_method=self.contact_method,
)
@@ -582,7 +582,7 @@ def test_referral_list(self):
models.FollowupRequest.objects.create(
referral=referral3,
contact_instructions="Call him",
- due_date=datetime.date(2018, 11, 01),
+ due_date=datetime.date(2018, 11, 1),
author=Provider.objects.first(),
author_type=ProviderType.objects.first(),
patient=pt2
@@ -694,7 +694,7 @@ def setUp(self):
state='BA',
zip_code='63108',
pcp_preferred_zip='63018',
- date_of_birth=datetime.date(1990, 01, 01),
+ date_of_birth=datetime.date(1990, 1, 1),
patient_comfortable_with_english=False,
preferred_contact_method=self.contact_method,
)
@@ -724,7 +724,7 @@ def test_valid_input(self):
followup_request1 = models.FollowupRequest.objects.create(
referral=referral1,
contact_instructions="Call him",
- due_date=datetime.date(2018, 11, 01),
+ due_date=datetime.date(2018, 11, 1),
author=Provider.objects.first(),
author_type=ProviderType.objects.first(),
patient=self.pt
diff --git a/referral/urls.py b/referral/urls.py
index d9d1c84..ea5b847 100644
--- a/referral/urls.py
+++ b/referral/urls.py
@@ -24,4 +24,5 @@
]
wrap_config = {}
+
urlpatterns = [wrap_url(u, **wrap_config) for u in unwrapped_urlconf]
diff --git a/workup/migrations/0001_initial.py b/workup/migrations/0001_initial.py
index 705bc06..a0b179f 100644
--- a/workup/migrations/0001_initial.py
+++ b/workup/migrations/0001_initial.py
@@ -12,15 +12,15 @@
class Migration(migrations.Migration):
replaces = [
- (b'workup', '0002_add_verbose_names'),
- (b'workup', '0003_auto_20160122_1631'),
- (b'workup', '0004_auto_20160328_1425'),
- (b'workup', '0005_auto_20160826_0620'),
- (b'workup', '0007_auto_20170502_1107'),
- (b'workup', '0008_auto_20170623_1048'),
- (b'workup', '0009_vitals_to_numeric_type'),
- (b'workup', '0010_decimal_fields_and_validation'),
- (b'workup', '0011_historicalprogressnote_progressnote')]
+ ('workup', '0002_add_verbose_names'),
+ ('workup', '0003_auto_20160122_1631'),
+ ('workup', '0004_auto_20160328_1425'),
+ ('workup', '0005_auto_20160826_0620'),
+ ('workup', '0007_auto_20170502_1107'),
+ ('workup', '0008_auto_20170623_1048'),
+ ('workup', '0009_vitals_to_numeric_type'),
+ ('workup', '0010_decimal_fields_and_validation'),
+ ('workup', '0011_historicalprogressnote_progressnote')]
dependencies = [
('pttrack', '0001_squashed_0010_auto_20170623_1300'),
diff --git a/workup/models.py b/workup/models.py
index 51962a8..b04a3fa 100644
--- a/workup/models.py
+++ b/workup/models.py
@@ -23,7 +23,7 @@ class Meta:
name = models.CharField(max_length=100, primary_key=True)
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -34,7 +34,7 @@ class Meta:
name = models.CharField(max_length=50)
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -47,7 +47,7 @@ class Meta:
clinic_date = models.DateField()
- def __unicode__(self):
+ def __str__(self):
return (str(self.clinic_type) + " on " +
datetime.datetime.strftime(self.clinic_date, '%A, %B %d, %Y'))
@@ -109,6 +109,7 @@ def sign(self, user, active_role=None):
"Provider {p} doesn't have role {r}!".format(
p=user.provider, r=active_role))
+
if active_role.signs_charts:
assert active_role in user.provider.clinical_roles.all()
@@ -269,5 +270,5 @@ def written_date(self):
def url(self):
return reverse('workup', args=(self.pk,))
- def __unicode__(self):
+ def __str__(self):
return self.patient.name() + " on " + str(self.clinic_day.clinic_date)
diff --git a/workup/tests.py b/workup/tests.py
index f4c29cf..e8402ab 100644
--- a/workup/tests.py
+++ b/workup/tests.py
@@ -104,9 +104,6 @@ def test_create_clindate(self):
reverse('new-clindate', args=(pt.id,)),
{'clinic_type': models.ClinicType.objects.first().pk})
- with open('tmp.html', 'w') as f:
- f.write(r.content)
-
self.assertRedirects(r, reverse('new-workup', args=(pt.id,)))
self.assertEqual(models.ClinicDate.objects.count(), 1)