Spaces:
Sleeping
Sleeping
Commit History
2 days ago
-
Update dependencies and fix runtime bugs found in audit
Dependencies - Pin Streamlit 1.67.0 and Python 3.12 via README sdk_version/python_version - Update all packages to current releases (pandas 3.1, numpy 2.5, plotly 7.1, PyMuPDF 2.1, Pillow 13, OpenCV 5, reportlab 5.1, google-genai 3.1, firebase-admin 7.7, Document AI 3.17) - Remove unused packages: langchain, langchain-core, langchain-community, langchain-google-genai, langsmith, google-generativeai (deprecated), fpdf2, imageio, python-docx, python-dotenv, pyyaml - Add beautifulsoup4 (used for HTML table parsing) and packages.txt with tesseract-ocr so the Tesseract OCR fallback works on Spaces Streamlit API - Replace deprecated use_container_width=True with width="stretch" (136 calls) - Replace deprecated st.components.v1.html with st.iframe via embed_html helper Bug fixes - CropDrive parent-window listener script had a JS syntax error (doubled braces in a non f-string), so language/config messages were never handled - OCR: missing `io` import broke PDF-to-image conversion…3f62288
-
Simplify results analysis flow and remove streaming progress helpers
Mark CuizonDrop streamlit_runtime progress callbacks and connection-abort special-casing so analysis uses a simpler UI update path.156f38b -
Simplify OCR structured JSON and fix results metadata display
Mark CuizonStreamline upload OCR sample formatting and structured JSON extraction. Fix seasonal datetime usage and stop filtering core step metadata fields from results UI.abdb5ed
-
Harden Gemini model selection and hide fallback error metadata
Mark Cuizon3c12ca1 -
Fix results rendering and Gemini fallback robustness
Mark Cuizon3e1ad08 -
refactor: simplify Step 2/3 results, severity thresholds, and analysis progress UI
Mark CuizonRestore simpler recommendation display and MPOB severity matching in analysis/results, and streamline Streamlit step progress updates during AI analysis.e30538d -
fix: Step 2 real issues, clean Step 1/3 formatting, stop empty re-extract
Mark CuizonKeep pre-extracted soil/leaf parameter_statistics instead of wiping them. Rebuild Step 2 from real averages with correct severity thresholds. Format Step 3 solutions as cards; strip ### and raw Action/Headers dumps; skip placeholder tables.95837b5 -
fix: analysis progress UI, Gemini models, and Step 2/3/5 results
Mark CuizonShorten AI progress labels to stop duplicating full step prompts. Prefer gemini-2.5-pro/flash. Rebuild Step 2/3/5 narratives from real issues and economic forecast when LLM returns placeholders. Route Step 2 and 5 through dedicated renderers and hide empty Issues Source dumps.f8d30ca
-
Merge hf/main: resolve conflicts, keep HF fixes and translations
Mark Cuizona5c3983 -
fix-bodystreambuffer-hf
Mark Cuizon8f155fd
-
Add Malay/Indonesian translation coverage and switch to Gemini 3.1
Mark Cuizonf746550
-
Fix data visualization errors in Step 1 - improve error handling and validation for bar charts
8b27ac1 -
Update app.py, results.py, and translations.py
0540f42 -
Fix Step 1 bar chart display errors - add comprehensive validation and error handling
a6cd531
-
Fix Step 6 placeholder table issue - filter out error placeholder tables
66f28c2
-
Fix Malaysian language translations for Step 6 PDF titles and chart labels
c4a4c9c -
Update results.py
e286985 -
Update results.py
fb9e860
-
Update results, pdf_utils, and translations
329ee7f -
Fix translation for Step 6 yield forecast headers and chart titles in results page and PDF utils
412d66d -
Fix Step 6 translation issues - Translate all graph elements, axis labels, year labels, investment scenarios, and footnotes to Malaysian language
fb7fb3f -
Fix Step 2 missing formatted_analysis display in Malaysian language - Add formatted_analysis and detailed_analysis display to display_step2_issue_diagnosis function
d270421 -
Update app.py, results.py, pdf_utils.py, and translations.py
2f19080 -
Add Malaysian language translations for step results and PDF reports
- Added translate_content_labels() function to replace English labels (Analysis::, Summary::, Detailed Analysis::, Formatted Analysis::) in step results content - Applied translations to all step display functions (steps 1-6) - Translated all hardcoded English strings in PDF generation: - Header sections (Analysis Results, Analysis Date, Report Types) - Step titles and descriptions - Section headers (Summary, Detailed Analysis, Data Tables, Key Findings) - Economic Impact Forecast labels - Yield Forecast labels - Added automatic table header translation in PDF table creation - Removed blank Solution Recommendations section from Step 3 PDF - Added missing translation keys for PDF sections6d52594 -
Update results.py
ecb5e1d
-
Fix Malaysian language translations for step titles and analysis results headers
- Fixed hardcoded 'Step {number}' text to use translation function - Ensured all step titles (Step 1-6) are properly translated - Fixed 'Additional Analysis Results' header to use translation - Added translation for sub-headers: Analysis, Summary, Detailed Analysis, Formatted Analysis - Fixed 'Detailed Interpretations' headers to use translation - Added translate_llm_headers() function to translate English headers in LLM output - Applied translations to summary and detailed analysis text sectionsd934d06 -
Update results.py with additional translation fixes
f7a1772 -
Fix Malaysian language translations for step titles and analysis results headers - Translate all step titles (Step 1-6) to Malaysian - Fix STEP/LANGKAH prefix translation - Translate Additional Analysis Results header - Translate sub-headers (Analysis, Summary, Formatted Analysis, Detailed Interpretations) - Fix Economic Impact Analysis messages - Ensure all tables display properly in both languages
4217c16 -
Add Malaysian language translation for all analysis results text including step titles and headers
f099144 -
Fix: Sort nutrient gap analysis table by severity and gap magnitude
- Fix magnitude parsing to handle '%' character properly - Ensure table is sorted: Critical > Low > Balanced, then by gap magnitude descending - Update table title to use translation (Jadual 2 in Malaysian, Table 2 in English) - Remove '%' suffix from magnitude values for proper numeric sortinga4c3adb -
Fix: Improve table formatting in Step 3 and Step 6
- Convert <br> tags to proper line breaks in formatted_analysis - Extract and render markdown tables properly in Step 3 formatted analysis - Extract and render markdown tables properly in Step 6 content - Improve paragraph splitting and display formatting for better readability5ed085c -
Fix: Translate step titles and fix table placeholders in Step 5
- Added translation support for step titles (Steps 2-6) including patterns like 'Diagnose Agronomic Issues', 'Recommend Solutions', etc. - Fixed table placeholder rendering in Step 5 to replace __TABLE_PLACEHOLDER_X__ with actual economic forecast tables - Enhanced translate_step_title() function to handle more step title patterns - Updated display_formatted_economic_tables() to accept analysis_data and replace placeholders with real tables - Added Malaysian translation keys for step title patterns9de4c72
-
Fix Step 6 errors and analysis limit enforcement - Fix 'str' object has no attribute 'get' error in forecast graph - Fix interpretations and key_findings display formatting issues - Fix analysis limit check order to use updated session state - Add proper type validation for forecast data
197ef6c -
Update results.py
11a73b0 -
Update results.py with improvements and fixes
5bcdb7e -
Update results.py - code cleanup and optimizations
e38b436
-
Fix analysis history display and Step 1 table formatting - Fix Firestore timestamp to use datetime objects for proper query ordering - Add cache clearing after analysis save for immediate history display - Improve Step 1 table formatting with styled HTML tables and color-coded status
334991e
-
Fix ANALYSIS_COMPLETE message format to match integration guide - Remove userId from message (website uses authenticated user ID) - Remove timestamp from top-level message - Update local function to call integration function first - Add validation for required message fields - Fix all fallback messages to match guide format - Improve Step 1 table formatting with proper styling and descriptions
c651656
-
fix: Complete data table formatting and LLM content label translation
- Fixed data table formatting issues in formatted analysis section for all steps (1-6) - Added missing apply_table_styling() and translate_column_headers() calls to all dataframes - Implemented translate_llm_content_labels() function to translate LLM-generated content labels - Added translation keys for common LLM content labels: • Analysis: → Analisis: • Summary: → Ringkasan: • Detailed Analysis: → Analisis Terperinci: • Formatted Analysis: → Analisis Terformat: - Applied label translation to all LLM-generated content before display - Ensured all data tables show proper formatting with translated column headers - Fixed inconsistent table styling across step-by-step analysis sections - All data tables now display correctly with proper Malaysian translations Data tables in formatted analysis now show proper formatting for all steps, and all LLM content labels (Analysis:, Summary:, Detailed Analysis:) are properly translated to Malaysian when the language is switched.023d7c3 -
feat: Implement comprehensive formatted data tables for all analysis steps
- Fixed critical f-string syntax errors preventing table translations from working - Created unified formatted comparison table showing soil and leaf results vs MPOB standards - Implemented proper HTML table formatting with localized headers and content: • Parameter (parameter name) • Sumber/Source (Tanah/Daun - Soil/Leaf) • Purata/Average (average values) • Piawaian MPOB/MPOB Standard (MPOB standard ranges) • Jurang/Gap (calculated difference from standards) - Updated display_overall_results_summary_table() to show formatted comparison table - Updated display_comprehensive_data_tables() to use same formatted approach - Added comprehensive MPOB standards mapping for all soil and leaf parameters - Implemented gap calculation logic for different standard formats (> X, X-Y ranges) - Added translation keys for all table headers and content - Ensured formatted tables appear in all analysis steps (1-6) through main analysis flow - Tables automatically switch between English and Mal…d584695 -
fix: Complete step-by-step results section localization
- Fixed critical f-string syntax errors where {t('detailed_analysis', 'Detailed Analysis')} was displaying literally instead of being evaluated - Added comprehensive translation keys for all remaining hardcoded headers in step-by-step results: • 📋 Summary → 📋 Ringkasan • 📋 Detailed Analysis → 📋 Analisis Terperinci • 📊 Data Tables → 📊 Jadual Data • 🔍 Detailed Interpretations → 🔍 Tafsiran Terperinci • 💰 Economic Forecast → 💰 Ramalan Ekonomi • 📈 Investment Scenarios → 📈 Senario Pelaburan • 📋 Key Assumptions → 📋 Andaian Utama • 🌱 Raw Soil Sample Data → 🌱 Data Sampel Tanah Mentah • 📊 Economic Analysis Tables → 📊 Jadual Analisis Ekonomi • 📊 Economic Impact Analysis → 📊 Analisis Kesan Ekonomi • 📋 Complete Analysis Tables → 📋 Jadual Analisis Lengkap - Corrected all f-string syntax errors (missing 'f' prefix) that prevented translation functions from executing - Updated all step-by-step analysis section headers to use translation functions - Ensured a…b0e9312 -
feat: Complete Malaysian localization for step headers and analysis sections
- Add comprehensive translation keys for all remaining hardcoded headers - Update all step display headers to use translation functions: • 📋 Summary → 📋 Ringkasan • 📋 Detailed Analysis → 📋 Analisis Terperinci • 📊 Data Tables → 📊 Jadual Data • 🔍 Detailed Interpretations → 🔍 Tafsiran Terperinci - Update step title generation to use translated step titles instead of dynamic English • Step 1: Data Analysis → Langkah 1: Analisis Data • Step 2: Issue Diagnosis → Langkah 2: Diagnosis Isu • All step titles (1-6) now properly localized - Add translation keys for step-specific headers and analysis sections - Ensure all step-by-step analysis headers switch between English and Malaysian - Maintain existing PDF localization while improving web interface translations All section headers, step titles, and analysis display elements in the results page now provide complete bilingual support, ensuring Malaysian users see all content in Bahasa Malaysia when the language toggle is a…4950b71 -
feat: Complete Malaysian localization for all results page headers
- Add comprehensive translation keys for all hardcoded section headers - Update all results page section titles to use translation functions: • Comprehensive Data Analysis Tables → Jadual Analisis Data Komprehensif • Soil Parameter Averages → Purata Parameter Tanah • All Soil Sample Values → Semua Nilai Sampel Tanah • Leaf Analysis Summary → Ringkasan Analisis Daun • All Leaf Sample Values → Semua Nilai Sampel Daun • Combined Analysis Summary → Ringkasan Analisis Gabungan • Step-by-Step Analysis → Analisis Langkah Demi Langkah • Key Findings → Penemuan Utama • Specific Recommendations → Cadangan Khusus • Additional Analysis Results → Keputusan Analisis Tambahan • Analysis Results → Keputusan Analisis - Update HTML content in step display functions to use translated headers - Ensure all user-facing text in results page switches between English and Malaysian - Maintain existing PDF localization functionality All section headers, titles, and user interface elements …a09a243 -
feat: Complete Malaysian language localization for results page
- Add comprehensive translation keys for results page elements - Replace all hardcoded English strings with translation function calls - Add translate_column_headers() function for DataFrame column translation - Fix data table formatting with proper localized column headers - Ensure PDF utils maintain existing translation support - Test translation functions for both English and Malaysian languages Changes include: - utils/translations.py: Added missing translation keys and Malaysian translations - modules/results.py: Replaced hardcoded strings and added column header translation All results page elements, data tables, and user interface text now properly switch between English and Malaysian languages.9707d9d
-
feat: Implement AI Assistant Integration Guide
- Update CONFIG message handling to store user config in window.userConfig - Enhance ANALYSIS_COMPLETE message sending with proper format and sessionStorage backup - Add REQUEST_CONFIG_UPDATE functionality for config synchronization - Implement comprehensive error handling with safePostMessage function - Add automatic config update requests after analysis completion - Improve bidirectional communication between AI assistant and CropDrive website99cf00c -
Fix: Add REQUEST_CONFIG_UPDATE after ANALYSIS_COMPLETE and enhanced logging
- Added REQUEST_CONFIG_UPDATE message requests after sending ANALYSIS_COMPLETE - Increased delay to 2 seconds to allow parent time to process ANALYSIS_COMPLETE - Added backup request after 5 seconds - Enhanced logging for upload count updates - Added warnings about parent website needing to increment upload count - Improved CONFIG message handling to update URL params NOTE: Parent website MUST increment upload count when it receives ANALYSIS_COMPLETE. If parent sends CONFIG with old count, it will overwrite optimistic update.7a7eafd -
Fix: Add optimistic upload count update after ANALYSIS_COMPLETE
- Added optimistic upload count increment in Python session state before sending ANALYSIS_COMPLETE - Added optimistic update in JavaScript sessionStorage and URL params - Updated upload.py to always read from URL params (most up-to-date source) - Enhanced CONFIG message handling with logging - Added CONFIG_UPDATE handler for non-reload updates - Ensures upload count (e.g., 0/2 used) updates immediately after analysis completes - Multiple update mechanisms ensure count stays in syncddd3171 -
Fix: Enhanced ANALYSIS_COMPLETE message delivery with multiple strategies
- Added sessionStorage backup storage for analysis results - Implemented multiple origin attempts ('*' and 'https://www.cropdrive.ai') - Added window.top fallback for message delivery - Multiple retry attempts with delays (100ms, 500ms, 1000ms) - Added delayed backup send (200ms) in show_results_page - Enhanced error handling and logging throughout - Ensures message reaches parent window even if first attempt failsb5d9b97 -
Fix: Enhanced ANALYSIS_COMPLETE message sending with robust error handling
- Improved user_id retrieval from multiple sources with detailed logging - Fixed JSON serialization with make_serializable() function - Enhanced JavaScript error handling with validation and retry logic - Changed html component height from 0 to 1 to ensure rendering - Added comprehensive fallback error handling - Ensured all message values are JSON-serializable (strings/numbers/None/bool) - Added detailed logging throughout the message sending process - Fixed issue causing 'Sending minimal ANALYSIS_COMPLETE message due to error'2bcabfa -
Fix: Send ANALYSIS_COMPLETE message after results are displayed
- Added ANALYSIS_COMPLETE message sending in show_results_page() after results are ready - Fixed JSON serialization errors by simplifying analysisData field - Enhanced JavaScript error handling with retry logic - Improved logging throughout the message sending process - Ensures message is sent when results are actually available, not just after processing - Message now sent in two locations for redundancy0383eb3