One day of location data for a city
Four hundred people carried a phone for one day. One fix per minute each. This is what the raw data looks like on a map.
The data
Three columns per row: person_id, time, x, y. No names, no addresses, no purpose of travel.
This is what a mobility data vendor starts from. The dense smudges are places where many people stood still. The lines between them are trips. Everything else has to be derived.
One person: break the day into stays and trips
Take one of the 400. The stay-point rule from the trajectory lecture, all fixes within m for at least min, splits the day into stays and the trips between them.
This person's day
Six columns of numbers became a list of episodes. Every step from here on works on stays, not on fixes.
Everyone: stays, in order
Run the same rule on all 400 people. Sort each person's stays by time and the day becomes a sequence: where they were first, second, third.
Home is not in the data either. It is inferred: the place where each person was at 03:00. Work, in a multi-day dataset, is inferred the same way from weekday daytime hours. With one day we stop at home.
Join the stays to places
Add the points of interest and the census tracts. A stay within m of a point of interest takes its name and category. The sequences turn into activities.
Flip it around: look at one place
Until now the unit was a person. Now the unit is a place. Every stay that matched it is a visit. Choose a place:
Visits, unique visitors, arrival curve, dwell time. This is the first page of a commercial foot-traffic report, and it came out of the stays table with one filter.
Try the University, the General hospital and Grocery West after the mall. Same pipeline, very different curves.
Who visits: home tracts and the census
Each visitor has an inferred home. Each home falls in a census tract. Each tract has a published profile. Count visitors by home tract, weight the tract profiles by those counts, and you have a demographic profile of the place's visitors.
This is exactly how vendors report "visitor demographics": not from the people, from the census geography of their inferred homes. It is an ecological inference. It is also the only way to do it without collecting personal data.
Where they came from, where they went next
Because stays are ordered, every visit has a previous stay and a next stay. Count them by category and the place sits in the middle of the city's day.
Top places before and after
A mall that knows most visitors come straight from work and go straight home markets differently from one whose visitors come from the park and go to dinner. The same table answers "who else shares my customers".