Uh oh!
There was an error while loading. Please reload this page.
OpenConceptLab/ocl_issues#22 | exclude retired concepts and/or mappings from exports - #14
Conversation
| 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
2c6ad01Compare@PatrickCmd The missing thing is a test to exclude retired concepts |
ea03273 to
481d93aCompare| @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)) |
| 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 neededs3_key = version.export_path if include_retired else version.exclude_retired_export_path
snyaggarwal
commented
Aug 30, 2021
@PatrickCmd This looks good. Few things that are still left:
|
481d93a to
7a97a85CompareUh oh!
There was an error while loading. Please reload this page.
7a97a85 to
e552dc8Comparee552dc8 to
fd2297dCompare0fc07a3 to
cf7a6aaCompare…ow excluded from exports
cf7a6aa to
02f9138Compare
Retired concepts and/or mappings can now be excluded from concepts and or mappings.