Big questions.
Grounded answers.
Turn satellite observations into insights you can trace.
Ask a question. Explore the evidence. Make the connection.
What would you like to explore?
A good answer starts with evidence.
Your answer and its reference records will appear here.
Every source is yours to inspect.
Explore the dataset.
103 invented observations. 28 places across Malaysia. Four ways to see our planet.
Where the records live
Malaysia outline · north is up · panels use separate scales. Hover or focus a point for its place name.
Coordinates are approximate place references. All observations and measurement values are fictional. Outline: Natural Earth.
The system behind the answer.
Follow the current system: Malaysian sample data, editable records, computed rankings and optional web context.
01 / HOW THE COMPONENTS CONNECTSystem architecture
One browser app and a shared Python backend, served locally or through Heroku Gunicorn. The backend combines the bundled dataset with saved edits, computes results and optionally calls the model and web-search service.
Components and folders
Each folder groups one responsibility. The backend serves the frontend and calls the RAG engine in the same Python process. Ollama and web search connect to optional external services.
frontend/ · Browser interface
Pages, styles and JavaScript for the assistant, Data Explorer and Architecture views. Bundled map assets provide geographic context. The browser sends questions and record edits to the backend API.
backend/ · Python API gateway
server.py starts the local server; webapp.py handles HTTP routes and the production WSGI entry point. It validates requests, serves UI assets, reads current records and returns answers, saved edits and exports.
rag_server/ · RAG and AI context
rag.py retrieves dataset evidence, computes rankings and listings, and composes excerpts or calls Ollama. web_context.py builds model context with optional external search excerpts and checks citations.
data/ · Datasets and persistence
sample-data/ holds the JSON, CSV, GeoJSON and practice queries. generate_data.py rebuilds the synthetic corpus. record_store.py validates edits, merges SQLite overrides and exports current records; local saves live in database/.
docs/ · Architecture and guides
diagrams/ holds the downloadable architecture and process-flow SVG documents shown on this page. HEROKU.md describes deployment, model connections and storage limits.
tests/ · Shared verification
Unit and HTTP integration checks cover retrieval, model and search fallback, data consistency, record editing and API responses. Deployment settings such as Procfile and requirements.txt stay at the repository root.
Question flow: frontend/ → backend/ → current records from data/ → evidence and answer from rag_server/ → backend response → browser. Saved edits pass through the backend to the data store.
Nationwide sample data
The generator creates 103 synthetic observations across 28 locations, covering all 13 Malaysian states and three federal territories. Four applications cover flood, vegetation, land-use and coastal observations. These are invented teaching measurements.
Persistent record editing
Expand an Explorer card and choose Edit record, then Save changes or Cancel. The backend validates changes and detects stale edits. Saved overrides live in local SQLite, separate from the bundled JSON, and are read for each request.
Immediate data updates
New answers, rankings, map markers and CSV, JSON or GeoJSON downloads use saved values immediately. Observation summaries and quality labels update automatically; IDs, applications and units remain stable. The editing browser clears its previous answer after a save.
Malaysia reference map
The Explorer draws locally bundled Natural Earth country outlines behind the markers. Both use the same coordinate projection. Peninsular and East Malaysia use separate panel scales, with hover and keyboard-focus labels. The map works offline.
Model and web connections
The backend calls the configured Ollama-compatible model. The Web search switch is off by default. Turning it on selects AI Ollama and searches through Ollama Cloud for up to five external excerpts. Model and search credentials stay on the server.
Deployment and persistence
Local SQLite edits survive local app restarts and are shared by workers on the same filesystem. Heroku dyno filesystems are temporary and separate; durable hosted editing needs persistent storage. Local development can use local Ollama; Heroku needs a reachable model endpoint.
How does retrieval differ from numeric ranking?
Exact place and state names, topic aliases and the selected Topic narrow the candidate records. General questions use BM25 to rank positive text matches, with k1 = 1.5 and b = 0.75. There is no fixed source-count cap. BM25 scores measure text relevance, not confidence or environmental severity.
Questions such as “top 5 worst flood in Malaysia” sort every matching record numerically before selecting five results. Flood rankings use inundated area, not overall severity. “List all flood observations” returns every matching record. Python computes these results directly, including when AI Ollama is selected.
Regional phrases such as “southern Malaysia” are not built-in state filters. With web search enabled, the model can use external context to explain a regional interpretation and its limitations. This project uses lexical retrieval, with no model training, embeddings or vector database.
Explore BM25 scoring ↗ · Stanford information retrieval chapter ↗
02 / FROM QUESTION TO RESPONSEProcess flow
The request validates settings, reads current records and selects evidence. Web search adds an optional external path; computed dataset rankings and listings remain intact.
Dataset-only requests
Web off makes no search-provider request. The model receives dataset evidence only. Without matching records, or for live conditions and predictions, the dataset-only path reports insufficient evidence. Offline mode shows excerpts and computed results without a model call.
Web-assisted requests
Web on sends the question to Ollama Cloud search. Usable excerpts and their URLs form a separate evidence set, which can support model inference even when the dataset is insufficient. External context never validates invented measurements or replaces computed dataset results. Choosing Offline turns the switch off.
Transparent fallback
Search failures and empty results are labelled, and the response uses dataset evidence. Model errors, timeouts and missing or invalid citations fall back to labelled excerpts. Successful web references remain available when the model fails.
Check evidence and dates
Generated citation IDs must belong to the supplied evidence; web-assisted answers must cite a web reference. This checks source identity, not whether every claim follows from it. Search retrieval times are not publication dates. Verify relevance, dates and limitations.
References and exports
The displayed answer hides inline source IDs and the duplicate Refs footer. The References section separates synthetic dataset cards from clickable external links and excerpts. Response JSON downloads retain both evidence sets, actual mode, notices and search status.
Edit and save flow
An Explorer edit submits the original record and changed fields. Validation errors keep the draft available; a conflict protects newer edits. Successful saves update SQLite and the editing browser, while later queries and data downloads read the merged values.
03 / NO CODING KNOWLEDGE NEEDEDFrom your question to a grounded answer
Think of SpaceLab as a notebook, a finder, a calculator, an optional web researcher and an AI writer. Each has a different job.
Your notebook
The dataset contains invented observations around Malaysia. Edit a record in Data Explorer and save it to update the notebook for everyone using this app. Summaries, map markers, future answers and data downloads use those saved changes.
Choose the evidence
Leave Web search off to use your dataset only. Turn it on to add external context with links you can inspect. Offline mode uses the calculator and source excerpts; AI Ollama asks the configured model to help explain the evidence.
Your final check
Open References to inspect the dataset cards and any web sources. A plausible answer still needs checking. Sample measurements describe classroom scenarios; external excerpts may be incomplete or out of date.