enviroCar / enviroCar-app

enviroCar Android Application
https://envirocar.org
GNU General Public License v3.0
88 stars 154 forks source link

Implement Profile Page #241

Closed matthesrieke closed 6 years ago

matthesrieke commented 9 years ago

Tasks needed to be done:

matthesrieke commented 9 years ago

comments welcome of course!

matthesrieke commented 9 years ago

Hi Rahul,

regarding the time series graph: I checked the server's track API and it provides nice statistics for a single track, containing MAX, MIN, AVG and the number of contributed individual measurements for every phenomena. Example:

https://envirocar.org/api/stable/tracks/53cc16eae4b04a9bce9c62ea/statistics

If this is not sufficient for the app we could design a simplified resource, e.g. https://envirocar.org/api/stable/users/me/statisticsTimeseries?limit=5 - providing statistics on the latest 5 tracks of a user.

rahulrj commented 9 years ago

Yes.Daniel told me about this. For now, i will download the user's track first and then loop over it to download the statistics of each track.

rahulrj commented 9 years ago

Profile is available offline and for TimeSeries graph, i am focussing on Co2 emission and Fuel Consumption. Graph of speed vs time may not be relevant for the user. Also leaderboard will be one pending feature in Profile Page.

rahulrj commented 9 years ago

Matthes,one question about the project.

Should i use Picasso for downloading images. Currently i am downloading user's friend's images and also the user's picture. So Picasso will take care of the caching, threading etc. Or is the task too smaller to use Picasso(overhead) and i should do it using simple AsyncTask?

nuest commented 9 years ago

What is Picasso? Do you have a link?

rahulrj commented 9 years ago

Here is the link http://square.github.io/picasso/ And i have read pretty good reviews of it on StackOverflow. But unable to decide if we need to use an additional library for our purpose.

matthesrieke commented 9 years ago

I guess using Picasso is fine. It is just 100kb and under Apache License 2.0. It seems like a robust implementation of loading images dynamically from remote and cache resources.

matthesrieke commented 9 years ago

Hi Rahul. I just installed your current development version to my device. A quick comment: currently the profile page is displayed after a successful login. I could not find a way to navigate to it once I have left that view. Could you add an entry to the ActionBar on the left? Maybe you could also replace the "Logout" entry with a link to the Profile view and implement the logout mechanism as a button on that view?

rahulrj commented 9 years ago

Yes sure i will do that and all small fixes in this week's commit

rahulrj commented 9 years ago

For the timeseries graph, suppose a user has 50 tracks, then i will fetch the tracks and make 50 calls to server to fetch statistics about each track. So i think this method wont do justice. There is a need for a service.

nuest commented 9 years ago

I understand your performance concern about the 50 calls to the server - but for now that is how it will have to work.

@cfarmer you should now also be able to work with the issues here.

carsonfarmer commented 9 years ago

