Building a Demonstrable Interface
Explore how to build a thin interface that collects inputs, calls working logic, and shows results tied to the current run. Understand how to handle empty, invalid, and replaced inputs without showing stale results, and how to plan a timed demo route, preparing you to show your work truthfully in under five minutes.
Designing the opening screen
Review stock levels and identify reorder recommendations. The application does not place orders. Display this scope statement before the coordinator interacts with the application.
A stock coordinator uses a local browser application to upload a CSV file, review reorder recommendations, and investigate invalid records. The coordinator places orders outside the application.
The opening screen must display the following input requirements and workflow constraints:
Required CSV columns:
sku,on_hand, andreorder_point.Validation: Both
on_handandreorder_pointmust contain nonnegative integers. Theskufield must not be blank.Review output: The review generates reorder recommendations and identifies invalid rows that require correction.
Execution: All calculations run locally. The application does not submit purchase orders.
A thin interface accepts user inputs, invokes the existing business logic, and displays results without duplicating decision logic. Every displayed result must correspond to the input and execution that generated it.
Use Streamlit for this example to support the required browser-based file upload and result display. A command-line interface (CLI) would be sufficient if the brief required only command-line interaction. Other lightweight options, such as Gradio, may also meet the requirements. The assignment does not mandate a specific framework.
Choosing the minimal controls
One CSV uploader and an explicit “Review stock” button are enough. Before visual polish, provide the inputs, execution action, useful outputs, supporting evidence, and actionable empty and error states.
After processing, show:
The current filename and execution mode:
Local input , local calculation.Counts accounting for every input row: Reorder, no reorder, or review.
Recommendations containing SKU,
on_hand,reorder_point, proposed quantity, and source row.Review items containing the available SKU, source row, rejected value or missing field, and correction guidance.
An explicit no-reorder message handles a successful run with no recommendations. Charts, login, hosting, editable grids, and automated purchasing have no required job here. The coordinator can correct verified values in the local CSV and rerun.
Building the Streamlit app
Keep this example in its own folder; it does not change earlier examples or a shared README. The prerequisites are Python 3.11 or later and the Streamlit dependency installed below.
Create ...