Skip to content

Commit 03f20ef

Browse files
author
fredkingham
committed
Merge branch 'v0.20.0'
2 parents 239a52d + f58da03 commit 03f20ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+292
-198
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ python:
44
- "3.5"
55
- "3.6"
66
- "3.7"
7+
- "3.8"
78

89
services:
910
- postgresql

MANIFEST.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
recursive-include opal/static *
22
recursive-include opal/templates *
33
recursive-include opal/scaffolding *
4-
recursive-include opal/core/collaborative/static *
5-
recursive-include opal/core/collaborative/templates *
64
recursive-include opal/core/search/static *
75
recursive-include opal/core/search/templates *
86
recursive-include opal/core/pathway/static *

changelog.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,38 @@
1+
### 0.20.0 (Major Release)
2+
3+
#### Python 3 version changes.
4+
5+
Opal now supports python 3.5 - python 3.8.
6+
Please note that the 0.21.0 release will drop support for python 3.5.
7+
8+
### Scaffold application episode category
9+
10+
The scaffolded application created by `startproject` now creates a custom
11+
episode category class.
12+
13+
### Removes Django Axes
14+
15+
Axes has been removed from the Opal core application. The package creates a database
16+
log of all login attempts and was installed by default. It is now considered that this
17+
should be an application level choice rather than a framework choice. Installing it on a
18+
per application basis is simple, and requires only settings and requirements changes.
19+
20+
### Removes Letter
21+
22+
The dependency on the letter python package has been removed from the Opal core application. If you wish to send emails, django ships with email wrappers to make this easy.
23+
24+
#### Updates to the Dependency Graph
25+
26+
* Django: 2.0.13 -> 2.2.16
27+
* Django-compressor: 2.2 -> 2.4
28+
* Six==1.15.0
29+
* Psycopg2: 2.8.3 -> 2.8.6
30+
* Requests: 2.22.0 -> 2.25.0
31+
* Python-dateutil: 2.8.0 -> 2.8.1
32+
* Django-rest-framework: 3.10.2 -> 3.12.2
33+
* Django-Axes -> Removed
34+
* Letter -> Removed
35+
136
### 0.18.4 (Minor Release)
237

338
#### Some models have translations

doc/docs/guides/episodes.md

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ such as a start and end date, and the type of episode. This may be an inpatient
55
stay, an outpatient treatment, a telephone consultation - or any other arbitrarily
66
defined period of care.
77

8-
98
## Episode Categories
109

1110
An episode must have a related category. An Opal `EpisodeCategory` is a discoverable
@@ -19,7 +18,7 @@ the `display_name` attribute of the relevant category.
1918
```python
2019
episode = patient.episode_set.first()
2120
print episode.category
22-
# <opal.core.episode.InpatientEpisode object>
21+
# <{{ your app name }}.InpatientEpisode object>
2322

2423
print episode.category.display_name
2524
# "Inpatient"
@@ -34,15 +33,6 @@ The category of an episode determines which template will be used to display it
3433
on the detail page for the patient. This template is determined by looking up
3534
the `detail_template` attribute of the `EpisodeCategory`.
3635

37-
```python
38-
episode.category
39-
print episode.category
40-
# <opal.core.episode.InpatientEpisode object>
41-
42-
print episode.category.detail_template
43-
# detail/inpatient.html
44-
```
45-
4636
The Episode Category template does not comprise the entire
4737
[Patient detail view](patient_detail_views.md). This is made of multiple episodes
4838
and by default will display some basic demographic details as well as other episodes.

doc/docs/reference/episode_categories.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,3 @@ rest of the data that's been used to update the episode.
8686
InpatientEpisode(episode).set_stage('Discharged', user, data_dict)
8787
# -> True
8888
```
89-
90-
91-
## InpatientEpisode
92-
93-
This is the default EpisodeCategory imlpementation - applications started with Opal's
94-
scaffolding scripts will use this as the `OpalApplication.default_episode_category`.
95-
It sets the detail template to `detail/inpatient.html`

doc/docs/reference/upgrading.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,63 @@
33
This document provides instructions for specific steps required to upgrading your Opal
44
application to a later version where there are extra steps required.
55

