Download the comments of survey in ODK-CENTRAL

1. What is the problem? Be very detailed.

In ODK-CENTRAL with the version 1.2 is possible to make a comments about the info of the record, It's very usefull, but If I need a xls (or csv or txt) with all comments of the surveys, in which section can obtain all the comments of the intervies. It's this possible?

Thanks a lot!

2. What app or server are you using and on what device and operating system? Include version numbers.

ODK v 1.2 in droplet with Digital Ocean

3. What you have you tried to fix the problem?

I search the option for download all the comments with out lucky!

4. What steps can we take to reproduce the problem?

Navigate in the options of admin access

5. Anything else we should know or have? If you have a test form or screenshots or logs, attach below.

No.

Is there a any way to download has issues comment or conversation related to survey of participants.

Sorry we didn't get back to you previously, @abelinuxmx! We know this is something people want. I've moved this thread to Features because it doesn't look like we're tracking this there. Include server log in data download from Central - #3 by Florian_May has some mention of it.

It would be helpful to understand what you would like to do with this and what format it would be helpful to have it in.

You can currently grab all of the comments for a specific submission via the API: https://odkcentral.docs.apiary.io/#reference/submissions/comments/listing-comments This means you could consider creating your own export document from an external script.

Hi,
I am trying to download comments using the API (i don't think it has been implemented in ruODK yet). I have tried using -

GET /v1/projects/{projectId}/forms/{xmlFormId}/submissions/{instanceId}/comments
GET /v1/projects/{projectId}/forms/{xmlFormId}/submissions/{instanceId}/comments/listing-comments

The first request does not return any comments associated with the submission.

The second Request returns a 404 Response. I noticed that the second one is not documented in the API docs - does that mean that it doesn't exist?

By the way, I have been referring to: https://docs.getodk.org/central-api-submission-management/#listing-comments

Also, I have been trying to extract the comments from the ODK Cloud hosting

GET /v1/projects/{projectId}/forms/{xmlFormId}/submissions/{instanceId}/comments is the endpoint I expect. If you don't have any comments associated with the submission, I'd expect an empty response.

Make sure you have the correct project ID (it's a number) and the form ID (it's a string, not a number).

Here's a quick Python script using pyODK you can try.

from pyodk.client import Client

my_form_id = "favorite_colors"
my_project_id = 1

with Client() as client:
  submissions = client.submissions.list(form_id=my_form_id)
  for submission in submissions:
    print(submission.instanceId)
    comments = client.submissions.list_comments(form_id=my_form_id, project_id=my_project_id, instance_id=submission.instanceId)
    for comment in comments:
      print(" " + comment.body)

Here's the output I get.

uuid:fc44c3d9-ad41-44d6-9fbe-51ea46b13a00
 Another comment!
 Sally changed her name
uuid:6d6c46c6-0805-45e3-91dd-3474606668ca
uuid:67088acb-16ff-48c2-b8d0-0c8744edb172
uuid:9c1fdbc3-561a-4e5f-8fec-a36e7696c4d4
uuid:066f175e-c245-421d-b282-8664283003c3
 I got older and started liking yellow 💛
uuid:cf1535ad-7f6c-4e54-bbda-60bfb4dea87c
uuid:d65b8be6-56f8-4e9c-90f0-f55dd6a365d9

@Florian_May Any chance for comments support in ruODK?

1 Like

Ahhhh, thanks for the python alternative! (it confirms the output that I received from the Restful interface). So it seems I have a misunderstanding in what are "Comments".

I found a submission with Comments that worked. As you can see in the picture, the top comment was returned, but not the comment with "Has Issues". That implies that not all comments are equal!

Is it possible to retrieve the "Has Issues" comments? Happy for any python, restful alternatives

Cheers

After a quick read of the pyODK docs, it seems there are comments associated with the "Review". I can see how you can add reviews, but there seems to be no method of listing reviews per submission.

Is there something in the manual I am missing?

You are missing something, and it's something I missed too! It's not a comment. It's a note that's associated with an action. So it's part of the server audit logs and associated with a submission.update. Hopefully that gets you pointed in the right direction.

I'll post another script when I get a chance.

This script below will get you those action notes. Unfortunately, it doesn't give you a way to associate it with an instance via the API because you just get the submissionID.

I'll speak with the Central team to see what improvements we can make, because the current behavior is not ideal.

from pyodk.client import Client

my_form_id = "favorite_colors"
my_project_id = 1

with Client() as client:
  audits = client.get("audits", params={"action": "submission.update"}).json()
  for audit in audits:
    if audit['notes']:
      print(audit['details']['submissionId'], audit['notes'])

Great!

The python code was assistive.

For the moment, I will do a workflow change and ensure that the comments get used.
Thanks for the assistance!

1 Like

@Matthew_White showed me a way to get all comments and notes!

from pyodk.client import Client

my_form_id = "favorite_colors"
my_project_id = 1

with Client() as client:
  submissions = client.submissions.list(form_id=my_form_id)
  for submission in submissions:
    print(submission.instanceId)
    comments = client.submissions.list_comments(form_id=my_form_id, project_id=my_project_id, instance_id=submission.instanceId)
    for comment in comments:
      print(" comment: " + comment.body)
    audits = client.get("projects/" + str(my_project_id) + "/forms/" + my_form_id + "/submissions/"+ submission.instanceId + "/audits").json()
    for audit in audits:
      if audit['action'] == 'submission.update' and audit['notes']:
        print(" note:" + audit['notes'])

Hey, that is wholesome!
Thanks for the code chunk - it worked a treat.

Cheers you @Matthew_White

@yanokwa in the queue for implementation at ruODK! Great pointers in this thread.

@florian_may - while it has been illustrative to use python to problem solve, ruODK is my home ground. Do you think it would take long to implement comments?