Skip to content

Instantly share code, notes, and snippets.

@philshem
Last active December 26, 2017 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save philshem/3015de98de26df1681635244c95186aa to your computer and use it in GitHub Desktop.
Save philshem/3015de98de26df1681635244c95186aa to your computer and use it in GitHub Desktop.
python script to parse NEISS tsv files
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import glob
import csv
# export options - default is just CSV
csv_tf = True #.csv
db_tf = False #.sl3 sqlite3 db
pickle_tf = False #.pkl pickle
hdf5_tf = False #.h5
json_tf = False #.json
prefix = 'neiss'
csv_sep = '\t'
def main(file_list=[]):
if len(file_list)==0:
file_list = glob.glob('nss*.tsv')
cols = ['case_id','trmt_date','psu','weight','stratum','age','sex','race','race_other','diag','diag_other','body_part','disposition','location','fmv','prod1','prod2','narr1','narr2']
for f in file_list:
print f
# create temp dataframe per file
# full options - http://pandas.pydata.org/pandas-docs/stable/generated/pandas.read_csv.html
tt = pd.read_csv(f, sep='\t', names=cols, header=1, quoting=csv.QUOTE_NONE, low_memory=False, \
skipinitialspace=True, warn_bad_lines=True, error_bad_lines=False, \
parse_dates=False, \
) #nrows =10000)
# add sourcefile to data
tt['sourcefile'] = f
tt['trmt_date'] = pd.to_datetime(tt.trmt_date, format='%m/%d/%Y').dt.date
# create real dataframe, or append to it if it exists already
if 'df' in locals() or 'df' in globals():
df = pd.concat([df,tt], axis=0)
else:
df = tt
# set index after adding new file
df.set_index('case_id')
print tt.shape[0],'records from',f
# exit loop over raw data
# clean data in one data frame
print df.shape[0],'records in combined output'
# decoding sex
conditions = [ (df.sex == 1), (df.sex == 2), (df.sex == 0)]
choice = ['Male', 'Female', 'Not recorded']
df['sex'] = np.select(conditions, choice, default=df.sex)
# decoding age
df['age'] = np.where(df.age==0, np.NaN , df.age)
df['age'] = np.where(df.age>199, ((df.age - 200)/12), df.age)
# decoding race
conditions = [ (df.race == 1), (df.race == 2), (df.race == 3), (df.race == 4), (df.race == 5), (df.race == 6), (df.race == 0) ]
choice = ['White', 'Black/African American', 'Asian', 'American Indian/Alaska Native', 'Native Hawaiian/Pacific Islander', 'Other', 'Not Stated in ED record']
df['race_text'] = np.select(conditions, choice, default=df.race)
# decoding location
conditions = [ (df.location == 1), (df.location == 2), (df.location == 4), (df.location == 5), (df.location == 6), (df.location == 7), (df.location == 8), (df.location == 9), (df.location == 0) ]
choice = ['Home', 'Farm/ranch', 'Street or highway', 'Other public property', 'Mobile/Manufactured home', 'Industrial', 'School/Daycare', 'Place of recreation or sports','Not recorded']
df['location'] = np.select(conditions, choice, default=df.location)
# decoding fire involvement
conditions = [ (df.fmv == 1), (df.fmv == 2), (df.fmv == 3), (df.fmv == 0)]
choice = ['Fire involvement and/or smoke inhalation - Fire Dept. attended', \
'Fire involvement and/or smoke inhalation - Fire Dept. did not attend', \
'Fire involvement and/or smoke inhalation - Fire Dept. attendance is not recorded', \
'No fire involvement or fire involvement not recorded']
df['fire_involvement'] = np.select(conditions, choice, default=df.fmv)
df.drop('fmv', axis=1, inplace=True)
# decoding hospital strata
conditions = [ (df.stratum == 'C'), (df.stratum == 'V'), (df.stratum == 'L'), (df.stratum == 'M'), (df.stratum == 'S') ]
choice = ['Children\'s Hospitals', 'Very Large Hospitals', 'Large Hospitals', 'Medium Hospitals', 'Small Hospitals']
df['hospital_stratum'] = np.select(conditions, choice, default=df.stratum)
df.drop('stratum', axis=1, inplace=True)
# renaming hospital id
df.rename(columns={'psu': 'patient_service_unit'}, inplace=True)
df.rename(columns={'weight': 'psu_weight'}, inplace=True)
# decoding disposition
conditions = [ (df.disposition == 1), (df.disposition == 2), (df.disposition == 4), (df.disposition == 5), (df.disposition == 6), (df.disposition == 8), (df.disposition == 9)]
choice = ['Treated and released or examined and released without treatment', \
'Treated and transferred to another hospital', \
'Treated and admitted for hospitalization (within same facility)', \
'Held for observation', \
'Left without being seen/Left against medical advice (AMA)', \
'Fatality, including DOA, died in the ED, brain dead', \
'Not recorded']
df['disposition'] = np.select(conditions, choice, default=df.disposition)
# decoding diagnosis
diag_dict = {50 : u'Amputation'
,65 : u'Anoxia'
,42 : u'Aspirated foreign object'
,72 : u'Avulsion'
,48 : u'Burns, scald (from hot liquids or steam)'
,51 : u'Burns, thermal (from flames or hot surface)'
,49 : u'Burns, chemical (caustics, etc.)'
,73 : u'Burns, radiation (includes all cell damage by ultraviolet, x-rays, microwaves, laser beam, radioactive materials, etc.)'
,46 : u'Burns, electrical'
,47 : u'Burns, not specified'
,52 : u'Concussions'
,53 : u'Contusions, Abrasions'
,54 : u'Crushing'
,60 : u'Dental injury'
,74 : u'Dermatitis, Conjunctivitis'
,55 : u'Dislocation'
,67 : u'Electric shock'
,56 : u'Foreign body'
,57 : u'Fracture'
,58 : u'Hematoma'
,66 : u'Hemorrhage'
,41 : u'Ingested foreign object'
,62 : u'Internal organ injury'
,59 : u'Laceration'
,61 : u'Nerve damage'
,68 : u'Poisoning'
,63 : u'Puncture'
,64 : u'Strain or Sprain'
,69 : u'Submersion (including Drowning)'
,71 : u'Other/Not Stated'}
df['diag'] = df.diag.replace(diag_dict)
# decoding body part
body_dict = {33 : u'Arm, lower (not including elbow or wrist)'
,80 : u'Arm, upper'
,37 : u'Ankle'
,94 : u'Ear'
,32 : u'Elbow'
,77 : u'Eyeball'
,76 : u'Face (including eyelid, eye area and nose)'
,92 : u'Finger'
,83 : u'Foot'
,82 : u'Hand'
,75 : u'Head'
,0 : u'Internal (use with aspiration and ingestion)'
,35 : u'Knee'
,36 : u'Leg, lower (not including knee or ankle)'
,81 : u'Leg, upper'
,88 : u'Mouth (including lips, tongue and teeth)'
,89 : u'Neck'
,38 : u'Pubic region'
,30 : u'Shoulder (including clavicle, collarbone)'
,93 : u'Toe'
,79 : u'Trunk, lower'
,31 : u'Trunk, upper (not including shoulders)'
,34 : u'Wrist'
,84 : u'25-50% of body'
,85 : u'All parts of body (more than 50% of body)'
,87 : u'Not recorded'}
df['body_part'] = df.body_part.replace(body_dict)
# decoding product codes, with merge
pc = parse_product_codes()
df['prod1_text'] = df.prod1.astype(float).replace(pc)
df['prod2_text'] = df.prod2.astype(float).replace(pc)
# combine narrative fields, if they exist
try:
df['narr'] = df.narr1 + ' ' + df.narr2
df.drop('narr1', axis=1, inplace=True)
df.drop('narr2', axis=1, inplace=True)
except:
pass # old files don't have narrative
# write data to sqlite3 database
if db_tf:
import sqlite3
cnx = sqlite3.connect(prefix+'.sl3')
df.to_sql(con=cnx, name=prefix+'_t', if_exists='replace', index=True)
if csv_tf:
df.to_csv(prefix+'.csv',sep=csv_sep, encoding='utf-8')
if json_tf:
d = df.to_json(prefix+'.json', orient='records', date_format='iso', date_unit='s')
if False: # testing
import json
with open(prefix+'.json','rb') as i:
j = json.load(i)
print json.dumps(j[-1],indent=4)
# http://stackoverflow.com/a/17098736/2327328
if pickle_tf:
df.to_pickle(prefix+'.pkl')
# to read
#df = pd.read_pickle(file_name)
if hdf5_tf:
import HDFStore
store = HDFStore(prefix+'.h5')
store['df'] = df
# load it
# store['df'] # load it
def parse_product_codes():
with open('product_codes.tsv','rb') as p:
pc = pd.read_csv(p,sep='\t')
pc['product_code'] = pc.product_code.map(float)
return pc.set_index('product_code').T.to_dict(orient='index').get('product_text')
if __name__ == "__main__":
#print parse_product_codes()
#main()
#file_list = glob.glob('raw_data\\*.tsv')
#for f in file_list:
main()
product_code product_text
0102 Wringer washing machines
0106 Electric clothes dryers without washers
0107 Gas clothes dryers without washers
0110 Electric heating pads
0112 Sewing machines or accessories
0113 Floor buffers or waxers
0114 Rug shampooers
0115 Vacuum cleaners
0116 Electric brooms
0118 Gas water heaters
0119 Electric water heaters (excluding immersion heaters)
0125 Water softeners or conditioners (appliances)
0127 Clothes dryers, not specified
0131 Propane, LP or butane gas tanks or fittings
0132 Electric blankets or sheets
0133 Other water heaters
0134 Water heaters, not specified
0136 Drinking fountains
0137 Automatic doors or door openers (excluding garage doors)
0138 Automatic garage doors or door openers
0139 Incinerators
0140 Washing machines, other or not specified
0212 Electric corn poppers
0213 Electric can openers
0214 Dishwashers
0215 Electric blenders
0216 Electric counter-top ovens, broilers or toaster ovens
0217 Electric coffee makers or teapots
0218 Electric or battery-powered knives
0219 Electric deep fryers
0221 Food warmers
0222 Electric frying pans and skillets
0223 Electric griddles
0224 Hot plates
0227 Ice makers (separate from refrigerators)
0231 Electric mixers
0232 Electric scissors
0234 Toasters (excluding toaster ovens)
0235 Electric waffle irons
0236 Faucet water heaters
0237 Garbage disposers
0240 Electric knife sharpeners
0241 Rotisseries
0242 Electric immersion water heaters
0252 Trash compactors
0255 Clothes steamers
0263 Freezers (separate from refrigerators)
0264 Microwave ovens
0268 Slow cookers
0269 Electric kettles or hot pots
0270 Ice crushers
0271 Juicers
0274 Ice cream makers
0275 Food processors
0276 Refrigerators
0277 Clothing irons
0278 Electric ranges or ovens (excl. counter-top ovens)
0279 Gas ranges or ovens
0280 Other ranges or ovens
0281 Ranges or ovens, not specified
0304 Humidifiers
0305 Vaporizers
0306 Dehumidifiers
0307 Air purifiers
0308 Boilers
0309 Coal furnaces
0310 Gas furnaces (excluding floor furnaces)
0311 Oil furnaces (excluding floor furnaces)
0312 Electric baseboard heaters
0316 Wood burning fireplaces, factory built
0318 Electric furnaces (excluding floor furnaces)
0322 Furnaces, other or not specified
0334 Gas-burning fireplaces, factory built
0336 Built-in fireplaces
0340 Thermostats (for heating or cooling systems)
0342 Fireplaces, not specified
0346 Electric fireplaces, factory built
0348 Portable electric heaters
0365 Heat pumps
0367 Coal or wood-burning stoves
0371 Ductwork for heating or cooling systems (excluding flues)
0372 Brick, stone or masonry chimneys
0373 Metal chimneys, stovepipes or flues
0374 Pipes (excluding smoking pipes)
0378 Chimneys, not specified
0379 Radiators (excluding vehicle radiators)
0380 Fans
0381 Air conditioners
0384 Floor furnaces (built into floor)
0388 Electric heaters, not elsewhere classified
0390 Heat tapes, electric
0391 Portable gas or LP heaters
0392 Gas or LP heaters, other or not specified
0393 Heaters or heating systems, other or not specified
0394 Outdoor patio heaters or firepits (manufactured)
0399 Kerosene or oil heaters
0401 Nonelectric can openers
0405 Unpowered coffee makers or teapots
0408 Ironing boards or covers
0412 Pressure cookers or canners
0413 Waste containers, trash baskets or refuse bins
0416 Corkscrews
0417 Flatware (excluding knives)
0419 Tie racks, belt racks or other clothes hangers
0420 Manual scissors
0421 Nonelectric knife sharpeners
0422 Bottle openers
0427 Ice picks
0428 Kitchen gadgets, not elsewhere classified
0429 Food skewers
0431 Toothpicks or hor d'oeuvres picks
0432 Trays (excluding food warmers)
0434 Doorstops
0435 Kitchen mixing bowls, canisters or similar containers (excluding plastic products)
0436 Potholders, oven mitts or hot pads
0438 Laundry baskets
0443 Drinking straws
0444 Knife sharpeners, not specified
0450 Scissors, not specified
0452 Coffee makers or teapots, not specified
0453 Can openers, not specified
0460 Metal cookware (nonelectric; excluding pressure cookers and canners)
0461 Nonmetal cookware (nonelectric)
0462 Chafing dishes or fondue pots
0463 Candles, candlesticks and other candle holders
0464 Knives, not elsewhere classified
0465 Other cookware
0466 Cookware, not specified
0469 Slicers and choppers
0471 Food grinders
0474 Tableware and accessories (excluding drinking glasses)
0477 Thermometers (excluding medical thermometers)
0478 Drinking glasses
0480 Manual cleaning equipment (excluding buckets or pails)
0481 Bread making machines
0482 Appliances, other or not specified
0519 Television tables or stands
0529 Telescopes, binoculars, microscopes or magnifying glasses
0530 Phonograph records
0531 Recording tapes
0532 Glass bottle cutting equipment
0533 Lapidary equipment
0536 Photographic equipment (excluding chemicals and projectors)
0545 Amateur two-way radios
0546 Stereo or hi-fi components or accessories (excluding self-contained units)
0547 Sound recording, reproducing or receiving equipment, not specified
0549 Projectors
0550 Telephones or telephone accessories
0552 Antennas, not specified
0555 Radios (self-contained units; excluding two-way radios)
0556 Tape recorders or players (self-contained units)
0557 Computers (equipment and electronic games)
0558 Indoor antennas (separate)
0559 Radios, not specified
0561 Outdoor antennas (separate)
0562 Laser pointers
0563 Record players (self-contained units)
0565 Musical instruments, electric or battery operated
0566 Musical instruments, not electric or not battery operated or not specified
0567 Coaxial Cable
0569 Art and ceramic supplies or equipment (excl. paintbrushes)
0571 Business and office machines
0572 Televisions
0573 Other sound recording, reproducing or receiving equipment
0574 Remote control, universal or not stated (excl. remote controls for toys)
0575 Compact disks (CDs) and DVDs
0576 Video players and recorders (excl. cameras)
0604 Desks, dressers, chests, bureaus, or buffets
0606 Generators or power plants
0609 Glass bathtub or shower enclosures
0610 Nonglass bathtub or shower enclosures
0611 Bathtubs or showers (including fixtures or accessories; excluding enclosures, faucets, spigots and towel racks)
0612 Runners, throw rugs or doormats (excluding bathtub mats)
0613 Room-sized, wall-to-wall or outdoor carpeting (excluding runners)
0617 Draperies, curtains or shower curtains (fabric or plastic)
0618 Stepladders (excluding step stools)
0620 Step stools
0623 Butane or LP gas meters
0627 Light bulbs (excluding Christmas tree light bulbs)
0628 Electric chandeliers, hanging lamps or other attached light fixtures
0638 Window shades, venetian blinds or indoor shutters
0639 Flashlights or battery-powered lanterns
0648 Sinks (excluding faucets)
0649 Toilets
0650 Slipcovers
0651 Table linens
0652 Pictures, picture frames or wall decorations
0653 Artificial flowers or plants
0654 Knickknacks, statues, vases or urns
0657 Towel racks or bars
0661 Bunk beds
0662 Waterbeds or water pillows
0663 Fireplace equipment
0666 Towels or cloths
0667 Bedspreads, throws or comforters
0669 Clothespins
0670 Chair, recliner
0671 Chair, rocking
0672 Laundry hampers
0676 Rugs or carpets, not specified
0679 Sofas, couches, davenports, divans or studio couches
0680 Convertible beds, hideaway beds or sofa beds
0685 Extension cords
0687 Benches (excluding work benches)
0689 Blankets, not specified
0692 Magazine racks or book ends
0693 Footlockers
0698 Hot tubs or home spas
0699 Faucets or spigots
0701 Fire extinguishers
0702 Fire or smoke alarms
0704 Burglar alarms
0706 Lightning rods or arresters, antenna discharge units or other grounding devices
0707 Padlocks, chain locks or other locks
0709 Safes
0710 Electric timers
0711 Fire escape devices (excluding ladders)
0712 Carbon monoxide detectors
0713 Fire sprinklers
0803 Power sanders
0804 Power routers
0805 Power lathes
0807 Power jointers
0808 Power shapers
0809 Other portable or stationary power tools
0814 Hoists, lifts, jacks or jack stands
0815 Electrical testing equipment
0819 Electric motors (separate)
0820 Internal combustion engines (nonvehicular)
0821 Automotive tools or accessories
0823 Air compressors (separate)
0827 Hammers
0828 Screwdrivers
0829 Manual drills
0830 Hand saws
0832 Portable circular power saws
0833 Workshop compounds or chemicals
0834 Heavy-duty workshop staplers
0835 Toolboxes or tool kits (excluding tools)
0836 Knives with replaceable blades
0837 Wire, not specified
0841 Bench or table saws
0842 Band saws
0843 Radial arm saws
0845 Saws, not specified
0847 Drills, not specified
0852 Rope or string (excluding mountain climbing or jump ropes and kite strings)
0854 Workshop furnishings
0855 Portable power drills and accessories
0856 Stationary power drills and accessories
0857 Pliers, wire cutters or wrenches
0858 Reamers
0859 Soldering equipment, not specified
0862 Manual filing or sanding tools
0864 Sabre saws
0866 Electric soldering equipment
0868 Nonelectric soldering equipment
0869 Glue guns
0870 Awls, chisels or planes
0871 Power drills or accessories, not specified
0874 Cutting torches
0875 Jigsaws
0877 Trouble lights or extension work lights
0878 Levels
0879 Vises or workshop clamps
0880 Drain snakes
0881 Other manual workshop tools
0882 Nail guns or stud drivers
0883 Battery chargers/adapters
0884 Batteries
0885 Chains, not elsewhere classified
0886 Stretch cords or stretch straps
0887 Painting equipment, powered (including sprayers, rollers or brushes)
0888 Sprayers, not elsewhere classified
0890 Torches, not specified
0893 Tools, not specified
0894 Hacksaws
0895 Power saws, other or not specified
0896 Welding equipment
0897 Power workshop grinders, buffers or polishers
0898 Manual workshop grinders, buffers or polishers
0899 Workshop grinders, buffers, or polishers, not specified
0904 Floor waxes
0905 Furniture polishes or waxes
0908 Paint or varnish thinners (excluding turpentine)
0909 Adhesives (excluding tapes)
0910 Gasoline
0913 Lubricants
0914 Dry ice
0915 Methyl alcohol
0917 Charcoal
0920 Caulking or spackling compounds
0921 Chemicals, not elsewhere classified
0925 Paintbrushes or rollers, manual
0926 Photographic chemicals
0927 Tapes (with adhesive surfaces)
0929 Drain cleaners
0930 Ammonia, household
0931 Metal polishes, tarnish removers or preventatives
0932 Shoe polishes
0933 Turpentine
0934 Dishwasher detergents
0936 Acids (excluding drain cleaners and battery acids)
0937 Rust removers
0938 Swimming pool chemicals
0940 Lighter fluids
0941 Fuels for chafing dishes or fondue pots
0942 Oven cleaners
0945 Pine oil cleaning and disinfectant preparations
0949 Laundry soaps or detergents
0951 Toilet bowl products
0952 Fabric treatment products (excluding spot removers, cleaning fluids, bleaches and dyes)
0953 Abrasive cleaners
0954 General purpose household cleaners (excluding abrasives, ammonia, pine oil and toilet bowl products)
0955 Automotive chemicals (excluding antifreeze, lubricants, waxes and windshield wiper fluids)
0956 Bleaches (noncosmetic)
0957 Dyes (noncosmetic)
0958 Other polishes
0959 Polishes, not specified
0960 Paints, varnishes or shellacs
0961 Rust preventatives
0962 Diesel fuels
0963 Kerosene
0964 Lamp oils
0965 Fuel oils, not specified
0966 Antifreeze
0967 Windshield wiper fluids
0968 Caustics (excluding lye)
0969 Lye
0970 Wallpaper cleaners (chemical)
0971 Wallpaper steamers
0972 Paint or varnish removers, paintbrush cleaners (excluding turpentine)
0973 Liquid room deodorizers or fresheners
0974 Solid room deodorizers or fresheners
0975 Room deodorizers or fresheners, not specified
0976 Detergents, not specified
0977 Spot removers or cleaning fluids
0978 Automotive waxes, polishes or cleaners
0979 Dishwashing liquid
0980 Fuel storage tanks (excluding propane, LP and butane tanks)
0981 Gasoline cans
0982 School laboratory chemicals
0983 Soaps (excluding laundry soaps or detergents)
0984 Solvents, other or not specified
1023 Fertilizers, not specified
1053 Fertilizers and other chemicals for outdoor use (excluding pesticides)
1062 Tractors, other or not specified
1102 Vacuum containers
1103 Self-contained openers (e.g., zip-top or pull-top cans)
1107 Other containers (excluding vacuum or pressurized containers)
1112 Metal containers (excluding aerosols, trash and gasoline cans)
1114 Cardboard products
1116 Containers with key openers
1120 Glass soft drink bottles
1122 Glass alcoholic beverage bottles
1123 Plastic containers (rigid or semi-rigid, excluding bottles and jars)
1124 Glass tubing or test tubes
1125 Wooden containers
1127 Nonglass bottles or jars (excluding baby bottles)
1128 Paper bags
1130 Plastic bags
1131 Plastic wrapping products (excluding plastic bags)
1133 Aerosol containers
1134 Other glass bottles or jars
1135 Bottles or jars, not specified
1136 Canning jars or lids
1137 Paper products (excluding bags, cups, straws and cardboard products)
1138 Pressurized containers (nonaerosol; excluding alcoholic beverage or soft drink bottles and cans)
1139 Aluminum foil wrapping products
1140 Glass bottles or jars, not specified
1141 Containers, not specified
1143 Buckets or pails
1144 Bags, not elsewhere classified
1145 Other specified plastic products
1200 Sports and recreational activity, not elsewhere classified
1205 Basketball (activity, apparel or equipment)
1206 Bowling (activity, apparel or equipment)
1207 Boxing (activity, apparel or equipment)
1208 Croquet (activity, apparel or equipment)
1211 Football (activity, apparel or equipment)
1212 Golf (activity, apparel or equipment)
1213 Golf carts
1215 Lacrosse (activity, apparel or equipment)
1217 Sleds
1233 Trampolines
1234 Treehouses or playhouses
1235 Archery (activity, apparel or equipment)
1237 Gas, air or spring-operated guns (including BB guns)
1239 Horseback riding (activity, apparel or equipment)
1240 Aquariums or accessories
1242 Slides or sliding boards (excluding swimming pool slides)
1243 Seesaws or teeterboards
1244 Monkey bars, playground gyms or other playground climbing apparatus
1257 Horseshoes (activity, apparel or equipment)
1258 Mountain climbing (activity, apparel or equipment)
1260 Billiards or pool (activity, apparel or equipment)
1261 Surfing (activity, apparel or equipment)
1264 Water skiing (activity, apparel or equipment)
1266 Volleyball (activity, apparel or equipment)
1267 Soccer (activity, apparel or equipment)
1269 Table tennis (activity, apparel or equipment)
1270 Wrestling (activity, apparel or equipment)
1271 Batons
1272 Gymnastics (activity, apparel or equipment; excluding trampolines)
1273 Toboggans
1274 Snow disks
1275 Scuba diving (activity, apparel or equipment)
1276 Tetherball (activity, apparel or equipment)
1277 Swimming pool slides
1278 Diving or diving boards
1279 Ice hockey (activity, apparel or equipment)
1282 Handball (activity, apparel or equipment)
1283 Unicycles
1284 Swimming pools, not specified
1290 Snowmobiles (activity, apparel or equipment)
1293 Amusement attractions (including rides)
1294 Bleachers
1295 Field hockey (activity, apparel or equipment)
1299 Snow tubing (activity, apparel or equipment)
1301 Tricycles (children's)
1309 Kites or kite string
1310 Pogo sticks
1313 Fireworks
1314 Rocketry sets
1319 Metal or plastic molding sets
1322 Children's play tents, play tunnels or other enclosures
1325 Inflatable toys (excluding balls & balloons)
1326 Blocks, stacking toys or pull toys
1327 Nonwheeled riding toys, unpowered (e.g., rocking or bouncing horses, etc.)
1328 Wagons (children's)
1329 Scooters, unpowered
1330 Powered riding toys
1333 Skateboards
1338 Toy bows or arrows
1342 Costumes or masks
1344 Toy musical instruments
1345 Building sets
1346 Clacker balls
1347 Balloons (toy)
1349 Stilts
1350 Squeeze or squeaker toys
1352 Slingshots or sling-propelled toys
1353 Toy boxes or chests
1354 Marbles
1362 Woodburning kits
1365 Water toys (excluding squeeze or squeaker toys and inner tubes or similar flotation equipment)
1376 Molding compounds
1381 Toys, not elsewhere classified
1389 Other toy weapons (nonprojectile)
1390 Toy guns, not specified
1392 Toy sports equipment
1393 Chemistry sets or science kits
1394 Dolls, plush toys, and action figures
1395 Toys, not specified
1398 Wheeled riding toys, unpowered (excluding bicycles and tricycles)
1399 Toy guns with projectiles
1401 Power lawn mowers, not specified
1402 Manual push mowers (unpowered)
1403 Other unpowered garden tools
1405 Garden tractors
1406 Snow throwers/blowers
1407 Garden sprayers
1408 Power tillers or cultivators (not farm equipment)
1409 Other power garden tools
1411 Chain saws
1413 Greenhouse or gardening supplies (excluding plant stands, tools, hoses, sprayers and chemicals)
1414 Garden hoses, nozzles or sprinklers
1415 Manual snow or ice removal tools
1422 Riding power lawn mowers
1425 Wheelbarrows or lawn carts
1426 Hatchets or axes
1427 Power hedge trimmers
1430 Seed and fertilizer spreaders
1431 Grass and leaf catchers (attachments for lawn mowers)
1432 Animal traps
1433 Power leaf mulchers and grinders
1439 Lawn mowers, not specified
1441 Lawn vacuums
1445 Plant foods or fertilizers for potted plants
1447 Pruning or trimming equipment, not specified
1448 Rotary power lawn mowers (walk-behind)
1449 Manual hedge trimmers
1450 Manual lawn trimmers or edgers
1452 Outdoor electric lighting equipment
1453 Other manual pruning or trimming equipment
1454 Other power pruning or trimming equipment
1455 Manual pruning or trimming equipment, not specified
1456 Power pruning or trimming equipment, not specified
1457 Log splitters
1460 Insect traps, powered
1461 Leaf blowers
1462 Pumps, not elsewhere classified
1463 Brushcutters, powered
1464 Lawn trimmers or edgers, powered (excluding brushcutters)
1465 Decorative yard equipment, excluding water features
1466 Decorative water features, including man-made ponds and fountains
1502 Baby changing tables
1505 Baby carriages
1506 Baby gates or barriers
1508 Baby walkers or jumpers
1509 Baby bottles or nipples
1510 Bottle warmers
1511 Sterilizers (home use)
1512 Diapers
1513 Playpens and play yards
1515 Baby scales
1517 Baby rattles
1519 Car seats (for infants or children)
1520 Baby exercisers
1522 Baby strollers
1524 Baby harnesses
1525 Pacifiers or teething rings
1526 Crib mobiles or crib gyms
1527 Baby carriers or slings (backpacks)
1528 Diaper pails
1529 Portable cribs
1531 Baby carriers (bicycle-mounted)
1533 Night-lights
1535 Potty chairs or training seats (for children)
1537 Bassinets or cradles
1539 Shoelace fasteners (for infants)
1542 Baby mattresses or pads
1543 Cribs (excluding portable cribs)
1544 Baby baths or bathinettes
1545 Cribs, not specified
1548 Baby carriers, not specified
1549 Other baby carriers
1550 Infant and toddler play centers (excluding jumpers, bouncers, and exercisers
1551 Diaper fasteners (excluding safety pins)
1553 Portable baby swings (for home use)
1554 Safety pins
1555 High chairs
1556 Attachable high chairs (including booster seats)
1557 Baby bathtub seats or rings (not toys)
1558 Baby bouncer seats (excl jumpers)
1602 Hair dryers
1604 Cigarette or pipe lighters
1605 Wigs, falls or hairpieces
1607 Eye protection devices
1610 Massage devices or vibrators (excluding shower attachments)
1612 Saunas
1613 Electric shoe polishers
1615 Footwear
1616 Jewelry (excluding watches)
1617 Ear protection devices
1618 Respiratory protection devices
1619 Personal protection devices
1622 Watches
1623 Luggage (excluding foot lockers)
1625 Lighted make-up mirrors
1634 Heat or infrared lamps
1637 Electric combs
1638 Combs or hairbrushes, unpowered
1641 Clothes brushes
1643 Keys, key rings or key chains
1644 Nightwear
1645 Day wear
1646 Outerwear
1647 Clothing accessories
1650 Desk supplies (excluding pens and pencils)
1651 Combs, not specified
1654 Paper cutters
1658 Clothing, not specified
1659 Manicuring devices
1660 Umbrellas
1661 Nonelectric razors or shavers
1662 Hair grooming equipment or accessories, not specified
1664 Electric razors or shavers
1667 Razors or shavers, not specified
1669 Pins and needles (excluding safety pins and knitting needles)
1671 Sewing basket articles (excluding scissors, pins, needles and sewing machine accessories)
1677 Other clothing
1678 Bath or facial brushes
1679 Grocery or shopping carts
1680 Dollies, handtrucks or luggage carriers
1682 Hair curlers, curling irons, clips & hairpins
1683 Hair clippers and trimmers
1684 Carts, other or not specified
1685 Pens and pencils
1686 Coins
1687 Lighters, not specified
1688 Fuel multi-purpose lighters (incl. micro torches)
1689 Electric multi-purpose lighters
1690 Multi-purpose lighters, not specified
1701 Artificial Christmas trees
1711 Christmas tree lights
1712 Christmas tree stands or supports
1714 Seasonal decorations (excluding Christmas decorations)
1715 Pet supplies (excluding foods and medicines)
1718 Flares
1719 Lunch boxes or pails
1720 Party favors
1726 Lockers
1728 Matchbooks
1729 Christmas decorations (nonelectric)
1730 Wooden matches
1731 Matches, not specified
1733 Vending machines (excluding car washing machines)
1734 Music boxes or chimes
1735 Coin-operated car washing equipment
1736 Electric Christmas decorations (excluding Christmas tree lights)
1738 Public equipment, not elsewhere classified (including conveyor belts, signs)
1739 Ashtrays, electric or battery operated
1740 Ashtrays, not electric or not battery operated or not specified
1741 Tarpaulins
1742 Heating or cooling comfort packs (nonelectric)
1744 Motorized vehicles, not elsewhere classified (three or more wheels)
1803 Thermal or sound insulation materials
1807 Floors or flooring materials
1808 Outdoor awnings or shutters
1812 Gutters, drainpipes, downspouts or run-off pipes
1816 Scaffolding
1817 Porches, balconies, open-side floors or floor openings
1818 Cisterns, cesspools or septic tanks
1819 Nails, screws, carpet tacks or thumbtacks -> Nails, screws, tacks or bolts
1820 Cabinet or door hardware
1821 Clotheslines or clothes drying racks (excluding poles)
1826 Storm windows
1828 Window screens
1829 Handrails, railings or banisters
1840 Pull-down or folding stairs
1841 Mobile/manufactured homes
1842 Stairs or steps (excluding pull-down and folding stairs)
1843 Ramps or landings
1854 Plastic panels for doors or windows
1857 Artificial turf
1863 Wallpaper
1864 Counters or countertops (excluding bars)
1865 Poles (excluding fence posts, fishing, pole vaults and play-ground equipment)
1866 General home or room involvement in fires
1870 Windowsills or frames
1871 Fences or fence posts
1876 House repair or construction materials, not elsewhere classified
1878 Doorsills or frames
1884 Ceilings and walls (interior part of completed structure)
1885 Wood paneling and particleboard
1886 Garage doors (excluding automatic garage doors or door openers)
1887 Tool sheds
1888 Window or door security barriers
1889 Elevators or other lifts (excl. escalators, hoists, jacks, forklifts and automotive lifts)
1890 Escalators
1891 Moving walks
1892 Glass doors or doors with glass panels
1893 Doors, other or not specified
1894 Windows and window glass, other than storm windows
1895 Tree stands (hunting)
1897 Drywall in a completed structure
1898 Gas fumes or gas vapors of unknown origin
1899 Carbon monoxide poisonings (when source is unknown)
1913 Cosmetics, including facial and eye make-up, deodorants, hair preparations, nail polish and removers, bath oils, skin creams and lotions, etc.
1914 Veterinary medicines
1915 Liniments or rubbing compounds
1916 Preparations containing iron salts
1923 Aspirin or aspirin compounds
1926 Pesticides
1927 Liquid drugs (excluding aspirin, aspirin substitutes, iron preparations and antihistamines)
1928 Antihistamines
1929 Drugs or medications, not specified
1930 Aspirin substitutes
1931 Tablet or capsule drugs (excluding aspirin, aspirin substitutes, iron preparations and antihistamines)
1932 Other drugs or medications
1934 Hot water
1935 Gunpowder or ammunition (excluding BBs and pellets)
1936 BBs or pellets
2300 School equipment
2640 Oral hygiene products
3200 Water tubing (activity, apparel or equipment)
3202 Pedal-powered adult vehicles (three or more wheels)
3203 Skeet shooting (activity, apparel or equipment; excluding guns and ammunition)
3215 Mopeds or power-assisted cycles
3216 Roller skating (activity, apparel or equipment)
3217 Skating (activity, apparel or equipment) not specified
3218 Charcoal or wood-burning grills
3219 Other playground equipment
3221 Above-ground swimming pools (excluding portable pools)
3222 Badminton (activity, apparel or equipment)
3223 Fishing (activity, apparel or equipment; excluding fishing knives)
3224 Other guns or firearms
3229 Electric grills
3230 Kerosene grills or stoves
3233 Other grills or stoves
3234 Rugby (activity, apparel or equipment)
3235 Other ball sports (activity, apparel or equipment)
3236 Ball sports (activity, apparel or equipment), not specified
3245 Street hockey (activity, apparel or equipment)
3246 Swings or swing sets (excluding portable baby swings)
3247 Ice or snow boating (activity, apparel or equipment)
3248 Gas or LP grills or stoves (for outdoor use)
3249 Grills, not specified
3250 Portable food or beverage coolers
3251 Built-in swimming pools
3252 Sleeping bags
3253 Guns, not specified
3254 Cheerleading (activity, apparel or equipment; excluding batons)
3255 Ice skating (activity, apparel or equipment)
3256 Squash, racquet ball or paddle ball (activity, apparel or equipment)
3257 Martial arts (activity, apparel or equipment)
3259 Go-carts
3260 Fencing (activity, apparel or equipment)
3261 Shuffleboard (activity, apparel or equipment)
3262 Swimming pool equipment (excluding chemicals, diving boards and swimming pool slides)
3265 Weight lifting (activity, apparel or equipment)
3272 Hockey (activity, apparel or equipment), not specified
3273 Playground equipment, not specified
3274 Swimming (activity, apparel or equipment; excluding flotation devices)
3276 Water polo (activity, apparel or equipment)
3277 Exercise equipment (excluding weight lifting or gymnastic equipment)
3278 Dancing (activity, apparel or equipment)
3279 Flotation toys (excluding official life-saving devices)
3282 Curling (activity, apparel or equipment)
3283 Snow skiing (activity, apparel or equipment)
3284 Tennis (activity, apparel or equipment)
3285 All-terrain vehicles (three wheels only; exclusively off-road)
3286 All-terrain vehicles (four wheels, excluding dune buggies; exclusively off-road)
3287 All-terrain vehicles (number of wheels not specified; excluding dune buggies; exclusively off-road)
3288 Dune buggies/beach buggies
3289 Darts, for indoor use (activity or equipment)
3290 Darts, lawn (activity or equipment)
3291 Darts, not specified
3293 Water slides, not elsewhere classified
3294 Water slides, backyard/home (not swimming pool slides)
3295 Water slides, public (stationary amusement rides)
3296 All-terrain vehicles (more than four wheels; exclusively off-road)
3297 In-line skating (activity, apparel or equipment)
3299 Exercise (activity or apparel without equipment), including aerobics, stretching, walking, jogging, running (excluding track and field)
4002 Bedding, not specified
4004 Mirrors or mirror glass (excluding lighted make-up mirrors)
4005 Filters (excluding swimming pool and aquarium filters)
4008 Nonelectric blankets
4009 Nonbaby mattresses (excluding camp mattresses)
4010 Mattresses, not specified
4011 Inflatable furniture
4013 Other furniture
4014 Furniture, not specified
4016 Beach chairs or folding chairs
4025 Barstools or kitchen stools
4030 Bathtub or shower enclosures, not specified
4039 Other electric lighting equipment
4041 Electric lighting equipment, not specified
4042 Lighting equipment, not specified
4045 Fabrics (not part of finished item)
4047 Books, magazines, albums or scrapbooks
4050 Pillows (excluding water pillows)
4051 Sheets or pillowcases
4054 Other bedding
4055 Drapery or curtain rods, hooks or rings
4056 Cabinets, racks, room dividers and shelves, not elsewhere classified
4057 Tables, not elsewhere classified (excl. baby changing tables, billiard or pool tables and television tables or stands)
4058 Bars and bar accessories (excluding gymnastic and weight lifting equipment)
4060 Fuel-burning lighting equipment
4061 Electrical outlets or receptacles
4062 Electrical wire or wiring systems (excluding panelboards, receptacles or interrupters)
4063 Panelboards, circuit breakers, ground fault circuit interrupters (GFCIs) or fuses
4064 Futons
4065 Clocks, electric or battery operated
4066 Scales, electric or battery operated (excluding baby scales)
4067 Clocks, not electric or not battery operated or not specified
4068 Scales, not electric or not battery operated or not specified (excluding baby scales)
4069 Cots
4070 Floor lamps or table lamps, halogen
4071 Floor lamps or table lamps, electric (excluding halogen lamps)
4074 Chairs, other or not specified
4075 Bed rails
4076 Beds or bedframes, other or not specified
4077 Extension or straight ladders
4078 Ladders, other or not specified
4079 Footstools, ottomans or hassocks
4080 Stools, other or not specified
4081 Cords, electrical, other or not specified
4082 Toddler beds
4083 Surge suppressors or power strips
4084 Residential alternative energy systems for on-site power generation
4802 Straps, non-stretch, other, or not specified
5001 Other toy weapons (projectile)
5005 Riding toys (excluding bicycles and tricycles), not specified
5006 Other toy guns
5007 Toy weapons, not specified
5010 Crayons or chalk (excluding billiard or pool chalk)
5011 Book bags or back carriers (excluding baby carriers, luggage and camping equipment)
5013 Toy make-up kits or cosmetics (excluding mirrors)
5015 Toy caps, cap toys or cap guns
5016 Balls, other or not specified
5017 Flying discs and boomerangs
5018 Doll houses and other play scenes
5019 Games or game parts (excluding marbles and computer games)
5020 Pretend electronics, tools, housewares, and appliances
5021 Toy vehicles (excluding riding toys)
5029 Camping equipment (excl. trailers, lighting equipment, sleeping bags, cots, hammocks, coolers, stoves and heaters)
5030 Track and field (activity, apparel or equipment; excluding jogging or running for fitness)
5031 Snow boarding (activity, apparel or equipment)
5032 Roller hockey (activity, apparel or equipment)
5033 Mountain or all-terrain bicycles or accessories
5034 Softball (activity, apparel or equipment)
5035 Minibikes, powered
5036 Two-wheeled, powered, off-road vehicles (incl. dirt bikes and trail bikes; excl. mopeds and minibikes)
5037 Hammocks
5038 Fitness/activity tracker, personal (including pedometers and non-medical heart rate monitors)
5040 Bicycles or accessories (excluding mountain or all-terrain bicycles)
5041 Baseball (activity, apparel or equipment; excluding softball)
5042 Scooters/skateboards, powered
5043 Portable swimming pools
5044 Utility vehicles
5555 Substance ingested or inhaled by a victim under age 5 which could lead to a poisoning and for which there is no current product code.
@Chikimonki
Copy link

Missing parentheses? did you want to type (tf)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment