From 6cba088cc0a1c0f95202d8066d6ab9d844547c7e Mon Sep 17 00:00:00 2001 From: Adam Wilson Date: Wed, 31 Jul 2024 14:13:16 -0400 Subject: [PATCH 01/68] Merge metadata --- app/controllers/metadata_controller.rb | 9 ++++++--- app/javascript/packs/metadata_upload.jsx | 25 +++++++++++++++++++++--- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/app/controllers/metadata_controller.rb b/app/controllers/metadata_controller.rb index 98a46dc..ad5c3a5 100644 --- a/app/controllers/metadata_controller.rb +++ b/app/controllers/metadata_controller.rb @@ -15,7 +15,11 @@ def update unless @image render json: {filename: params[:filename], error: 'Image not found'}, staus: :unprocessable_entity else - @image.metadata = params[:metadata] + if params[:merge_metadata] + @image.metadata = (@image.metadata || {}).merge(metadata_params[:metadata]) + else + @image.metadata = metadata_params[:metadata] + end if @image.save render json: {filename: params[:filename], success: true} else @@ -27,7 +31,6 @@ def update private def metadata_params - params.require(:filename, metadata: []) + params.permit(metadata: {}) end - end diff --git a/app/javascript/packs/metadata_upload.jsx b/app/javascript/packs/metadata_upload.jsx index 9839d31..554e817 100644 --- a/app/javascript/packs/metadata_upload.jsx +++ b/app/javascript/packs/metadata_upload.jsx @@ -9,12 +9,14 @@ const doUpload = async ({ authenticityToken, imageSourceId, filename, + merge_metadata, metadata }) => { const result = await post('/metadata', { authenticity_token: authenticityToken, image_source_id: imageSourceId, filename: filename, + merge_metadata: merge_metadata, metadata: metadata }) return result.data @@ -56,6 +58,7 @@ const MetadataUpload = ({ }) => { const [sourceId, setSourceId] = useState(imageSourceId || -1) + const [mergeMetadata, setMergeMetadata] = useState(false) const [data, setData] = useState(null) const [uploading, setUploading] = useState(false) @@ -76,6 +79,7 @@ const MetadataUpload = ({ active: '1', imageSourceId: sourceId, filename: data[i][0], + merge_metadata: mergeMetadata, metadata: getMetadata({headers, row: data[i]}) }) results.push(result) @@ -91,11 +95,11 @@ const MetadataUpload = ({ <> {!uploading &&
-
+
-
-
+
+ +
+ setMergeMetadata(e.target.checked)} + /> + +
+
+
From 20cc02c189f35af93f6eaecb8e732dc68b4cd337 Mon Sep 17 00:00:00 2001 From: Adam Wilson Date: Wed, 31 Jul 2024 14:18:05 -0400 Subject: [PATCH 02/68] Removed Trachoma references --- app/views/home/index.html.erb | 21 +++++++++------------ app/views/layouts/_nav.html.erb | 2 +- app/views/layouts/application.html.erb | 2 +- app/views/layouts/home.html.erb | 2 +- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/views/home/index.html.erb b/app/views/home/index.html.erb index dbdf0cf..6100c03 100644 --- a/app/views/home/index.html.erb +++ b/app/views/home/index.html.erb @@ -2,14 +2,11 @@
-

Trachoma Photo Database

-

This database is the result of a collective effort by the trachoma community to support education and research efforts for trachoma elimination and long-term surveillance.

-

It has been proposed that the use of photography and image grading can help us to overcome some of the trachoma diagnosis challenges we face. For the most recent progress report on this work please click here.

-

This database was put together to create one acessible portal where images of the eye can be shared and accessed by stakeholders in the trachoma community for education and research. Thank you for your support and for contributing to our efforts.

-

Please note that Tropical Data administers this database on behalf of the trachoma community, with support from a Steering Committee. A list of members can be found here. If you have any questions, please contact admin@tropicaldata.org.

+

Title

+

Some Text

- +
@@ -18,15 +15,15 @@

Uploading Images

-

If you have images you wish to share, please can you complete this form for us to assign a login to the system. Alongside any photos you upload, you will need to prepare and upload an accompanying metadata template which can be found here. For full instructions on how to access the site, how to complete the metadata template, and how to upload, please click here.

+

Uploading image documentation

Accessing Images

-

If you would like to access photos for educational and/or research purposes, please complete and return this form. Access requests will be reviewed and confirmed by the database’s Steering Committee.

+

Accessing image documentation

Grading

-

If you have been invited to grade images on the system, you will have been sent details on how to log in. A guide for graders can be found here.

+

Grading image documentation

@@ -37,14 +34,14 @@ © Copyright notice <%= Date.today.year %>
- Database endorsed by + Powered by
diff --git a/app/views/layouts/_nav.html.erb b/app/views/layouts/_nav.html.erb index 607b364..a147600 100644 --- a/app/views/layouts/_nav.html.erb +++ b/app/views/layouts/_nav.html.erb @@ -1,7 +1,7 @@