mirror of
https://github.com/rickbarrette/simple-aircraft-manager-rails.git
synced 2026-11-17 23:50:36 -05:00
Record keeping: 43.9/43.11 sign-off fields, AD method, status report
- Logbook entries record the signer's kind of certificate and number and an inspection's result; maintenance and inspection entries list what 43.9 / 43.11 needs that's missing (flagged, not enforced). Transcription reads the certificate details too - AD compliance records the method (inspection, terminating action, AMOC, not applicable) and the AD revision complied with, filled in from the AD when blank; the method sets the permanent / N/A flags - Maintenance status report (91.417(a)(2)): total times, life-limited parts, time since overhaul, inspection and AD status, major alterations, open discrepancies; print or save as PDF; on maintenance share links too - Archives carry the new fields Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a4b72cf2c1
commit
a4ec7a691e
30 files changed
+515
-26
No files matched your search
@@ -66,6 +66,7 @@ module AircraftArchive
|
||||
ads: ads.map { ad_hash(_1, component_ids) },
|
||||
ad_compliances: a.ad_compliances.map do |c|
|
||||
{ id: id(c), ad_id: id(c.airworthiness_directive_id), date_complied: c.date_complied&.iso8601, compliance_notes: c.compliance_notes,
|
||||
compliance_method: c.compliance_method, ad_revision: c.ad_revision,
|
||||
permanent: c.permanent, next_due_at_time: dec(c.next_due_at_time), aircraft_hours_at_compliance: dec(c.aircraft_hours_at_compliance),
|
||||
logbook_entry_id: id(c.logbook_entry_id), inspection_record_id: id(c.inspection_record_id), aircraft_id: id(a),
|
||||
component_id: id(c.component_id), not_applicable: c.not_applicable }
|
||||
@@ -136,7 +137,9 @@ module AircraftArchive
|
||||
|
||||
def logbook_hash(e)
|
||||
{ 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, log_image_id: id(e.document_id),
|
||||
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),
|
||||
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
|
||||
|
||||
@@ -223,6 +223,9 @@ module AircraftArchive
|
||||
entry_type: LogbookEntry::ENTRY_TYPES.key?(data["entry_type"]) ? data["entry_type"] : LogbookEntry::ENTRY_TYPES.keys.first,
|
||||
date: date(data["date"]) || Date.new(1900, 1, 1), text: data["text"].to_s.presence || "—",
|
||||
signoff_person: data["signoff_person"], signoff_location: data["signoff_location"],
|
||||
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,
|
||||
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]
|
||||
)
|
||||
@@ -318,11 +321,14 @@ module AircraftArchive
|
||||
c = @aircraft.ad_compliances.new(
|
||||
airworthiness_directive_id: ad_id, date_complied: date(data["date_complied"]) || Date.new(1900, 1, 1),
|
||||
compliance_notes: data["compliance_notes"].to_s, permanent: data["permanent"] == true,
|
||||
compliance_method: AdCompliance::METHODS.key?(data["compliance_method"]) ? data["compliance_method"] : nil,
|
||||
ad_revision: data["ad_revision"].to_s.presence,
|
||||
next_due_at_time: num(data["next_due_at_time"]) || 0, aircraft_hours_at_compliance: num(data["aircraft_hours_at_compliance"]),
|
||||
logbook_entry_id: @map[:logbook][data["logbook_entry_id"].to_s],
|
||||
inspection_record_id: @map[:inspection_record][data["inspection_record_id"].to_s],
|
||||
component_id: @map[:component][data["component_id"].to_s], not_applicable: data["not_applicable"] == true
|
||||
)
|
||||
c.apply_method # older archives have only the permanent / not-applicable flags
|
||||
c.save!(validate: false)
|
||||
tick("ad_compliances")
|
||||
end
|
||||
|
||||
@@ -26,7 +26,11 @@ Fields:
|
||||
- log_type: AC (airframe), ENG (engine), PROP (propeller), or OTHER
|
||||
- text: the entry text verbatim, or a close paraphrase where wording is unclear; write [?] for illegible words
|
||||
- aircraft_hours: the tach/total time the entry records (a number), or null if none is written
|
||||
- signoff_person / signoff_location: a string, or null
|
||||
- signoff_person / signoff_location: a string, or null (the person's name only; certificate details go below)
|
||||
- signoff_certificate_type: the kind of certificate written with the signature: AP (A&P), IA (A&P with
|
||||
Inspection Authorization), A (airframe only), P (powerplant only), REPAIR_STATION (repair station
|
||||
number), REPAIRMAN, PILOT (pilot certificate, for owner preventive maintenance), OTHER, or null
|
||||
- signoff_certificate_number: the certificate or repair station number exactly as written, or null
|
||||
- page_start / page_end: page indices within this request
|
||||
- confidence: high (clearly legible), medium (some guesswork), low (mostly illegible)
|
||||
- unparseable_pages: pages too illegible to extract anything from
|
||||
|
||||
@@ -13,12 +13,14 @@
|
||||
"aircraft_hours": { "type": ["number", "null"] },
|
||||
"signoff_person": { "type": ["string", "null"] },
|
||||
"signoff_location": { "type": ["string", "null"] },
|
||||
"signoff_certificate_type": { "type": ["string", "null"], "description": "AP, IA, A, P, REPAIR_STATION, REPAIRMAN, PILOT, OTHER, or null" },
|
||||
"signoff_certificate_number": { "type": ["string", "null"] },
|
||||
"page_start": { "type": "integer" },
|
||||
"page_end": { "type": "integer" },
|
||||
"confidence": { "type": "string", "enum": ["high", "medium", "low"] }
|
||||
},
|
||||
"required": ["date", "log_type", "entry_type", "text", "aircraft_hours", "signoff_person", "signoff_location",
|
||||
"page_start", "page_end", "confidence"],
|
||||
"signoff_certificate_type", "signoff_certificate_number", "page_start", "page_end", "confidence"],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
# The aircraft's maintenance status as 14 CFR 91.417(a)(2) lists it:
|
||||
# total time in service (airframe, engines, propellers), life-limited parts,
|
||||
# time since overhaul, inspection status, AD status and major alterations.
|
||||
class MaintenanceReport
|
||||
attr_reader :aircraft, :generated_at
|
||||
|
||||
def initialize(aircraft)
|
||||
@aircraft = aircraft
|
||||
@generated_at = Time.current
|
||||
end
|
||||
|
||||
def time_in_service = aircraft.current_hours
|
||||
|
||||
# Engines and propellers, by component type name.
|
||||
def engines = major_components(/engine/i)
|
||||
def propellers = major_components(/propell?er|\bprop\b/i)
|
||||
|
||||
# Parts with a mandatory replacement time (life limits).
|
||||
def life_limited
|
||||
in_use.select { |c| c.replacement_critical? && (c.replacement_hours || c.replacement_days) }
|
||||
end
|
||||
|
||||
# Items overhauled on a time basis.
|
||||
def overhaul_items
|
||||
in_use.select { |c| c.tbo_hours || c.tbo_days }
|
||||
end
|
||||
|
||||
def inspections = @inspections ||= Compliance.inspection_rows(aircraft)
|
||||
def ads = @ads ||= Compliance.ad_rows(aircraft)
|
||||
def major_records = aircraft.major_records.recent_first.includes(:component, :form_337_document, :stc_document)
|
||||
def open_squawks = aircraft.squawks.active.by_priority.includes(:component)
|
||||
def airworthiness = aircraft.airworthiness
|
||||
|
||||
private
|
||||
|
||||
def in_use = @in_use ||= aircraft.components.in_use.includes(:component_type).order(:install_location).to_a
|
||||
|
||||
def major_components(pattern) = in_use.select { |c| c.component_type&.name.to_s.match?(pattern) }
|
||||
end
|
||||
Reference in new issue
Block a user