Using the HTMS API to work with tabular-network database


1. Database description

A conceptual data schema is four tables and a description of the dependencies between them:

Notes:

  • sequence number of the response in the survey - used only to form a queryset when displaying the page with the survey
  • name of the survey participant registered on the site - it is filled out only for registered users (non-registered users can also vote and comment). Registered users may suggest creating new polls, but we will not discuss such subtleties in this article.

Dependencies:

  1. Each survey (a row in the Polls table) corresponds to 2 or more answers, i.e. rows in table Answers
  2. Each answer (a row in the Answers table) corresponds to 0 or more comments, i.e. rows in the Comments table
  3. If the site visitor voted for the first time, a new row is created for him in the Visiters table. Users are identified by ip address
  4. After each vote, the number of votes cast for the selected answer in the survey increases by 1
  5. The site must remember what answers each visitor gave and what comments he left: each user comment is written in a new row of the Comments table