Skip to content

Document architecture

fredrikbw edited this page May 6, 2021 · 6 revisions

Metadata Database structure

  • Description: A Database containing all metadata needed for visualizing data from different data sources.
  • Type: MongdoDB
  • Deployment: Atlas Cluster*
  • Version: 4.4.4*
  • Region: AWS N. Virginia (us-east-1)*

*Subject to change

MongoDB stores data in flexible, JSON-like documents. This allows for fields to vary from document to document. By taking advantage of this we can create field in the database that consists of an array of all the different types of visualizations that are possible for that data source, the names of axes and fields, value limits and the types of those values.

Description of the documents fields:

{
   "_id":"ID of the document",
   "name":"Name of the document",
   "datasource_id":"Custom made ID for each data source",
   "description":"Description of the document",
   "tags":[
      "An array of tags for this data source"
   ],
   "source":"A URL to where the open data is taken from",
   "updated":"timestamp of when data source was last updated.",
   "published":"timestamp of when data source was published",
   "visualisations":[
      "Array consisting of Objects. Each Object contains information about a visualization that is possible for this data source"
   ]
}

Example of an metadata document that could be stored in the database

{
   "_id":{
      "$oid":"603f7f657793a9a7a24144a0"
   },
   "name":"MetAPI Forecast",
   "description":"This service delivers a full weather forecast for one location, that is, a forecast with several parameters for a nine-day period.",
   "datasource_id":"MET_API",
   "tags":[
      "meteorologisk institutt",
      "Met",
      "Weather",
      "Forecast"
   ],
   "source":"https://api.met.no/weatherapi/locationforecast/2.0/documentation",
   "updated":"2020-12-01 23:59:59.000",
   "published":"2010-12-01 23:59:59.000",
   "visualisations":[
      {
         "type":"barchart",
         "axes":{
            "x":{
               "name":"Torsk",
               "type":"integer",
               "limit":[
                  {
                     "$numberInt":"0"
                  },
                  {
                     "$numberInt":"100"
                  }
               ]
            },
            "y":{
               "name":"År",
               "type":"date",
               "limit":[
                  {
                     "$numberInt":"0"
                  },
                  {
                     "$numberInt":"100"
                  }
               ]
            }
         }
      },
      {
         "type":"piechart",
         "segments":[
            {
               "name":"A",
               "value":[
                  {
                     "$numberInt":"0"
                  },
                  {
                     "$numberInt":"10"
                  }
               ]
            }
         ]
      },
      {
         "type":"linechart",
         "axes":{
            "x":{
               "name":"Torsk",
               "type":"integer",
               "limit":[
                  {
                     "$numberInt":"0"
                  },
                  {
                     "$numberInt":"100"
                  }
               ]
            },
            "y":{
               "name":"aar",
               "type":"date",
               "limit":[
                  {
                     "$numberInt":"0"
                  },
                  {
                     "$numberInt":"100"
                  }
               ]
            }
         }
      },
      {
         "type":"thresholdchart",
         "threshold":{
            "$numberInt":"50"
         },
         "axes":{
            "x":{
               "name":"torsk",
               "type":"integer",
               "limit":[
                  {
                     "$numberInt":"0"
                  },
                  {
                     "$numberInt":"100"
                  }
               ]
            },
            "y":{
               "name":"aar",
               "type":"date",
               "limit":[
                  {
                     "$numberInt":"0"
                  },
                  {
                     "$numberInt":"100"
                  }
               ]
            }
         }
      }
   ]
}