SShortSingh.
Back to feed

Price cleaner should flag unrecognized formats instead of guessing amounts

0
·1 views

A scraped price field can look clean after stripping non-digit characters, but this may distort its meaning, such as turning a range into a single number or a delivery fee into a price. The article recommends preserving the raw source value, deriving a separate amount, and attaching a status that downstream stages can inspect. It illustrates this with a narrow Python example that accepts only GBP amounts with exactly two decimal places and rejects ranges, grouped amounts, negatives, and other currencies. The author stresses that a value matching the grammar is not automatically the intended price, since parsing syntax does not establish business meaning. Missing inputs and unrecognized formats are kept distinct so that unmatched values remain available for review rather than being silently converted.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

osFoundry keeps resident Claude Code sessions cache-friendly during busy channels

osFoundry's Message channel feature lets a long-running Claude Code session stay responsive to repeated mentions without re-sending everything each turn. The desktop app keeps a live agent process per channel and binding, and only the newest user turn is sent to an already-warm process. Cold or restored sessions receive the full framing and replayed history instead. Channel context shows at most twelve recent unseen messages, truncated at 600 characters and tracked by a per-session watermark. A simulation, since the Claude binary is not installed on the author's Mac, is used to estimate the savings in cache-friendly prompt size.

0
ProgrammingDEV Community ·

Day 28 of React Learning: useContext, React Router, and Navigation Basics

The author explains how useContext lets components share data without passing props through every intermediate layer, avoiding props drilling. They describe React Router as a tool that displays the correct component based on the current URL, enabling page navigation without reloading the site. BrowserRouter is presented as managing browser navigation, while Routes and Route connect URL paths to specific components via the element prop. The post also covers Link for declarative navigation and the useNavigate hook for programmatic navigation, such as redirecting to /home after a button click. A comparison of Link and useNavigate concludes the learning notes.

0
ProgrammingDEV Community ·

Lévis startup MilhommeSI builds French-Quebec AI phone assistant for local SMEs

Alexandre Milhomme founded MilhommeSI in Lévis in 2026 and is building a product for small and medium businesses across Quebec. He argues that starting with local firms on the South Shore gives him context on seasonal call patterns and more candid feedback from business owners. The first version of the AI secretary, named Sarah, handles 24/7 phone answering in natural Quebec French, answers frequent questions, takes contact details, books appointments and sends follow-ups by text and email. Milhomme says the team is deliberately limiting early features so that testing stays focused on core functions, and he plans to document the product's development in future installments.

0
ProgrammingDEV Community ·

Finding and Fixing Memory Leaks in JavaScript and React Apps

A developer describes how a steadily climbing memory graph in DevTools revealed a leak that slowly degraded their app's performance. Memory leaks occur when forgotten references stop the garbage collector from freeing objects, and the usual culprits are unremoved event listeners, uncleared timers, fetches resolving after unmount, detached DOM nodes, unbounded caches, and third-party instances that are never destroyed. The article recommends a quick check using the Performance monitor's JS heap size to spot sustained growth. It then outlines a deeper workflow using heap snapshot comparisons, detached-node filtering, allocation sampling, and the React DevTools Profiler to identify components that mount and unmount excessively.