Skip to content

GDocs data validation #11

@dhornbein

Description

@dhornbein
function phenClockGDImport (json ) {
        var out = [];
        for( var i = 0; i < json.feed.entry.length; i++){
          var entry = json.feed.entry[i];
          out[i] = {
            'id': entry.gsx$id.$t,
            'categories': entry.gsx$category.$t.split(','),
            'category': entry.gsx$category.$t,
            'name': entry.gsx$name.$t,
            'events': [{
                'start': entry.gsx$eventstart.$t,
                'end': entry.gsx$eventend.$t
            }],
            'description': entry.gsx$description.$t,
            'color': entry.gsx$color.$t.replace('#','')
          }
        }
        pClock.data = out;
      }

This is the logic that builds the pClock data object. At some point this data needs to be validated.

id must be a number
category & categories... these need to be fleshed out more, might deprecate.
name there are actually two kinds of names, the species name (which should be the same across spreadsheets) and common name, which is what local people call it.
events should be a date, in any conceivable format.
description can be any kind of text
color is a hex color with or without a hashtag

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions