Fluids and magnetism

This commit is contained in:
Codex
2026-03-07 21:46:23 +00:00
parent 067d615b53
commit f1afaa6d3a
4 changed files with 113 additions and 42 deletions

View File

@@ -6,6 +6,60 @@ BASE_DIR = Path(__file__).resolve().parent
CALCLIST = BASE_DIR / 'calculators_list.md'
OUTPUT_FILE = BASE_DIR / 'hdyc-svelte/src/lib/data/calculators.ts'
FLUID_KEYWORDS = [
'flow',
'mass flux',
'volumetric',
'permeability',
'viscosity',
'kinematic',
'surface tension',
'molar',
'concentration',
'flux density',
'flow rate',
'gallon per',
'gallons per',
'liter per',
'liters per',
'cubic per',
'cubic meter per',
'cubic meters per',
'cubic foot per',
'cubic feet per',
'cubic inch per',
'cubic inches per',
'kg per',
'kilogram per',
'kilograms per',
'gram per',
'grams per',
'g per',
'lb per',
'lbs per',
'pound per',
'pounds per',
'mole per',
'moles per',
'mol per',
'mmol per',
'percent by mass',
'ppm',
'heat transfer coefficient',
'per square meter',
'per square metre',
'per square foot',
'per square inch',
'per square centimeter',
'per square centimetre',
'per cubic meter',
'per cubic metre',
'per cubic foot',
'per cubic inch'
]
CURRENCY_KEYWORDS = ['currency', 'exchange rate', 'forex']
def load_external_descriptions():
# Placeholder for future enrichment sources.
return {}
@@ -55,11 +109,14 @@ def split_conversion_name(name):
def guess_category(name):
name_l = name.lower()
if any(keyword in name_l for keyword in CURRENCY_KEYWORDS):
return 'currency'
if any(keyword in name_l for keyword in FLUID_KEYWORDS):
return 'fluids'
if any(x in name_l for x in ['acre-foot', 'acre-feet', 'acrefoot', 'acre feet']):
return 'volume'
if 'temp scale' in name_l or 'newton (temp' in name_l:
return 'temperature'
if any(x in name_l for x in ['flow', 'mass flux', 'volumetric', 'permeability', 'viscosity', 'kinematic', 'surface tension', 'molar', 'concentration', 'flux density', 'flow rate']): return 'fluids'
if any(x in name_l for x in ['force', 'torque', 'newton', 'dyne', 'foot-pound']): return 'force'
if any(x in name_l for x in ['acre', 'hectare', 'square']): return 'area'
if any(x in name_l for x in ['meter', 'inch', 'feet', 'yard', 'mile', 'cable', 'fathom', 'rod', 'chain', 'nautical', 'league']): return 'length'
@@ -306,10 +363,12 @@ export const categories: Record<string, { label: string; icon: string }> = {
weight: { label: 'Weight / Mass', icon: '⚖️' },
temperature: { label: 'Temperature', icon: '🌡️' },
volume: { label: 'Volume', icon: '🧪' },
fluids: { label: 'Fluids', icon: '💧' },
area: { label: 'Area', icon: '📐' },
speed: { label: 'Speed / Velocity', icon: '💨' },
pressure: { label: 'Pressure', icon: '🔽' },
energy: { label: 'Energy', icon: '' },
currency: { label: 'Currency', icon: '💱' },
magnetism: { label: 'Magnetism', icon: '🧲' },
power: { label: 'Power', icon: '🔌' },
data: { label: 'Data Storage', icon: '💾' },