This is the full data model of Rootski in the PostgreSQL database. The pictures show how the data is used on the frontend.
Obviously, we could use the data in more than just these ways, but the images should help make it concrete.
Postgres is a really cool technology, but I wonder if we would be better served switching to a NoSQL database type. This is something that's on my mind, but for now, SQLAlchemy and Postgres all the way!
Factors to consider in a database technology:
- Duration of read queries — How fast can I get the data I request?
- Duration of write queries and consistency! — After inserting/updating a record (like a user breakdown), how long does it take for all other users of the app to see the new record or notice that it has changed?
- Cost — How much will it cost us monthly to use the database for our read/write needs?
- Scalability — As the number of users increases, is our database able to handle more frequent transactions? If it's horizontally scalable, then yes. If it's only vertically scalable, to handle more requests, we'd have to pay for a more expensive machine to run the database on.
Here are the queries we want to be able to run:
/search/{search_term}
— Given a string of Roman OR Cyrillic characters (not both), what are all the words containing that substring?
/wordData/{word_id}
— Given a word ID, fetch the following things:
- The breakdown for the word associated with the user making the request
- All the definitions and subdefinitions for that word
- All of the example sentences for that word
- The POS-dependent grammar information for the word: conjugations for verbs, declensions for adjectives and nouns, short forms for adjectives.
- All the related words for that word (words that share the same root—not necessarily the same prefix or suffix)