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

Add duration as a type to JTS #210

Closed
rufuspollock opened this Issue Aug 27, 2015 · 11 comments

Comments

Projects
None yet
4 participants
@rufuspollock
Contributor

rufuspollock commented Aug 27, 2015

Aligns with XSD, exists in SQL.

@pwalsh

This comment has been minimized.

Show comment
Hide comment
@pwalsh

pwalsh Sep 23, 2015

Member

+1

Member

pwalsh commented Sep 23, 2015

+1

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 19, 2015

+1
I added duration to my usage of JTS, but I'd prefer not to deviate from the spec.

ghost commented Oct 19, 2015

+1
I added duration to my usage of JTS, but I'd prefer not to deviate from the spec.

@pwalsh

This comment has been minimized.

Show comment
Hide comment
@pwalsh

pwalsh Oct 19, 2015

Member

@back5576 could you share an example of how you implemented it?

Member

pwalsh commented Oct 19, 2015

@back5576 could you share an example of how you implemented it?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Oct 19, 2015

For spec here:
https://github.com/dataprotocols/dataprotocols/blob/gh-pages/json-table-schema/index.md
I named the new datatype "duration" and values are in days.

ghost commented Oct 19, 2015

For spec here:
https://github.com/dataprotocols/dataprotocols/blob/gh-pages/json-table-schema/index.md
I named the new datatype "duration" and values are in days.

@femtotrader

This comment has been minimized.

Show comment
Hide comment
@femtotrader

femtotrader Oct 19, 2015

It's not a spec but we should probably have something that behave like Python Pandas to_timedelta

$ ipython
Python 3.4.3 |Anaconda 2.3.0 (x86_64)| (default, Mar  6 2015, 12:07:41)
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import pandas as pd

In [2]: pd.to_timedelta("0 days 01:03:30.24")
Out[2]: Timedelta('0 days 01:03:30.240000')

The problem with this is that we can't use weeks, months, years.

It seems that they are using internally nanoseconds

In [3]: pd.to_timedelta(1E9)
Out[3]: Timedelta('0 days 00:00:01')

femtotrader commented Oct 19, 2015

It's not a spec but we should probably have something that behave like Python Pandas to_timedelta

$ ipython
Python 3.4.3 |Anaconda 2.3.0 (x86_64)| (default, Mar  6 2015, 12:07:41)
Type "copyright", "credits" or "license" for more information.

IPython 4.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import pandas as pd

In [2]: pd.to_timedelta("0 days 01:03:30.24")
Out[2]: Timedelta('0 days 01:03:30.240000')

The problem with this is that we can't use weeks, months, years.

It seems that they are using internally nanoseconds

In [3]: pd.to_timedelta(1E9)
Out[3]: Timedelta('0 days 00:00:01')
@femtotrader

This comment has been minimized.

Show comment
Hide comment
@femtotrader

femtotrader Oct 19, 2015

ISO 8601 also defines a period (duration)
https://en.wikipedia.org/wiki/ISO_8601

I seems to be used in XML Schema
http://www.w3.org/TR/xmlschema-2/#d0e11648

and that's probably better to follow this way

femtotrader commented Oct 19, 2015

ISO 8601 also defines a period (duration)
https://en.wikipedia.org/wiki/ISO_8601

I seems to be used in XML Schema
http://www.w3.org/TR/xmlschema-2/#d0e11648

and that's probably better to follow this way

@djvanderlaan

This comment has been minimized.

Show comment
Hide comment
@djvanderlaan

djvanderlaan Oct 27, 2015

+1

We needed a period type in an application visualizing statistical output tables. Actually many if not most statistical output tables contain periods as they concern quarters, months, years. For visualizing we wanted to differentiate between periodical figures belonging to one specific date (e.g. population the January 1) or belonging to a period (e.g. inflation). We decided to use the regular date field allowing also the ISO 8601 period specifier referenced by @femtotrader. The first quarter of 2015 can then be represented using 2015-01/P3M; the first month by 2015-01 or 2015-01/P1M; the complete year 2015 by 2015 or 2015/P1Y.

What I call a period above is a period between two specific dates. It is not a pure period such as 2 days and 3 hours.

In our javascript we use moment.js and twix.js. We wrote a function that translates the input strings to twix objects.

We actually also accept 2015M[0]1 for months; 2015Q[0]1for quarters.

djvanderlaan commented Oct 27, 2015

+1

We needed a period type in an application visualizing statistical output tables. Actually many if not most statistical output tables contain periods as they concern quarters, months, years. For visualizing we wanted to differentiate between periodical figures belonging to one specific date (e.g. population the January 1) or belonging to a period (e.g. inflation). We decided to use the regular date field allowing also the ISO 8601 period specifier referenced by @femtotrader. The first quarter of 2015 can then be represented using 2015-01/P3M; the first month by 2015-01 or 2015-01/P1M; the complete year 2015 by 2015 or 2015/P1Y.

What I call a period above is a period between two specific dates. It is not a pure period such as 2 days and 3 hours.

In our javascript we use moment.js and twix.js. We wrote a function that translates the input strings to twix objects.

We actually also accept 2015M[0]1 for months; 2015Q[0]1for quarters.

@rufuspollock

This comment has been minimized.

Show comment
Hide comment
@rufuspollock

rufuspollock Oct 29, 2015

Contributor

OK, I propose we go with the XSD style duration. @femtotrader would you like to submit a PR?

@djvanderlaan you are quite right re "points in time" vs duration. I like your method of being explicit though generally i would just interpret as a point in time e.g. 2015-Q1 or similar. Also, I'm interested to hear about your project - is it public?

Contributor

rufuspollock commented Oct 29, 2015

OK, I propose we go with the XSD style duration. @femtotrader would you like to submit a PR?

@djvanderlaan you are quite right re "points in time" vs duration. I like your method of being explicit though generally i would just interpret as a point in time e.g. 2015-Q1 or similar. Also, I'm interested to hear about your project - is it public?

@femtotrader

This comment has been minimized.

Show comment
Hide comment
@femtotrader

femtotrader Oct 29, 2015

Sorry @rgrp I'm quite busy these days (probably until december). So don't expect a PR from me. Sorry.

femtotrader commented Oct 29, 2015

Sorry @rgrp I'm quite busy these days (probably until december). So don't expect a PR from me. Sorry.

@rufuspollock

This comment has been minimized.

Show comment
Hide comment
@rufuspollock

rufuspollock Nov 2, 2015

Contributor

@femtotrader no problem - and thanks for all the contributions so far! We'll look to get that PR in.

Contributor

rufuspollock commented Nov 2, 2015

@femtotrader no problem - and thanks for all the contributions so far! We'll look to get that PR in.

@rufuspollock

This comment has been minimized.

Show comment
Hide comment
@rufuspollock

rufuspollock Nov 19, 2015

Contributor

OK, about to submit fix for this. Two things:

Contributor

rufuspollock commented Nov 19, 2015

OK, about to submit fix for this. Two things:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment