Models
A major change in the v3 Dashboard is the structure of the database. More models where added to help with performance and creating queries.
Terminaology
I will draw comparisions from MongoDB to SQL terms. Starting from the bottom,
Row
in SQL is called aDocument
in MongoDB.- For example we have a Document for image
P25959661.jpg
- For example we have a Document for image
Table
in SQL is called aCollection
in MongoDB.- For example we have a Collection for all images
Schema
in SQL is aNamespace
in MongoDB.- For example we have a Namespace called
dev
or one calledproduction
.
- For example we have a Namespace called
Models
The following are the TypeScript interfaces for each model. If a key has a ?
next to it means its optional.
Catalog
The Catalog object is the overarching model that contains the archives which in turn contains the images. It also contains the questions that are applied to all images of archives that are part of this catalog. This is the types of the Catalog.
There is a new noteable field called imageServeOrder
that defines how to serve imags. By
default it is "random" however if the json file used for import via the CLI is like so
Then images of archive1
will be assigned in that order (image1 is assigned first, then image2 then image3 and so on). NOTE
caution
If there are other archives such
as archive2
that isnt defined then that archive will use random assignment.
Archives
These are subfolders of the Catalogs and is originally in place due to how the NOAA images where downloaded. They serve no other purpose other then to group images up and serve as a link between Catalogs and Images
Images
The Image models most important fields are the tags
, the tillComplete
and
taggable
fields. A major change is the tillComplete
,finalTag
,finishedTagging
,and tags
fields have been removed
Question Set
Of the current models, the question set is the only one that is NOT checked. It serves simply as a guideline for admins to use. Due to this nature it is HIGHLY reccomended to make sure the documents for Question Sets are correct and is best to copy an existing one
These are some Typescript type annotations to help understand the structre of each question type. Anything with ?:
means its optional, else its required
There are 4 types of questions, Radio,Checkbox,Quick submit button and Textfield.
User
Finally there is the user model which is more or less the same
Assigned Image
This is one of the newer models. It serves to store the currerntly assigned image of a (user,archive) pair. This model requires that imageId
,archiveId
,userId
be given. The remaining fields are automatically created
Tag
Another new model. This model takes the data from the tags
field of an image and places each tag as a new entry. This is done for many reasons. Firsty it makes it easy to get a list of images that have been tagged, since every entry is a tag of an image that has been tagged. It also ensures that certain pieces of information are recorded such as userId
and imageId
Notification
This is global messages to show to users.
It just has a message and the date of the message. On the home page it shows the recent message as the top one. The message can even have html and css inside it, for example like so.
Namespaces
As mentioned before Namespaces are like Schemas in SQL. Generally there are 3, a dev namespace,a production namespace and test namespace.