Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show/export Flow instance usage #2612

Closed
janagombitova opened this issue Apr 23, 2018 · 18 comments
Closed

Show/export Flow instance usage #2612

janagombitova opened this issue Apr 23, 2018 · 18 comments
Assignees
Milestone

Comments

@janagombitova
Copy link
Contributor

janagombitova commented Apr 23, 2018

Context

Our SaaS pricing model is based on the number of submitted forms. For the partnership team to be able to track their accounts and for partners to know how much they have spent, they need to be able to know their usage status. Furthermore, sometimes a Flow instance is owned by a partner, who shares it with other organisations. These then contribute to the SaaS payment but the owner organisation then needs to know how many submissions these partners made.

So for Petra, it is important to understand their usage in the context of the contract and how they capture data in general. She also is interested to see the uptake of the product per project. Salim is interested in seeing which forms are being used and how heavily.

Problem or idea

Today Salim and Petra have no easy way to know:

  • total submissions on the Flow instance
  • submissions per form
  • for a specific period of time or since the beginning of time

Currently, @stellanl has a script he can run per instance that gives a csv file with the survey path, form name, form ID and number of submissions. This however needs to be requested creating an unnecessary communication pipeline and Stellan needs to run it causing Stellan more work and breaking his flow and deep focus.

Opportunity 1 - download sheet with usage breakdown

The idea is to improve Stellan's sheet and create an option to export the file in the UI through which any user can export the usage per form per a specific period of time.

In the Sheet we should:

  • remove the 1st column, as the user knows which Flow instance she is on
  • remove the privacy column
  • rename Instance count to 'Number of submissions'
    Screen Shot 2019-08-08 at 12 22 08

User experience:

  • define where to create the export option - it does not need to be perfect, this is the 1st iteration (the possibility is to create another export option under Data > Exports)
  • make sure this is active without having to select a folder>survey>form
  • enable to define the date range (optional)
  • define the name of the export so it is clean in the UI list of exports
  • perhaps we can move the Survey form export and this usage export into a 2nd row under the data exports (just an idea)

Opportunity 2 - UI overview + download option

Later we should consider to create a way to see usage in the UI and from this page to be able to download the breakdown overview.

  • total forms submitted on the instance + when the number was updated
  • possible other stats that can be interesting: total data points; total devices, total surveys, total users
  • usage trend - showing number of submissions over a time period
  • be able to filter on date - submission date
  • option to download the breakdown sheet from this place

Far future

In the future, how might we take it further and bring their usage in relation to their pricing plan? How can Petra, as a Flow user know how many forms I have left from my contract period without having to contact Akvo?

@janagombitova janagombitova changed the title DRAFT: Show Flow instance usage Show/export Flow instance usage Aug 8, 2019
@stellanl
Copy link
Contributor

stellanl commented Aug 8, 2019

Is the current simple CSV format ok, or should it be an Excel file?

@janagombitova
Copy link
Contributor Author

CSV file is fine, if we make the changes mentioned above to the data. This is a first iteration, so it does not need to be shiny-fancy.

@stellanl
Copy link
Contributor

stellanl commented Oct 8, 2019

Do we want to filter the list to only contain the forms the user has access to? Or should this entire report be restricted to certain users?

@janagombitova
Copy link
Contributor Author

janagombitova commented Oct 9, 2019

I would keep it simple for now and push all forms in the file.

Can we restrict it to users who are admin's (user management)? Then we follow the pattern Lumen has where admins only see the usage stats

Stellan, where do you think we should place it? I am a bit reluctant about pushing it under the data exports tab as I originally suggested as it might clutter the page. How about another tab under the Data tab? Or do you have other ideas? I also asked @Kiarii to give this some thought

@Kiarii
Copy link

Kiarii commented Oct 9, 2019

since we are looking for a quick turnaround, could we just add a "Stats" (or sth similar) page on the top menu just after "Messages"?

I think we should separate the instance data from survey data, even if both are exported or downloaded in the same way..

It is also in that stats page that more info on the instance e.g. current package, expiry and so on, will go into in the future..

@janagombitova
Copy link
Contributor Author

@stellanl if we agree to link the export to the user admin role, how much extra effort is it to add the logic to hide the new 'Stats' tab if the user does not have that permission? If it is too much effort, could we add a subtab 'Stats' under the main 'Users' tab, then the permission will be respected?

@stellanl
Copy link
Contributor

stellanl commented Oct 9, 2019

Does not sound very hard to me. Should be able to cut-and-paste the code that hides the users tab.
To make it secure, the POST /rest/reports endpoint must also enforce the only-admins for this type.

@janagombitova
Copy link
Contributor Author

Sounds good @stellanl. Let's keep this issue to the minimum and create a new one for your suggestion on using the /rest API

stellanl added a commit that referenced this issue Oct 11, 2019
stellanl added a commit that referenced this issue Oct 14, 2019
@stellanl
Copy link
Contributor

Here is a report on the dev datastore:
STATISTICS-146532016.xlsx

@stellanl
Copy link
Contributor

As agreed w Emmanuel, I will not make a copy-pasted UI in Ember, but make that part a separate issue.

@stellanl
Copy link
Contributor

Any privacy issues with counts from the uat1 datastore? If not I can put an example of the slightly enhanced report here.

@janagombitova
Copy link
Contributor Author

Can you drop the file in the Akvo team Google drive somewhere and share the link? Just to be sure

@stellanl
Copy link
Contributor

@janagombitova
Copy link
Contributor Author

@stellanl I took a look at the file shared and have a few remarks. Good initiative on adding the extra stats. Let's see if users find them useful and request more ;) :

  • Can you change the sheet name from 'Form instance count' to 'Form submissions'
  • Can remove the 1st row with the 'Form instances' header? If we name the column headers and sheets clearly this row is then redundant.
  • Can you change 'Instance count' to 'Submissions'
  • In the file the Instance count column is empty. But I know many of the forms there do have submissions. (Or did you export the file based on a specific date range?)
  • In the 2nd sheet we have the item - Survey groups. Is this what we call Folders? If so, can we change the name to the user known one?

@stellanl
Copy link
Contributor

The first line of the sheet also contains the date range (if selected). I could put that somewhere else, of course.
The instance count column is empty because uat1 is not running this branch yet, and so can't count instances.

@janagombitova
Copy link
Contributor Author

I see. Then leave the 1st row as it is. Users can always delete it themselves, just instead on Form instance' let's use 'Form submissions'.

stellanl added a commit that referenced this issue Oct 21, 2019
stellanl added a commit that referenced this issue Oct 29, 2019
iperdomo added a commit that referenced this issue Oct 29, 2019
stellanl referenced this issue in akvo/akvo-flow-services Oct 30, 2019
@muloem
Copy link
Member

muloem commented Nov 1, 2019

So one comment I also made on the UI side of things, currently when you load the Stats page of the UI, it retrieves all reports including the comprehensive, raw data and statistics reports. I think it makes sense to update the reports endpoint slightly and only be able to query for reports of a specific type. e.g. /reports?type=statistics so as to avoid retrieving unnecessary reports for the user every time when they want to see the stats.

@muloem
Copy link
Member

muloem commented Nov 19, 2019

All done here! 👍

@muloem muloem closed this as completed Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants