OpenConceptLab/ocl_issues#22 | exclude retired concepts and/or mappings from exports#14
Conversation
core/common/tasks.py
Outdated
| try: | ||
| logger.info('Found source version %s. Beginning export...', version.version) | ||
| write_export_file(version, 'source', 'core.sources.serializers.SourceVersionExportSerializer', logger) | ||
| write_export_file(self.request, version, 'source', 'core.sources.serializers.SourceVersionExportSerializer', logger) |
There was a problem hiding this comment.
@PatrickCmd these methods should not be dependent on the request object.
passing include_retired=True in export_source directly as a parameter keeps things flexible and the same can be passed to write_export_file. The view should control request query params.
The reason I don't like using request object in write_export_file is it's a very low-level method and if I want to call it anywhere else I need to have a full request object, which is an overkill in my opinion.
There was a problem hiding this comment.
@snyaggarwal I have worked on this. please do review again.
11e3fa5 to
2c6ad01
Compare
|
@PatrickCmd The missing thing is a test to exclude retired concepts |
ea03273 to
481d93a
Compare
core/common/models.py
Outdated
| @cached_property | ||
| def exclude_retired_export_path(self): | ||
| last_update = self.last_child_update.strftime('%Y%m%d%H%M%S') | ||
| return self.generic_export_path(suffix="{}_non_retired.zip".format(last_update)) |
There was a problem hiding this comment.
non_retired -> unretired
core/common/utils.py
Outdated
| logger.info('Done compressing. Uploading...') | ||
|
|
||
| s3_key = version.export_path | ||
| if not include_retired: |
There was a problem hiding this comment.
export_path is an expensive call, since its calculates on runtime so use it only if needed
s3_key = version.export_path if include_retired else version.exclude_retired_export_path
|
@PatrickCmd This looks good. Few things that are still left:
|
481d93a to
7a97a85
Compare
7a97a85 to
e552dc8
Compare
e552dc8 to
fd2297d
Compare
0fc07a3 to
cf7a6aa
Compare
…ow excluded from exports
cf7a6aa to
02f9138
Compare
Retired concepts and/or mappings can now be excluded from concepts and or mappings.