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

Utilization Analytics MVP #1136

Merged
merged 5 commits into from
Aug 5, 2020
Merged

Utilization Analytics MVP #1136

merged 5 commits into from
Aug 5, 2020

Conversation

neilmb
Copy link
Member

@neilmb neilmb commented Jul 31, 2020

Description

There is lots of valuable information about 18F operations in the Tock database. This is a very early step in making that data visible. It adds a page under "Reports" called "Analytics" that currently has just a single graph of the total hours billed over time broken down by billable and non-billable.

Screen Shot 2020-07-31 at 3 54 20 PM

There are many more relevant graphs that could be added here in the future, but this is an MVP to establish that we can include these kinds of graphs.

Additional information

This adds a dependency on the python plotly library for creating the plots in a way that can be included in the template and the template for the page then includes the Plotly.js library on-page from their CDN. If we need to ship a fixed version of that JS library, we could figure out how to do that instead.

tock/utilization/views.py Outdated Show resolved Hide resolved
{% endblock %}

{% block content %}
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's bring this in house and serve ourselves for consistency by pulling the version we need into tock/tock/static/vendor

https://github.com/18F/tock/blob/main/docs/dependency-management.md#production

def _utilization_data(start_date, end_date):
Timecard = apps.get_model("hours", "Timecard")
billable_filter = Q(timecardobjects__project__accounting_code__billable=True)
data = (Timecard.objects.filter(reporting_period__start_date__gte=start_date,
Copy link
Contributor

Choose a reason for hiding this comment

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

Opportunity here to limit this to submitted timecards by filtering on Timecard.submitted

@Jkrzy
Copy link
Contributor

Jkrzy commented Aug 5, 2020

Looks :amaze: @neilmb, thank you!!
Made a few comments inline where there are some opportunities for changes.

@neilmb
Copy link
Member Author

neilmb commented Aug 5, 2020

@Jkrzy Comments addressed: filter on submitted, vendor plotly into static, sum using existing billable/non-billable totals on timecard.

Copy link
Member

@timoballard timoballard left a comment

Choose a reason for hiding this comment

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

lgtm!

@Jkrzy Jkrzy merged commit 7b3e5c6 into main Aug 5, 2020
@Jkrzy Jkrzy deleted the nmb/analytics branch August 5, 2020 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants