Interview answers API - translation

Hello,

I have a questionnaire translated in two languages(English and Kinyarwanda) and I’m trying to call an API for getting answers of an interview(GET /api/v1/interviews/{id}), but the endpoint provides answers in the language the interview was conducted in. For example, if the interview was conducted in Kinyarwanda, the API will generate answers Kinyarwanda. Is there an endpoint that can get answers in a specific translation?

What is the question type? Text?

The questionnaire has around 300 questions and most of them are of single or multiple selection type

For SingleSelect and MultiSelect question types the actual stored value is numeric, and hence language-neutral. But the mentioned API point doesn’t give the numeric value, but rather a textual label. This is convenient if you need to generate a transcript, but not so much if you need to analyze the data.

You can try a GraphQL query of the sort:

This should give you the underlying numeric values.

Thank you, where can I find the GraphQL API documentation?

Here are a couple of books on GraphQL in general (and there are plenty of others, look for related books):

The Survey Solutions-specific schema for GraphQL queries is available at:
https://your.server.address/graphql?sdl

@manipack , what are you trying to build using the API?

We are using SurveySolutions to collect information on individuals which later on need to be pushed in a data management system that shall provide an interface to allow CRUD operation on individuals’ data. Is there any available data management open source solution that can be used or I will have to build it from scratch? Thanks

Hello @sergiy,

My questionnaire has 300 questions, but when I use this GraphQL it only returns one question, the so-called FeaturedQuestion, yet I wanted all questions and answers.
Please find the query I’m executing:

interviews

    {

        nodes {

            key,

            id, interviewMode,identifyingData { entity {questionText, variable}, answerValue }

        }

    }

Do you have an idea of what might be wrong. Thanks

I think this is because identifyingData property contains only identifying questions, as per:

@sergiy

  1. Is there a workaround to get all questions and answers in GraphQL
  2. Is it possible to set all questions to identifying questions from Designer?

Thanks

GraphQL doesn’t give you any advantage over full export in your use case - one of the main benefits of it is the ability that the client application may request only a part of information that server has so this allows flexibility. In your case, you know that you want to have a copy of ALL data so you’re not gaining anything by reading out data via GraphQL api calls. So the best option to me is to setup a workflow of (periodically) exporting all/new interviews to a (SQL) database.

Of course, you get the simple CRUD by that as well. Without knowing exactly what your application must do, it’s difficult to recommend any existing software vs writing from scratch.

2 Likes

I have tried the export functionality, but I couldn’t find interviews’ questions and answers.

Regarding the system I want to build, it’s a database of individuals using information collected from Survey Solutions.
Below are crucial requirement on the database:
1.Changes made on the questionnaire from SurveySolution should automatically reflect in the Database
2. Since the database shall enable update of information, it should support all types of questions including single and multiple select, and it should support roasters.
3. API for easy integration

I was suggested to use DHIS2 but it does not meet requirement 1 and 2. Thanks