Repository navigation
Image Server System
Part of Transcriber & Coordinator Workflow. See also Assignment-System — assignments exist to hand out the images described here.
Models: app/models/image_server_group.rb, app/models/image_server_image.rb · Controllers: app/controllers/image_server_groups_controller.rb, app/controllers/image_server_images_controller.rb
FreeREG's scanned-register image pipeline. The integration is confirmed FreeREG-specific directly in the code — the external image-server URLs are hardcoded to a manage_freereg_images/... path (image_server_group.rb:411, image_server_image.rb:41,185), and there's no template_set/freecen gating anywhere in either model.
Source → ImageServerGroup → ImageServerImage, sitting alongside the Assignment-System pipeline: ImageServerGroup belongs_to :source, optional :place/:church, has_many :image_server_images (dependent: :restrict_with_error — a group can't be deleted while it still has images; the controller's destroy rescues Mongoid::Errors::DeleteRestriction). ImageServerImage belongs_to :image_server_group, optional belongs_to :assignment — note it only tracks the current assignment, not a history of prior reassignments (there's a comment in the model suggesting assignment should perhaps be current_assignment or a real history array instead).
A group is a named batch of images (e.g. one register's worth) allocated as a unit to a syndicate before individual images are assigned to transcribers/reviewers (Assignment-System). Key fields: group_name, syndicate_code, assign_date, number_of_images, summary (a Hash — status/difficulty/transcriber/reviewer/count rollup across every image in the group). summary is a manually-maintained cache, refreshed via ImageServerImage.refresh_src_dest_group_summary any time an image's status changes — not a real-time DB aggregate, so if that refresh call is ever missed on a new code path, the summary silently goes stale.
- SC requests a group (
request_sc_image_server_group) → sets statusar, emails the county coordinator. - CC approves/rejects via
ImageServerGroupsController#updatewithparams[:type]='allocate accept'/'allocate reject'/'unallocate'/'complete', dispatching toImageServerGroup.update_image_and_group_for_put_request, which drives thear → a/a → u/r → ctransitions (see Assignment-System's status lifecycle) and firesUserMailer.notify_sc_allocate_request_rejectionon rejection. - Once complete,
send_complete_to_cc/email_cc_completionsets image status tocsand emails the county coordinator.
This is the same "dispatch on a hidden type/origin param inside one fat update action" pattern used across Message-System and Assignment-System — ImageServerImage#update does the same thing on params[:image_server_image][:origin] ('edit'/'move'/'propagate_difficulty'/'propagate_status').
upload/upload_return send the browser to an entirely separate service (Rails.application.config.image_server, a different host) for the actual scan-upload UI; that service then redirects back to upload_return as a callback. upload_return is explicitly exempted from login (skip_before_action :require_login, only: [:upload_return], since the callback carries no Rails session) and guards against double-processing via a session[:upload_return] flag. image_server_images#download/view/destroy work the same way — the browser is redirected straight to a manage_freereg_images/... URL on the image-server host, the Rails app never proxies the actual image bytes.
Ruby-version compatibility footgun: the URL builders (create_upload_images_url, create_url, url_for_delete_image_from_image_server) all call URI.escape(...), which was removed in Ruby 3.0. This only works if the app is pinned to an older Ruby (or has a compatibility shim restoring URI.escape) — worth checking before any Ruby upgrade work touches this area.
ImageServerImage#image_detail_access_allowed? branches on person_role: a syndicate_coordinator must match the image's syndicate_code; a county_coordinator must match either the county's county_coordinator userid, or (if session[:manage_user_origin] == 'manage syndicate') the group's syndicate_code; system_administrator is always allowed.
-
resources :image_server_groupsplus ~10 custom routes (config/routes.rb:648-658):my_list_by_syndicate,my_list_by_county,allocate,initialize_status, a member-scopedindex(image_server_groups/:id/index— unusual,indexis normally collection-level),upload,upload_return,request_cc_image_server_group,request_sc_image_server_group,send_complete_to_cc. -
resources :image_server_imagesplusdownload,view,flush, a member-scopedindex(image_server_images/:id/index, same pattern as above),move,return_from_image_deletion(config/routes.rb:640-646).
© 2025 FreeUKGen. Licensed under Apache License 2.0