#1 by Hauke
Hi Chris & Community, I created an app that mimics social media feeds. I would like it to be easy to use and customize -- even without any knowledge in python/otree/bootstrap/... For this reason, I am trying to provide as many settings in the session configurations as possible. This way, researchers unfamiliar with otree have a GUI to click through. Hence, I was wondering whether it is possible to customize the session config GUI a little, for instance, by making it more dynamic (certain input fields only show up if a specific box is checked) or by offering additional input field widgets (such as dropdowns). Or do you see any alternatives? The end goal is to have some sort of an admin interface where people can - provide a (url to) a csv file, - configure redirects to qualtrics, - specify a briefing, - make a few design choices (e.g. whether and how an ad banner is displayed) Best Hauke
#2 by Chris_oTree
You can use the REST API for this. Make a website separate from otree, design the interface exactly as you want it, and when the user clicks the button to create the session, send a request to the create_session REST API endpoint.
#3 by Hauke
Thank you, I'll look into the corresponding docs!
#4 by Hauke
Thanks again! For convenience (because I do not yet know how to set up another website that handles the REST API), I created another oTree app where one can configure and send the API call (and get the admin_url as a response via live pages). This works well locally but not if I host the app on Heroku (within the same project as the app that shall be configured). I know that this solution is not too elegant as the whole idea is to utilize a different website. Hence, I am wondering whether this is technically wrong (such that it will never work) or whether there is another error. Again, it works well if I run the configuration app (triggering the API calls) locally while the target app is hosted on heroku but it does not work if both are hosted within the same heroku project. Best and thanks in advance, Hauke
#5 by Chris_oTree
I recommend creating a separate site. You can set up a simple 1-page site using Flask or Starlette, kind of like this: https://github.com/oTree-org/custom-room-welcome-page
#6 by Hauke
Thanks. I managed to do that and it works well. I defined an OTREE-REST-KEY and it seems as if a researcher without admin credentials could only access the session she has the session.code for, correct? If so, I could tell the users of the FLASK app (that sends the REST calls), that is, the researchers to write down that code and as long as nobody else has it, its only them (and the admin) who can see their session. Now I would like to create a custom data export. As far as I understood it, I create the `def custom_export(players):` function in the __init__.py file within the player model and that results in some export functionality I can access in the export section. Is that correct (can't see it)? If so, then its only the admin who can see the custom exports, right? To put it differently, (how) is it possible to create a custom export only dedicated people without admin permissions could download? Best regards and thanks in advance, Hauke
#7 by Chris_oTree
Not under the player model. It’s a top level function.
#8 by Chris_oTree
Not under the player model. It’s a top level function.
#9 by Hauke
Thanks, that works. Is it also possible to provide a custom download in *.herokuapp.com/SessionData/[session.code] or anywhere else where people without credentials have access to (with OTREE_AUTH_LEVEL == Demo).
#10 by Chris_oTree
if they have the session code, they can access the session admin page. From there they can click the 'data' tab to see session data (and I think should be able to download the CSV). alternatively you can also define an admin_report: https://otree.readthedocs.io/en/latest/admin.html#customizing-the-admin-interface-admin-reports
#11 by Hauke
Thanks, I also thought about using the REST API (and the Flask app I built following your advice above). Would it be feasible to store the player-variables (they only play one app in one round) as participant vars and use the “Get session data” endpoint? Yes, they can click the data tab (next to the monitor tab) but there is no custom export. I'll consider the admin report if you advise against the REST approach. Best Hauke