Skip to content

Model layer

Paul Crossley edited this page Sep 17, 2024 · 4 revisions

This is a brief explanation of the model layer of the backend application (these models are found in the app/models directory).

Authentication

  • User - Hopefully self-explanatory, this stores:
    • Email address and password
    • Auth token, which is set as a cookie on the user's browser
    • A flag indicating whether or not they are an admin (this is currently unused, and pre-dates the new team-based permission model)
    • Disabled - a flag which when enabled disables the user's access to LMT.
  • Team - This is a "container" for all of a team's resources
  • Membership - Join table between User and Team
  • Permission - Permission type linked to specific dataset
  • TeamPermission - Permission associated table with Team and Permission. Enabled property determines status of permission for a Team

Basics

  • Region - Container for region-specific stuff, in practice most teams only have 1 region, so we might want to remove the region model entirely and move all the contained resources up to the team level
  • Overlay - Container for GeoJSON files that are uploaded through the UI
  • Model - for the old modelling system
  • Project - for the new projects system
  • Dataset - Saved results from the project system; JSON file is attached with ActiveStorage
  • Extent - Geographical data for a work area
  • Mask - Saved TileGrid for non-quadrilateral Extents

Map tiles

  • MapTileLayer - stores a group of thematically related map tiles (i.e. a year, or a season)
  • MapTileUpload - stores an uploaded ZIP archive (attached with ActiveStorage) that is extracted by a background job on the server
  • MapTile - stores metadata about a map tile; the image is attached with ActiveStorage

Interacting with the image classifier

A lot of this stuff becomes redundant with the new projects system, and might need to be refactored or removed

  • LabelSchema - defines a "format" for categorical data, e.g. "Land use classification" or "
    • Label - Defines a specific category, including name and colour
  • LabellingGroup - in the UI these are called "labellings", these store the metadata about a labelling (i.e. the extent and zoom level)
    • Labelling - in the UI these are called "labelling layers", these store the actual data for each layer in a labelling
  • MapTileDownload - used to download archives of map tiles to classify
  • LabellingGroupUpload - used to upload the result produced by the image classifier
  • TrainingDataDownload - used to download archives containing training data to train the classifier
  • TrainingDataSampler - this isn't actually persisted to the database, but is used to generate a randomly sampled subset of training data

Diagram

Simplified diagram with legacy tables removed

Legacy diagram