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

Update timestamp desc to unix timestamp milliseconds #138

5 changes: 3 additions & 2 deletions generate_schema/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,10 @@
},
"timestamp": {
"$id": "#/definitions/timestamp",
"title": "Floating-point seconds since Unix epoch",
"title": "Integer seconds since Unix epoch",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seconds -> milliseconds

"type": "number",
"minimum": 0.0
"multiple_of": 1.0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the keyword is multipleOf - but I like this, nice approach!

"minimum": 1483228800
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a good idea to enforce via the schema?

What about a process that generates fake data, shouldn't it be allowed to generate data across whatever time series it wants?

If MDS gets back-ported to TNCs and other related types of shared mobility, this could hamstring the ability to get historic data.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that fair, I'm gonna say let's not enforce via schema but some sort of "truth-yness" validator.

}
}
}
9 changes: 4 additions & 5 deletions provider/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ represented as a GeoJSON [`Feature`](https://tools.ietf.org/html/rfc7946#section
{
"type": "Feature",
"properties": {
"timestamp": 1529968782.421409
"timestamp": 1529968782421
},
"geometry": {
"type": "Point",
Expand All @@ -99,8 +99,7 @@ represented as a GeoJSON [`Feature`](https://tools.ietf.org/html/rfc7946#section

### Timestamps

References to `timestamp` imply floating-point seconds since [Unix epoch](https://en.wikipedia.org/wiki/Unix_time), such as
the format returned by Python's [`time.time()`](https://docs.python.org/3/library/time.html#time.time) function.
References to `timestamp` imply integer milliseconds since [Unix epoch](https://en.wikipedia.org/wiki/Unix_time). You can find the implementation of unix timestamp in milliseconds for your programming language [here](https://currentmillis.com/).

[Top][toc]

Expand Down Expand Up @@ -183,7 +182,7 @@ Routes must include at least 2 points: the start point and end point. Additional
"features": [{
"type": "Feature",
"properties": {
"timestamp": 1529968782.421409
"timestamp": 1529968782421
},
"geometry": {
"type": "Point",
Expand All @@ -196,7 +195,7 @@ Routes must include at least 2 points: the start point and end point. Additional
{
"type": "Feature",
"properties": {
"timestamp": 1531007628.3774529
"timestamp": 1531007628377
},
"geometry": {
"type": "Point",
Expand Down
16 changes: 12 additions & 4 deletions provider/status_changes.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,19 @@
"properties": {
"type": {
"type": "string",
"emum": [
"enum": [
"Feature"
]
},
"properties": {
"type": "object",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type can be an array, see #142 for how I implemented this to allow null for the optional fields like parking_verification_url.

"oneOf": [
{
"type": "null"
},
{
"type": "object"
}
],
"required": [
"timestamp"
],
Expand Down Expand Up @@ -139,9 +146,10 @@
},
"timestamp": {
"$id": "#/definitions/timestamp",
"title": "Floating-point seconds since Unix epoch",
"title": "Integer seconds since Unix epoch",
"type": "number",
"minimum": 0.0
"multiple_of": 1.0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multipleOf

"minimum": 1483228800
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment above.

},
"vehicle_type": {
"$id": "#/definitions/vehicle_type",
Expand Down
18 changes: 13 additions & 5 deletions provider/trips.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,19 @@
"properties": {
"type": {
"type": "string",
"emum": [
"enum": [
"Feature"
]
},
"properties": {
"type": "object",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use array for type, see comment above

"oneOf": [
{
"type": "null"
},
{
"type": "object"
}
],
"required": [
"timestamp"
],
Expand Down Expand Up @@ -85,7 +92,7 @@
"properties": {
"type": {
"type": "string",
"emum": [
"enum": [
"FeatureCollection"
]
},
Expand Down Expand Up @@ -170,9 +177,10 @@
},
"timestamp": {
"$id": "#/definitions/timestamp",
"title": "Floating-point seconds since Unix epoch",
"title": "Integer seconds since Unix epoch",
"type": "number",
"minimum": 0.0
"multiple_of": 1.0,
hunterowens marked this conversation as resolved.
Show resolved Hide resolved
"minimum": 1483228800
hunterowens marked this conversation as resolved.
Show resolved Hide resolved
},
"vehicle_type": {
"$id": "#/definitions/vehicle_type",
Expand Down