redcap-tools / PyCap

REDCap in Python
http://redcap-tools.github.io/PyCap/
MIT License
169 stars 80 forks source link

Unexpected Behavior: {the fields forms in export_metadata seems to don't work} #234

Closed herrlockskun closed 2 years ago

herrlockskun commented 2 years ago

Hello, I tried to export only one form of my metadata and i have all my forms instead.

data = project.export_metadata(format_type='df',forms='qcd')

field_name     form_name                                                      section_header  field_type  ... matrix_group_name matrix_ranking  field_annotation                                                                                                                                            
record_id        my_first_instrument                                                NaN         text  ...               NaN            NaN               NaN
id_patient       my_first_instrument                                                NaN         text  ...               NaN            NaN               NaN
age              my_first_instrument                                                NaN         text  ...               NaN            NaN               NaN
pseudo_variable  my_first_instrument                                                NaN          sql  ...               NaN            NaN               NaN
qcd_1                            qcd                                                NaN        yesno  ...               NaN            NaN               NaN
qcd_2                            qcd                                                NaN  descriptive  ...               NaN            NaN               NaN
qcd_3                            qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_4                            qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_5                            qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_6                            qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_7                            qcd                                                NaN         text  ...               NaN            NaN               NaN
qcd_8                            qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_9_a                          qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_9_b                          qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_9_c                          qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_9_d                          qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_9_e                          qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_9_f                          qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_9_g                          qcd                                                NaN        radio  ...               NaN            NaN               NaN
qcd_10_a                         qcd  9-\tEntourez le chiffre qui décrit le mieux co...        radio  ...       pas_compris            NaN               NaN
qcd_10_b                         qcd                                                NaN        radio  ...       pas_compris            NaN               NaN
qcd_10_c                         qcd                                                NaN        radio  ...       pas_compris            NaN               NaN
qcd_10_d                         qcd                                                NaN        radio  ...       pas_compris            NaN               NaN
qcd_10_e                         qcd                                                NaN        radio  ...       pas_compris            NaN               NaN
qcd_10_f                         qcd                                                NaN        radio  ...       pas_compris            NaN               NaN
rpaq_1                          rpaq                                                NaN        yesno  ...               NaN            NaN               NaN
rpaq_1_1                        rpaq                                                NaN        radio  ...               NaN            NaN               NaN

Thank you all.

pwildenhain commented 2 years ago

Thanks for pointing this out. Can you try this on the "API Playground" and see if you get the same results? If so, it's a REDCap server issue, not a PyCap issue. It can likely be solved with upgrading your site's version of REDCap

herrlockskun commented 2 years ago

It works fine with the "API Playground" Capture d’écran de 2022-05-10 08-57-33

field_name,form_name,section_header,field_type,.....field_annotation

qcd_1,qcd,,yesno.....,,,
qcd_3,qcd,,radio,....,,
qcd_4,qcd,,radio,".....,,
.......

I ask the upgrading of REDCap to my superiors but it's a slow process, so i was wondering if there were a solution. Not a big deal the rest work really fine, so i will just wait for an upgrade of REDCap. Thank you for you're quick answer.

pwildenhain commented 2 years ago

Will you try passing the forms parameter as a list instead of a string?

data = project.export_metadata(format_type='df',forms=['qcd'])
herrlockskun commented 2 years ago

This works perfectly thank you.