From fe3356c56f0e23bd589cf9d0d28d617b1012c86b Mon Sep 17 00:00:00 2001 From: Gregg P <117232882+GcioGregg@users.noreply.github.com> Date: Mon, 6 May 2024 11:03:33 -0700 Subject: [PATCH] Vfep 1364 - add API's for IpedsIcAy, IpedsIcPy & IpedsIc (#1114) * add api for ipedsicay * apis for ipedsid, ipedsicay, and ipedsicpy --- app/controllers/dashboards_controller.rb | 16 ++++++++++++++++ config/csv_file_defaults.yml | 9 +++++++++ config/initializers/csv_types.rb | 6 +++--- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index 7281621ea..2dd747ecc 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -171,6 +171,9 @@ def upload_file(class_nm, csv) file = "tmp/#{params[:csv_type]}s.csv" file = 'tmp/InstitutionCampus.csv' if class_nm.eql?('AccreditationInstituteCampus') file = 'tmp/hd2022.csv' if class_nm.eql?('IpedsHd') + file = 'tmp/ic2022_ay.csv' if class_nm.eql?('IpedsIcAy') + file = 'tmp/ic2022_py.csv' if class_nm.eql?('IpedsIcPy') + file = 'tmp/ic2022.csv' if class_nm.eql?('IpedsIc') upload.csv = file file_options = { @@ -206,6 +209,19 @@ def download_csv(klass) _stdout, _stderr, status = Open3.capture3("curl -X GET \ https://nces.ed.gov/ipeds/datacenter/data/HD2022.zip \ -H 'Content-Type: application/json' -o tmp/download.zip") + when klass.name.eql?('IpedsIcAy') + _stdout, _stderr, status = Open3.capture3("curl -X GET \ + https://nces.ed.gov/ipeds/datacenter/data/IC2022_AY.zip \ + -H 'Content-Type: application/json' -o tmp/download.zip") + when klass.name.eql?('IpedsIcPy') + _stdout, _stderr, status = Open3.capture3("curl -X GET \ + https://nces.ed.gov/ipeds/datacenter/data/IC2022_PY.zip \ + -H 'Content-Type: application/json' -o tmp/download.zip") + when klass.name.eql?('IpedsIc') + _stdout, _stderr, status = Open3.capture3("curl -X GET \ + https://nces.ed.gov/ipeds/datacenter/data/IC2022.zip \ + -H 'Content-Type: application/json' -o tmp/download.zip") + end # rubocop:enable Style/EmptyCaseCondition status.success? diff --git a/config/csv_file_defaults.yml b/config/csv_file_defaults.yml index dc0badb38..5cca48ee2 100644 --- a/config/csv_file_defaults.yml +++ b/config/csv_file_defaults.yml @@ -20,6 +20,15 @@ Hcm: IpedsHd: liberal_parsing: true +IpedsIcAy: + liberal_parsing: true + +IpedsIcPy: + liberal_parsing: true + +IpedsIc: + liberal_parsing: true + Complaint: skip_lines: 7 diff --git a/config/initializers/csv_types.rb b/config/initializers/csv_types.rb index 67188fb5c..b278264df 100644 --- a/config/initializers/csv_types.rb +++ b/config/initializers/csv_types.rb @@ -10,9 +10,9 @@ { klass: EightKey, required?: true }, { klass: Hcm, required?: true }, { klass: IpedsHd, required?: true, has_api?: true, no_api_key?: true }, - { klass: IpedsIcAy, required?: true }, - { klass: IpedsIcPy, required?: true }, - { klass: IpedsIc, required?: true }, + { klass: IpedsIcAy, required?: true, has_api?: true, no_api_key?: true }, + { klass: IpedsIcPy, required?: true, has_api?: true, no_api_key?: true }, + { klass: IpedsIc, required?: true, has_api?: true, no_api_key?: true }, { klass: Mou, required?: true }, { klass: Outcome, required?: true }, { klass: Scorecard, required?: true, has_api?: true },