Read one field from a RIDA dataset with Python and Node.js
I used AI assistance to draft this tutorial. I’m sharing RIDA as its maker.
A bilingual archive gives you a simple reason to read a record one field at a time. When you want the Urdu translation, there is no reason to send the Arabic text and every note along with it. RIDA builds an index over prepared records so a reader can look up a field by record ID. Here is a small example you can reproduce with the same file in Python and Node.js.
1. Build a tiny dataset
Use Python 3.10 or later and Node.js 20 or later. In a fresh directory, save this as records.json:
{ "entry-1": { "arabic": "كتاب", "urdu": "کتاب", "category": "glossary" } } python3 -m venv .venv source .venv/bin/activate python -m pip install rida-format==3.0.2 rida build records.json Demo.rida --yes Keep Demo.rida and its companion index together. The build writes a dataset to disk. Use a fresh output name for another build.
2. Read just the Urdu value in Python
Save this as read_demo.py and run python read_demo.py from the same directory.
from rida import RidaFile with RidaFile("Demo.rida") as dataset: print(dataset.get("entry-1", "urdu")) Expected output is کتاب. You can fetch both values in one call with dataset.get_many("entry-1", ["arabic", "urdu"]) inside the with block.
3. Open the Python-built file in Node.js
Install the Node reader with npm install rida-format@3.0.2. Save the following as read_demo.mjs, then run node read_demo.mjs.
import { RidaReader } from "rida-format"; const reader = await RidaReader.open("./Demo.rida"); try { console.log(await reader.get("entry-1", "urdu")); } finally { await reader.close(); } You should see the same کتاب. Both programs read the same data and index. There is no second build or intermediate JSON export.
What changes when the data is hosted?
The lookup still starts with a record ID and a field name. The index lets the reader find the stored value, then the remote reader can use HTTP byte-range requests to retrieve the relevant bytes. Your host needs to support byte ranges, and your reader needs the companion index. Check the remote setup in the guides before deploying. If you enable encryption on a real dataset, provide its key when reading and keep it separate from public files.
This approach fits prepared, read-heavy collections where your app already knows the record ID. Full-text search is a separate job. For a catalogue, one practical setup is to find an ID in the search layer and use that ID to fetch its display fields from RIDA.
The RIDA repository has a larger public sample and the Python and Node.js guides. I wrote more about the bilingual archive that prompted this example in RIDA by QASRA on Medium.