Monthly Masters #17

Closed
opened 2021-04-19 09:59:01 +00:00 by banillie · 10 comments
banillie commented 2021-04-19 09:59:01 +00:00 (Migrated from github.com)

Hi @yulqen is it possible for datamaps Master classes to record the month for data. e.g. Jan 2021. This would be useful in addition to quarters. Thanks.

Hi @yulqen is it possible for datamaps Master classes to record the month for data. e.g. Jan 2021. This would be useful in addition to quarters. Thanks.
yulqen commented 2021-04-19 12:23:01 +00:00 (Migrated from github.com)

Sure - could do that. What is the requirement for the month attribute - the first month of the quarter? Do you need it as a date object or text and if so - what format? We can discuss.

On Mon, 19 Apr 2021, at 10:59 AM, Will Grant wrote:

Hi @yulqen https://github.com/yulqen is it possible for datamaps Master classes to record the month for data. e.g. Jan 2021. This would be useful in addition to quarters. Thanks.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/yulqen/datamaps/issues/17, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB4ISJUKUKQQZJDSNJE25TTJP5HNANCNFSM43FPWLBQ.

Sure - could do that. What is the requirement for the month attribute - the first month of the quarter? Do you need it as a `date` object or text and if so - what format? We can discuss. On Mon, 19 Apr 2021, at 10:59 AM, Will Grant wrote: > > Hi @yulqen <https://github.com/yulqen> is it possible for datamaps Master classes to record the month for data. e.g. Jan 2021. This would be useful in addition to quarters. Thanks. > — > You are receiving this because you were mentioned. > Reply to this email directly, view it on GitHub <https://github.com/yulqen/datamaps/issues/17>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAB4ISJUKUKQQZJDSNJE25TTJP5HNANCNFSM43FPWLBQ>.
banillie commented 2021-04-21 08:03:18 +00:00 (Migrated from github.com)

This would be something separate to quarters. So you have the ability to specify a month (from a possible 12) and a year.
I'm asking because we are going to start using DMs for a quarterly reporting process.
Cheers.

This would be something separate to quarters. So you have the ability to specify a month (from a possible 12) and a year. I'm asking because we are going to start using DMs for a quarterly reporting process. Cheers.
yulqen commented 2021-04-28 18:37:04 +00:00 (Migrated from github.com)

Sorry to labour the point, but would you be able to provide an example - in code - of what you would like to see?

At present, you create a Master using something like:

m = project_data_from_master("master.xlsx", 1, 2021)

This results in an object: Master() object whose attributes you can query with, for example:

* `quarter = m.quarter`
* `data = m.data`
* 'year = m.year`

Additionally, the quarter object here can then be queried for its financial year properties, e.g.:

fy = quarter.fy

whose properties are:

fy.q1 (results in "2021-04-01", for example)

You mention you want to be able to specify a month, so is it as simple as creating the month with the following?

* `m = project_data_from_master("master.xlsx", 7, 2021)` (for July, for example)

And therefore, what do you need out of the resulting object?

* `month = m.month`

The obvious attributes are m.start_date, m.end_date, m.long_name ("January"), m.short_name ("Jan") - etc.

Let me know if I'm on the right track.

Sorry to labour the point, but would you be able to provide an example - in code - of what you would like to see? At present, you create a `Master` using something like: `m = project_data_from_master("master.xlsx", 1, 2021)` This results in an object: `Master()` object whose attributes you can query with, for example: * `quarter = m.quarter` * `data = m.data` * 'year = m.year` Additionally, the `quarter` object here can then be queried for its financial year properties, e.g.: `fy = quarter.fy` whose properties are: `fy.q1` (results in "2021-04-01", for example) You mention you want to be able to specify a month, so is it as simple as creating the month with the following? * `m = project_data_from_master("master.xlsx", 7, 2021)` (for July, for example) And therefore, what do you need out of the resulting object? * `month = m.month` The obvious attributes are `m.start_date`, `m.end_date`, `m.long_name` ("January"), `m.short_name` ("Jan") - etc. Let me know if I'm on the right track.
banillie commented 2021-04-29 09:07:16 +00:00 (Migrated from github.com)

Yes it is a simple as creating a month e.g. project_data_from_master("master.xlsx", 7, 2021) (for July, for example)` as above.

The Master() object would then have the following attributes.

quarter = m.quarter
data = m.data
year = m.year
month = m.month

From a user case perspective you'd need to specify a month or quarter. No need for both. The reason for this is, is it allows for quarterly or monthly reporting cycles. (The user will not be doing both at the same time.)

Yes it is a simple as creating a month e.g. `project_data_from_master("master.xlsx", 7, 2021)` (for July, for example)` as above. The `Master()` object would then have the following attributes. ``` quarter = m.quarter data = m.data year = m.year month = m.month ``` From a user case perspective you'd need to specify a month or quarter. No need for both. The reason for this is, is it allows for quarterly or monthly reporting cycles. (The user will not be doing both at the same time.)
yulqen commented 2021-05-16 20:12:03 +00:00 (Migrated from github.com)

