-------------------------------------------------------------------------------- Document ID : DAB-DASH-SPEC-V9-3-001 Title : Daralbeida Intelligence Hub — v9.3 Hardening Specification Version : 9.3 Status : DRAFT Date Created : 2026-05-01 Prepared by : PYB / Daralbeida Style : BPGP Department : OPS Classification: Internal Related Docs : DAB-DASH-SPEC-V9-4-001; bi.html (v9.3); api/newsdata_proxy.php Builds on : DAB-DASH-SPEC-V9.2 (superseded) -------------------------------------------------------------------------------- OUTLINE -------------------------------------------------------------------------------- 1. Purpose and Scope 2. Changes vs. v9.2 3. Feed Resolution Order — RSS Type 4. Feed Resolution Order — NewsData Type 5. Manual Intel Upgrades to Live Feeds 6. NewsData.io Integration 7. API Key Handling 8. Path Convention 9. UI Additions 10. Testing Checklist 11. Change Log 12. Files Shipped with This Specification 13. Acronyms 14. Glossary 15. Document Control ================================================================================ 1. PURPOSE AND SCOPE ================================================================================ This document specifies the v9.3 hardening changes to the Daralbeida Intelligence Hub (bi.html). The primary objective is to convert v9.2 brittleness into a redundancy-first feed architecture. v9.2 fails silently when a single endpoint (Google News, OOT, Specialty Food Association) rate- limits or returns zero items. v9.3 adds per-feed fallback, upgrades four Manual Intel cards to live feeds where feasible, and introduces a Morocco- native (FR/AR) intelligence layer via NewsData.io. ================================================================================ 2. CHANGES VS. V9.2 ================================================================================ Change Description --------------------------------------------------------------- 2.1 Every feed entry gains a Bing News RSS fallback endpoint. 2.2 Four Manual Intel cards (FDA, ONSSA, CBP, IWMI) upgraded to live feeds. 2.3 New Compliance tab added (absent in v9.2). 2.4 NewsData.io integrated for Morocco-native FR/AR queries. 2.5 Defensive image handling — fixes v9.2 crash on item.enclosure.link when enclosure is undefined. 2.6 Empty-feed detection triggers fallback fetch. 2.7 Per-card resolution tag: [PRIMARY] / [FALLBACK] / [NEWSDATA] / [QUIET]. 2.8 8-second timeout per feed, then skip. ================================================================================ 3. FEED RESOLUTION ORDER — RSS TYPE ================================================================================ Step 1 Fetch primary endpoint via rss2json proxy. Step 2 If primary returns 0 items OR errors, fetch Bing fallback via rss2json proxy. Step 3 If both return 0, render with [QUIET] tag; suppress card from sort buffer. ================================================================================ 4. FEED RESOLUTION ORDER — NEWSDATA TYPE ================================================================================ Step 1 Fetch api/newsdata_proxy.php with q/country/language params. Step 2 Proxy hits newsdata.io with server-side API key. Step 3 Response normalised to RSS-like shape by client. Step 4 Tag rendered as [NEWSDATA]. ================================================================================ 5. MANUAL INTEL UPGRADES TO LIVE FEEDS ================================================================================ Source Primary Endpoint Fallback --------------------------------------------------------------- IWMI iwmi.cgiar.org/feed/ (native) Bing News FDA Imports Google News site:fda.gov + DWPE terms Bing News ONSSA Google News site:onssa.gov.ma Bing News CBP Rulings Google News CBP olive oil rulings Bing News Note on RSSHub: the public rsshub.app instance has no confirmed route for FDA Import Alerts, ONSSA, or CBP rulings. Three upgrade paths documented for v9.4: Path A Self-host RSSHub on daralbeida.com subdomain (Docker, approximately $5/month VPS); build custom routes for the three portals. Path B Submit RSSHub route requests via the GitHub repo and wait for community coverage. Path C Write a thin PHP scraper at api/scraper_fda.php that emits RSS from the FDA Import Alerts HTML table. For v9.3, the Google News + Bing redundant pair is accepted as the working substitute. ================================================================================ 6. NEWSDATA.IO INTEGRATION ================================================================================ Parameter Value --------------------------------------------------------------- Free tier 200 requests/day; 10 articles per response Use case 1-3 Morocco-native cards refreshed on page load API key location api/newsdata_proxy.php (server-side only) Registration newsdata.io/register Default query huile olive OR (Arabic: olive oil) Default country ma Default language fr,ar Response mapping title, link, pubDate, image_url, description fields mapped to RSS shape by client JS ================================================================================ 7. API KEY HANDLING ================================================================================ Decision tree for API key storage: Is bi.html publicly served at daralbeida.com? YES: use PHP proxy (default delivered). Key sits in api/newsdata_proxy.php, never on the client. NO: key may be inlined in bi.html for simplicity. Swap noted at the bottom of bi.html (commented block). ================================================================================ 8. PATH CONVENTION ================================================================================ Deployment layout (sibling architecture): public_html/ bi.html css/ daralbeida_core.css (optional — not required for v9.3) api/ form_handler.php newsdata_proxy.php (NEW in v9.3) public_html/devt/ (sibling, not nested; lowercase) bi.html css/ api/ newsdata_proxy.php All URLs in bi.html use relative form: api/newsdata_proxy.php (NOT /api/... NOT https://...) ================================================================================ 9. UI ADDITIONS ================================================================================ 9.1 Card tag shows resolved source state: [PRIMARY] gold (#B8832A) [FALLBACK] ocean (#4A7C9E) [NEWSDATA] terracotta (#C4856A) [QUIET] charcoal (#2C3539) 9.2 Tab buttons count badge (live items / total cards). DEFERRED to v9.4 — adds complexity beyond hardening scope. 9.3 Empty panel state: "INTEL QUIET — NO ITEMS RETURNED." ================================================================================ 10. TESTING CHECKLIST ================================================================================ Pre-promotion from devt to production: [ ] Open bi.html in devt — all six tabs load without console errors. [ ] Manually break a primary URL (typo) — verify [FALLBACK] tag appears on that card's items. [ ] Manually break both primary and fallback — verify [QUIET] tag. [ ] Confirm api/newsdata_proxy.php returns valid JSON when hit directly with ?q=test&country=ma&language=fr. [ ] Verify NewsData.io key is NOT visible in browser DevTools Network tab response from the proxy. [ ] Confirm relative paths work in both production and devt deployment levels. ================================================================================ 11. CHANGE LOG ================================================================================ v9.3.0 Initial v9.3 spec. Bing fallback per feed. NewsData.io via PHP proxy. Compliance tab added. Manual Intel upgraded to live feeds for FDA, ONSSA, CBP, IWMI. Defensive image handling. ================================================================================ 12. FILES SHIPPED WITH THIS SPECIFICATION ================================================================================ File Description --------------------------------------------------------------- bi.html Hardened dashboard (drop-in replacement for v9.2 bi.html) api/newsdata_proxy.php NewsData.io proxy (new in v9.3) DAB-DASH-SPEC-V9-3-001.TXT This document ================================================================================ 13. ACRONYMS ================================================================================ API Application Programming Interface AR Arabic language code BI Business Intelligence (also: bi.html — the dashboard file) CBP US Customs and Border Protection CSS Cascading Style Sheets DEVT Development environment (public_html/devt/) FAQ Frequently Asked Questions FDA US Food and Drug Administration FR French language code IWMI International Water Management Institute JS JavaScript JSON JavaScript Object Notation ONSSA Office National de Securite Sanitaire des Produits Alimentaires (Morocco) OPS Operations and Logistics (department code) PHP PHP Hypertext Preprocessor (server-side scripting) PYB Internal reference code for the Daralbeida founder RSS Really Simple Syndication (web feed format) UI User Interface URL Uniform Resource Locator VPS Virtual Private Server ================================================================================ 14. GLOSSARY ================================================================================ Daralbeida Intelligence Hub The Daralbeida internal market intelligence dashboard (bi.html). Aggregates live news feeds across olive oil production, trade, regulation, and competitive intelligence. Hosted on daralbeida.com. FALLBACK Feed resolution state. Indicates that the primary endpoint returned zero items or an error, and the Bing News fallback was used instead. Rendered as an [FALLBACK] tag in ocean blue (#4A7C9E) on the card. NewsData.io Third-party news API. Provides Morocco-native French and Arabic language news coverage. Free tier: 200 requests/day, 10 articles per response. API key stored server-side in newsdata_proxy.php. PRIMARY Feed resolution state. Indicates that the primary RSS endpoint returned items successfully. Rendered as a [PRIMARY] tag in atlas gold (#B8832A) on the card. QUIET Feed resolution state. Indicates that both the primary endpoint and the Bing fallback returned zero items. Card is suppressed from the sort buffer. Rendered as a [QUIET] tag in charcoal (#2C3539). RSSHub Open-source project generating RSS feeds from websites that do not natively provide them. A self-hosted instance is a documented future upgrade path for FDA, ONSSA, and CBP feed coverage in v9.4. rss2json A proxy service that converts RSS XML feeds to JSON format for consumption by JavaScript clients in the browser. Sibling Architecture The Daralbeida deployment convention in which the production and devt environments are sibling directories under public_html, not nested. All relative paths are consistent across both environments. -------------------------------------------------------------------------------- DOCUMENT CONTROL (FOOTER) -------------------------------------------------------------------------------- Document ID : DAB-DASH-SPEC-V9-3-001 Version : 9.3 Status : DRAFT Style : BPGP Department : OPS Last Modified : 2026-05-01 Review Cycle : Upon promotion from devt to production; upon v9.4 release Retention : 2 years from date of creation Owner : PYB / Daralbeida Distribution : Internal only — webmaster/sysadmin receives this document for implementation COMPLIANCE : NewsData.io API key must never appear in client-side code or be visible in browser DevTools Network responses. Relative path convention is mandatory — do not use absolute paths or leading slashes in bi.html URL references. Revision History: Version Date Author Summary of Changes -------------------------------------------------- 9.3.0 2026-05-01 PYB Initial v9.3 spec -------------------------------------------------------------------------------- END OF DOCUMENT — DAB-DASH-SPEC-V9-3-001 --------------------------------------------------------------------------------