6+
#### v0.18.3 -> v0.20.0
7+
8+
##### Dependency upgrades
9+
10+
How you do this depends on how you have configured your application. You will need to
11+
update both the Opal version, and versions of dependencies upgraded dependencies if
12+
you have specified them in for instance, a requirements.txt.
13+
14+
(This will be the case if you use the requirements.txt originally provided by
15+
`opal startproject`)
16+
17+
# requirements.txt
18+
opal==0.20.0
19+
django==2.2.16
20+
djangorestframework==3.12.2
21+
django-compressor==2.4
22+
six==1.15.0
23+
psycopg2==2.8.6
24+
requests==2.25.0
25+
python-dateutil==2.8.1
26+
27+
28+
##### API API Changes (REST Framework)
29+
30+
Note that the Django REST Framework update includes a breaking change to their public
31+
API which may affect your application. The `base_name` attribute of a ViewSet has been
32+
renamed to `basename` ([release notes](https://www.django-rest-framework.org/community/release-notes/#390)).
33+
34+
Any APIs implemented in your application will likely need to rename this attribute as
35+
part of this upgrade.
36+
37+
##### Episode Categories
38+
39+
40+
`Inpatient` is no longer provided in `opal.core.episodes`. If you are using the
41+
Inpatient episode category you can add it in your `{{ appname }}/episode_categories.py`
42+
```
43+
from opal.core.episodes import EpisodeCategory
44+
45+
46+
class InpatientEpisode(EpisodeCategory):
47+
display_name = 'Inpatient'
48+
detail_template = 'detail/inpatient.html'
49+
stages = [
50+
'Inpatient',
51+
'Followup',
52+
'Discharged'
53+
]
54+
```
55+
56+
##### Django Axes
57+
58+
Opal has removed the built in dependency on Django Axes. If your application wishes to
59+
continue using it, then the relevant settings should already be in your settings file.
60+
If you were relying on the entry in the opal `setup.py` to install it at deployment time,
61+
you will need to ensure this via some other mechanism - for instance ensuring it is in your
62+
application `requirements.txt`.
663

764
#### v0.17.1 -> v0.18.2
865

doc/mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ dev_addr: 0.0.0.0:8965
121121
include_next_prev: false
122122

123123
extra:
124-
version: v0.18.4
124+
version: v0.20.0
125125

126126
markdown_extensions:
127127
- fenced_code

opal/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""
22
Declare our current version string
33
"""
4-
__version__ = '0.18.4'
4+
__version__ = '0.20.0'

opal/core/api.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121

2222

2323
class OPALRouter(routers.DefaultRouter):
24-
def get_default_base_name(self, viewset):
25-
name = getattr(viewset, 'base_name', None)
24+
def get_default_basename(self, viewset):
25+
name = getattr(viewset, 'basename', None)
2626
if name is None:
27-
return routers.DefaultRouter.get_default_base_name(self, viewset)
27+
return routers.DefaultRouter.get_default_basename(self, viewset)
2828
return name
2929

3030

@@ -81,7 +81,7 @@ class RecordViewSet(LoginRequiredViewset):
8181
Return the serialization of all active record types ready to
8282
initialize on the client side.
8383
"""
84-
base_name = 'record'
84+
basename = 'record'
8585

8686
def list(self, request):
8787
return json_response(schemas.list_records())
@@ -91,7 +91,7 @@ class ReferenceDataViewSet(LoginRequiredViewset):
9191
"""
9292
API for referencedata
9393
"""
94-
base_name = 'referencedata'
94+
basename = 'referencedata'
9595

9696
def list(self, request):
9797
data = {}
@@ -141,7 +141,7 @@ class MetadataViewSet(LoginRequiredViewset):
141141
"""
142142
Our metadata API
143143
"""
144-
base_name = 'metadata'
144+
basename = 'metadata'
145145

146146
def list(self, request):
147147
data = {}
@@ -237,7 +237,7 @@ class UserProfileViewSet(LoginRequiredViewset):
237237
"""
238238
Returns the user profile details for the currently logged in user
239239
"""
240-
base_name = 'userprofile'
240+
basename = 'userprofile'
241241

242242
def list(self, request):
243243
profile = request.user.profile
@@ -248,7 +248,7 @@ class UserViewSet(LoginRequiredViewset):
248248
"""
249249
Provides applications with information about all system users
250250
"""
251-
base_name = 'user'
251+
basename = 'user'
252252

253253
def list(self, request):
254254
"""
@@ -269,7 +269,7 @@ class TaggingViewSet(LoginRequiredViewset):
269269
"""
270270
Returns taggings associated with episodes
271271
"""
272-
base_name = 'tagging'
272+
basename = 'tagging'
273273

274274
@episode_from_pk
275275
def retrieve(self, request, episode):
@@ -293,7 +293,7 @@ class EpisodeViewSet(LoginRequiredViewset):
293293
"""
294294
Episodes of care
295295
"""
296-
base_name = 'episode'
296+
basename = 'episode'
297297

298298
def list(self, request):
299299
return json_response(
@@ -357,7 +357,7 @@ def retrieve(self, request, episode):
357357

358358

359359
class PatientViewSet(LoginRequiredViewset):
360-
base_name = 'patient'
360+
basename = 'patient'
361361

362362
@patient_from_pk
363363
def retrieve(self, request, patient):
@@ -366,7 +366,7 @@ def retrieve(self, request, patient):
366366

367367

368368
class PatientRecordAccessViewSet(LoginRequiredViewset):
369-
base_name = 'patientrecordaccess'
369+
basename = 'patientrecordaccess'
370370

371371
def retrieve(self, request, pk=None):
372372
return json_response([
@@ -376,7 +376,7 @@ def retrieve(self, request, pk=None):
376376

377377

378378
class PatientListViewSet(LoginRequiredViewset):
379-
base_name = 'patientlist'
379+
basename = 'patientlist'
380380
permission_classes = (IsAuthenticated,)
381381

382382
def retrieve(self, request, pk=None):
@@ -401,7 +401,7 @@ def register_subrecords():
401401
sub_name = subrecord.get_api_name()
402402

403403
class SubViewSet(SubrecordViewSet):
404-
base_name = sub_name
404+
basename = sub_name
405405
model = subrecord
406406

407407
router.register(sub_name, SubViewSet)

opal/core/application.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class OpalApplication(object):
9292
index=0
9393
)
9494
]
95-
default_episode_category = 'Inpatient'
95+
default_episode_category = None
9696

9797
@classmethod
9898
def get_core_javascripts(klass, namespace):
@@ -113,10 +113,8 @@ def get_menu_items(klass, user=None):
113113
"""
114114
Default implementation of get_menu_items()
115115
"""
116-
# we import here as settings must be set before this is imported
117-
from django.contrib.auth.views import logout as logout_view
118116
logout = menus.MenuItem(
119-
href=reverse(logout_view), icon="fa-sign-out", index=1000
117+
href=reverse("logout"), icon="fa-sign-out", index=1000
120118
)
121119
admin = menus.MenuItem(
122120
href="/admin/", icon="fa-cogs", display=_("Admin"),

0 commit comments

Comments
 (0)