Skip to content
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

Allow uploads of images via ODK #766

Merged
merged 14 commits into from
Jan 9, 2021

Conversation

dodumosu
Copy link
Collaborator

@dodumosu dodumosu commented Nov 8, 2020

this pull request allows Apollo manage participant-submitted images via ODK as responses to questions. it also allows for the configuration of ODK Collect via a QR Code, either for the entire system (in which case no credentials are applied), or for a specific participant.
Image uploads can be configured locally or for Amazon S3. Relevant settings are:

  • ATTACHMENTS_USE_S3 (boolean flag, set to true if uploads should go to S3)
  • AWS_ACCESS_KEY_ID: required if the above is true
  • AWS_SECRET_ACCESS_KEY: required if the above is true
  • AWS_DEFAULT_REGION: optional
  • AWS_DEFAULT_BUCKET: optional
  • AWS_IMAGES_REGION: specifically for images. defaults to AWS_DEFAULT_REGION
  • AWS_IMAGES_BUCKET: specifically for images: defaults to AWS_DEFAULT_BUCKET
  • AWS_ENDPOINT_URL
  • DEFAULT_STORAGE_PATH: defaults to the configured path for uploads
  • IMAGES_STORAGE_PATH: defaults to a subfolder named images in DEFAULT_STORAGE_PATH

@dodumosu dodumosu requested a review from takinbo November 8, 2020 15:55
@takinbo
Copy link
Collaborator

takinbo commented Nov 10, 2020

@dodumosu rebase

@dodumosu dodumosu force-pushed the issue-87-image-uploads branch from 2ad759c to b1e19b8 Compare November 10, 2020 05:46
@dodumosu
Copy link
Collaborator Author

dodumosu commented Nov 10, 2020

@takinbo rebased

@dodumosu dodumosu force-pushed the issue-87-image-uploads branch from b1e19b8 to 50afe6c Compare November 11, 2020 01:26
@dodumosu dodumosu force-pushed the issue-87-image-uploads branch from 131881d to 9e6f3b2 Compare December 2, 2020 16:13
apollo/formsframework/forms.py Outdated Show resolved Hide resolved
apollo/formsframework/models.py Outdated Show resolved Hide resolved
apollo/formsframework/models.py Outdated Show resolved Hide resolved
apollo/formsframework/models.py Outdated Show resolved Hide resolved
apollo/formsframework/utils.py Outdated Show resolved Hide resolved
apollo/settings.py Show resolved Hide resolved
apollo/settings.py Show resolved Hide resolved
apollo/settings.py Show resolved Hide resolved
apollo/settings.py Show resolved Hide resolved
apollo/static/js/angular-form-builder-components.js Outdated Show resolved Hide resolved
@dodumosu dodumosu force-pushed the issue-87-image-uploads branch 3 times, most recently from 01989c7 to 35b3ee0 Compare December 13, 2020 15:59
Copy link
Collaborator

@takinbo takinbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments inline. Also this PR needs a rebase.

apollo/formsframework/models.py Outdated Show resolved Hide resolved
@dodumosu dodumosu force-pushed the issue-87-image-uploads branch from 35b3ee0 to a8cde9a Compare December 20, 2020 06:59
@dodumosu dodumosu force-pushed the issue-87-image-uploads branch 2 times, most recently from 2641172 to d2a4679 Compare January 6, 2021 06:12
Copy link
Collaborator

@takinbo takinbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting this error when I try to spin a container:

worker_1    | Traceback (most recent call last):
worker_1    |   File "/app/manage.py", line 15, in <module>
worker_1    |     from apollo.core import db
worker_1    |   File "/app/apollo/__init__.py", line 15, in <module>
worker_1    |     from apollo import assets, models, services
worker_1    |   File "/app/apollo/models.py", line 14, in <module>
worker_1    |     from apollo.submissions.models import (  # noqa
worker_1    |   File "/app/apollo/submissions/models.py", line 3, in <module>
worker_1    |     from depot.fields.specialized.image import UploadedImageWithThumb
worker_1    |   File "/usr/local/lib/python3.6/site-packages/depot/fields/specialized/image.py", line 5, in <module>
worker_1    |     from PIL import Image
worker_1    | ModuleNotFoundError: No module named 'PIL'

to dependencies

also upgrade requests because boto3 requires a higher minimum urllib3
version
this commit adds several configuration variables, viz:
- `ATTACHMENTS_USE_S3`
- `AWS_ACCESS_KEY_ID`
- `AWS_SECRET_ACCESS_KEY`
- `AWS_DEFAULT_REGION`
- `AWS_DEFAULT_BUCKET`
- `AWS_IMAGES_REGION`
- `AWS_IMAGES_BUCKET`
- `AWS_ENDPINT_URL`
- `DEFAULT_STORAGE_PATH`
- `IMAGES_STORAGE_PATH`
this commit adds several changes:
- adds the field `allow_attachments` to the form model
- adds toggling of the `allow_attachments` field in the form properties
- adds the `image` field type
- adds image attachment model class
- adds support for the `location` and `image` field types
  to the form builder
- adds support for importing and exporting forms with
  the `image` field type
this commit disables rendering of image and location fields until
a decision is reached on how
they will be rendered
this commit adds the following:
- a URL endpoint to generate a QR code for configuring ODK Collect,
  optionally for a specific participant
- processing for image attachments using ODK
@dodumosu dodumosu force-pushed the issue-87-image-uploads branch from 41c4c4b to 693b017 Compare January 9, 2021 13:59
Copy link
Collaborator

@takinbo takinbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

@takinbo takinbo merged commit de7d673 into nditech:develop Jan 9, 2021
@dodumosu dodumosu deleted the issue-87-image-uploads branch February 9, 2021 10:05
@dodumosu dodumosu restored the issue-87-image-uploads branch February 27, 2022 05:29
@dodumosu dodumosu deleted the issue-87-image-uploads branch March 3, 2022 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants