Skip to content

Commit

Permalink
Merge pull request #1190 from ctti-clinicaltrials/fix/AACT-716-Update…
Browse files Browse the repository at this point in the history
…-Tests-for-TableExporter

AACT-716 - Update tests for table exporter
  • Loading branch information
micronix authored Jun 14, 2024
2 parents 304f26a + e29c6a0 commit 3899af1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/models/study_downloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,19 @@ def self.print_progress(current, total, message_prefix="downloading")
else
print "\r#{message_prefix} #{total} studies: #{formatted_progress}% "
end

def self.find_studies_to_remove
studies = ClinicalTrialsApiV2.all

with_search_path('ctgov_v2, support, public') do
json = StudyJsonRecord.where(version: '2').pluck(:nct_id)
removing = json - studies.map{|k| k[:nct_id]}
puts "removing #{removing.length} studies from study_json_records".red

imported = Study.pluck(:nct_id)
removing = imported - studies.map{|k| k[:nct_id]}
puts "removing #{removing.length} studies from imported".red
end
end
end
end
3 changes: 3 additions & 0 deletions app/models/study_json_record/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ def flatten(path, data, parent=nil)
nil
else
res = flatten(path[1..-1], children, item)
# if res.first.nil?
# byebug
# end
append_parent(res.first, parent) if parent
res
end
Expand Down

0 comments on commit 3899af1

Please sign in to comment.