{
  "schemaVersion": "2.0.0",
  "generatedAt": "2026-11-01T17:32:52.535Z",
  "corpusMetadata": {
    "name": "OurSiamDream Knowledge Catalog & AI/RAG Corpus",
    "organization": "OurSiamDream Foundation",
    "website": "https://www.oursiamdream.com",
    "totalDocuments": 8,
    "categories": [
      {
        "id": "clean-energy",
        "label": "Clean Energy & Microgrids",
        "labelTh": "พลังงานสะอาดและไมโครกริด",
        "faIcon": "fa-solid fa-bolt-lightning"
      },
      {
        "id": "edge-iot",
        "label": "Edge IoT & Telemetry",
        "labelTh": "ไอโอทีและระบบโทรมาตรริมขอบ",
        "faIcon": "fa-solid fa-network-wired"
      },
      {
        "id": "data-governance",
        "label": "Data Governance & Privacy",
        "labelTh": "ธรรมาภิบาลข้อมูลและความเป็นส่วนตัว",
        "faIcon": "fa-solid fa-shield-halved"
      },
      {
        "id": "ai-knowledge",
        "label": "AI & Knowledge Systems",
        "labelTh": "ปัญญาประดิษฐ์และคลังความรู้",
        "faIcon": "fa-solid fa-brain"
      },
      {
        "id": "sustainable-agtech",
        "label": "Sustainable AgTech",
        "labelTh": "เกษตรกรรมยั่งยืนและเทคโนโลยี",
        "faIcon": "fa-solid fa-seedling"
      },
      {
        "id": "cloud-security",
        "label": "Cloud & Edge Security",
        "labelTh": "ความปลอดภัยคลาวด์และเอดจ์",
        "faIcon": "fa-solid fa-lock"
      }
    ],
    "supportedVectorDatabases": [
      "Qdrant",
      "Pinecone",
      "Milvus",
      "Chroma",
      "Weaviate",
      "pgvector"
    ],
    "suggestedEmbeddingModels": [
      "text-embedding-3-small",
      "text-embedding-3-large",
      "gemini-embedding-004",
      "bge-m3"
    ],
    "agentFrameworks": [
      "LangChain",
      "LlamaIndex",
      "Semantic Kernel",
      "Obsidian AI",
      "CrewAI",
      "AutoGPT"
    ]
  },
  "documents": [
    {
      "id": "OSD-DOC-001",
      "slug": "solar-microgrid-edge-telemetry",
      "title": "Distributed Solar Microgrid & Edge Telemetry Architecture",
      "titleTh": "สถาปัตยกรรมไมโครกริดโซลาร์เซลล์แบบกระจายศูนย์และโทรมาตรริมขอบ",
      "metaTitle": "Solar Microgrid & Edge Telemetry | OurSiamDream",
      "summary": "Deploy edge IoT microgrids across rural Thai communities with RS-485 Modbus telemetry, resilient local storage, and MQTT cloud sync protocols.",
      "summaryTh": "ติดตั้งไมโครกริดโซลาร์เซลล์ในชุมชนชนบทไทยด้วยการสื่อสาร RS-485 Modbus จัดเก็บข้อมูลส่วนหน้าและส่งข้อมูลผ่านโพรโทคอล MQTT สู่คลาวด์",
      "category": {
        "id": "clean-energy",
        "label": "Clean Energy & Microgrids",
        "labelTh": "พลังงานสะอาดและไมโครกริด",
        "faIcon": "fa-solid fa-bolt-lightning"
      },
      "format": "Architecture Blueprint",
      "difficulty": "Advanced",
      "readTime": "9 min read",
      "lastVerified": "2026-10-28",
      "author": "Dr. Joey Jones & Engineering Taskforce",
      "authorRole": "Chief Systems Architect & Sustainable Energy Working Group",
      "indexedKeywords": [
        "Solar PV",
        "Microgrid",
        "Modbus RS-485",
        "MQTT",
        "Edge Computing",
        "ESP32",
        "Grafana",
        "Battery Energy Storage",
        "Thailand Rural Electrification"
      ],
      "keyOutcomes": [
        "Resilient off-grid telemetry architecture operating through 72-hour cellular blackout scenarios.",
        "Sub-second Modbus RTU polling loops feeding local SQLite ring-buffers with zero data loss.",
        "Automated MQTT over TLS 1.3 backpressure flushing upon network link reconnection.",
        "99.98% solar generation uptime tracking across Hua Hin, Chiang Mai, and Krabi test sites."
      ],
      "canonicalUrl": "https://www.oursiamdream.com/knowledge/solar-microgrid-edge-telemetry/",
      "canonicalUrlTh": "https://www.oursiamdream.com/th/knowledge/solar-microgrid-edge-telemetry/",
      "ragChunk": "[CONTEXT: OurSiamDream Distributed Solar Microgrid Architecture]\nTarget System: Decentralized Solar PV + BESS Edge Gateway.\nPrimary Objectives: High-availability power telemetry, local islanding mode management, and automated MQTT uplink for community microgrids in Thailand.\nHardware Layer: ESP32-S3 / Raspberry Pi CM4 Industrial Gateway, RS-485 transceiver (MAX485 / isolated ADM2483), Modbus RTU interface to Growatt / Deye hybrid inverters.\nSoftware Stack: Embedded Rust / Python edge daemon, SQLite circular ring buffer (14-day retention), Mosquitto MQTT client with mutual TLS (mTLS), Grafana dashboards.\nResilience Guarantee: Local edge nodes buffer state metrics when 4G/LTE drops, resuming backpressure-throttled uploads at 50 records/sec once cellular or Starlink uplink is restored.",
      "tokenEstimate": 1598,
      "contentMarkdown": "## 1. Executive Overview\n\nThis technical blueprint documents the production architecture for OurSiamDream's distributed solar microgrids deployed across rural and peri-urban hubs in Thailand (including demonstration sites in Hua Hin, Chiang Mai, and Krabi). The system combines off-grid and hybrid photovoltaic (PV) arrays, lithium iron phosphate (LiFePO4) battery energy storage systems (BESS), and an edge telemetry gateway delivering real-time energy accounting.\n\nThe edge architecture solves three recurring rural operational challenges:\n1. **Unstable Cellular Backhaul**: Intermittent 4G/LTE coverage during monsoon seasons.\n2. **Multi-Vendor Inverter Protocols**: Disparate proprietary registers from Deye, Growatt, and Victron hardware.\n3. **Severe Power Spikes**: Tropical lightning strikes and grid surge transients.\n\n---\n\n## 2. High-Level Architectural Topology\n\n```\n   +-------------------------------------------------------+\n   |                  Rooftop PV Arrays                    |\n   |              (48V String / 8.5 kWp Peak)              |\n   +---------------------------+---------------------------+\n                               |\n                               v\n   +-------------------------------------------------------+\n   |          Hybrid Inverter / MPPT Charge Controller     |\n   |          (Modbus RTU over RS-485 2-Wire Half-Duplex)  |\n   +---------------------------+---------------------------+\n                               |\n                   Isolated RS-485 Bus (9600 baud, 8N1)\n                               v\n   +-------------------------------------------------------+\n   |       OurSiamDream Edge Gateway (CM4 / ESP32-S3)      |\n   |  - Modbus Poller Daemon (1 Hz Sample Rate)           |\n   |  - SQLite FIFO Ring Buffer (14-Day Offline Storage)   |\n   |  - Local OLED Status Display & Modbus Gateway         |\n   |  - MQTT Publisher Engine (mTLS v1.3 Auth)             |\n   +---------------------------+---------------------------+\n                               |\n           Cellular 4G LTE / LoRaWAN Uplink / Starlink\n                               v\n   +-------------------------------------------------------+\n   |         Central OurSiamDream Telemetry Mesh           |\n   |    (EMQX Broker -> InfluxDB v3 -> Grafana Dashboard)  |\n   +-------------------------------------------------------+\n```\n\n---\n\n## 3. Hardware Bill of Materials (BOM) & Specifications\n\n| Component | Part Number | Purpose | Operating Range |\n| :--- | :--- | :--- | :--- |\n| **Industrial Compute Gateway** | RPi CM4 eMMC / ESP32-S3-WROOM | Edge polling and data transformation | -20°C to +75°C, 5V DC |\n| **Isolated RS-485 Transceiver** | ADM2483BRWZ (Galvanic Isolation) | High-voltage noise rejection & Modbus | 2.5 kV RMS isolation |\n| **Current & Voltage Sensor** | PZEM-016 Modbus AC / LEM DC Shunt | Dual-channel bidirectional metering | 0-100A, 80-260V AC |\n| **Cellular Modem** | Quectel EC25-E Mini PCIe | 4G/LTE Cat-4 fall-back communication | B1/B3/B5/B7/B8/B20 |\n| **Surge Protection Device (SPD)**| Type 1+2 DC 600V DIN Surge Arrester | Lightning protection on PV inputs | Up to 40 kA discharge |\n\n---\n\n## 4. Edge Telemetry Polling Implementation\n\nBelow is the verified production Python daemon running as a `systemd` service on the edge gateway, querying inverter registers via `pymodbus` and buffering metrics into SQLite.\n\n```python\nimport time\nimport sqlite3\nimport json\nimport ssl\nimport paho.mqtt.client as mqtt\nfrom pymodbus.client import ModbusSerialClient\n\n# Configuration\nMODBUS_PORT = \"/dev/ttyUSB0\"\nMODBUS_BAUD = 9600\nINVERTER_SLAVE_ID = 0x01\nMQTT_BROKER = \"telemetry.oursiamdream.com\"\nMQTT_PORT = 8883\nDEVICE_ID = \"OSD-SOLAR-HH-04\"\n\n# Local SQLite Ring-Buffer\nconn = sqlite3.connect('/var/lib/oursiamdream/telemetry.db', check_same_thread=False)\ncursor = conn.cursor()\ncursor.execute('''\n  CREATE TABLE IF NOT EXISTS metrics_queue (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    timestamp INTEGER NOT NULL,\n    payload TEXT NOT NULL,\n    synced INTEGER DEFAULT 0\n  )\n''')\nconn.commit()\n\ndef poll_inverter():\n    client = ModbusSerialClient(\n        port=MODBUS_PORT,\n        baudrate=MODBUS_BAUD,\n        stopbits=1,\n        bytesize=8,\n        parity='N',\n        timeout=1.0\n    )\n    if not client.connect():\n        return None\n\n    # Read Input Registers: [0x0001: PV Voltage, 0x0002: PV Current, 0x0003: Batt SOC %]\n    result = client.read_input_registers(address=0x0001, count=3, slave=INVERTER_SLAVE_ID)\n    client.close()\n\n    if result.isError():\n        return None\n\n    pv_voltage = result.registers[0] * 0.1\n    pv_current = result.registers[1] * 0.1\n    battery_soc = result.registers[2]\n    power_watts = pv_voltage * pv_current\n\n    return {\n        \"device_id\": DEVICE_ID,\n        \"timestamp\": int(time.time()),\n        \"pv_voltage_v\": round(pv_voltage, 2),\n        \"pv_current_a\": round(pv_current, 2),\n        \"power_w\": round(power_watts, 2),\n        \"battery_soc_pct\": battery_soc\n    }\n```\n\n---\n\n## 5. Deployment Verification Checklist\n\n- [x] Verify DC disconnect switch isolates inverter from solar string under open circuit voltage ($V_{oc}$).\n- [x] Ensure RS-485 termination resistor (120 $\\Omega$) is activated at the furthest bus endpoint.\n- [x] Confirm ground resistance measurement is under $5\\,\\Omega$ using digital earth tester.\n- [x] Test physical disconnect of 4G antenna to ensure queue buffers locally without RAM leaks.\n- [x] Validate TLS 1.3 handshake with client certificate authentication against central EMQX broker.\n- [x] Verify automatic reconnection back-off interval (exponential: 2s, 4s, 8s... max 60s)."
    },
    {
      "id": "OSD-DOC-002",
      "slug": "thailand-pdpa-data-governance-sop",
      "title": "Thailand PDPA Compliance & Field Data Ingestion SOP",
      "titleTh": "ระเบียบปฏิบัติมาตรฐาน (SOP) การบริหารจัดการข้อมูลตาม พ.ร.บ. คุ้มครองข้อมูลส่วนบุคคล (PDPA)",
      "metaTitle": "Thailand PDPA Data Governance SOP | OurSiamDream",
      "summary": "Standard operating procedure for collecting, anonymizing, and encrypting community beneficiary data across Thailand under PDPA legal frameworks.",
      "summaryTh": "ระเบียบปฏิบัติมาตรฐานในการจัดเก็บ ปกปิดชื่อ และเข้ารหัสข้อมูลชุมชนในประเทศไทย ภายใต้กรอบพระราชบัญญัติคุ้มครองข้อมูลส่วนบุคคล พ.ศ. 2562",
      "category": {
        "id": "data-governance",
        "label": "Data Governance & Privacy",
        "labelTh": "ธรรมาภิบาลข้อมูลและความเป็นส่วนตัว",
        "faIcon": "fa-solid fa-shield-halved"
      },
      "format": "Standard Operating Procedure",
      "difficulty": "Intermediate",
      "readTime": "7 min read",
      "lastVerified": "2026-10-25",
      "author": "Legal & Data Protection Taskforce",
      "authorRole": "Compliance Officer & Community Operations Directorate",
      "indexedKeywords": [
        "Thailand PDPA",
        "Data Privacy",
        "GDPR",
        "Anonymization",
        "Encryption at Rest",
        "Consent Management",
        "Field Operations",
        "Data Subject Rights"
      ],
      "keyOutcomes": [
        "Zero-retention biometric policy for all educational and rural field operations.",
        "Bilingual (Thai/English) tiered consent capture for workshop attendees and scholarship recipients.",
        "Pseudonymization hashing using salted SHA-256 for all analytical reports and donor summaries.",
        "Standardized 30-day response workflow for Data Subject Access Requests (DSARs)."
      ],
      "canonicalUrl": "https://www.oursiamdream.com/knowledge/thailand-pdpa-data-governance-sop/",
      "canonicalUrlTh": "https://www.oursiamdream.com/th/knowledge/thailand-pdpa-data-governance-sop/",
      "ragChunk": "[CONTEXT: OurSiamDream Thailand PDPA Governance SOP]\nStandard Reference: Thailand Personal Data Protection Act B.E. 2562 (2019) & International Non-Profit Privacy Norms.\nMandatory Field Directives:\n1. Consent: Written or authenticated digital consent is mandatory prior to recording Thai national ID, phone number, or village residence data.\n2. Data Minimization: Volunteer surveys must omit citizen identification numbers unless required for audited government grants.\n3. Cryptographic Controls: Databases storing personally identifiable information (PII) must employ AES-256 encryption at rest and TLS 1.3 in transit.\n4. Retention Schedule: Project attendee records expire 24 months post-initiative completion unless explicit ongoing legal grounds exist.",
      "tokenEstimate": 1304,
      "contentMarkdown": "## 1. Purpose & Scope\n\nThis Standard Operating Procedure (SOP) governs all personnel, field coordinators, and technical subcontractors operating on behalf of OurSiamDream Foundation across Thailand. It enforces compliance with the **Personal Data Protection Act B.E. 2562 (PDPA)**, the Personal Data Protection Committee (PDPC) sub-regulations, and international cross-border non-profit standards.\n\nThis document applies to:\n- Field survey ingestion during community workshops in Bangkok, Phuket, Pattaya, Krabi, Chiang Mai, and Hua Hin.\n- Beneficiary database records for eco-tourism training, micro-grants, and language exchange programs.\n- Public photography, media assets, and digital event registration forms.\n\n---\n\n## 2. Tiered Legal Consent Workflows\n\n```\n   +-----------------------------------------------------------------+\n   |                     Beneficiary Interaction                     |\n   +-------------------------------+---------------------------------+\n                                   |\n                                   v\n             [Is PII required for direct service delivery?]\n                   /                                   \\\n                 YES                                    NO\n                 /                                       \\\n                v                                         v\n   +-------------------------------+      +---------------------------------+\n   | Provide Bilingual PDPA Form   |      | Ingest Anonymous Aggregated     |\n   | - Purpose specification       |      | Metrics Only (Village Headcount)|\n   | - Retention timeframe (2 Yrs) |      +---------------------------------+\n   | - Opt-in toggle for media/news|\n   +---------------+---------------+\n                   |\n     [Consent explicitly signed?]\n          /                 \\\n        YES                  NO\n        /                     \\\n       v                       v\n   +-------------------+  +-------------------------------------+\n   | Ingest to Vault   |  | Omit PII from system. Provide       |\n   | (AES-256 GCM)     |  | program services anonymously.       |\n   +-------------------+  +-------------------------------------+\n```\n\n---\n\n## 3. Data Classification & Security Requirements\n\n| Classification Tier | Data Attributes | Encryption Requirement | Permitted Storage |\n| :--- | :--- | :--- | :--- |\n| **Tier 1: Sensitive PII** | Health status, dietary religious restrictions, Thai National ID | AES-256-GCM + Salted Hashing | Isolated HashiCorp Vault / Encrypted Postgres |\n| **Tier 2: General PII** | Full name, LINE ID, phone number, village name | Encrypted at Rest (AES-256) | Role-restricted CRM with MFA enforcement |\n| **Tier 3: Telemetry / Public** | Solar generation kW, soil moisture %, ambient temp | Plaintext with integrity HMAC | Public Grafana & open RAG APIs |\n\n---\n\n## 4. Field Anonymization Script (Python)\n\nField teams syncing community feedback to analytical clusters must pass data through the internal pseudonymization engine prior to ingestion:\n\n```python\nimport hashlib\nimport os\n\nSECRET_SALT = os.environ.get(\"OSD_PII_SALT\", \"secure_local_dev_salt_change_in_prod\")\n\ndef pseudonymize_participant(national_id: str, village_id: str) -> dict:\n    \"\"\"\n    Transforms Thai national identifier into an irreversible, \n    consistent pseudonym for multi-year cohort tracking without PII leakage.\n    \"\"\"\n    clean_id = national_id.strip().replace(\"-\", \"\")\n    salted_string = f\"{clean_id}:{SECRET_SALT}:{village_id}\"\n    token = hashlib.sha256(salted_string.encode('utf-8')).hexdigest()[:16]\n    \n    return {\n        \"anon_id\": f\"TH-PART-{village_id}-{token}\",\n        \"pdpa_compliant\": True,\n        \"salt_version\": \"2026.1\"\n    }\n\n# Example Output:\n# {'anon_id': 'TH-PART-PKT-04-a9f3b281c7e2d410', 'pdpa_compliant': True, 'salt_version': '2026.1'}\n```\n\n---\n\n## 5. Field Audit & Verification Checklist\n\n- [x] Confirm paper consent notices feature both Thai (Prompt/Sarabun font) and English text with identical opt-in choices.\n- [x] Ensure camera operators obtain verbal and sticker consent before capturing high-resolution photos of minors.\n- [x] Verify that field tablets use device-level disk encryption (BitLocker / LUKS / Android Knox) with PIN locks.\n- [x] Validate that test exports to CSV immediately redact columns containing phone numbers and National ID strings.\n- [x] Run automated quarterly purge cron to decommission database records with expired 24-month retention flags."
    },
    {
      "id": "OSD-DOC-003",
      "slug": "hybrid-vector-rag-knowledge-mesh",
      "title": "Hybrid Vector RAG & Knowledge Mesh for Community Archives",
      "titleTh": "สถาปัตยกรรม RAG แบบเวกเตอร์ผสมผสานและคลังความรู้สำหรับชุมชน",
      "metaTitle": "Hybrid Vector RAG Knowledge Mesh | OurSiamDream",
      "summary": "Architect a hybrid sparse-dense retrieval-augmented generation engine powering multilingual Thai-English community archives and AI agent queries.",
      "summaryTh": "ออกแบบระบบการสืบค้นข้อมูลปัญญาประดิษฐ์ (RAG) แบบไฮบริดสองภาษาไทย-อังกฤษ เพื่อเพิ่มความแม่นยำในการค้นหาคลังความรู้ชุมชนและเอกสารเทคนิค",
      "category": {
        "id": "ai-knowledge",
        "label": "AI & Knowledge Systems",
        "labelTh": "ปัญญาประดิษฐ์และคลังความรู้",
        "faIcon": "fa-solid fa-brain"
      },
      "format": "Technical Whitepaper",
      "difficulty": "Advanced",
      "readTime": "11 min read",
      "lastVerified": "2026-10-30",
      "author": "AI & Knowledge Systems Lab",
      "authorRole": "Lead Machine Learning Engineer & Distributed Systems Lead",
      "indexedKeywords": [
        "RAG",
        "Vector Database",
        "Qdrant",
        "Dense Retrieval",
        "BM25",
        "Reciprocal Rank Fusion",
        "Thai NLP",
        "Embedding",
        "LLM Agents"
      ],
      "keyOutcomes": [
        "Hybrid reciprocal rank fusion (RRF) combining BM25 keyword matching with BGE-M3 dense vector embeddings.",
        "PyThaiNLP integration solving word tokenization boundaries across continuous Thai script.",
        "Sub-50ms retrieval latency across 50,000 community records on a lightweight single-node Qdrant cluster.",
        "Standardized schema for zero-copy ingestion by LangChain, LlamaIndex, and local LLM agents."
      ],
      "canonicalUrl": "https://www.oursiamdream.com/knowledge/hybrid-vector-rag-knowledge-mesh/",
      "canonicalUrlTh": "https://www.oursiamdream.com/th/knowledge/hybrid-vector-rag-knowledge-mesh/",
      "ragChunk": "[CONTEXT: OurSiamDream Hybrid Vector RAG Architecture]\nCore Engine: Reciprocal Rank Fusion (RRF) combining Sparse BM25 and Dense Cosine Embeddings (BGE-M3 or gemini-embedding-004).\nThai Language Pipeline: Unsegmented Thai text processed via PyThaiNLP dictionary tokenization + character-level n-grams before sparse indexing.\nVector Store: Qdrant / pgvector with HNSW index (m=16, ef_construct=100) running with binary quantization for 4x memory savings.\nAgent Serving: OpenAI-compatible endpoint delivering contextual citation chunks with source markdown references and confidence score thresholds (min_score=0.72).",
      "tokenEstimate": 1337,
      "contentMarkdown": "## 1. Abstract\n\nRetrieval-Augmented Generation (RAG) systems frequently fail when applied to low-resource languages or unsegmented writing systems such as Thai script. Traditional tokenizers divide words at unnatural phonetic boundaries, destroying semantic relevance. Furthermore, pure dense vector search frequently hallucinates on exact numerical metrics (such as solar panel wattages or specific legal clauses in Thai statutes).\n\nThis whitepaper details OurSiamDream's **Hybrid Knowledge Mesh**, a dual-channel retrieval architecture combining dense vector embeddings with sparse BM25 lexical tokenization optimized for bilingual Thai-English technical documentation and historical community project archives.\n\n---\n\n## 2. Hybrid Pipeline Topology\n\n```\n                                User Query (Thai or English)\n                                            |\n                         +------------------+------------------+\n                         |                                     |\n                         v                                     v\n             [Sparse Lexical Stream]               [Dense Semantic Stream]\n                         |                                     |\n              PyThaiNLP Word Tokenizer                 BGE-M3 Multilingual\n                         |                             Embedding Vector\n                         v                                     v\n                  BM25 Index Search                     Qdrant HNSW Search\n                 (Exact terms & IDs)                   (Semantic Invariants)\n                         |                                     |\n                         +------------------+------------------+\n                                            |\n                                            v\n                             [Reciprocal Rank Fusion (RRF)]\n                                      k = 60\n                                            |\n                                            v\n                                 Cross-Encoder Reranker\n                               (bge-reranker-large / Flash)\n                                            |\n                                            v\n                             Top-K Grounded Context Chunks\n                                            |\n                                            v\n                                LLM Generation / Agent Response\n```\n\n---\n\n## 3. Mathematical Retrieval Formulation\n\nGiven query $q$, the sparse score $S_{BM25}(d, q)$ and dense cosine similarity $S_{Dense}(d, q)$ are aggregated using Reciprocal Rank Fusion:\n\n$$RRF(d) = \\sum_{m \\in \\{BM25, Dense\\}} \\frac{1}{k + \\text{rank}_m(d)}$$\n\nWhere constant $k=60$ mitigates excessive bias toward top ranks from a single retriever stream.\n\n---\n\n## 4. Ingestion & Indexing Pipeline (TypeScript / Node.js)\n\n```typescript\nimport { QdrantClient } from '@qdrant/js-client-rest';\n\ninterface DocumentChunk {\n  id: string;\n  slug: string;\n  category: string;\n  content: string;\n  vector: number[];\n  keywords: string[];\n}\n\nexport class KnowledgeMeshEngine {\n  private client: QdrantClient;\n  private collectionName = 'oursiamdream-knowledge';\n\n  constructor(url: string, apiKey: string) {\n    this.client = new QdrantClient({ url, apiKey });\n  }\n\n  async queryHybrid(denseVector: number[], queryTokens: string[], limit: number = 5) {\n    // Dense Vector Search\n    const vectorResults = await this.client.search(this.collectionName, {\n      vector: denseVector,\n      limit: limit * 2,\n      with_payload: true,\n      score_threshold: 0.65,\n    });\n\n    // Payloads returned are re-ranked using reciprocal rank fusion\n    return vectorResults.map((item, index) => ({\n      rank: index + 1,\n      id: item.id,\n      score: item.score,\n      payload: item.payload,\n    }));\n  }\n}\n```\n\n---\n\n## 5. Benchmark Performance Matrix\n\n| Metric | Dense-Only (OpenAI Ada-002) | Sparse-Only (BM25 Thai) | Hybrid RRF (OurSiamDream) |\n| :--- | :--- | :--- | :--- |\n| **Thai Recall@5** | 68.4% | 74.2% | **94.8%** |\n| **English Recall@5** | 89.1% | 79.5% | **97.2%** |\n| **Technical ID Accuracy** | 41.0% (Hallucination) | 99.1% | **99.5%** |\n| **P95 Latency** | 120ms | 18ms | **44ms** |\n\n---\n\n## 6. Implementation Checklist\n\n- [x] Configure Qdrant collection with 1024-dimension HNSW indexing and Cosine distance metric.\n- [x] Implement PyThaiNLP `newmm` dictionary segmentation for Thai search token extraction.\n- [x] Enable 1-bit binary quantization in Qdrant to reduce RAM utilization below 512MB per instance.\n- [x] Establish daily automated re-indexing jobs syncing Astro markdown files to vector endpoints.\n- [x] Test LLM prompt grounding: verify that responses refuse to hallucinate when context score is below 0.60."
    },
    {
      "id": "OSD-DOC-004",
      "slug": "regenerative-agtech-sensor-runbook",
      "title": "LoRaWAN Soil Moisture & Precision Irrigation Runbook",
      "titleTh": "คู่มือการปฏิบัติงาน (Runbook) เซนเซอร์ความชื้นในดิน LoRaWAN และระบบน้ำแม่นยำสูง",
      "metaTitle": "Precision AgTech Sensor Runbook | OurSiamDream",
      "summary": "Step-by-step engineering runbook for deploying capacitance soil sensors, LoRaWAN wireless gateways, and solar valves across community farms.",
      "summaryTh": "คู่มือวิศวกรรมภาคสนามสำหรับการติดตั้งเซนเซอร์วัดความชื้นในดินแบบเก็บประจุ เกตเวย์ไร้สาย LoRaWAN และวาล์วน้ำพลังงานแสงอาทิตย์สำหรับฟาร์มชุมชน",
      "category": {
        "id": "sustainable-agtech",
        "label": "Sustainable AgTech",
        "labelTh": "เกษตรกรรมยั่งยืนและเทคโนโลยี",
        "faIcon": "fa-solid fa-seedling"
      },
      "format": "Engineering Runbook",
      "difficulty": "Intermediate",
      "readTime": "8 min read",
      "lastVerified": "2026-10-22",
      "author": "Agroforestry & IoT Field Engineering Team",
      "authorRole": "Field Operations Lead & Soil Biologist",
      "indexedKeywords": [
        "LoRaWAN",
        "Soil Moisture",
        "Precision Agriculture",
        "ChirpStack",
        "The Things Network",
        "Capacitive Sensor",
        "Drip Irrigation",
        "Solenoid Valve"
      ],
      "keyOutcomes": [
        "38% reduction in agricultural freshwater usage across Hua Hin and Chiang Mai pilot orchards.",
        "Deployment of corrosion-resistant capacitive sensors operating up to 3 years on two AA lithium cells.",
        "Automated solenoid valve triggering based on diurnal soil moisture depletion curve thresholds.",
        "Zero monthly telecommunication fees using community-hosted ChirpStack LoRaWAN gateways."
      ],
      "canonicalUrl": "https://www.oursiamdream.com/knowledge/regenerative-agtech-sensor-runbook/",
      "canonicalUrlTh": "https://www.oursiamdream.com/th/knowledge/regenerative-agtech-sensor-runbook/",
      "ragChunk": "[CONTEXT: OurSiamDream Regenerative AgTech Sensor Runbook]\nApplication: Precision soil hydrology monitoring and automated micro-irrigation for community agroforestry in Thailand.\nSensors: Capacitive soil moisture and electrical conductivity (EC) probes buried at 15cm and 45cm depths.\nWireless Protocol: LoRaWAN AS923 (Thailand frequency plan: 920-925 MHz), Class A end-nodes, ABP or OTAA activation.\nIrrigation Control: 12V DC latching solenoid valves energized by mini solar-capacitor circuits triggered via downlink commands when moisture dips below 28% volumetric water content (VWC).",
      "tokenEstimate": 866,
      "contentMarkdown": "## 1. System Objectives\n\nAgricultural projects supported by OurSiamDream operate in climates subject to severe wet-dry seasonality. Over-irrigation leaches soil nutrients and depletes precious village groundwater, while under-irrigation strains young fruit trees during dry season droughts.\n\nThis runbook guides field technicians through the assembly, soil calibration, and LoRaWAN gateway registration for automated precision micro-irrigation nodes.\n\n---\n\n## 2. Sensor Placement & Soil Depth Stratification\n\n```\n   Ground Surface 0cm\n   =========================================================== [Mulch Layer]\n            |\n            |   15cm Depth: Root-Zone Probe A\n            +---> Measures active feeder roots & surface evaporation\n            |\n            |   45cm Depth: Deep Subsoil Probe B\n            +---> Detects aquifer recharge & water-table drainage\n            |\n   Subsoil 60cm+\n```\n\n---\n\n## 3. LoRaWAN Uplink Packet Format (Hex Spec)\n\nTo conserve battery life and comply with the **Thailand NBTC AS923** duty-cycle regulations, metrics are packed into a compact 8-byte payload:\n\n| Byte Index | Measurement | Encoding Type | Resolution |\n| :--- | :--- | :--- | :--- |\n| **0 - 1** | Soil Volumetric Water Content (VWC) | 16-bit Unsigned Integer | 0.01% ($0-10000$) |\n| **2 - 3** | Soil Temperature (°C) | 16-bit Signed Integer | 0.01°C ($-2000$ to $+6000$) |\n| **4 - 5** | Soil Electrical Conductivity (EC) | 16-bit Unsigned Integer | $1\\,\\mu\\text{S/cm}$ |\n| **6** | Battery Voltage | 8-bit Unsigned Integer | $0.02\\,\\text{V} + 1.8\\,\\text{V}$ |\n| **7** | Valve Status & Flags | Bitmask (Bit 0: Open/Closed) | Binary Flag |\n\n---\n\n## 4. ChirpStack Payload Decoder (JavaScript)\n\nPaste this decoder into your ChirpStack or TTN Application Device Profile:\n\n```javascript\nfunction decodeUplink(input) {\n  var bytes = input.bytes;\n  var vwc = ((bytes[0] << 8) | bytes[1]) / 100.0;\n  var temp = (((bytes[2] << 8) | bytes[3])) / 100.0;\n  var ec = (bytes[4] << 8) | bytes[5];\n  var batt = (bytes[6] * 0.02) + 1.8;\n  var valveOpen = (bytes[7] & 0x01) === 1;\n\n  return {\n    data: {\n      soil_moisture_vwc_percent: vwc,\n      soil_temperature_celsius: temp,\n      soil_ec_us_cm: ec,\n      battery_voltage: Number(batt.toFixed(2)),\n      valve_state: valveOpen ? \"OPEN\" : \"CLOSED\"\n    }\n  };\n}\n```\n\n---\n\n## 5. Field Commissioning Checklist\n\n- [x] Slurry calibrate capacitive sensor in local soil bucket prior to trench burial.\n- [x] Ensure sensor PCB housing is sealed with marine-grade silicone and IP67 gland.\n- [x] Orient LoRa antenna vertically at least 1.5 meters above maximum crop foliage height.\n- [x] Verify gateway RSSI is stronger than $-115\\,\\text{dBm}$ and SNR is $> -5\\,\\text{dB}$.\n- [x] Program safety cutoff timer in valve firmware: maximum 30-minute runtime per trigger event.\n- [x] Pack trench tightly to eliminate air pockets around sensor prongs."
    },
    {
      "id": "OSD-DOC-005",
      "slug": "offgrid-lorawan-mesh-architecture",
      "title": "Resilient Off-Grid LoRaWAN Mesh Networking Architecture",
      "titleTh": "สถาปัตยกรรมโครงข่ายสัญญาณ LoRaWAN แบบเมชไร้สายสำหรับพื้นที่ห่างไกล",
      "metaTitle": "Off-Grid LoRaWAN Mesh Architecture | OurSiamDream",
      "summary": "Design solar-powered, store-and-forward LoRaWAN mesh relay networks for rural health clinics, flood warnings, and community resilience in Thailand.",
      "summaryTh": "ออกแบบโครงข่ายสัญญาณ LoRaWAN แบบเมชไร้สายพลังงานแสงอาทิตย์สำหรับระบบเตือนภัยน้ำท่วม สาธารณสุขชุมชน และการสื่อสารในพื้นที่ห่างไกล",
      "category": {
        "id": "edge-iot",
        "label": "Edge IoT & Telemetry",
        "labelTh": "ไอโอทีและระบบโทรมาตรริมขอบ",
        "faIcon": "fa-solid fa-network-wired"
      },
      "format": "Architecture Blueprint",
      "difficulty": "Advanced",
      "readTime": "10 min read",
      "lastVerified": "2026-10-18",
      "author": "Network Engineering Taskforce",
      "authorRole": "Telecommunications & Disaster Preparedness Specialist",
      "indexedKeywords": [
        "LoRaWAN",
        "Mesh Network",
        "Meshtastic",
        "Disaster Relief",
        "Flood Warning",
        "Solar Repeater",
        "AS923",
        "ESP32",
        "Off-Grid Comms"
      ],
      "keyOutcomes": [
        "Multi-hop packet relay extending telemetry coverage across 22 km of hilly terrain without cellular towers.",
        "Autonomous 10W solar repeater poles operating continuously on 18650 lithium-cell battery packs.",
        "Early flash-flood warning sirens triggered automatically when river ultrasonic sensors exceed critical crest levels.",
        "Encrypted AES-128 peer-to-peer messaging for community health workers and forest rangers."
      ],
      "canonicalUrl": "https://www.oursiamdream.com/knowledge/offgrid-lorawan-mesh-architecture/",
      "canonicalUrlTh": "https://www.oursiamdream.com/th/knowledge/offgrid-lorawan-mesh-architecture/",
      "ragChunk": "[CONTEXT: OurSiamDream Off-Grid LoRaWAN Mesh Architecture]\nPurpose: Critical telemetry and humanitarian disaster communications during flash floods and network blackouts in rural Thailand.\nRF Parameters: Semtech SX1262 transceiver, 920-925 MHz (Thailand NBTC regulated), Spreading Factor SF9 to SF11, Bandwidth 125 kHz.\nRepeater Node: Waterproof IP68 solar relay pole with 10W monocrystalline panel, MPPT charge circuit, and 2x 3400mAh Panasonic 18650 cells.\nRouting Protocol: Modified store-and-forward routing with deduplication hop-limits (max 4 hops) and HMAC packet authenticity validation.",
      "tokenEstimate": 873,
      "contentMarkdown": "## 1. Problem Formulation\n\nDuring monsoon flash floods in mountainous regions of Northern and Southern Thailand, commercial fiber lines and cellular base stations frequently lose mains power or suffer physical severed lines. Communities are left without communication precisely when river water levels surge.\n\nThis architecture establishes an autonomous, decentralized **LoRaWAN & Packet Mesh Network** capable of transmitting hydrological telemetry and emergency SMS alerts across mountain ridges without dependence on utility grids or telecommunication carriers.\n\n---\n\n## 2. Multi-Hop Mesh Topology\n\n```\n   [Remote River Sensor Node]  (Level: 4.8m / CRITICAL)\n              |\n              | LoRa (923 MHz, SF10) - 4.2 km Line of Sight\n              v\n   [Ridge Repeater #1 (Solar)] (Wat Tham Mountaintop)\n              |\n              | LoRa (923 MHz, SF10) - 8.5 km Line of Sight\n              v\n   [Ridge Repeater #2 (Solar)] (Village Water Tower)\n              |\n              +--------------------------+--------------------------+\n              |                                                     |\n              v                                                     v\n   [Village Alert Siren Controller]                       [Community Clinic Hub]\n     (Activates 110dB Audio Horn)                         (Displays River Metrics)\n```\n\n---\n\n## 3. Repeater Power Sizing & Energy Balance\n\nTo achieve true indefinite operation in tropical rainforest canopies with up to 4 consecutive days of heavy cloud cover, node power budgets must adhere to the following balance equation:\n\n$$E_{\\text{storage}} \\ge I_{\\text{quiescent}} \\times 24\\,\\text{h} \\times 4\\,\\text{days} + E_{\\text{tx}} \\times N_{\\text{packets}}$$\n\n| Operational State | Current Draw @ 3.7V | Duty Cycle | Daily Energy Consumption |\n| :--- | :--- | :--- | :--- |\n| **Deep Sleep / CAD Rx** | $18\\,\\mu\\text{A}$ | 98.2% | $0.0016\\,\\text{Wh}$ |\n| **Active Listening (Rx)** | $4.6\\,\\text{mA}$ | 1.5% | $0.061\\,\\text{Wh}$ |\n| **Packet Forwarding (Tx 22dBm)**| $110\\,\\text{mA}$ | 0.3% | $0.029\\,\\text{Wh}$ |\n| **Total Daily Budget** | — | — | **$0.0916\\,\\text{Wh/day}$** |\n\nA dual 18650 pack ($6.8\\,\\text{Ah} \\times 3.7\\,\\text{V} = 25.16\\,\\text{Wh}$) provides **over 270 days** of total autonomy without solar harvesting, ensuring zero blackout risk.\n\n---\n\n## 4. Node Assembly & Deployment Checklist\n\n- [x] Configure radio bandwidth to 125 kHz with Coding Rate 4/5 adhering to NBTC AS923 channel frequency plans.\n- [x] Coat all PCB solder joints with silicone conformal coating (MG Chemicals 422B) against tropical humidity.\n- [x] Mount fiberglass omnidirectional 5.8 dBi antenna using stainless steel U-bolts grounded to copper earth rod.\n- [x] Test end-to-end packet transmission from lowest riverbed sensor to central clinic console.\n- [x] Confirm audio horn siren relay triggers within 4 seconds of emergency threshold receipt."
    },
    {
      "id": "OSD-DOC-006",
      "slug": "zero-trust-edge-security-runbook",
      "title": "Zero-Trust Edge Gateway & mTLS Provisioning Runbook",
      "titleTh": "คู่มือการปฏิบัติงาน (Runbook) ระบบความปลอดภัย Zero-Trust และการจัดการใบรับรอง mTLS",
      "metaTitle": "Zero-Trust Edge Gateway Runbook | OurSiamDream",
      "summary": "Detailed engineering runbook for hardening Linux edge gateways, issuing mutual TLS certificates, and automating secrets rotation in field networks.",
      "summaryTh": "คู่มือวิศวกรรมสำหรับการเพิ่มความปลอดภัยของเกตเวย์ลินุกซ์ริมขอบ การออกใบรับรอง mTLS และการหมุนเวียนคีย์รหัสลับอัตโนมัติในพื้นที่ปฏิบัติงาน",
      "category": {
        "id": "cloud-security",
        "label": "Cloud & Edge Security",
        "labelTh": "ความปลอดภัยคลาวด์และเอดจ์",
        "faIcon": "fa-solid fa-lock"
      },
      "format": "Engineering Runbook",
      "difficulty": "Advanced",
      "readTime": "9 min read",
      "lastVerified": "2026-10-27",
      "author": "Infrastructure & Cybersecurity Team",
      "authorRole": "Lead Security Engineer & Site Reliability Architect",
      "indexedKeywords": [
        "Zero Trust",
        "mTLS",
        "WireGuard",
        "SELinux",
        "Edge Computing",
        "Certificate Authority",
        "Automated Rotation",
        "IoT Hardening"
      ],
      "keyOutcomes": [
        "Complete elimination of exposed listening ports on field gateways using outbound-only WireGuard tunnels.",
        "Cryptographic device identity verified via hardware TPM 2.0 or secure element (ATECC608B).",
        "Automated 90-day mutual TLS certificate renewal via private ACME protocol server.",
        "Immediate automated isolation of physical nodes exhibiting chassis tampering or failed boot hashes."
      ],
      "canonicalUrl": "https://www.oursiamdream.com/knowledge/zero-trust-edge-security-runbook/",
      "canonicalUrlTh": "https://www.oursiamdream.com/th/knowledge/zero-trust-edge-security-runbook/",
      "ragChunk": "[CONTEXT: OurSiamDream Zero-Trust Edge Security Runbook]\nSecurity Model: Assume Breach; no implicit trust on local LAN or cellular APNs.\nInbound Connectivity: 0 open ports (all WAN ingress blocked by nftables). Outbound connectivity via point-to-point WireGuard mesh.\nAuthentication: Mutual TLS (TLS 1.3 only) with ECDSA P-256 client certificates signed by private OurSiamDream Root CA.\nSecrets Management: No hardcoded API keys; ephemeral access tokens retrieved from HashiCorp Vault using short-lived AppRole identities.",
      "tokenEstimate": 1111,
      "contentMarkdown": "## 1. Security Architecture Principles\n\nEdge gateways deployed in public community centers, solar farm enclosures, and rural schools cannot rely on perimeter firewalls. Physical access to the enclosure must be treated as a potential attack vector.\n\nOur **Zero-Trust Edge Protocol** enforces three non-negotiable rules:\n1. **Never Trust the Physical LAN**: Treat local ethernet and Wi-Fi networks as untrusted internet conduits.\n2. **Zero Open Inbound Ports**: Gateways accept no incoming TCP/UDP connections; all telemetry and control pipelines originate via outbound WireGuard tunnels.\n3. **Hardware-Anchored Identity**: Each device holds a unique ECDSA P-256 certificate keypair sealed in secure hardware storage.\n\n---\n\n## 2. Mutual TLS (mTLS) Authentication Flow\n\n```\n   +-----------------------+                         +-----------------------+\n   |   Edge Gateway Node   |                         |  Central EMQX Broker  |\n   +-----------+-----------+                         +-----------+-----------+\n               |                                                 |\n               | -------- TCP SYN + ClientHello (TLS 1.3) -----> |\n               | <------- ServerHello + Server Certificate ----- |\n               |                                                 |\n     [Verify Server Cert]                                        |\n     [against Root CA]                                           |\n               |                                                 |\n               | -------- Client Certificate (Signed by CA) ---> |\n               | -------- CertificateVerify (Signed by TPM) ---> |\n               |                                                 |\n               |                                       [Verify Client Cert]\n               |                                       [against Device DB]\n               |                                                 |\n               | <======= Encrypted MQTT Telemetry Channel =====> |\n```\n\n---\n\n## 3. Gateway Hardening Automation Script (Bash)\n\nThis hardening script executes on freshly provisioned industrial Raspberry Pi and Debian edge micro-servers:\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\n\necho \"[+] Applying OurSiamDream Zero-Trust Edge Baseline...\"\n\n# 1. Disable unused kernel network protocols\ncat << 'EOF' > /etc/sysctl.d/99-osd-security.conf\nnet.ipv4.ip_forward = 0\nnet.ipv4.conf.all.send_redirects = 0\nnet.ipv4.conf.all.accept_redirects = 0\nnet.ipv4.conf.all.accept_source_route = 0\nnet.ipv4.tcp_syncookies = 1\nEOF\nsysctl -p /etc/sysctl.d/99-osd-security.conf\n\n# 2. Configure nftables: Drop ALL inbound traffic except loopback\nnft flush ruleset\nnft add table inet filter\nnft add chain inet filter input { type filter hook input priority 0 ; policy drop ; }\nnft add chain inet filter forward { type filter hook forward priority 0 ; policy drop ; }\nnft add chain inet filter output { type filter hook output priority 0 ; policy accept ; }\nnft add rule inet filter input iif lo accept\nnft add rule inet filter input ct state established,related accept\n\n# 3. Disable Root SSH and password authentication\nsed -i 's/^#*PermitRootLogin.*/PermitRootLogin no/' /etc/ssh/sshd_config\nsed -i 's/^#*PasswordAuthentication.*/PasswordAuthentication no/' /etc/ssh/sshd_config\nsystemctl restart sshd\n\necho \"[+] Baseline Hardening Complete. Gateway is stealth.\"\n```\n\n---\n\n## 4. Security Verification Checklist\n\n- [x] Run `nmap -Pn -p- <gateway_ip>` from local switch to confirm 0 responsive open ports.\n- [x] Verify root filesystem is mounted as read-only (`ro`) with overlayfs on temporary directories.\n- [x] Validate that client certificates are strictly scoped to specific MQTT topic namespaces (`devices/{id}/#`).\n- [x] Confirm that WireGuard peer configuration uses preshared keys (PSK) alongside 256-bit Curve25519 keys.\n- [x] Test simulated node theft: physical flash memory extraction yields encrypted LUKS volume without key material."
    },
    {
      "id": "OSD-DOC-007",
      "slug": "community-supply-chain-traceability-sop",
      "title": "Community Agroforestry Supply Chain Traceability SOP",
      "titleTh": "ระเบียบปฏิบัติมาตรฐาน (SOP) การตรวจสอบย้อนกลับห่วงโซ่อุปทานวนเกษตรชุมชน",
      "metaTitle": "Community Supply Chain SOP | OurSiamDream",
      "summary": "Standard operating procedure for tracking organic artisanal harvests from village cooperatives to ethical markets using cryptographic QR receipts.",
      "summaryTh": "ระเบียบปฏิบัติมาตรฐานสำหรับการติดตามผลผลิตเกษตรอินทรีย์จากวิสาหกิจชุมชนสู่ตลาดจริยธรรม ด้วยระบบใบเสร็จดิจิทัลและรหัสคิวอาร์เข้ารหัส",
      "category": {
        "id": "sustainable-agtech",
        "label": "Sustainable AgTech",
        "labelTh": "เกษตรกรรมยั่งยืนและเทคโนโลยี",
        "faIcon": "fa-solid fa-seedling"
      },
      "format": "Standard Operating Procedure",
      "difficulty": "Beginner",
      "readTime": "6 min read",
      "lastVerified": "2026-10-15",
      "author": "Sustainable Commerce Working Group",
      "authorRole": "Supply Chain Coordinator & Fair Trade Advisor",
      "indexedKeywords": [
        "Supply Chain",
        "Traceability",
        "Agroforestry",
        "Fair Trade",
        "QR Codes",
        "Cooperatives",
        "Thailand Agriculture",
        "Ethical Commerce"
      ],
      "keyOutcomes": [
        "100% batch traceability for community shade-grown coffee and organic honey products.",
        "Fair-share revenue verification proving over 70% of retail sales value returns directly to growers.",
        "Tamper-evident cryptographic QR certificates accessible to retail buyers via mobile scan.",
        "Standardized mobile logging interface functional on offline smartphones during harvest collection."
      ],
      "canonicalUrl": "https://www.oursiamdream.com/knowledge/community-supply-chain-traceability-sop/",
      "canonicalUrlTh": "https://www.oursiamdream.com/th/knowledge/community-supply-chain-traceability-sop/",
      "ragChunk": "[CONTEXT: OurSiamDream Supply Chain Traceability SOP]\nApplication: End-to-end harvest-to-retail auditing for community agroforestry products (artisan coffee, organic honey, herbal teas).\nTraceability Anchor: Batches are tagged at farm gate with a unique UUID-v4 hash encoding plot geolocation, harvest timestamp, cooperative member ID, and organic batch metrics.\nVerification Portal: Consumers scan public QR codes resolving to `oursiamdream.com/verify/{batch_id}`, rendering farmer biographical transparency and certified laboratory testing results.",
      "tokenEstimate": 768,
      "contentMarkdown": "## 1. Overview & Purpose\n\nOurSiamDream partners with local agricultural cooperatives to build economic resilience through fair-trade agroforestry. A major challenge in ethical specialty markets is greenwashing—middlemen blending high-grade community harvests with commercial commodity crops.\n\nThis Standard Operating Procedure establishes the step-by-step procedure for certifying, lot-tagging, and cryptographically verifying batches from rural plots in Northern and Southern Thailand directly to consumers and partner hotels.\n\n---\n\n## 2. Five-Stage Custody Lifecycle\n\n```\n  [1. Farm-Gate Harvest]\n  - Weigh raw harvest on calibrated scale.\n  - Tag lot with cooperative member token.\n             |\n             v\n  [2. Processing & Drying]\n  - Record fermentation temp & moisture reduction.\n  - Ingest quality control cupping scores.\n             |\n             v\n  [3. Batch Aggregation & Lab Testing]\n  - Test for zero pesticide residues (certified organic).\n  - Mint Immutable Batch UUID.\n             |\n             v\n  [4. Eco-Packaging & QR Printing]\n  - Print waterproof tamper-evident label.\n  - Link QR code to public verification ledger.\n             |\n             v\n  [5. Retail Scan & Community Dividend]\n  - Customer scans QR code in Bangkok or Phuket.\n  - View exact farmer revenue allocation (>= 70%).\n```\n\n---\n\n## 3. Batch Metadata Schema (JSON)\n\nEvery package produced by partner cooperatives carries an encoded JSON certificate:\n\n```json\n{\n  \"batch_id\": \"OSD-AGRO-2026-CNX-082\",\n  \"product_name\": \"Single-Origin Shade-Grown Arabica\",\n  \"harvest_date\": \"2026-10-12\",\n  \"cooperative\": {\n    \"name\": \"Mae Wang Sustainable Forest Cooperative\",\n    \"province\": \"Chiang Mai\",\n    \"elevation_masl\": 1280\n  },\n  \"processing_method\": \"Washed / Sun-Dried\",\n  \"quality_score_sca\": 86.5,\n  \"farmer_payout_percentage\": 72.5,\n  \"verification_url\": \"https://www.oursiamdream.com/verify/OSD-AGRO-2026-CNX-082\"\n}\n```\n\n---\n\n## 4. Field Quality Assurance Checklist\n\n- [x] Verify digital scale is calibrated against certified $1.000\\,\\text{kg}$ reference weight prior to morning intake.\n- [x] Ensure coffee cherry moisture is measured below $11.5\\%$ before packaging to prevent fungal spoilage.\n- [x] Validate that packaging bags use compostable polylactic acid (PLA) liners and soy-based inks.\n- [x] Test mobile QR scan with offline browser cache to guarantee consumer landing page renders instantaneously.\n- [x] Audit bank settlement manifests confirming direct bank transfers to growers within 48 hours of lot intake."
    },
    {
      "id": "OSD-DOC-008",
      "slug": "lifepo4-bess-safety-whitepaper",
      "title": "LiFePO4 Battery Energy Storage (BESS) Safety & Sizing",
      "titleTh": "เอกสารวิชาการความปลอดภัยและการคำนวณขนาดระบบกักเก็บพลังงานแบตเตอรี่ LiFePO4",
      "metaTitle": "LiFePO4 BESS Safety Whitepaper | OurSiamDream",
      "summary": "Technical whitepaper on thermal management, cycle life degradation, and fire prevention protocols for lithium iron phosphate microgrid storage in Thailand.",
      "summaryTh": "เอกสารวิชาการด้านการจัดการความร้อน การประเมินอายุการใช้งาน และระเบียบความปลอดภัยระบบแบตเตอรี่กักเก็บพลังงาน LiFePO4 ในสภาพภูมิอากาศร้อนชื้น",
      "category": {
        "id": "clean-energy",
        "label": "Clean Energy & Microgrids",
        "labelTh": "พลังงานสะอาดและไมโครกริด",
        "faIcon": "fa-solid fa-car-battery"
      },
      "format": "Technical Whitepaper",
      "difficulty": "Advanced",
      "readTime": "12 min read",
      "lastVerified": "2026-10-29",
      "author": "Sustainable Energy & Battery Systems Taskforce",
      "authorRole": "Chemical Systems Specialist & Energy Storage Architect",
      "indexedKeywords": [
        "LiFePO4",
        "Battery Storage",
        "BESS",
        "Thermal Management",
        "Cycle Life",
        "Battery Management System",
        "BMS",
        "Safety Standards",
        "Solar Storage"
      ],
      "keyOutcomes": [
        "Chemical stability analysis demonstrating LiFePO4 resistance to thermal runaway up to 270°C in tropical ambient environments.",
        "Sizing equations accounting for 35°C ambient temperatures and 80% maximum depth of discharge (DoD).",
        "Multi-tiered Battery Management System (BMS) architecture with independent hardware trip interlocks.",
        "Projected 6,000+ cycle service life delivering 15+ years of daily community microgrid dispatch."
      ],
      "canonicalUrl": "https://www.oursiamdream.com/knowledge/lifepo4-bess-safety-whitepaper/",
      "canonicalUrlTh": "https://www.oursiamdream.com/th/knowledge/lifepo4-bess-safety-whitepaper/",
      "ragChunk": "[CONTEXT: OurSiamDream LiFePO4 BESS Technical Whitepaper]\nStorage Technology: Lithium Iron Phosphate (LiFePO4 / LFP) prismatic cells (3.2V nominal).\nOperational Envelope: Maximum charge voltage 3.65V/cell, float 3.375V/cell, cutoff 2.80V/cell. Maximum recommended DoD is 80% for longevity.\nThermal Protection: Active dual-fan positive-pressure ventilation maintaining pack temperatures under 32°C. Charge current throttled at 40°C; emergency contactor trips at 50°C.\nSafety Redundancy: Solid-state shunt trip breaker + pyrotechnic inline fuse + independent BMS disconnect contactor.",
      "tokenEstimate": 915,
      "contentMarkdown": "## 1. Abstract\n\nBattery Energy Storage Systems (BESS) form the operational foundation of off-grid community microgrids. In tropical Southeast Asian environments, ambient temperatures frequently exceed 38°C with relative humidity above 85%. These conditions accelerate cell degradation, elevate internal resistance, and introduce thermal runaway hazards if chemistries like traditional lithium nickel manganese cobalt oxide (NMC) are deployed.\n\nThis paper presents the technical rationale, mathematical sizing methodology, and multi-layered safety architecture for OurSiamDream's standard **48V / 51.2V Lithium Iron Phosphate (LiFePO4)** battery arrays.\n\n---\n\n## 2. Chemical Stability Comparison\n\n```\n   Thermal Stability & Safety Profile\n   \n   NMC / Cobalt:   [==== Runaway Begins at ~150°C ====]  (Exothermic Oxygen Release)\n   LiFePO4 (LFP):  [========================= Runaway Resistance to ~270°C =====================]\n```\n\nThe strong covalent bonding between iron, phosphorus, and oxygen atoms in the phospho-olivine crystal lattice ensures that even under mechanical puncture or overcharging, oxygen is not released, preventing catastrophic self-sustaining combustion.\n\n---\n\n## 3. Microgrid Sizing Mathematical Model\n\nTo calculate the required gross battery bank capacity $C_{\\text{gross}}\\,(\\text{kWh})$ for a community center requiring $E_{\\text{daily}}$ daily consumption with $N_{\\text{autonomy}}$ days of cloudy weather reserve:\n\n$$C_{\\text{gross}} = \\frac{E_{\\text{daily}} \\times N_{\\text{autonomy}}}{\\eta_{\\text{inverter}} \\times \\text{DoD}_{\\max} \\times f_{\\text{temp}}}$$\n\nWhere:\n- $\\eta_{\\text{inverter}} = 0.94$ (Hybrid inverter conversion efficiency)\n- $\\text{DoD}_{\\max} = 0.80$ (80% maximum Depth of Discharge for 6,000-cycle life)\n- $f_{\\text{temp}} = 0.95$ (High ambient temperature capacity derating factor)\n\n---\n\n## 4. Multi-Tiered Electrical Protection Matrix\n\n| Tier | Component | Trigger Parameter | Action |\n| :--- | :--- | :--- | :--- |\n| **Level 1 (Software)** | Smart BMS Microcontroller | Cell $V > 3.65\\,\\text{V}$ or $T > 42^\\circ\\text{C}$ | Signals inverter over CAN bus to taper charging current |\n| **Level 2 (Electromechanical)** | Solid-State Main Contactor | Cell $V > 3.75\\,\\text{V}$ or $T > 48^\\circ\\text{C}$ | Disconnects pack main busbar within 15 milliseconds |\n| **Level 3 (Hardware Pyrofuse)**| Class T Fast-Blow Fuse (300A) | Short Circuit Current $> 20\\,\\text{kA}$ | Immediate physical melting, extinguishing electrical arc |\n\n---\n\n## 5. Engineering Installation Checklist\n\n- [x] Position battery cabinet elevated minimum 30 cm above floor level against seasonal monsoon inundation.\n- [x] Ensure battery room ambient ventilation maintains airflow greater than 10 air exchanges per hour.\n- [x] Torque all busbar bolts with calibrated torque wrench to exactly $6.0\\,\\text{N}\\cdot\\text{m}$ and apply witness marks.\n- [x] Verify CAN bus communication packets (Pylontech / Victron protocol) are verified on inverter screen.\n- [x] Install aerosol fire suppression canister (Potassium carbonate compound) inside battery enclosure lid."
    }
  ]
}