Refactor: manual operator reporting as primary fault ingestion path - #75
Open
AdamRidene wants to merge 1 commit into
Open
Refactor: manual operator reporting as primary fault ingestion path#75AdamRidene wants to merge 1 commit into
AdamRidene wants to merge 1 commit into
Conversation
…path Legacy machines without digital connectivity are the norm in mid-size plants. Previously the system treated MQTT as the default and manual input as a demo simulation; this inverts that model. Changes ------- - source field on WorkOrder and FaultIn, defaulting to 'manual' - ManualFaultForm always visible, machine as <select>, 'Simulate' button removed from both dashboards - Standalone mobile-optimized operator page at /operator/report (3-tap submission, RTL-ready, dark mode) - MQTT made purely opt-in (empty broker URL by default, listener conditional, health check returns configured: False) - SourceBadge component showing manual/mqtt provenance in table - GET /api/fault-codes endpoint with caching - Fault code hints filtered by selected machine on operator page - Dedup: handle_fault checks for recent (machine, fault_code) within 30s window to avoid duplicate work orders - Dashboard quick-link card pointing to /operator/report - Landing copy, FAQ, i18n updated to describe three-tier model (manual / REST / MQTT) with no hardware required for Tier 1 - README documents the three-tier ingestion architecture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Hackathon feedback: the target audience is maintenance managers in mid-size Tunisian plants (textile, agro-food, plastics, mechanical) where machines are 10-30 years old with no PLCs, no SCADA, no digital connectivity. The system was originally built assuming MQTT as the default ingestion path, with manual input treated as a
SIM_FAULTSdemo button -- the exact opposite of what real users need.Solution
Invert the architecture: make manual operator reporting the primary (and default) path, and treat MQTT as an optional Tier 3 upgrade.
Three-tier ingestion model
Key changes
sourcefield onWorkOrderandFaultInschemas (defaults to"manual"), tracked through the entire pipeline so operators and MQTT-sourced faults are distinguishable/operator/report/operator/report): pure HTML/CSS/JS, 3-tap submission (select machine -> tap fault code -> submit), RTL-ready, dark mode by default, loads machines and fault codes from API/operator/reportwith QR-friendly linkManualFaultFormrefactored: always visible (no collapsible toggle), machine field changed from free-text to<select>dropdown populated fromGET /api/machinesSourceBadgecomponent: shows manual (amber) or mqtt (blue) in work order table rows"", listener only starts when non-empty, health endpoint returns{"configured": false, "connected": false}, dashboard health bar shows muted grey dotGET /api/fault-codesendpoint with in-memory caching to populate hintshandle_faultchecks for an existing work order with the same (machine, fault_code) within a 30-second window before creating a new oneFiles changed
Verification