Thanks @nuest! @rahul690973 I also think making 50 calls to the server is going to be too much overhead. Try just querying the most recent k tracks, with k to be defined by you (5 or 10 would probably be sufficient). The other option would be to cache statistics about uploaded tracks in the app itself (i.e., don't query the server for this information, but rather store it locally [just the summaries]). I'm not sure if this is the best idea, but if 50+ queries is a concern, it's one way to think about it.

rahulrj commented 9 years ago

The server is not returning the profile pic. which it was doing so previously. I am using a chrome extension called POSTMAN to validate this. Its giving 404 error. Here is the screenshot http://imgur.com/JNRQHLC

nuest commented 9 years ago
  1. There is a typo in the URL, the endpoint is "avatar", not "avator" - https://envirocar.org/api/stable/users/rsh1103/avatar
  2. The URL above gives me a 403 - Forbidden which means that you will have to authenticate to download user images.

Please check the API documentation carefully. And since the information about ..users/<username>/avatar I kindly ask you to create a new issue on the enviroCar-server project requesting an update of the documentation.

rahulrj commented 9 years ago

Okay I will do that today. On Aug 6, 2014 2:34 AM, "Daniel Nüst" notifications@github.com wrote:

  1. There is a typo in the URL, the endpoint is "avatar", not "avator"
  2. https://envirocar.org/api/stable/users/rsh1103/avatar
  3. The URL above gives me a 403 - Forbidden which means that you will have to authenticate to download user images.

Please check the API documentation carefully. And since the information about ..users//avatar I kindly ask you to create a new issue on the enviroCar-server project requesting an update of the documentation.

— Reply to this email directly or view it on GitHub https://github.com/enviroCar/enviroCar-app/issues/241#issuecomment-51259604 .

carsonfarmer commented 9 years ago

@rahul690973 Can you please add a reference to the new issue here as well for those following this thread.

rahulrj commented 9 years ago

Disk caching and memory caching of images involve appropriate headers from the server side..i.e. the cache-control headers. https://github.com/square/picasso/issues/237

matthesrieke commented 9 years ago

are you sure this is the same issue? I read from the thread that the cache files are on the disk but not loaded. as far as I understand your post, you do not have the files cached on disk yet. So probably there is something going wrong with the actual storing?

matthesrieke commented 9 years ago

in addition I investigated the reponse headers from the gravatar servers and they provide cache-control:

HTTP/1.1 200 OK
Server: nginx
Date: Tue, 12 Aug 2014 09:20:06 GMT
Content-Type: image/png
Content-Length: 7052
Connection: keep-alive
Last-Modified: Wed, 09 Oct 2013 13:55:32 GMT
Content-Disposition: inline; filename="0f6d43a903cb252db44e084ae352cc6d.png"
Access-Control-Allow-Origin: *
Accept-Ranges: bytes
X-Varnish: 1246097383 1244923803
Via: 1.1 varnish
Expires: Tue, 12 Aug 2014 09:25:06 GMT
Cache-Control: max-age=300
Source-Age: 527

Maybe there is an issue with following redirects? Our server does a HTTP/1.1 307 Temporary Redirect to the gravatar server

matthesrieke commented 9 years ago

I checked your current develop version. Also a few comments here regarding the time series graphs:

besides that: nice work! the profile page is really great to have.

rahulrj commented 9 years ago

Yes, in my case, Picasso is not creating any cache folder. I will have to spend time on that. Regarding the graph, i have created two versions. One is the dummy that you see. In other version, as i mentioned in my previous comment that if a user has 50 tracks, then i am making 50 calls to server according to the current API for fetching the statistics of each track and displaying it in a graph. So currently i have not pushed that version. Because its very inefficient and has to be changed with a new service.

rahulrj commented 9 years ago

Can you please give me an example of how panning in a graph will look like.

rahulrj commented 9 years ago

Also in the second graph ( comparison with friend), we will have to omit the localization of units i think. Because it involves 10 parameters and we wont have the localized units for each of the parameters. Since it is a comparison, will the user still want the values according to his own units?

matthesrieke commented 9 years ago

Let me think about the "user statistics" resource. maybe we can define a static JSON mockup similar to the leaderboard concept.

regarding panning: here is a screenshot of your recent app. I think we actually do not need panning (swiping on the graph). So maybe disabling that functionality will do the job.

screenshot_2014-08-13-17-28-08

carsonfarmer commented 9 years ago

Disabling for now is an option, however, once users start to build up long time series, it will be useful to be able to go back and forth in history to see how things have changed...

rahulrj commented 9 years ago

Yes. Please do so if a static json is possible. Because then we wont have to change anything much at the time of replacing it with original values

matthesrieke commented 9 years ago

I have created a static JSON. If you miss something, let me know and I will update the file. for the moment I have used 5 entries. I think a reasonable approach is to take the first 10 (or less if not available) entries for the default view.

http://envirocar.github.io/examples/user-statistics.json

hafenkran commented 6 years ago

has been revised in principle