Skip to content
This repository was archived by the owner on Sep 6, 2019. It is now read-only.

Fixed a bunch of bugs, and some documentation issues #6

Merged
merged 3 commits into from
Aug 28, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 57 additions & 29 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,61 @@ <h2>Check your data file</h2>

<label for="input">Enter data file:</label>
<textarea id="input">[
{
"title": "Example",
"description": "An example valid data file",
"dataDictionary": "http://foo.gov",
"accessURL": "http://foo.gov",
"license": "public domain",
"public": true,
"organization": "Project Open Data",
"keywords": [
"example",
"schema"
]
},
{
"title": "Another Example",
"description": "Another example dataset",
"dataDictionary": "http://foo.gov",
"accessURL": "http://foo.gov",
"license": "public domain",
"public": true,
"organization": "Project Open Data",
"keywords": [
"another",
"example"
]
}
]</textarea>
{
"title": "Data Catalog",
"description": "Version 1.0",
"keyword": "catalog",
"modified": "2013-05-09",
"publisher": "US Department of X",
"person": "Contact Person",
"mbox": "[email protected]",
"identifier": "1",
"accessLevel": "Public",
"distribution": [{
"accessURL": "http://agency.gov/data.json",
"format": "json"
}]
},
{
"title": "Public Elementary/Secondary Listing",
"description": "The purpose of the CCD nonfiscal surveys is to provide a listing of all schools and agencies providing free public elementary and secondary education, along with basic descriptive statistical information on each school and agency listed. Penalties apply for misuse, seehttp://nces.ed.gov/ncesglobal/data_usage_agreement.aspfor more details.",
"keyword": "education, schools",
"modified": "2011-11-19",
"publisher": "US Department of Education",
"person": "Open Data Initiative",
"mbox": "[email protected]",
"identifier": "ykv5-fn9t",
"accessLevel": "Public",
"dataDictionary": "http://nces.ed.gov/ccd/pdf/INsc09101a.pdf",
"distribution": [{
"accessURL": "https://explore.data.gov/views/ykv5-fn9t/rows.csv?accessType=DOWNLOAD",
"format": "csv",
"size": "200mb"
},{
"accessURL": "https://explore.data.gov/views/ykv5-fn9t/rows.json?accessType=DOWNLOAD",
"format": "json"
},{
"accessURL": "https://explore.data.gov/views/ykv5-fn9t/rows.xml?accessType=DOWNLOAD",
"format": "xml"
}],
"webService": "http://explore.data.gov/api/views/ykv5-fn9t/rows.json",
"license": "Public Domain",
"spatial": "US",
"temporal": "2009-09-01 00:00:00,2010-05-31 00:00:00",
"frequency": "one-time",
"language": "English",
"granularity": "",
"dataQuality": "true",
"theme": "education",
"references": "http://nces.ed.gov/ccd/data/txt/psu091alay.txt",
"landingPage": "http://ed.gov/developer",
"feed": "",
"systemOfRecords": "http://nces.ed.gov/ccd/"
}]</textarea>

<input type="checkbox" id="require_if_available" name="require_if_available" value="true" onchange="window.rebuild_schema();project_open_data_validator.validate()"> Require "Required if Applicable" Fields<br>
<input type="checkbox" id="require_extended" name="require_extended" value="true" onchange="window.rebuild_schema();project_open_data_validator.validate()"> Require all Extended Fields<br>


<h3>Status</h3>

Expand All @@ -69,8 +97,8 @@ <h3>Additional Resources</h3>
<ul>
<li><a href="https://gist.github.com/3952577">JSON 101</a></li>
<li><a href="http://jsonlint.com/">JSON Validator</a> (useful for your JSON not properly parsing)</li>
<li><a href="http://project-open-data.github.com/common-core-metadata-schema/">Schema Definition</a>
<li><a href="http://project-open-data.github.com/open-data-catalog/">Reporting Requirements</a>
<li><a href="http://project-open-data.github.io/schema/">Schema Definition</a>

</ul>
</div> <!-- /container -->

Expand Down
261 changes: 152 additions & 109 deletions js/schema.coffee
Original file line number Diff line number Diff line change
@@ -1,113 +1,156 @@
#Project open data reporting schema
#For more information on the format,
# see https://github.com/Baggz/Amanda/blob/master/docs/json/objects/schema.md
#
#For more information on the project open data schema, see http://project-open-data.github.io/schema/

require_if_available = () -> document.getElementById("require_if_available").checked
require_extended = () -> document.getElementById("require_extended").checked


rebuild_schema = () ->
window.schema =
type: "array"
minItems: 1
required: true
uniqueItems: true
items:
type: "object"
properties:

#
# required fields
title:
type: "string"
required: true

description:
type: "string"
required: true

keyword:
type: "string"
required: true

modified:
type: "string"
format: "date"
required: true

publisher:
type: "string"
required: true

person:
type: "string"
required: true

mbox:
type: "string"
required: true

identifier:
type: [ "string", "integer" ]
required: true

accessLevel:
type: "string"
required: true
enum: [
"Public", "Restricted", "Private"
]

#
# required if available
dataDictionary:
type: "string"
format: "url"
required: require_if_available()

accessURL:
type: "string"
format: "url"
required: require_if_available()

format:
type: [ "string", "array" ]
required: require_if_available()

license:
type: "string"
required: require_if_available()

webService:
type: "string"
format: "url"
required: require_if_available()

spatial: {
required: require_if_available()
} # what format is this?

temporal: {
required: require_if_available()
} # what format is this?


#
#expanded fields

format:
type: [ "string", "array" ]
required: require_extended()

issued:
type: "string"
format: "date"
required: require_extended()

accrualPeriodicity:
type: "string"
enum: ["hourly", "daily", "weekly", "yearly", "other"]
required: require_extended()

language:
type: "string"
required: require_extended()

granularity:
type: "string"
required: require_extended()

dataQuality:
type: "string"
required: require_extended()

theme:
type: "string"
required: require_extended()

references:
type: "string"
required: require_extended()

distribution:
type: [ "string", "array", "object" ]
required: require_extended()

size:
type: [ "string", "integer" ]
required: require_extended()


download:
type: "string"
format: "url"
required: require_extended()

Feed:
type: "string"
format: "url"
required: require_extended()

rebuild_schema()

window.rebuild_schema = rebuild_schema

window.schema =
type: "array"
minItems: 1
required: true
uniqueItems: true
items:
type: "object"
properties:

#basic fields

title:
type: "string"
required: true

description:
type: "string"
required: true

dataDictionary:
type: "string"
format: "url"
required: true

accessURL:
type: "string"
format: "url"
required: true

keywords:
type: "array"
required: true
minItems: 1
items:
type: "string"

license:
type: "string"
required: true

public:
type: "boolean"
required: true

organization:
type: "string"
required: true

#expanded fields

modified:
type: "string"
format: "datetime"

format:
type: [ "string", "array" ]

publisher:
type: "string"

issued:
type: "string"
format: "datetime"

accrualPeriodicity:
type: "string"

identifier:
type: [ "string", "integer" ]

spatial: {} # what format is this?

temporal: {} # what format is this?

language:
type: "string"

granularity:
type: "string"

dataQuality:
type: "string"

theme:
type: "string"

references:
type: "object"

distribution:
type: [ "string", "array", "object" ]

size:
type: [ "string", "integer" ]

format:
type: [ "string", "array" ]

download:
type: "string"
format: "url"

WebService:
type: "string"
format: "url"

Feed:
type: "string"
format: "url"
Loading