Javascript Data Request Form

From OPeNDAP Documentation
Jump to: navigation, search

My goal is to create a Javascript API for accessing OpenDAP metadata and an intuitive, Javascript-based data-request construction form.

Please note: This is a proposal for a Google Summer of Code project. It was not implemented.

1 Plan of action

  1. Create API for accessing geographical and time data with Javascript by modifying existing BES module or adding a new one
  2. Create Javascript library for easily accessing OpenDAP metadata
    1. Write asynchronous metadata retrieval interface
    2. Write metadata parser
    3. Write JSON emitter
  3. Create data request form constructor using metadata bridge
    1. Write basic form constructor to build simple but clear HTML forms
    2. Add more advanced form controls (maps, timelines, etc.) for more capable browsers

2 Execution path

  1. User requests data-request form
  2. Server sends simple HTML page with form-generation Javascript
  3. Javascript requests DDS and DAS for selected data
  4. Javascript parses DDS and DAS to generate HTML form
  5. User requests data through form
  6. Server returns user-selected data

3 Application structure

3.1 Form generator

3.1.1 Public interface

The public interface gives developers a dead-simple interface to create data-specific request forms.

createDataRequestForm({"url" : "http://test.com/data.gz", "containerID" : "requestform"});

3.1.2 Generator

The heart of the form generator transforms the JSON-encoded DAS and DDS into an interactive HTML form.

var generator = createFormGenerator();
var form = generator.generateForm(dasData, ddsData);
document.appendChild(form);

3.2 DAS/DDS Javascript API

3.2.1 Public interface

The public interface allows developers to easily fetch JSON-encoded DAS and DDS data from a data source.

var dasData = fetchDAS("http://test.com/data.gz");
var ddsData = fetchDDS("http://test.com/data.gz");

3.2.2 HTTP request generator

This critical piece will handle fetching the raw DAS or DDS data from the server.

var rawDASData = fetch({"url" : "http://test.com/data.gz.das", "callback" : onDataReceived});

3.2.3 DAS parser

The DAS parser will convert the raw DAS data into a Javascript-accessible JSON object.

var dasParser = createDASParser();
var dasData = dasParser.parse(rawDASData);

3.2.4 DDS parser

Like the DAS parser, the DDS parser will translate a raw DDS string into a JSON object.

var ddsParser = createDDSParser();
var ddsData = ddsParser.parse(rawDDSData);