I'm finishing up the work on this - to be released in a new version of
datamaps this week.

There is a new function you will need to import:
datamaps.api.project_data_from_master_month. It is somewhat
troublesome to try to use the current function for this
(project_data_from_master) - the reason is related to the function
signature and the unnecessary complexity of trying to detect whether the
caller is passing in a month or a quarter. Example, in the current API:

from datamaps.api import project_data_from_master

d = project_data_from_master("master.xlsx", 3, 2021)
assert d.quarter== Quarter(3, 2021)

The signature of this function is project_data_from_master(master, quarter, year). It would be nice to be able to use the same function
and instead of passing in a quarter integer here, pass in a month
integer, e.g. project_data_from_master("master.xlsx", 12, 2021) but that exposes a little too much instability - you have to test
whether the caller means a quarter or a month here and opens up a bunch
of problems.

Instead, the new func added to the API goes like this:

from datamaps.api import project_data_from_master_month

d = project_data_from_master_month("master.xlsx", 10, 2021)
assert d.quarter==Quarter(3, 2021)
assert d.month.name == "October"
assert d.month.start_date == datetime.date(2021, 10, 1)
assert d.month.end_date == datatime.date(2021, 10, 31)
assert d.quarter.months==[Month(October), Month(November),
Month(December)]

I just need to fix a few bits related to leap years. This will be coming
out in datamaps v1.1.6.

@banillie

I'm finishing up the work on this - to be released in a new version of datamaps this week. There is a new function you will need to import: `datamaps.api.project_data_from_master_month`. It is somewhat troublesome to try to use the current function for this (`project_data_from_master`) - the reason is related to the function signature and the unnecessary complexity of trying to detect whether the caller is passing in a month or a quarter. Example, in the current API: ```python from datamaps.api import project_data_from_master d = project_data_from_master("master.xlsx", 3, 2021) assert d.quarter== Quarter(3, 2021) ``` The signature of this function is `project_data_from_master(master, quarter, year)`. It would be nice to be able to use the same function and instead of passing in a quarter integer here, pass in a month integer, e.g. `project_data_from_master("master.xlsx", 12, 2021)` but that exposes a little too much instability - you have to test whether the caller means a quarter or a month here and opens up a bunch of problems. Instead, the new func added to the API goes like this: ```python from datamaps.api import project_data_from_master_month d = project_data_from_master_month("master.xlsx", 10, 2021) assert d.quarter==Quarter(3, 2021) assert d.month.name == "October" assert d.month.start_date == datetime.date(2021, 10, 1) assert d.month.end_date == datatime.date(2021, 10, 31) assert d.quarter.months==[Month(October), Month(November), Month(December)] ``` I just need to fix a few bits related to leap years. This will be coming out in datamaps `v1.1.6`. @banillie
banillie commented 2021-05-17 14:55:38 +00:00 (Migrated from github.com)

@yulqen thanks very much for this. I think this arrangement will work nicely. Having two different functions is not a problem. Cheers.

@yulqen thanks very much for this. I think this arrangement will work nicely. Having two different functions is not a problem. Cheers.
yulqen commented 2021-05-18 19:38:05 +00:00 (Migrated from github.com)

Implemented in v1.1.6 - now released on PyPI. Update with pip install -U datamaps.

Use:

from datamaps.api import project_data_from_master_month.

Report bugs!

Implemented in `v1.1.6` - now released on PyPI. Update with `pip install -U datamaps`. Use: `from datamaps.api import project_data_from_master_month`. Report bugs!
yulqen commented 2021-05-19 16:45:24 +00:00 (Migrated from github.com)

Updated to v1.1.7 to fix bug in repr().

Updated to `v1.1.7` to fix bug in `repr()`.
banillie commented 2021-05-21 12:31:52 +00:00 (Migrated from github.com)

Hiya @yulqen sorry only just getting to this now, but going to try it out. cheers.

Hiya @yulqen sorry only just getting to this now, but going to try it out. cheers.
banillie commented 2021-05-21 13:45:28 +00:00 (Migrated from github.com)

@yulqen I was able to integrate this into analysis_engine now problem. One of the reporting process now uses monthly masters. Cheers Man.

@yulqen I was able to integrate this into analysis_engine now problem. One of the reporting process now uses monthly masters. Cheers Man.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
yulqen/datamaps#17
No description provided.