mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Unverified transcriptions, PM templates, ICA inspections, W&B, AD watch
- Entries transcribed by Claude are unverified (with Claude's confidence) until an owner checks them against the scan: badge, filter, "mark verified" stepping through the rest - Preventive maintenance templates on new logbook entries, keyed to Part 43 Appendix A(c), setting the entry type and pilot certificate (43.3(g)) - An STC's ICA can become a tracked recurring inspection, linked from its major record - Weight & balance: history of empty weight/CG (linked to the 337 that changed them), loading stations and CG envelope from the POH, and a live calculator for takeoff and landing weight/CG; shown on the status report - New ADs: weekly Federal Register search per aircraft (aircraft, engine and propeller models, or custom terms); track or dismiss each; included in the weekly reminder - Archives carry the new records; brakeman: explicit params, reviewed About-page links Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bed07386ef
commit
6cab81332e
49 files changed
+1197
-35
No files matched your search
@@ -81,7 +81,12 @@ module AircraftArchive
|
||||
date_performed: r.date_performed&.iso8601, performed_by: r.performed_by, component_id: id(r.component_id),
|
||||
form_337_document_id: id(r.form_337_document_id), stc_number: r.stc_number, stc_holder: r.stc_holder,
|
||||
stc_document_id: id(r.stc_document_id), logbook_entry_id: id(r.logbook_entry_id), aircraft_hours: dec(r.aircraft_hours),
|
||||
notes: r.notes, has_ica: r.has_ica, ica_notes: r.ica_notes }
|
||||
notes: r.notes, has_ica: r.has_ica, ica_notes: r.ica_notes, ica_inspection_type_id: id(r.ica_inspection_type_id) }
|
||||
end,
|
||||
weight_balance_records: a.weight_balance_records.map do |w|
|
||||
{ id: id(w), date: w.date&.iso8601, empty_weight: dec(w.empty_weight), empty_arm: dec(w.empty_arm),
|
||||
max_gross_weight: dec(w.max_gross_weight), reason: w.reason, notes: w.notes,
|
||||
major_record_id: id(w.major_record_id), document_id: id(w.document_id) }
|
||||
end,
|
||||
notes: a.notes.includes(:user).map do |n|
|
||||
{ id: id(n), aircraft_id: id(a), text: n.text, public: n.public, added_by_display: n.user&.display_name,
|
||||
@@ -120,7 +125,8 @@ module AircraftArchive
|
||||
|
||||
def aircraft_hash(a)
|
||||
{ id: id(a), tail_number: a.tail_number, make: a.make, model: a.model, serial_number: a.serial_number,
|
||||
description: a.description, purchased: a.purchased&.iso8601, status: a.status, time_basis: a.time_basis, tach_time: dec(a.tach_time),
|
||||
description: a.description, purchased: a.purchased&.iso8601, status: a.status, time_basis: a.time_basis,
|
||||
loading_stations: a.loading_stations, cg_envelope: a.cg_envelope, ad_watch_terms: a.ad_watch_terms, tach_time: dec(a.tach_time),
|
||||
tach_time_offset: dec(a.tach_time_offset), hobbs_time: dec(a.hobbs_time), hobbs_time_offset: dec(a.hobbs_time_offset),
|
||||
picture: file(a.picture, "aircraft_pictures"), icao_type: a.icao_type }
|
||||
end
|
||||
@@ -139,7 +145,8 @@ module AircraftArchive
|
||||
{ id: id(e), aircraft_id: id(e.aircraft_id), log_type: e.log_type, date: e.date&.iso8601, text: e.text,
|
||||
signoff_person: e.signoff_person, signoff_location: e.signoff_location,
|
||||
signoff_certificate_type: e.signoff_certificate_type, signoff_certificate_number: e.signoff_certificate_number,
|
||||
inspection_result: e.inspection_result, log_image_id: id(e.document_id),
|
||||
inspection_result: e.inspection_result, verified: e.verified, transcription_confidence: e.transcription_confidence,
|
||||
log_image_id: id(e.document_id),
|
||||
aircraft_hours_at_entry: dec(e.aircraft_hours_at_entry), component_hours: {}, entry_type: e.entry_type,
|
||||
page_number: e.page_number, components: [], related_documents: [] }
|
||||
end
|
||||
|
||||
@@ -140,6 +140,8 @@ module AircraftArchive
|
||||
make: a["make"].to_s, model: a["model"].to_s, serial_number: a["serial_number"].to_s, description: a["description"].to_s,
|
||||
purchased: date(a["purchased"]), status: Aircraft::STATUSES.key?(a["status"]) ? a["status"] : "AVAILABLE",
|
||||
time_basis: Aircraft::TIME_BASES.key?(a["time_basis"]) ? a["time_basis"] : "tach",
|
||||
loading_stations: a["loading_stations"].is_a?(Hash) ? a["loading_stations"] : nil,
|
||||
cg_envelope: a["cg_envelope"].is_a?(Array) ? a["cg_envelope"] : nil, ad_watch_terms: a["ad_watch_terms"].to_s.first(500).presence,
|
||||
tach_time: num(a["tach_time"] || a["flight_time"]) || 0, tach_time_offset: num(a["tach_time_offset"]) || 0,
|
||||
hobbs_time: num(a["hobbs_time"]) || 0, hobbs_time_offset: num(a["hobbs_time_offset"]) || 0,
|
||||
icao_type: a["icao_type"].to_s.upcase.presence&.then { _1.match?(/\A[A-Z0-9]{1,4}\z/) ? _1 : nil }
|
||||
@@ -227,6 +229,8 @@ module AircraftArchive
|
||||
signoff_certificate_type: LogbookEntry::CERTIFICATE_TYPES.key?(data["signoff_certificate_type"]) ? data["signoff_certificate_type"] : nil,
|
||||
signoff_certificate_number: data["signoff_certificate_number"].to_s.presence,
|
||||
inspection_result: LogbookEntry::INSPECTION_RESULTS.key?(data["inspection_result"]) ? data["inspection_result"] : nil,
|
||||
verified: data["verified"] != false,
|
||||
transcription_confidence: %w[high medium low].include?(data["transcription_confidence"]) ? data["transcription_confidence"] : nil,
|
||||
aircraft_hours_at_entry: num(data["aircraft_hours_at_entry"]), page_number: data["page_number"],
|
||||
document_id: @map[:document][data["log_image_id"].to_s]
|
||||
)
|
||||
@@ -359,11 +363,26 @@ module AircraftArchive
|
||||
form_337_document_id: @map[:document][data["form_337_document_id"].to_s], stc_number: data["stc_number"].to_s,
|
||||
stc_holder: data["stc_holder"].to_s, stc_document_id: @map[:document][data["stc_document_id"].to_s],
|
||||
logbook_entry_id: @map[:logbook][data["logbook_entry_id"].to_s], aircraft_hours: num(data["aircraft_hours"]),
|
||||
notes: data["notes"].to_s, has_ica: data["has_ica"] == true, ica_notes: data["ica_notes"]
|
||||
notes: data["notes"].to_s, has_ica: data["has_ica"] == true, ica_notes: data["ica_notes"],
|
||||
ica_inspection_type_id: @map[:inspection_type][data["ica_inspection_type_id"].to_s]
|
||||
)
|
||||
r.save!(validate: false)
|
||||
(@map[:major_record] ||= {})[data["id"].to_s] = r.id
|
||||
tick("major_records")
|
||||
end
|
||||
import_weight_balance
|
||||
end
|
||||
|
||||
def import_weight_balance
|
||||
m("weight_balance_records").each do |data|
|
||||
w = @aircraft.weight_balance_records.new(
|
||||
date: date(data["date"]) || Date.new(1900, 1, 1), empty_weight: num(data["empty_weight"]) || 0, empty_arm: num(data["empty_arm"]) || 0,
|
||||
max_gross_weight: num(data["max_gross_weight"]), reason: data["reason"].to_s.presence, notes: data["notes"].to_s.presence,
|
||||
major_record_id: (@map[:major_record] || {})[data["major_record_id"].to_s], document_id: @map[:document][data["document_id"].to_s]
|
||||
)
|
||||
w.save!(validate: false)
|
||||
tick("weight_balance_records")
|
||||
end
|
||||
end
|
||||
|
||||
def import_notes
|
||||
|
||||
Reference in new issue
Block a user