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

Specify a preferred JSON representation of an XLSForm #57

Open
dorey opened this issue Sep 10, 2015 · 2 comments
Open

Specify a preferred JSON representation of an XLSForm #57

dorey opened this issue Sep 10, 2015 · 2 comments

Comments

@dorey
Copy link
Contributor

dorey commented Sep 10, 2015

Goal: Describe a JSON format that can be converted directly into XLSForm and back to JSON so that all of the details in this standards doc are relevant to future tools that do not use the XLS(™) file format but want to remain interoperable.


We've often needed tools which store a text representation of an XLSForm and CSV is not the best choice for non-numeric data. The next obvious choice is JSON* but that leaves some ambiguity about how the structure should be stored.

Without getting too far into a discussion about the perfect text representation of an XLSForm, I'd like to discuss a few steps to convert a JSON structure to an XLSForm and back again, and add a section about this into the XLSForm spec so that future tools can build surveys which remain interoperable without storing everything as XLS.

Edit: I took a first pass at this and will turn it into a PR once I have some examples up.

*Note: this is NOT the same JSONForm that formhub exposes, which was originally meant to be a testable representation of an intermediate stage of the XLS-2-XForm conversion. Those JSON representations cannot easily be converted back to XLS.

@IanLawrence
Copy link

I know of a couple of organizations at least who would very much benefit from having such a well defined JSON structure. Can you show your ideas on constraints and relevance too?

@IanLawrence
Copy link

The first pass you mention above translates into a JSON schema something like this I think

{ 
"$schema": "http://json-schema.org/schema#", 
"id": "http://somedomain.com/schemas/JSONXPath.json",
"title": "JSON Form",
"type": "object",
"properties": {
        "survey": {
            "description": "Gives the form its overall structure",
            "type": "array",
            "text": {
                    "description": "Text Questions",
                    "type" : "string",
                    "name" : "string",
                    "label" : "string"
                },
            "integer": {
                    "description": "Integer Questions",
                    "type" : "integer",
                    "name" : "string",
                    "label" : "string"
                }
        },
        "choices": {
            "description": "Used to specify the answer choices for the form",
            "type": "array"
        },
        "settings": {
            "description": "Form related settings",
            "type": "object",
            "form_title": { "type": "string"},
            "form_id": { "type": "string"},
            "submission_url": { "type": "string"}
        }
    },
    "required": ["survey", "choices"]
}

(I have never written a schema before so this may be completely wrong)

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

No branches or pull requests

2 participants