-
Notifications
You must be signed in to change notification settings - Fork 35
Upload Process
Seán Lynch edited this page May 6, 2023
·
10 revisions
Currently being refactored to Uploads\UploadPhotoController
-
Request Verification
- The file should be an image
-
Check for GPS
- We extract the EXIF data and check it for GPS keys.
- If no GPS keys are found, a 500 error is thrown and the process is aborted.
- We then test for empty "0/0" values, which we believe can be introduced when transferring images across devices.
- If no GPS values are found, a 500 error is thrown with this information.
- We extract the EXIF data and check it for GPS keys.
-
Check For Duplicates
- We check the
dateTime
the image was taken at. - The user will get an error if they try to upload the same photo twice.
- We check the
- UploadPhotoAction x2
- We use AWS S3 on production, DigitalOcean on staging, and
public/local-uploads/
locally. - Creates the filepath in
year/month/day/fileHashName.jpg
format. - Uploads the photo.
- We duplicate the upload with a resized image of 500x500 dimensions for the OpenLitterAI.
- This should be done asynchronously after everything else has been done.
- We use AWS S3 on production, DigitalOcean on staging, and
-
Convert EXIF values to lat/lon.
-
Reverse Geocode the coordinates at OpenStreetMap to get an address.
- Use OpenStreetMap address values to populate list of locations at OpenLitterMap.
- If a new location is created, we fire these events:
NewCountryAdded
,NewStateAdded
, andNewCityAdded
. - These need to move to after the Photo was created.
- If a new location is created, we fire these events:
- Use OpenStreetMap address values to populate list of locations at OpenLitterMap.
- Preprocess
- Get device model (eg. iPhone 13 Pro / Android Samsung X)
- Convert the coordinates into a geohash
- Create the record on the
photos
table.
-
We need to move the Users XP to Redis.
-
We need daily, weekly, monthly Leaderboards.
- After everything is done, we should dispatch these last.
-
Image Uploaded
- AddLocationContributor
- IncreaseLocationTotalPhotos
- IncreaseTeamTotalPhotos
- This data needs to move to Redis
-
Locations Created should move here
-
Increment PhotosPerMonth
- IncrementCountryMonth
- IncrementStateMonth
- IncrementCityMonth
-
We also need PhotosPerDay, per week and more.
-