Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDocs data validation #11

Open
dhornbein opened this issue Apr 1, 2014 · 1 comment
Open

GDocs data validation #11

dhornbein opened this issue Apr 1, 2014 · 1 comment
Labels

Comments

@dhornbein
Copy link
Owner

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

@dhornbein dhornbein added the bug label Apr 1, 2014
@thiagodemellobueno
Copy link
Collaborator

So we would throw out records and log warnings for mismatches?
We can set up some tests on the app side (not something I'm too familiar with, but keen to bring into my workflows) http://jasmine.github.io/2.0/introduction.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants