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

Business Lines | Report | Export non-comp LOB tasks CSV #13075

Closed
2 tasks
pkarman opened this issue Dec 31, 2019 · 2 comments
Closed
2 tasks

Business Lines | Report | Export non-comp LOB tasks CSV #13075

pkarman opened this issue Dec 31, 2019 · 2 comments
Assignees
Labels
Priority: Low Reported issue, not a blocker. "Last in" priority for new work. Product: caseflow-intake Team: Foxtrot 🦊

Comments

@pkarman
Copy link
Contributor

pkarman commented Dec 31, 2019

User or job story

As an administrator of a non-comp line of business, I need to report regularly on the number and type of completed tasks for my organization.

Acceptance criteria

  • On my /decision_reviews/:business_line_slug page, an "Download completed tasks as CSV" button (similar to asyncable jobs download)
  • The CSV download file should be named in the format yyyy-mm-dd-business-line-slug-completed-tasks.csv

Columns Required
Claimant Name
URL- url
Veteran File Number - veteran_file_number
Appeal Type - appeal_type
Time Created - created_at
Issues Total
Issue Descriptions - ?
User's CSS ID (Started the form) -

Out of scope

  • No date selector. Export all completed tasks to date.

Background/context

https://dsva.slack.com/archives/CFBLH2LR4/p1577735929035600

Technical notes

Example controller code:

csv_export = []
columns = [:id, :type, :appeal_type, :created_at, :closed_at]
csv_export << columns.join(",")
business_line.tasks.completed.order(id: :asc).pluck(columns).each do |t| 
  csv_export << t.join(",")
end
ymd = Time.zone.now.strftime("%Y%m%d")
filename = "#{ymd}-#{business_line.url}-completed-tasks.csv"
send_data csv_export.join("\n"), filename: filename

Open questions

Consider restricting this page to users who have the appropriate permissions relative to each LOB.

@msj0nes msj0nes changed the title Export non-comp LOB completed tasks Business Lines | Export non-comp LOB completed tasks Feb 26, 2020
@msj0nes msj0nes changed the title Business Lines | Export non-comp LOB completed tasks Business Lines | Export non-comp LOB tasks Feb 26, 2020
@msj0nes msj0nes changed the title Business Lines | Export non-comp LOB tasks Business Lines | Report | Export non-comp LOB tasks CSV Feb 26, 2020
@pkarman pkarman mentioned this issue Mar 18, 2020
4 tasks
@msj0nes msj0nes added the Priority: Low Reported issue, not a blocker. "Last in" priority for new work. label Mar 31, 2020
@Sjones352
Copy link
Contributor

Similar csv code #12707

@Sjones352 Sjones352 self-assigned this Jun 30, 2020
@leikkisa
Copy link
Contributor

leikkisa commented Jun 30, 2020

@Sjones352 I found a report created for Loan Guaranty from a batteam request. There's some differences that I think would be good to include:

  1. This includes all tasks with appeals, and orders them: .all.includes(:appeal).order(id: :asc)
  2. The task url would navigate to the specific task instead of the business line URL
  3. I also added both request issue and decision issue counts (based on the report that was submitted)

The report added a separate tab for issues descriptions, I couldn't find the script for it though. You couldn't do that in a CSV, but we could add a ticket to add a second report. The field on it included:

  • Issue type (request issue or decision issue)
  • Decision review ID
  • Decision review type
  • Description

The actual report has PII in it, but here's a Slack thread with a script:

loan = BusinessLine.find_by(url: "loan-guaranty")
	rows = loan.tasks.all.includes(:appeal).order(id: :asc).map do
	  |t| [
	    t.appeal.intake&.user&.css_id, 
	    t.id, 
	    "https://appeals.cf.ds.va.gov/decision_reviews/loan-guaranty/tasks/#{t.id}", 
	    t.appeal_id, 
	    t.appeal_type, 
	    t.appeal.veteran_file_number, 
	    t.created_at,
	    t.appeal.claimant.name,
	    t.appeal.request_issues.count,
            t.appeal.decision_issues.count
	  ]
	end
	rows.each { |r| puts r.join(",") }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Low Reported issue, not a blocker. "Last in" priority for new work. Product: caseflow-intake Team: Foxtrot 🦊
Projects
None yet
Development

No branches or pull requests

4 participants