-
Notifications
You must be signed in to change notification settings - Fork 10
Upload json tagging data, update upload/download functions to use singular data_access library and configuration. #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…m string subsitution. Upload handles visit&tag, visit¬ag, novisit Saving untagged to INCOMPLETE_TAG state works through local func testing cleaned up saving untagged images a bit Saving tags to DB also works Working upload flow with visit&tag, visit¬ag, novisit removing creds restructing vott_json_parser file. Deleting jsonpickle version Moving things around for importclean up purposes. Upload function still working, need to refactor download and check prior existing tests pytest working, had to rename db_access_v1 to fix conflicts Some more cleanup and restructring. Tested working through upload function and pytest
…ages from db then return Reverting some accidental renaming in other directories Removing vscode files download working, still need to 1. combine db config for all 3 functions, 2. write tests Download now works with new db_access_v2. Need to create shared_db config ditto prior
minor spacing
…sts. Should probably remove hardcoded resources
3a1ad09 to
92959a8
Compare
| # TODO: images need more meaningful data than just download urls | ||
| image_urls = DB_Access.get_images_for_tagging(connection, imageCount) | ||
| # DB configuration | ||
| data_access = ImageTagDataAccess(get_postgres_provider()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtarng this method raises an exception I believe. All the code should be in a try/catch
| # TODO: Should we add TagStateId = INCOMPLETE_TAG also for fetching images? | ||
| query = ("SELECT b.ImageId, b.ImageLocation, a.TagStateId FROM Image_Tagging_State a " | ||
| "JOIN Image_Info b ON a.ImageId = b.ImageId WHERE a.TagStateId = 1 order by " | ||
| "JOIN Image_Info b ON a.ImageId = b.ImageId WHERE a.TagStateId IN (1, 4) order by " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtarng I would suggest explicitly using the enums
| # Create user id | ||
| user_id = data_access.create_user(DB_Access_V2.getpass.getuser()) | ||
| logging.info("The user id for '{0}' is {1}".format(DB_Access_V2.getpass.getuser(),user_id)) | ||
| user_id = data_access.create_user("testuser") # TODO: remove this hardcoding, should be passed in the request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix this during next wave of changes. Plan to make user ID passed in the request.
| from azure.storage.blob import BlockBlobService, ContentSettings | ||
|
|
||
| from ..shared.db_provider import get_postgres_provider | ||
| from ..shared.db_access import ImageTagDataAccess, ImageInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't we exclusively using db_access_v2 at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, the code is in a file named db_access_v2.py, but it's been nested inside the db_access module. Check the /shared directory now. I'm going to delete the old db_access_v1 code in a follow up commit right now.
| } | ||
|
|
||
| def __get_filename_from_fullpath(filename): | ||
| path_components = filename.split('/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Why not use pathlib to avoid writing custom path handling and the various bugs that come with it? Pathlib can get the path, the filename, and the filename without extension.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved.
…gular data_access library and configuration. (CatalystCode#35) * Upload flow reworked to use new db_accessv2. Fixing db update bug from string subsitution. Upload handles visit&tag, visit¬ag, novisit Saving untagged to INCOMPLETE_TAG state works through local func testing cleaned up saving untagged images a bit Saving tags to DB also works Working upload flow with visit&tag, visit¬ag, novisit removing creds restructing vott_json_parser file. Deleting jsonpickle version Moving things around for importclean up purposes. Upload function still working, need to refactor download and check prior existing tests pytest working, had to rename db_access_v1 to fix conflicts Some more cleanup and restructring. Tested working through upload function and pytest * Working on refactoring download function, saving work. Need to get images from db then return Reverting some accidental renaming in other directories Removing vscode files download working, still need to 1. combine db config for all 3 functions, 2. write tests Download now works with new db_access_v2. Need to create shared_db config ditto prior * single db configuration minor spacing * updating onboarding function to use new shared directory * temp commenting out onboarding/onboarding-client.py as it breaks pytests. Should probably remove hardcoded resources * feedback * minor TODO comment reshuffling * removing deprecated db_access_v1
Sync dev branch with master
leaving user_id for query param for now.