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

CSV export of all actual spend #1155

Merged
merged 6 commits into from
Jun 1, 2021
Merged

Conversation

jcoglan
Copy link
Contributor

@jcoglan jcoglan commented May 28, 2021

Changes in this PR

This adds the ability for BEIS users to download all the transactions for each delivery partner as a CSV file that lists all the partner's activities with their total spending by quarter.

The main points of note here are that we probably want to iterate the design here -- do we want this split up by delivery partner, or should we have one big download? Do we need it more granular and split up by fund, etc.

The permissions here are very coarse, I've just limited this to only BEIS users. I'd expect this to change as iterating the design would probably mean changing the routes/resources/controllers we have here so I didn't want to get too into modelling permissions over those until we've a better idea of what we really want.

Screenshots of UI changes

All these changes are only visible to BEIS users. A new item is added to the top-level navigation:

Screenshot 2021-05-28 at 16 26 15

This links to a list of all delivery partner organisations:

Screenshot 2021-05-28 at 16 26 39

Each organisation links through to a list of exports for that organisation:

Screenshot 2021-05-28 at 16 26 58

Clicking "Download" provides the user with a CSV file containing all the transaction totals per quarter for all that organisation's activities. All activities are included even if they have no spend in any of the listed quarters. The set of quarter columns covers every quarter from the earliest to the most recent transaction in the set.

Screenshot 2021-05-28 at 16 27 24

Next steps

  • Is an ADR required? An ADR should be added if this PR introduces a change to the architecture.
  • Is a changelog entry required? An entry should always be made in CHANGELOG.md, unless this PR is a small tweak which has no impact outside the development team.
  • Do any environment variables need amending or adding?
  • Have any changes to the XML been checked with the IATI validator? See XML Validation

@jcoglan jcoglan force-pushed the feature/1802-csv-of-all-actual-spend branch from 9b2d746 to fabaae9 Compare May 28, 2021 15:52
@jcoglan jcoglan marked this pull request as ready for review May 28, 2021 15:54
@jcoglan
Copy link
Contributor Author

jcoglan commented May 28, 2021

@jcoglan jcoglan force-pushed the feature/1802-csv-of-all-actual-spend branch 3 times, most recently from 41aeb27 to 08c6ed9 Compare May 28, 2021 17:05
Comment on lines +31 to +32
echo "==> Running Brakeman"
bundle exec brakeman
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

@pezholio pezholio left a comment

Choose a reason for hiding this comment

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

LGTM 👍

James Coglan added 6 commits June 1, 2021 11:17
Brakeman is a form of static analysis that's relatively quick compared
to running all your tests. I'd rather run anything quick that might fail
for surprising reasons (like this and Standard) before running the whole
test suite, so I get alerted to gotchas without waiting for the entire
build.
This module was not working in some contexts because it assumes
something else has loaded the CSV module, which isn't the case
especially in some tests.
Given a set of activities, QuarterlyTransactionExport generates a
CSV-compatible response that shows the total actual spend by quarter for
all the given activities.

All the transactions linked to the given activities are loaded in a
single query, and their earliest and latest financial quarter is found.
We export a column for every quarter in this range, putting "0.00" in
cells where no spend is recorded for that activity and quarter.

So the columns in the response are the activity RODA and BEIS
identifiers, followed by every quarter from the earliest to the latest
we have records for. The rows are all the activities in the set,
including ones with no spending recorded.

This design lets us export a complete set of all data across all
organisations for a BEIS user, or just the activities for a particular
organisation for a delivery partner.
This exposes the functionality of the QuarterlyTransactionExport service
by providing two new pages:

- /exports: - lists all the delivery partners registered in RODA
- /exports/organisations/:id - lists all the exports available for the
  delivery partner

So far only one export is available: the summary of all the transaction
totals by quarter for all the delivery partner's activities.
This adds permissions to the ExportsController and
Exports::OrganisationsController to make sure those pages are only
accessible to BEIS users.

So far it is only staff inside BEIS that need this functionality so it's
simplest to restrict it to them at first.
@jcoglan jcoglan force-pushed the feature/1802-csv-of-all-actual-spend branch from 08c6ed9 to d7274bb Compare June 1, 2021 10:17
@jcoglan jcoglan merged commit 510b771 into develop Jun 1, 2021
@jcoglan jcoglan deleted the feature/1802-csv-of-all-actual-spend branch June 1, 2021 10:28
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.

2 participants