RAF Uniform NSN Finder
Based on British Army size chart from Johnsons of Leeds
Step 1: Define NSN data for uniform items
This is an example – you would replace with the actual mapping from the chart
uniform_data = {
“beret”: [
{“size_cm”: 54, “nsn”: “8405-99-123-4567”},
{“size_cm”: 55, “nsn”: “8405-99-123-4568”},
{“size_cm”: 56, “nsn”: “8405-99-123-4569”},
],
“shirt”: [
{“collar_in”: 14, “nsn”: “8405-99-234-5678”},
{“collar_in”: 15, “nsn”: “8405-99-234-5679”},
{“collar_in”: 16, “nsn”: “8405-99-234-5680”},
],
“trousers”: [
{“waist_in”: 30, “leg_in”: 30, “nsn”: “8405-99-345-6789”},
{“waist_in”: 32, “leg_in”: 32, “nsn”: “8405-99-345-6790”},
{“waist_in”: 34, “leg_in”: 32, “nsn”: “8405-99-345-6791”},
]
}
Step 2: Function to find best match based on closest measurement
def find_best_match(item_list, criteria):
best_match = None
smallest_diff = float(“inf”)
for item in item_list:
diff = 0
for key, value in criteria.items():
if key in item:
diff += abs(item[key] - value)
if diff < smallest_diff:
smallest_diff = diff
best_match = item
return best_match
Step 3: Get user measurements
print(“Enter your measurements:”)
height = int(input("Height (cm): "))
head_size = int(input("Head size (cm): "))
collar_size = float(input("Collar size (inches): "))
chest_size = int(input("Chest size (inches): "))
waist_size = int(input("Waist size (inches): "))
seat_size = int(input("Seat size (inches): "))
leg_size = int(input("Leg length (inches): "))
Step 4: Match NSNs
beret_match = find_best_match(uniform_data[“beret”], {“size_cm”: head_size})
shirt_match = find_best_match(uniform_data[“shirt”], {“collar_in”: collar_size})
trousers_match = find_best_match(uniform_data[“trousers”], {“waist_in”: waist_size, “leg_in”: leg_size})
Step 5: Output recommendations
print(“\nBest NSN recommendations for your measurements:”)
print(f"Beret: {beret_match[‘nsn’]} (Size {beret_match[‘size_cm’]} cm)“)
print(f"Shirt: {shirt_match[‘nsn’]} (Collar {shirt_match[‘collar_in’]} in)”)
print(f"Trousers: {trousers_match[‘nsn’]} (Waist {trousers_match[‘waist_in’]} in, Leg {trousers_match[‘leg_in’]} in)")