demichie / elicipy

Expert. elicitation Python code
GNU General Public License v2.0
2 stars 4 forks source link

Answers not saving to data repo #4

Closed peterjamesnugent closed 3 months ago

peterjamesnugent commented 4 months ago

Hi,

I got the app working - can be seen here: https://elicipy-test.streamlit.app/

However, I am struggling to get the data stored on the GitHub repo.

Branch in question is here: https://github.com/peterjamesnugent/elicipy/tree/config-test-2

I got it working by providing the link to the repo, but the comment says it's not needed unless I specify datarepo = 'local_github' or datarepo = 'local' which in this case I am not: https://github.com/peterjamesnugent/elicipy/blob/849e6a5ee9c1b4c423ecc5451c610eb737e40ced/ELICITATIONS/Cotopaxi/createWebformDict.py#L7

I have had two people fill out the form, but not entirely sure where the answers have gone :smile:

demichie commented 4 months ago

Hi, Thank you for let me notice that there was an error in the comment. RepositoryData is used only when datarepo == 'github' or datarepo == 'local_github' (see line 849 of streamlit_app.py). As regard your problem, I've seen that you have

RepositoryData = https://github.com/peterjamesnugent/eclipy-repo-data

It should be:

RepositoryData = 'eclipy-repo-data'

peterjamesnugent commented 3 months ago

@demichie - sorry, this is the right branch: https://github.com/peterjamesnugent/elicipy-test/tree/config-test

Where the RepositryData is correctly set: datarepo = 'eclipy-repo-data'

The odd thing is, Streamlit definitely has permissions correctly setup to edit the repo because it made this commit: https://github.com/peterjamesnugent/elicipy-test/commit/7659c51c282c62eb8a0bc67bc2cc7a68ae361b7c

This is the repo in question that it is refering to: https://github.com/peterjamesnugent/eclipy-repo-data

This is the reponse we get when filling in the form: Thank you [First] [Last] /mount/src/elicipy-test/ELICITATIONS/Cotopaxi/DATA/seed/questionnaire_2024_07_01_19_51_18_Output.csv SAVED

but I cannot seem to find these commits/files anywhere.

demichie commented 3 months ago

This is from your file:

# select 'github', 'local' or 'local_github' datarepo = 'github'

datarepo = 'eclipy-repo-data'

# Github repository for answers, used only when datarepo='local' or 'local_github' # RepositoryData = ''

You wrote the name of the repository in "datarepo", instead of "RepositoryData", which is commented and empty. In this way you overwrite the value datarepo = 'github'.

Please change in this way:

# select 'github', 'local' or 'local_github' datarepo = 'github'

# Github repository for answers, used only when datarepo='local' or 'local_github' RepositoryData = 'eclipy-repo-data'

peterjamesnugent commented 3 months ago

Hi @demichie - thanks for your help, I have made the changed as suggested and filled in the questionnaire using the app but the RepositryData is still blank: https://github.com/peterjamesnugent/eclipy-repo-data

Does the data get pushed periodically or should it be instant?

demichie commented 3 months ago

Hi, it is possible that you have to restart, or reboot, the app in streamlit. When everything works, the data are pushed almost instantly.

peterjamesnugent commented 3 months ago

I have rebooted the app and filled it in again to no avail: https://github.com/peterjamesnugent/eclipy-repo-data

Is there anything special I need to do with the RepositryData?

demichie commented 3 months ago

In Streamlit it should be possible to have a log of the application. Please can you try to download it and share? There should be a log of the attempt to upload the answers to the data repository on github.

peterjamesnugent commented 3 months ago

It seems unable to find the repositry but the name is correct.

Before pushing file to Gihub

RepositoryData eclipy-repo-data

Repository not found:  eclipy-repo-data

Committing file:  ./seed/questionnaire_2024_07_17_13_16_41_Output.csv

Problem committing file

After pushing file to Gihub

Path:  /mount/src/elicipy-test/ELICITATIONS

Path:  /mount/src/elicipy-test/ELICITATIONS/Cotopaxi

Data repository: github

Encrypting of data: False

ImportError

langs ['ENG', 'FRA', 'ITA']

lang_index 0

language ENG

group_list read ['SG1 (Clermont)', 'SG2 (Quito)', 'SG3 (Geol.)', 'SG4 (MathMod)', 'SG5 (Junior)', 'SG6 (Senior)']

Group 3;4 ['3', '4']
peterjamesnugent commented 3 months ago

I have updated the github token and refreshed it (and rebooted) to no avail.

demichie commented 3 months ago

Are you sure the github token is properly set in both github and streamlit?

peterjamesnugent commented 3 months ago

@demichie found the issue, I had set the repo to public so I could troubleshoot and share any ideas. But the permissions for GitHub explicitly state it's full control for private repos: image

Might be worth updating the README to say that the repo must be private if using datarepo = github otherwise streamlit will not be able to write data.

I was able to run analysis on the Cotopaxi and it's really impressive - thanks for all your support as I stumbled through 🤣

demichie commented 3 months ago

I'm happy the problem has been solved. It is strange because I did also some test with public repository for the answers and it was working. I will check it better. Thanks, Mattia