Trouble with adding app forms

how to add app forms into the reference application ?
i have forms in xml format.
i tried uploading it using medic conf by using commands convert app forms and upload app forms
but it was not working
uploading xml format is enough or do i need have the forms in json format also??
what are required to add the forms?

You should be able to upload app forms from their xml format using medic-conf upload-app-forms or from their xlsx format via medic-conf convert-app-forms upload-app-forms. Your expectations are correct and this should work as you’ve stated. I can confirm that json format should not be required.

There are some bugs which may silently block the upload if you are using medic-conf@3.1, can you confirm that you are using the latest medic-conf version via npm i -g medic-conf@latest? You can check your version via medic-conf --version, you should see medic-conf@3.2.0.

If the problem persists, can you share the medic-conf version you’re using and exact command-line you’re executing, along with the console output for the command.

1 Like

Appreciate your quick reply kenn
I am using medic conf 3.1.
However I am seeing the attached error while converting the xlxs forms

If you think I need to upgrade my medic conf can you please let me know the command to update medic conf to 3.2 as you did recommend

The important line in that stack is the PyXFormError at the bottom:

pyxform.errors.PyXFormError: The survey sheet is either empty or missing important column headers

This indicates there’s a problem with your intake_and_assessment_forms_5.17.2018.xlsx form definition. Can you compare it to one of your other form definitions (eg: the delivery.xlsx form) to see what’s missing?

Upgrading to medic-conf 3.2.0 won’t resolve this issue, but it’s a good idea anyway. The command to upgrade is npm install -g medic-conf@3.2.0.

Thanks gareth,
Figured out the forms issue, now the convert and upload forms doesn’t throw me any error
But still Iam not able to see those forms on the local host

Now that the form is uploaded to the server, we need to check the form’s properties to ensure it is configured to display at the right times. It is likely that the form is present but configured to not show on the reports tab (as tested in your screenshot above).

A form’s properties are controlled by a file “form_name.properties.json” – so based on the error above, this might be intake_and_assessment_forms_5.17.2018.properties.json? Specifically check out “context.expression” in that file – you could set that to “true” if you want it to display to all users in all contexts.

Make that change and upload it. Then sync and see if it shows up.

Once you get it showing up, you can constrain that “context.expression” value appropriately so the form appears at the times you expect.

2 Likes

the forms are added and they are showing up in the reports also but when i tried opening it it shows error loading in the reference application.moreover i am not able to see the sync option in my reference application.

Can you share the error that you’re seeing? Both the UI experience and the output in Chrome’s developer console?

My best guess is that you’re maybe logged in as an admin user without an associated facility or contact? If you are working from the “default” reference app, you can seed your database with some sample data by running medic-conf --local csv-to-docs upload-docs create-users. This will seed some places, some contacts, and some sample users.

Once this runs successfully, you should be able to logout from your admin account and then login as andra with pwd Secret_1. Can you try loading the form when logged in as this user?

This is the ui error I am seeing

Thanks for walking me over this app throughly When I did try to run the above command you mentioned As a medic user
I am seeing below error

After trying with medic user url and did upload docs and create users, I am able to login with andra
But all the new forms I did uploaded are showing the same question/form as below

Are you using medic-conf@3.2 now? An issue in medic-conf@3.1 may be responsible for forms not uploading.

Did updated and uploaded forms again
No luck :-1:t2:

What if you open the form via the contact’s tab? Select a contact and click “New Action”?

I am seeing only baby intake in the new action
I did added bay intake couple of times not sure if this can cause this issue

If I click on baby_intake, I am seeing the below

I don’t feel like I have a good grasp of what you’re expecting to see in that menu. More broadly, I don’t feel that I understand your project, or your desired outcomes. How can I understand these things such that I might guide these technical questions? Perhaps we could explain that here, or we could set up a quick support phone call?

appreciate your patience kenn
how can we setup the support call. i mean where can i get the support call number
so that i can explain better

Hi:
I’ve tried adding forms to my medic app (ver 3.9). I’ve taken the forms from the cht default app used the convert form upload comand but for some reason , I get the following error when trying to create a new person
Could not evaluate: add-date(today(), 0- /model/instance[1]/data/person/ephemeral_dob/age_years , 0- /model/instance[1]/data/person/ephemeral_dob/age_months ), message: r.v.indexOf is not a function"]

Any insights on why this happening?
Thank you.
Erick

The latest version of the default app from the cht-core repo is not compatible with 3.x versions of the CHT. That config has been updated to work with 4.x. I believe the error you are seeing is caused by trying to use the updated config with 3.9.

If you want to use the latest config, you should deploy the latest 4.x version of the CHT. Alternatively, for testing purposes only (do not use this in prod), you should be able to use the latest default configuration on your 3.x server by first upgrading your server to the enketo_upgrade_3.x branch which has been created specifically to enable testing 4.x compatible forms on a 3.x server.

Thank you @jkuester, for your feedback. I’ve had some minor issues with setting up 4.x following this procedure defined here Getting started building a CHT app | Community Health Toolkit and I keep getting the following error .IsADirectoryError: [Errno 21] Is a directory: ‘/docker-compose/couch’.
So I’m a bit stuck again and unable to proceed.
Thank you.
Erick