bailoo / itrack

Location Tracking for Everyone
3 stars 2 forks source link

Need Last Location Data between two dates #51

Closed sparwez closed 8 years ago

sparwez commented 9 years ago

Dear Sir,

              We need a API to get last location data between selected dates. This is required in last data report on home page of website. Presently we are using fulldata for the same thus putting overhead on cassandra and wasting RAM and CPU. Lastlog function is also not serving purpose as it give me latest data but not between specified date.
bailoo commented 9 years ago

Can you use getLastSeenDateTime ? Or should I set a lower date limit in this function?

ashish-iembsys commented 9 years ago

lower limit is required as customer also ask for last data between two dates, which may not be current date. But Lastseendatetime shud remain as it is as this function is also required. We need to create a separate function.

bailoo commented 9 years ago

use new function getLastSeenDateTimes which takes 2 inputs datetime1 (lower) and datetime2 (higher) and returns the last seen. Example given in example directory.

sparwez commented 9 years ago

getLastSeenDateTimes function is taking much more time for inactive vehicles.Plotting data on map or text mode Script is being hang for this reason.

bailoo commented 9 years ago

Please give some Imei of inactive vehicles and date time examples so that I can reproduce.

When creating issue you must give complete information so that it can be reproduced.

sparwez commented 9 years ago

Dear Sir ,

                I am giving you login detail of mumbai account along

with working imei and also imei which take much time for execution.You can take more examples for login in www.ecodrivesolution.com http://www.ecodrivesolution.com

_groupid:0068

_user_id:mothermumbai

password :mumbai.

The detail of working imei with their name given below and these imei status are green(active)

imei no :862170018323202 , vehiclename->331005(JF2232)Hanumant Spare imei no :862170018322881, vahiclename MH-04 EL 1820-Pune Primery

datetime1:2015-08-21 10:00:00 datetime2:2015-08-21 19:00:00

The detail of* imei with their name* which may take much time for execution given below and these imei status are _gray(inactive). * *It is happing with all inactive vehicle_s

imei no :862170018383289, vehcilename:300105(4838) imei No 862170017136738, vehiclename:300115(1223)

datetime1:2015-08-21 10:00:00 datetime2:2015-08-21 19:00:00

With Regards Shams Parwez 9935385122

On Thu, Aug 20, 2015 at 10:04 PM, Abhishek Singh Bailoo < notifications@github.com> wrote:

Please give some Imei of inactive vehicles and date time examples so that I can reproduce.

When creating issue you must give complete information so that it can be reproduced.

— Reply to this email directly or view it on GitHub https://github.com/bailoo/itrack/issues/51#issuecomment-133068834.

bailoo commented 9 years ago

This is a bug. Fixed in commit 91af345e61d165d2927aebf3b6976b17c6e60dee Now the function returns an empty object if not found. Please git pull and test.

sparwez commented 9 years ago

Dear Sir, We should get last data only when gps is valid. Our current last data api are getting last data without checking gps valid or not. I am giving you the example below please see it.

$mei = '862170017133743'; ( it give us last data however gps valid is not valid ) $datetime1 = '2015-08-31 00:00:00'; $datetime2 = '2015-08-31 23:59:59'; $st_results = getLastSeenDateTimes($o_cassandra, $imei, $datetime1, $datetime2);

you can check it by data log report.I am giving you user_id and password below to check log.

User Id : indiabulls Password : india@2015

bailoo commented 9 years ago

This example given above has valid latitude and longitude. Please give me an example which does not have latitude longitude.

sparwez commented 9 years ago

Dear Sir, Example is given below. $imei = '865733024479636'; $datetime1 = '2015-08-31 00:00:00'; $datetime2 = '2015-08-31 23:59:59'; $st_results = getLastSeenDateTimes($o_cassandra, $imei, $datetime1, $datetime2);

bailoo commented 9 years ago

returns empty object now if lat or long is missing. Fixed in commit 3149e2f61c4642593fe820747a78c6f64b159560

sparwez commented 9 years ago

Dear Sir, Sorry for wrong explain from my side. Actualy we want last gps valid data between dates.

Below example give us null result if gps not valid between given dates.Although track is plotting for the given datetimes.So If the track is plotting than why last position give null result between given dates.I am also giving you user_id and password so that you can check it.

User Id : indiabulls Password : india@2015

Example is given below. $imei = '865733024479636'; $datetime1 = '2015-08-31 00:00:00'; $datetime2 = '2015-08-31 23:59:59'; $st_results = getLastSeenDateTimes($o_cassandra, $imei, $datetime1, $datetime2);

bailoo commented 9 years ago

Fixed in commit 784b4fbadbfc6e1859abb53d118a644462789e90 Please git pull and test for all possible cases today. Reopen if anything fails.

sparwez commented 9 years ago

Dear Sir,

        I will test it in two three cases.It work fine when no data found(object return null) but it will give wrong last location data when data found.I will give you example below.

