FMEA Example
[1]:
import os
import pandas as pd
import numpy as np
import sys
sys.path.append(os.path.join("..","..","..",".."))
from mika.kd.NER import *
from mika.kd import FMEA
from torch import cuda
Define Severity Calculation
To get a severity column, define a severity function that creates a numeric value of severity from the data
[2]:
def calc_severity(df):
severities = []
for i in range(len(df)):
severities.append(safecom_severity(df.iloc[i]['Hazardous Materials'], df.iloc[i]['Injuries'], df.iloc[i]['Damages']))
df['severity'] = severities
return df
def safecom_severity(hazardous_mat, injury, damage):
key_dict = {"No":0, "Yes":1}
severity = key_dict[hazardous_mat] + key_dict[injury] + key_dict[damage]
if np.isnan(severity):
severity=0
return severity
Initiate FMEA
create object
load model
load data
[3]:
model_checkpoint = "NASA-AIML/MIKA_BERT_FMEA_NER"
[4]:
fmea = FMEA()
fmea.load_model(model_checkpoint)
file = os.path.join(os.path.abspath(os.path.join(os.getcwd(), os.pardir, os.pardir, os.pardir, os.pardir)),"data/SAFECOM/SAFECOM_UAS_fire_data.csv")
input_data = fmea.load_data(filepath=file, formatted=False, text_col='Text', id_col='Tracking #')
Predict Entities
[5]:
preds = fmea.predict()
df = fmea.get_entities_per_doc()
Post Process
[6]:
manual_cluster_file = os.path.join(os.getcwd(),"SAFECOM_UAS_clusters_V1.xlsx")
fmea.group_docs_manual(manual_cluster_file, grouping_col='Mode', additional_cols=['Mission Type'])
fmea.calc_severity(calc_severity)
fmea.get_year_per_doc('Date')
fmea.calc_frequency('Year')
fmea.calc_risk()
fmea.post_process_fmea(id_name='SAFECOM', max_words=10)
[6]:
Phase | Cause | Failure Mode | Effect | Control Process | Recommendations | Frequency | Severity | Risk | SAFECOM | |
---|---|---|---|---|---|---|---|---|---|---|
cluster | ||||||||||
Battery | Reconnaissance; Infrared Imagery | “ b, button, not, could, issue, battery level ... | hard, landing, depleted, battery, 40 percent, ... | dropping, 10, percent, lost, fell at close to ... | assumed manual, control, bringing it down, man... | batteries will be, tracked on an individual, l... | 2 | 0.333333 | 0.666667 | 19-0295 |
Casing dislodged | Reconnaissance; Infrared Imagery | fuselage, cowling on the aircraft was, missing... | battery hatch cover disengaged from the, motor... | hit, motors, shut down, the, small, nick, debr... | propeller and battery hatch cover were, replac... | replace | 2 | 0.000000 | 0.000000 | 21-0015 |
Communications/flight navigation with UAS failed | Infrared Imagery; External Load (Longline) | no contact with, operation, not know about, mi... | positive contact with a, uas operation, failed... | flight navigation software on the computer sta... | confirmed frequencies and mission, parameters,... | separation, contact, gain, approvals, and plan... | 2 | 0.000000 | 0.000000 | 17-0971 |
Employee personal drone usage without certification/official approval | Initial Attack; Reconnaissance; Aerial Ignitio... | did not recall any discussion of uas, use, nan... | ua, was put, the, litter | away, not, consuming, needle | 1420 acre prescribed, burn, uas was, aerial, p... | check the fire, activity, the, fuels, size of,... | 2 | 0.000000 | 0.000000 | 19-0448 |
Engine Failure | Other; Infrared Imagery | remained in guided, mode, attempting to mainta... | a33n engine, failed, aircraft, failure of the,... | ua, ) was, aircraft then, spiral, and, crashed... | aircraft, landing, monitoring the, visually, c... | with another, replace current mission planner,... | 3 | 0.500000 | 1.500000 | 20-0822 |
Fight plan error | Reconnaissance; Infrared Imagery; Air Attack | location of the, fire, placement of the launch... | uas aggressively changed its angle of, attack,... | ground, sustained, significant, damage, higher... | heat, flight, safety and operational, briefing... | detect any, remaining, map their, perimeters, ... | 3 | 0.500000 | 1.500000 | 20-1303 |
Hang Fire | Aerial Ignition | form of, visible, hang fire, functioned, melte... | a, hang, fire, on, aircraft gave a, hatch moti... | in, flight, fires, fire | vo assisted the pilot, resetting the ignis per... | follow, immediately, using the, camera, ensure... | 1 | 0.000000 | 0.000000 | 20-0872 |
High wind pushes UAS off course | Reconnaissance | propeller, strike, side gust of, hit a, landin... | wind, off, target, ground was, struck, breakin... | in guided, mode, automated rtl, landing, area,... | relocate, larger, area, clear of all, obstacle... | 2 | 0.500000 | 1.000000 | 18-0847 | |
Hobbyist offers services | Initial Attack | mission, no, t | fire, department, camera - equipped, drone, wa... | fly, will not be, allowed, faa, accreditation,... | 1 | 0.000000 | 0.000000 | 15-0166 | ||
Inappropriate Landing Site | Infrared Imagery | pilot was landing on the landing, pad, black, ... | portion of the skid landed on the, ” ), rise, | landing, upside, minor, damage, to, rotors | lift, pic, moving both sticks to forward | taking, more time to, level out uneven, surfac... | 1 | 1.000000 | 1.000000 | 21-0761 |
Landing Gear Failure | Aerial Ignition | position, screws that hold the landing gear se... | lift the landing gear, flight, failed to, rais... | the landing, gear | through the preflight, checklist, manually cyc... | 1 | 0.000000 | 0.000000 | 20-0495 | |
Loss of GCS | Reconnaissance; Aerial Ignition; Infrared Imagery | error, combination, thermal, signal, controlle... | in flight, failure, gsc, disconnection, error,... | immediately, ignis, warning, crash from, separ... | reset the home, point, noted the gps, location... | management, pulling flight logs and, video, en... | 3 | 0.333333 | 1.000000 | 21-0027 |
Loss of GPS on UAS | Reconnaissance; Other; Infrared Imagery | erratic, nose of the aircraft was pointed at, ... | of, solo made contact with, solo lost, gps, wi... | experienced loss, gps, tree, loss of, control,... | initiate, remote, controller, the last, traini... | should have been, suspended, or, cancelled, ha... | 3 | 0.400000 | 1.200000 | 21-0138 |
Loss of LOS | Aerial Ignition | had, lost, of the aircraft, position, and the,... | with a, broken, broken arm locking, ignis hous... | aircraft, collided, tree, tilted and, fell abo... | a hand held led, light, spot the, pad, exactly... | having the, visual observer 90, degrees, off o... | 1 | 1.000000 | 1.000000 | 20-0949 |
Loss of control | Reconnaissance; Infrared Imagery | left wing aileron servo was, sticking, aircraf... | rapid and uncommanded, descent, roll and, airc... | steep, aircraft, dropped and hit the, feed and... | no, monitored instruments, programmed flight, ... | be, inspected and, tested, at, facility, , com... | 3 | 0.666667 | 2.000000 | 20-1042 |
Manned Aircraft Intrusion | Infrared Imagery | altitude, aircraft, no tail, tower did not rec... | tfr, inc, aircraft operating, turned north, of... | lost, visual, northwest, presence, , the | preflight checklist /, inspection, a controls,... | made, and, avoid, discussed, being, vigilant, ... | 3 | 0.000000 | 0.000000 | 20-0641 |
Motor Mount Failure | Aerial Ignition; Infrared Imagery | m600 motor mount, separation, motor was, the m... | flight failure to, went into, uncontrolled, ya... | loss of, control, impacted, terrain, aircraft,... | maintenance, performed, lander gear, full, qui... | reduce the payload, weight, reduction of numbe... | 3 | 1.000000 | 3.000000 | 21-0876 |
Motor failure | Reconnaissance | failed attempts to control the left, positive ... | right rear motor, failed, ya, of, motors, fail... | arch and, melt the surrounding, plastic, melte... | aircraft was re positioned over the, road, lan... | thorough, inspection | 3 | 1.000000 | 3.000000 | 19-0628 |
Parachute Landing Failure | Infrared Imagery | chu, fully, parachute was packed, incorrectly,... | deploy, partial, opening, the, canopy | hard, fuselage was, damaged, e, been | checked all parachute, on, confirmed proper | site, packing, use a, buddy, check | 1 | 1.000000 | 1.000000 | 18-0821 |
Pilot Error | Aerial Ignition; Infrared Imagery | intense, smoke, cover, were, line, resources h... | fire, growth, indirect, crews, pulled off the,... | significant, impacted, multiple, sl, overs, no... | ) infrared, video and ir, resource was, awoken... | access, overs, imagery, and emergency, protoco... | 3 | 0.500000 | 1.500000 | 21-0934 |
Pins or needles dislodged | Reconnaissance; Aerial Ignition | mounted, position, space, pins, had, loose, no... | red puncture motion, error, puncture needle wa... | damage, abnormalities | error, stayed within the burn, unit, initiated... | inspect the, needles, to, ensure the proper al... | 3 | 0.000000 | 0.000000 | 21-0169 |
Propellor arm disconnect (sheared bolt heads or snaps) | Aerial Ignition; Aerial Ignition (Prescribed);... | heads on a propeller bolt had, normal, aircraf... | missing, separate bolt head had, sheared, loud... | snap, descended and, impacted the, ground, 4, ... | photo, was, propeller assembly was, rebuilt, t... | check propeller, bolts, and, document all bolt... | 2 | 1.000000 | 2.000000 | 19-0298 |
UAS Intrusion | Initial Attack; Retardant Drop (Airtanker); Wa... | system, heavy, smoke, erratic fire, conditions... | firefighters, a, recreational type unmanned ai... | immediately, cease, leave the, catastrophic, f... | tfr was put in place, was, ua, confronted, and... | wide circulation of, events, go, taken, mainta... | 4 | 0.067227 | 0.268908 | 20-0151 |
UAS airspace separation issue | Other; Aerial Ignition; Infrared Imagery | stationary, hove, clearance, altered, hovering... | unmanned aerial, came in close proximity of on... | passed by the, ua, attack, halted the su, mome... | aerial supervision was in place, were made awa... | avoid, , rather than, agl, same altitude, clea... | 3 | 0.000000 | 0.000000 | 20-1091 |
misc | Infrared Imagery | nan | 1 | 1.000000 | 1.000000 | 21-0859 |