Skip to main content

Lab 6 — Location Tags

Skills: 4, 11

The goal of this lab will be to build many functions related to tracking tags.

Given Data Definitions

A PhoneId is a String

Interpretation: a unique identifier for a person's phone

Examples:

PHONE1 = "p1"
PHONE2 = "p2"

Template:

fun phone-id-temp(pi :: String) -> Any:
... pi ...
end

A TagId is a String

Interpretation: a unique identifier for a tracking tag

Examples:

TAG1 = "t1"
TAG2 = "t2"
TAG3 = "t3"

Template:

fun tagid-temp(ti :: String) -> Any:
... ti ...
end

An Owner is a:

data Owner:
| owner(phoneid :: String, tagid :: String)
end

Interpretation: a record of a particular phone owning a tracking tag. There should only ever be one phone per tag, though can be many tags per phone.

Examples:

OWNER1 = owner(PHONE1, TAG1)
OWNER2 = owner(PHONE1, TAG2)
OWNER3 = owner(PHONE2, TAG3)

Template:

fun owner-temp(o :: Owner) -> Any:
... o.phoneid ... o.tagid ...
end

A Time is a Number

Interpretation: a time represented by the number of seconds since Jan 1, 2025.

Examples:

TIME1 = 10
TIME2 = 20
TIME3 = 30

Template:

fun time-temp(t :: Number) -> Any:
... t ...
end

An Encounter is a:

data Posn:
| posn(x :: Number, y :: Number)
end
data Encounter:
| encounter(phoneid :: String, tagid :: String, time :: Number, posn :: Posn)
end

Interpretation: a record of a tag being seen by a given phone at a given time and location. Note that location is represented as X,Y coordinates for simplicity.

Examples:

ENCOUNTER1 = encounter(PHONE1, TAG1, TIME1, posn(0, 0))
ENCOUNTER2 = encounter(PHONE2, TAG1, TIME2, posn(100, 100))
ENCOUNTER3 = encounter(PHONE1, TAG2, TIME3, posn(0, 0))

Template:

fun encounter-temp(e :: Encounter) -> Any:
... e.phoneid ... e.tagid ... e.time ... e.posn ...
end

Problem 1

Design a function tag-activity-count that takes a TagId, a List<Encounter>, a start Time, and an end Time, and calculates how many times the tag has been encountered between the two times, including encounters at exactly the start and end times. Assume that the second time is greater than the first.

Problem 2

Design a function tag-encounter-position that identifies all positions (0-indexed) where a specific TagId appears within a list of Encounters. If the tag id does not occur, the list may be empty.

Problem 3

Location tags can be used maliciously, most prominently for stalking. Abusive ex-partners (or other people) can secretly put tags in their target's car or in an item such as a bag and then use the location mechanism to track the person driving the car or carrying the bag.

Location tags have some privacy protections: tags often will emit an audible beep after separated from their owner for long enough (but those speakers can be intentionally damaged or removed), and given the right software support, might notify a non-owner that they are near. However, these privacy protections are recent additions. The risk of abuse was only taken seriously well after the products were initially released, and indeed, after lawsuits filed alleging the particular use of these tools for stalking.

For more information, see these articles:

In order to design location tags to minimize privacy risks from the beginning, we should analyze their privacy using the below table:

QuestionAnswer
What type of information is shared?[to be filled in]
Who is the subject of the information?[to be filled in]
Who is the sender of the information?The location tag device
Who are the potential recipients of the information?Intended: The purchaser of the tag who uses it to track their own belongings
Unintended: [to be filled in]
What principles govern the collection and transmission of the information?Purchase implies consent to tracking one's own items. People who are unknowingly being tracked have not consented to the transmission of information about their location. There is minimal regulation on who can buy/use tags or what properties the tags have. Data is transmitted through global phone network without verification of legitimate use.

For any gaps, include them in comments. For unintended recipients, list one recipient directly mentioned in the setup above and two additional unique categories of unintended recipients.