From 2ef8f5f67f4c5034c1355fc9339127b2982ffdec Mon Sep 17 00:00:00 2001 From: Justin Hui Date: Thu, 12 Mar 2026 16:25:26 -0500 Subject: [PATCH] Added Camera Make and Model to input parameters --- api/upsert_images.rb | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/api/upsert_images.rb b/api/upsert_images.rb index ce695b3..a72cdeb 100644 --- a/api/upsert_images.rb +++ b/api/upsert_images.rb @@ -94,11 +94,15 @@ def create_image_uploads(image_props, survey_sentera_id, sensor_type) # objects created by the # create_image_uploads mutation # @param [string] sensor_type The type of sensor that captured the images +# @param [string] calculated_index The calculated index value for the images +# @param [string] color_applied The color applied value for the images +# @param [string] camera_make The camera make for the image +# @param [string] camera_model The camera model for the image # @param [Array[Hash]] image_props Array of image properties # # @return [Hash] Hash containing results of the GraphQL request # -def upsert_images(survey_sentera_id, image_uploads, sensor_type, image_props) +def upsert_images(survey_sentera_id, image_uploads, sensor_type, calculated_index, color_applied, camera_make, camera_model, image_props) puts 'Upsert images' gql = <<~GQL @@ -139,9 +143,11 @@ def upsert_images(survey_sentera_id, image_uploads, sensor_type, image_props) # Note the use of the file_key attribute to reference # the previously uploaded image. altitude: 0, - calculated_index: 'UNKNOWN', + calculated_index: calculated_index, + camera_make: camera_make, + camera_model: camera_model, captured_at: Time.now.utc.iso8601, - color_applied: 'UNKNOWN', + color_applied: color_applied, filename: filename, key: image_upload['id'], gps_carrier_phase_status: 'STANDARD', @@ -169,6 +175,10 @@ def upsert_images(survey_sentera_id, image_uploads, sensor_type, image_props) images_path = ENV.fetch('IMAGES_PATH', '.') # Your fully qualified path to a folder containing the images to upload file_ext = ENV.fetch('FILE_EXT', '*.*') # Your image file extension sensor_type = ENV.fetch('SENSOR_TYPE', 'UNKNOWN') # Your sensor type for the images being uploaded +calculated_index = ENV.fetch('CALCULATED_INDEX', 'UNKNOWN') # Your calculated index for the images being uploaded +colored_applied = ENV.fetch('COLOR_APPLIED', 'UNKNOWN') # Your color applied value for the images being uploaded +camera_make = ENV.fetch('CAMERA_MAKE', nil) # Your Camera Make for the image being uploaded +camera_model = ENV.fetch('CAMERA_MODEL', nil) # Your Camera Model for the image being uploaded survey_sentera_id = ENV.fetch('SURVEY_SENTERA_ID', nil) # Your existing survey Sentera ID # ************************************************** @@ -193,10 +203,14 @@ def upsert_images(survey_sentera_id, image_uploads, sensor_type, image_props) upload_files(image_uploads, image_paths) # Step 3: Create images in FieldAgent using the uploaded images -results = upsert_images(survey_sentera_id, image_uploads, sensor_type, image_props) +results = upsert_images( + survey_sentera_id, image_uploads, + sensor_type, calculated_index, colored_applied, camera_make, camera_model, + image_props +) if results && results['succeeded'].any? puts "Done! Images for #{survey_sentera_id} were created in FieldAgent." else puts "Failed due to error: #{results['failed'].inspect}" -end +end \ No newline at end of file