File tree Expand file tree Collapse file tree
app/lib/mavis_cli/generate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,17 @@ class CohortImports < Dry::CLI::Command
1515 def call ( patients :)
1616 MavisCLI . load_rails
1717
18- ::Generate ::CohortImports . call ( patient_count : patients . to_i )
18+ patient_count = patients . to_i
19+ puts "Generating cohort import with #{ patient_count } patients..."
20+ progress_bar = MavisCLI . progress_bar ( patient_count )
21+
22+ result =
23+ ::Generate ::CohortImports . call (
24+ patient_count : patient_count ,
25+ progress_bar : progress_bar
26+ )
27+
28+ puts "\n Cohort import CSV generated: #{ result } "
1929 end
2030 end
2131 end
Original file line number Diff line number Diff line change @@ -36,14 +36,16 @@ class CohortImports
3636 :programme ,
3737 :urns ,
3838 :patient_count ,
39- :school_year_groups
39+ :school_year_groups ,
40+ :progress_bar
4041
4142 def initialize (
4243 ods_code : "A9A5A" ,
4344 programme : "hpv" ,
4445 urns : nil ,
4546 school_year_groups : nil ,
46- patient_count : 10
47+ patient_count : 10 ,
48+ progress_bar : nil
4749 )
4850 @organisation = Organisation . find_by ( ods_code :)
4951 @programme = Programme . find_by ( type : programme )
@@ -56,6 +58,7 @@ def initialize(
5658 . pluck ( :urn )
5759 @school_year_groups = school_year_groups
5860 @patient_count = patient_count
61+ @progress_bar = progress_bar
5962 @nhs_numbers = Set . new
6063 end
6164
@@ -121,6 +124,7 @@ def write_cohort_import_csv
121124 patient . parent_relationships . second &.type ,
122125 patient . school . urn
123126 ]
127+ progress_bar &.increment
124128 end
125129 end
126130 cohort_import_csv_filepath . to_s
You can’t perform that action at this time.
0 commit comments