learndb/db/README.md

56 wiersze
2.8 KiB
Markdown

2022-07-10 15:01:35 +00:00
# JSON format
2022-06-03 10:39:27 +00:00
2023-01-01 03:13:33 +00:00
These JSON files are now not the master data but will be generated from a PostgreSQL database whose schema is defined in `schema.sql`.
2022-12-26 01:04:11 +00:00
## topics.json
2022-06-03 10:39:27 +00:00
`name` is used as primary key and therefore, must be unique and avoid uppercase and special characters other than hyphen and slash. Here are some examples: `physics`, `linear-algebra`, `nations/india`, `programming-languages/objective-c`.
2023-01-01 03:13:33 +00:00
`hname` is used as human-readable name and can preserve uppercase. For eg: `ADHD`.
2022-06-03 10:39:27 +00:00
2023-01-01 03:13:33 +00:00
`parent_name` should be the name of the parent topic. This makes it possible to show a hierarchical view. If a topic does not have `parent_name`, it would be at the top-level but if it doesn't have children topics of its own, it will be clubbed under a dummy top-level topic called `Misc`.
2022-06-03 10:39:27 +00:00
`sort_index` is an integer that's used for controlling the ordering in which topics are displayed.
2023-01-01 03:13:33 +00:00
## creators.json
A top-level table that lists well-known experts and their metadata like occupation, links etc. These are references from items and their reviews.
2022-06-03 10:39:27 +00:00
2022-12-26 01:04:11 +00:00
## items.json
2022-06-03 10:39:27 +00:00
2023-01-01 03:13:33 +00:00
`id` should be a unique UUID. It is needed because there is no other natural primary key. This might also be useful later for defining collections of items.
2022-06-03 10:39:27 +00:00
`description` can contain markdown with multiple lines.
2023-01-01 03:13:33 +00:00
`links` is an array of strings. Each item in this array is `format`, `url` and optional identifiers separated by `|`. For eg, one of the strings in `links` might: `summary|https://sivers.org/book/Decisive|ipfs:bafykbzaceaejt6z54qnwnl3ccvw2lsdfksbeuwuh4sv77ixj4c3ldeof2c5so?filename=Daniel%20Higginbotham%20-%20Clojure%20for%20the%20Brave%20and%20True-No%20Starch%20Press%20%282015%29.pdf`.
2022-06-03 10:39:27 +00:00
2023-01-01 03:13:33 +00:00
The use-case for optional identifiers are things like `ipfs:`, `doi:`, `isbn:` or `isbn13:`.
2022-06-03 10:39:27 +00:00
2023-01-01 03:13:33 +00:00
`topics` is a array of topic names. These should exactly match `topics` table's `name` column.
2022-06-03 10:39:27 +00:00
2023-01-01 03:13:33 +00:00
`creators` is an array of strings which are references to the `creators` table's `name` column. For eg: `charles_darwin`.
2022-06-03 10:39:27 +00:00
2023-01-01 03:13:33 +00:00
`difficulty` must be either `null` or one of these: `childlike`, `beginner`, `intermediate`, `advanced`, `research`.
2022-06-03 10:39:27 +00:00
2023-01-01 03:13:33 +00:00
`rating` is an integer on 0-100 point scale. This is a curated value and should not be simply copied from external sources.
2022-06-03 10:39:27 +00:00
`tags` can describe quality: `visual`, `entertaining`, `challenging`, `inspirational`, `interactive`, `oer`. `oer` stands for "Open Educational Resource" and can be used if the linked content does not require payment or user login.
2022-06-03 10:39:27 +00:00
2023-01-01 03:13:33 +00:00
`reviews` is an array of JSON objects that must match this schema as you can see in `schema.sql`:
```
{
"type": "array",
"items": {
"type": "object",
"properties": {
"by_item": {"type": ["string", "null"]},
"by_creator": {"type": ["string", "null"]},
"rating": {"type": ["integer", "null"], "minimum": 0, "maximum": 100},
"blurb": {"type": ["string", "null"]},
"url": {"type": ["string", "null"]}
}
}
}
```