$imei = '862170017808674'; $datetime1 = '2015-09-16 10:00:00'; $datetime2 = '2015-09-16 12:00:00'; $st_results = getLastSeenDateTimes($o_cassandra, $imei, $datetime1, $datetime2); $o_cassandra->close();

Above code gives wrong last location data . Last location date time of imei should 2015-09-16 11:57:56 between given datetime but in above code last location datetime of imei is 2015-09-16 08:29:57.It is giving out of range last location data within given datetime.Please look into matter.

You can test it by given user_id and password in www.ecodrivesolution.com

group_id:0068 user_id:mother_mumbai password:mumbai

vehicleName: 300446(2232)

bailoo commented 9 years ago

I am getting correct expected results. Please check again.

$imei = '862170017808674'; $datetime1 = '2015-09-16 10:00:00'; $datetime2 = '2015-09-16 12:00:00';

returns [g] => 2015-09-16@12:03:03 [h] => 2015-09-16@11:59:57 [a] => NORMAL [b] => v1.50T [c] => 1 [d] => 18.47098N [e] => 73.8213E

Looks good to me.

bailoo commented 8 years ago

I am closing this issue. If you want to reopen please provide a case with unexpected result. The case above looks good as explained in my last comment above.

bailoo commented 8 years ago

As discussed this works fine on Linux and not on Windows. As we are running our servers on Linux, let us stick to testing on Linux only.

Please close this issue when you are done testing everything.

sparwez commented 8 years ago

Dear Sir, Get last seen date times function works fine with one day duration for inactive vehicles and returns result as example below.

    $imei = '861074027067977';
$datetime1 = '2015-09-22 00:00:00';
$datetime2 = '2015-09-22 23:59:59';
$st_results = getLastSeenDateTimes($o_cassandra, $imei, $datetime1, $datetime2);

   stdClass Object ( [g] => 2015-09-22@02:46:07 [h] => 2015-09-22@02:45:22 [a] => NORMAL [b] => 1.61LF [c] => 1 [d] => 28.0621N [e] => 73.32829E [f] => 0.19 [i] => 1 [j] => 2111 [k] => 4088 [l] => 2156 [m] => 4089 [n] => 2156 [o] => 2096 [p] => 4004 [q] => 0 [r] => 23.91 [ci] => )   

But when we pass multiple days for inactive vehicles in this function it returns null object as example given below.

   $imei = '861074027067977';
   $datetime1 = '2015-09-22 00:00:00';
   $datetime2 = '2015-09-23 23:59:59';
   $st_results = getLastSeenDateTimes($o_cassandra, $imei, $datetime1, $datetime2);

  stdClass Object ( )

Please look into the matter.

Note : it will happen only inactive vehicle;

bailoo commented 8 years ago

Fixed in commit ad8d1cdd99f22ea9029b4f670b42c2e9c205d72e please git pull and check.

$imei = '861074027067977';
$datetime1 = '2015-09-22 00:00:00';
$datetime2 = '2015-09-23 23:59:59';
$st_results = getLastSeenDateTimes($o_cassandra, $imei, $datetime1, $datetime2);

now returns

stdClass Object ( [g] => 2015-09-22@06:16:07 [h] => 2015-09-22@06:15:22 [a] => NORMAL [b] => 1.61LF [c] => 1 [d] => 28.0621N [e] => 73.32829E

sparwez commented 8 years ago

Dear Sir, Last location of below given date time is null .Although data is coming at (2015-10-13 15:54:47).

$imei = '911417050737422'; $datetime1 = '2015/10/13 00:00:00'; $datetime2 = '2015/10/13 18:30:19'; $st_results = getLastSeenDateTimes($o_cassandra, $imei, $datetime1, $datetime2);

bailoo commented 8 years ago

Fixed in commit 8ecc49a42e8b66430978e5957b9b4fe82a6f4ce9

good catch! this is because lat long were not actually null but 0.0 stdClass Object ( [g] => 2015-10-13@18:30:35 [h] => 2015-10-13@18:30:00 [a] => 5 [b] => ver0.8(24HR) (GPS ON)(AIRCEL BL : 46 1 API:19 0) [c] => 1 [d] => 0.0 [e] => 0.0 [f] => 0.0 [i] => 13189885,4058,10,0 [j] => )

Now, I am rejecting 0 and 0.0 as lat long so the return value is stdClass Object ( [g] => 2015-10-13@15:55:52 [h] => 2015-10-13@15:55:47 [a] => 5 [b] => ver0.8(24HR) (GPS ON)(AIRCEL BL : 64 1 API:19 0) [c] => 1 [d] => 26.495185 [e] => 80.25 [f] => 0.0 [i] => 13189885,4058,10,0 [j] => )

Please make a list of all false and invalid values that GPS gives for lat long like NULL 0 0.0