Skip to content
Andrés Maneiro edited this page Feb 3, 2016 · 11 revisions

Data model

CommonsLabInventory is built upon the services, API and data storage that CartoDB provides.

Table Visibility Description
projects in revision Private Stores data sent by using "Add form".
database_federal_citizen_science Public After CommonsLab team refines the data in "projects in revision" table, they are moved to this one to make them public.
properties Private Stores categories ("project topic", "agency sponsor", "agency partner", "geographic scope", etc) and their valid values. It is used to populate main page filters and the insert form components.

Properties

Some fields within the table database_federal_citizen_science have a finite set of valid values. We call this "properties" and the values are stored in the table properties.

For example, "project topic" allows as valid values:

Animals, Archeology, Astronomy & Space, Biology, Birds, Chemistry, Climate & Weather, Computers & Technology, Disaster Response, Ecology & Environment, Education, Food, Geology & Earth Science, Health & Medicine, Insects, Nature & Outdoors, Ocean & Water, Physics, Psychology, Science Policy, Transportation.

The table properties should contain as many rows as values are valid:

Property Value
project_topic Animals
project_topic Archeology
project_topic Astronomy & Space
... ...

These values are used to populate the filters in the front page of the project and also the components of the "add form" page. So with this mechanism, an administrator can add/remove/edit rows to the table properties and it has the effect of modifying live the filters and forms in the website.

How to use the Data / SQL API

  • By means of SQL CartoDB API, the data can be used by other people/projects.
  • The documentation regarding SQL CartoDB API: http://docs.cartodb.com/cartodb-platform/sql-api/
    • It offers the possibility to download data in CSV, SHP, SVG, KML, SpatiaLite and GeoJSON formats.

Take, as an example, the public projects table: https://inventory.cartodb.com/tables/database_federal_citizen_science/public

How to get all data from the public table in GeoJSON:

https://inventory.cartodb.com/api/v2/sql?format=GeoJSON&q=SELECT%20*%20FROM%20database_federal_citizen_science%20

To get a particular subset of the data (ie: those affiliated to USGS) regular SQL queries can be used:

https://inventory.cartodb.com/api/v2/sql?format=GeoJSON&q=SELECT%20*%20FROM%20database_federal_citizen_science%20WHERE%20affiliation=%27USGS%27
Clone this wiki locally