Comments (3)
The python ids get converted by the java, since the json produced by the python serves as input to the java program. The java program then converts the json ids into ids that are analogous to the csv ids. These are used for debugging and should be replaced, since they're overloaded with semantic importance.
I think what would be best for the json the web interface produces would be for it to just maintain a unique id. In addition to the provenance info needed for debugging, using cell data for ids allows us to know the ordering on answer options. I will update the json schema so that the options field takes a list of ids representing the total order on the options for a given question. If omitted or falsey, the question is unordered. I don't know if this change will affect the correctness of surveyman.js -- some time ago, the logic relied on the ids having meaning, but may have been replaced (in my cursory review, I don't see any of that old code, but I may have just missed it). In any case, if it's still present, it should go.
Long story short: just generate unique ids in the normal way.
from react-surveyman.
Thanks for the update!
Here's a sample json generated from react-surveyman. Any specific preferences on the IDs or is this okay?
{
"survey": [
{
"id": 0,
"randomizable": true,
"ordering": false,
"questions": [
{
"id": 753,
"qtext": "Which is your favorite color?",
"options": [
{
"id": 655,
"otext": "red"
},
{
"id": 805,
"otext": "green"
},
{
"id": 617,
"otext": "blue"
},
{
"id": 684,
"otext": "white"
},
{
"id": 842,
"otext": "black"
}
],
"ordering": false,
"freetext": false,
"exclusive": true
},
{
"id": 30,
"qtext": "Which color tshirt do you like to wear the most?",
"options": [
{
"id": 285,
"otext": "red"
},
{
"id": 17,
"otext": "green"
},
{
"id": 807,
"otext": "blue"
}
],
"ordering": false,
"freetext": false,
"exclusive": true
}
],
"subblocks": []
},
{
"id": 328,
"questions": [
{
"id": 526,
"qtext": "what is the value of 4 + 5?",
"options": [
{
"id": 32,
"otext": "9"
},
{
"id": 783,
"otext": "10"
},
{
"id": 934,
"otext": "Dont know"
},
{
"id": 937,
"otext": "Dont care"
}
],
"ordering": false,
"freetext": true,
"exclusive": true
}
],
"subblocks": [],
"randomizable": true,
"ordering": false
}
]
}
This is just Math.floor((Math.random() * 1000) + 1)
for now, but I can do something like prefix + uuid.uuid4().hex().toString()
.
from react-surveyman.
These look totally fine; in fact they don't even need to be universally unique, since the lookup is according to type. The previous conventions were about human readability. The only thing is, they will need to be strings if you're validating against the survey_input schema.
EDIT: I see in the commit that the type is now a string. 🎯
from react-surveyman.
Related Issues (20)
- Add transitions HOT 2
- Ability to duplicate blocks and questions
- Validate JSON Schema
- Ability to Save / Load surveys HOT 4
- Allow items to be positioned arbitrarily when being dropped HOT 6
- drop broke in safari HOT 3
- Add support for Subblocks HOT 3
- testing slack integration
- randomization button? HOT 5
- Clicking on x in the select component gives a NaN
- Add linting for ES6
- Move to ES6 classes HOT 2
- Apply fixed positioning to the Toolbox
- Add properties to the Question Schema HOT 5
- Broken package HOT 7
- Survey Incremental Validation HOT 13
- License type HOT 3
- s/ordering/ordered
- Several module not found errors HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-surveyman.