Javascript Data Request Form: Difference between revisions
EvanKroske (talk | contribs) m (→DAS/DDS Javascript API: Fixed markup) |
EvanKroske (talk | contribs) (All code examples are tentative.) |
||
Line 1: | Line 1: | ||
My goal is to create a Javascript API for accessing OpenDAP metadata and an intuitive, Javascript-based data-request construction form. | My goal is to create a Javascript API for accessing OpenDAP metadata and an intuitive, Javascript-based data-request construction form. | ||
'''Please note:''' All example code is highly tentative. If you don't think an operation is handled properly, send me an email at e.kroske@gmail.com or post your concern on the discussion page. I appreciate your opinion. | |||
== Plan of action == | == Plan of action == |
Revision as of 20:25, 15 April 2010
My goal is to create a Javascript API for accessing OpenDAP metadata and an intuitive, Javascript-based data-request construction form.
Please note: All example code is highly tentative. If you don't think an operation is handled properly, send me an email at e.kroske@gmail.com or post your concern on the discussion page. I appreciate your opinion.
Plan of action
- Create generalized Javascript OpenDAP-metadata bridge
- Write Javascript OpenDAP-metadata retrieval module (may involve server-side modifications)
- Write OpenDAP-metadata parser
- Write JSON emitter
- Create data request form constructor using metadata bridge
- Write basic form constructor to build simple but clear HTML forms
- Add more advanced form controls (maps, timelines, etc.) for more capable browsers
Execution path
- User requests data-request form
- Server sends simple HTML page with form-generation Javascript
- Javascript requests DDS and DAS for selected data
- Javascript parses DDS and DAS to generate HTML form
- User requests data through form
- Server returns user-selected data
Application structure
Form generator
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"});
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);
DAS/DDS Javascript API
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");
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});
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);
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);