Skip to content

Instantly share code, notes, and snippets.

@scastillo
Last active June 21, 2018 18:03
Show Gist options
  • Select an option

  • Save scastillo/b8f15cb515c6abc37df62c5fbd7c9e18 to your computer and use it in GitHub Desktop.

Select an option

Save scastillo/b8f15cb515c6abc37df62c5fbd7c9e18 to your computer and use it in GitHub Desktop.

Questions

image

Get all questions

GET /questions/

[{code:"1.1.1.1",
    text:"Descripcion de la propiedad",
    type:{name:"Text"},
    childs: [],
    summary: true},

{code:"1.1.1.2",
    text:"¿Este inmueble se encuentra en el exterior?",
    type:{name:"List", values: ["Si", "No"]},
    childs: ["1.1.1.2.1", "1.1.1.2.2"]}

{code:"1.1.1.2.1",
    text:"¿En que país se encunetra este bien?",
    type:{name: "List", values: [i for i in countries]},
    childs: []}

{code:"1.1.1.2.2",
    text:"Identificación del Inmuebles",
    type:{name: "Value", kind: "integer"},
    childs: []}
    ]

Get all questions optinally with answers too

GET /filling/:fid/questions?include_answers=[true/false]

Get all answers without questions

GET /filling/:fid/answers

Get questions for a group and/or instance

GET /filling/:fid/group/:group_id/questions?include_answers=[true/false]

GET /filling/:fid/group/:group_id/questions/:code/instance/:instance_id/

Get answers

GET /filling/:fid/answers/:code/

GET /filling/:fid/answers/group/:group_code/

Post an answer

POST /filling/:fid/answers/:code/instance/:instance_id/

{}

POST /user/:id/questions/:code/?instance=2

@alejandrovillegas
Copy link
Copy Markdown

  • in /get/ If I have grandchildren how to build this tree
    image

  • I need to send the Math op. fields, or back-end calculate this fields on the spotlight

  • Hoy we can Know the Summary fields

@scastillo
Copy link
Copy Markdown
Author

@alejandrovillegas as seto requested its not a tree it's a list that uses childs as the relationship between questions and subquestions. So for grandchildren you just add children to the question that is already a child of another one.

@orendon
Copy link
Copy Markdown

orendon commented Jun 21, 2018

Initial draft based on this model (might need some tweaks for the new questions types identified, like autofill and formula ones)

Endpoint: GET /objects/3.1.1

{ "objects": [

  { "code": "3.1.1.1",
    "text": "Compró vehiculo en este periodo fiscal?",
    "type": "List",
    "values": {"Si": ["3.1.1.2", "3.1.1.3", "3.1.1.4"], "No": []},
    "summary": true
  },

  { "code": "3.1.1.2",
    "text": "Ed: pero, pues, es vehiculo propio?",
    "type": "List",
    "values": {"Si": [], "No": []},
    "summary": false
  },

  { "code": "3.1.1.3",
    "text": "Marca del vehiculo?",
    "type": "Text",
    "values": {},
    "summary": false
  },

  { "code": "3.1.1.4",
    "text": "Color del vehiculo?",
    "type": "List",
    "values": {"Rojo": [], "Verde": [], "Azul": [], "Amarillo": [], "Negro": []},
    "summary": false
  },

  { "code": "4.1.1.1",
    "text": "Pagos por gastos de representación",
    "type": "Value",
    "values": {"positive": ["4.1.1.2"], "negative": []},
    "summary": false
  },

  { "code": "4.1.1.2",
    "text": "sub gastos A",
    "type": "Text",
    "values": {},
    "summary": false
  },
 ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment