Skip to content

Commit

Permalink
Merge pull request #1590 from openhealthcare/remove-copy-to-category
Browse files Browse the repository at this point in the history
Remove copy to category
  • Loading branch information
fredkingham committed Oct 4, 2018
2 parents fcd8481 + 35e1a17 commit 747a57b
Show file tree
Hide file tree
Showing 13 changed files with 18 additions and 296 deletions.
15 changes: 15 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
### 0.13.0 (Major Release)

#### Removes CopyToCategory

Removes the entire CopyToCategory flow from Opal Core. If applications continue to rely on it,
they are advised to implement at application level.

In general application developers are advised to find alternative ways to display subrecords
from multiple episodes rather than copying them however, as this is known to cause duplication
of data that is hard to trace back later on.

This includes the API endpoint at `episode/$id/actions/copyto/$category/`, the template
`copy_to_category.html`, the Angular controller `CopyToCategoryCtrl` and service
`CopyToCategory` and Subrecord property `_clonable`.


#### Lookuplist data format

Lookuplist entries in data files are no longer required to have an empty synonyms list
if the entry doesn't have a synonym. This reduces the file size and makes it easier to
hand craft data files for new applications.


#### Removes the deprecated Model._title property

Use of `Model._title` to set a display name of a subrecord has issued a warning for several
Expand Down
12 changes: 1 addition & 11 deletions doc/docs/reference/subrecords.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,6 @@ Name of the field by which we want to sort these records when displaying.
_sort = 'start_date'
```

#### Subrecord._clonable

A Boolean that is True by default used by `opal.views.EpisodeCopyToCategoryView`
to determine if instances of this record should be copied across.

```python
class Antimicrobial(EpisodeSubrecord):
_clonable = 'False'
```

#### Subrecord._exclude_from_extract

Boolean to specify that this subrecord should be excluded from any standard data extract.
Expand Down Expand Up @@ -104,7 +94,7 @@ Classmethod that returns the display name of the subrecord.
This is used as the user visible title of subrecord panels and modals amongst other places.

By default this uses the Django
[Meta verbose_name](https://docs.djangoproject.com/en/dev/ref/models/options/#verbose-name)
[Meta verbose_name](https://docs.djangoproject.com/en/dev/ref/models/options/#verbose-name)
property

```python
Expand Down
2 changes: 0 additions & 2 deletions opal/core/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class OpalApplication(object):
"js/opal/services/patient_loader.js",
"js/opal/services/episode_resource.js",
"js/opal/services/record_editor.js",
"js/opal/services/copy_to_category.js",
"js/opal/services/patientlist_loader.js",
'js/opal/services/fields_translater.js',
'js/opal/services/referencedata.js',
Expand All @@ -86,7 +85,6 @@ class OpalApplication(object):
"js/opal/controllers/account.js",
"js/opal/controllers/discharge.js",
"js/opal/controllers/undischarge.js",
"js/opal/controllers/copy_to_category.js",
"js/opal/controllers/keyboard_shortcuts.js",
"js/opal/controllers/patient_access_log.js",
"js/opal/controllers/lookup_list_reference.js"
Expand Down
1 change: 0 additions & 1 deletion opal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,6 @@ class Meta:


class EpisodeSubrecord(Subrecord):
_clonable = True

episode = models.ForeignKey(Episode, null=False)

Expand Down
45 changes: 0 additions & 45 deletions opal/static/js/opal/controllers/copy_to_category.js

This file was deleted.

30 changes: 0 additions & 30 deletions opal/static/js/opal/services/copy_to_category.js

This file was deleted.

95 changes: 0 additions & 95 deletions opal/static/js/test/copy.to.category.controller.test.js

This file was deleted.

40 changes: 0 additions & 40 deletions opal/templates/copy_to_category.html

This file was deleted.

1 change: 0 additions & 1 deletion opal/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ class Meta:


class Colour(models.EpisodeSubrecord):
_clonable = False
_advanced_searchable = False
_exclude_from_extract = True
_angular_service = 'Colour'
Expand Down
1 change: 0 additions & 1 deletion opal/tests/test_core_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def test_get_core_javascripts(self):
"js/opal/controllers/account.js",
"js/opal/controllers/discharge.js",
"js/opal/controllers/undischarge.js",
"js/opal/controllers/copy_to_category.js",
"js/opal/controllers/keyboard_shortcuts.js",
"js/opal/controllers/patient_access_log.js",
"js/opal/controllers/lookup_list_reference.js"
Expand Down
30 changes: 0 additions & 30 deletions opal/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,36 +414,6 @@ def test_get_non_existing_template(self):
self.assertEqual(404, resp.status_code)


class CopyToCategoryViewTestCase(BaseViewTestCase):
def test_copy_to_category(self):
""" copy all subrecords that don't have _clonable=True and
are not singletons
"""
request = MagicMock()
request.user = self.user;
view = self.setup_view(views.EpisodeCopyToCategoryView, request)
testmodels.Colour.objects.create(
episode=self.episode, name="purple"
)
testmodels.HatWearer.objects.create(
episode=self.episode, name="hat wearer"
)
testmodels.EpisodeName.objects.create(
episode=self.episode, name="episode name"
)
view.post(request, pk=self.episode.pk, category="Outpatient")

new_episode = models.Episode.objects.exclude(id=self.episode.id).get()
self.assertEqual(new_episode.hatwearer_set.get().name, "hat wearer")
self.assertEqual(new_episode.colour_set.count(), 0)
self.assertEqual(new_episode.category_name, "Outpatient")

# a singleton will be created but not populate it
self.assertEqual(
new_episode.episodename_set.filter(name="episode name").count(), 0
)


class CSRFFailureTestCase(TestCase):
def test_get(self):
factory = RequestFactory()
Expand Down
6 changes: 0 additions & 6 deletions opal/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@

url(r'^admin/', include(admin.site.urls)),

url(r'^episode/(?P<pk>\d+)/actions/copyto/(?P<category>[a-zA-Z_\-]+)/?$',
views.EpisodeCopyToCategoryView.as_view()),

# Template views
url(r'^templates/patient_list.html/(?P<slug>[0-9a-z_\-]+)/?$',
views.PatientListTemplateView.as_view(),
Expand All @@ -63,9 +60,6 @@
url(r'^templates/modals/discharge_episode.html/?$',
views.DischargeEpisodeTemplateView.as_view()),

url(r'^templates/modals/copy_to_category.html/?$',
views.CopyToCategoryTemplateView.as_view()),

url(r'^templates/modals/delete_item_confirmation.html/?$',
views.DeleteItemConfirmationView.as_view()),

Expand Down
Loading

0 comments on commit 747a57b

Please sign in to comment.