-
Notifications
You must be signed in to change notification settings - Fork 11
Closed
1 / 11 of 1 issue completedClosed
1 / 11 of 1 issue completed
Copy link
Milestone
Description
Summary
Implement a method to process images easily using our current interface. Automated all steps required on the backend.
Detailed Description
This should be a one-day experiment in Sprint 22
Implementation Details
Most functionality and updates will probably happen in the SourceImageUploadSerializer or one of the functions that it calls (auto process single, validate EXIF, regroup sessions properly, validate user for project, etc)
antenna/ami/main/api/serializers.py
Lines 988 to 1034 in 634cbe0
| class SourceImageUploadSerializer(DefaultSerializer): | |
| image = serializers.ImageField(allow_empty_file=False, use_url=True) | |
| created_at = serializers.DateTimeField(read_only=True) | |
| deployment = serializers.PrimaryKeyRelatedField( | |
| queryset=Deployment.objects.all(), | |
| required=True, | |
| ) | |
| user = serializers.PrimaryKeyRelatedField( | |
| read_only=True, | |
| ) | |
| source_image = SourceImageNestedSerializer(read_only=True) | |
| class Meta: | |
| model = SourceImageUpload | |
| fields = [ | |
| "id", | |
| "details", | |
| "image", | |
| "deployment", | |
| "source_image", | |
| "user", | |
| "created_at", | |
| ] | |
| def create(self, validated_data): | |
| # Add the user to the validated data | |
| request = self.context.get("request") | |
| user = get_current_user(request) | |
| # @TODO IMPORTANT ensure current user is a member of the deployment's project | |
| obj = SourceImageUpload.objects.create(user=user, **validated_data) | |
| source_image = create_source_image_from_upload( | |
| obj.image, | |
| obj.deployment, | |
| request, | |
| ) | |
| if source_image is not None: | |
| obj.source_image = source_image # type: ignore | |
| obj.save() | |
| return obj | |
| def validate_image(self, value): | |
| # Ensure that image filename contains a timestamp | |
| try: | |
| validate_filename_timestamp(value.name) | |
| except DjangoValidationError as e: | |
| raise serializers.ValidationError(str(e)) | |
| return value |
- A default sandbox project is automatically created when users register
- Station, Pipeline, etc is automatically registered (choose centroid of browser’s country)
- Only regional models selectable (or global if the rank classification is working well)
- User must open station -> upload manual images
- Checkbox for “process automatically”
- Don’t require timestamp in image filename
Sub-issues
Metadata
Metadata
Assignees
Labels
No labels