Skip to content

Commit 44a9440

Browse files
authored
Merge pull request #962 from ctti-clinicaltrials/dev
Release 6.2.5
2 parents b5029b4 + e354cbd commit 44a9440

9 files changed

+77
-164
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,16 @@ You can find information about the ClinicalTrials.gov beta API here: https://cli
3636

3737
<br>
3838

39+
## Requireqments
40+
41+
- Install zip
42+
- For mac `brew install zip`
43+
- For windows `gem install rubyzip`
44+
- For linux `sudo apt install ruby-zip`
45+
- Install [graphviz](https://graphviz.org/download/)
46+
47+
<br>
48+
3949
## Getting Started
4050

4151
1. Install PostgreSQL 13. If you have a Mac you can use brew to install PostgreSQL.

app/models/study_json_record.rb

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,10 @@ def eligibility_data
541541
gender_based: get_boolean(eligibility['GenderBased']),
542542
gender_description: eligibility['GenderDescription'],
543543
healthy_volunteers: eligibility['HealthyVolunteers'],
544-
criteria: eligibility['EligibilityCriteria']
544+
criteria: eligibility['EligibilityCriteria'],
545+
adult: eligibility.dig('StdAgeList', 'StdAge')&.include?('Adult'),
546+
child: eligibility.dig('StdAgeList', 'StdAge')&.include?('Child'),
547+
older_adult: eligibility.dig('StdAgeList', 'StdAge')&.include?('Older Adult')
545548
}
546549
end
547550

@@ -820,14 +823,30 @@ def id_information_data
820823
secondary_info = identification_module.dig('SecondaryIdInfoList', 'SecondaryIdInfo') || []
821824
org_study_info = identification_module['OrgStudyIdInfo']
822825
collection = []
823-
collection << { nct_id: nct_id, id_type: 'org_study_id', id_value: org_study_info['OrgStudyId'] } if org_study_info
826+
collection << {
827+
nct_id: nct_id,
828+
id_source: 'org_study_id',
829+
id_type: identification_module.dig('OrgStudyIdInfo', "OrgStudyIdType"),
830+
id_type_description = identification_module.dig('OrgStudyIdInfo', "OrgStudyIdDomain"),
831+
id_link = identification_module.dig('OrgStudyIdInfo', "OrgStudyIdLink"),
832+
id_value: org_study_info['OrgStudyId']
833+
} if org_study_info
824834

835+
.Study.ProtocolSection.id.OrgStudyIdInfo.OrgStudyIdType &&
836+
.Study.ProtocolSection.IdentificationModule.SecondaryIdInfoList.SecondaryIdInfo.SecondaryIdType
825837

826838
nct_id_alias.each do |nct_alias|
827-
collection << { nct_id: nct_id, id_type: 'nct_alias', id_value: nct_alias }
839+
collection << { nct_id: nct_id, id_source: 'nct_alias', id_value: nct_alias }
828840
end
829841
secondary_info.each do |info|
830-
collection << { nct_id: nct_id, id_type: 'secondary_id', id_value: info['SecondaryId'] }
842+
collection << {
843+
nct_id: nct_id,
844+
id_source: 'secondary_id',
845+
id_type: info['SecondaryIdType'],
846+
id_type_description: info['SecondaryIdDomain'],
847+
id_value: info['SecondaryId'],
848+
id_link: info['SecondaryIdLink']
849+
}
831850
end
832851
collection
833852
end
@@ -1292,7 +1311,8 @@ def responsible_party_data
12921311
name: responsible_party['ResponsiblePartyInvestigatorFullName'],
12931312
title: responsible_party['ResponsiblePartyInvestigatorTitle'],
12941313
organization: responsible_party['ResponsiblePartyOldOrganization'],
1295-
affiliation: responsible_party['ResponsiblePartyInvestigatorAffiliation']
1314+
affiliation: responsible_party['ResponsiblePartyInvestigatorAffiliation'],
1315+
old_name_title: responsible_party['ResponsiblePartyOldNameTitle']
12961316
}
12971317
end
12981318

app/models/util/db_manager.rb

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def dump_database
4141
run_command_line(cmd)
4242

4343
filename = File.basename(dump_file_location)
44-
record = FileRecord.create(file_type: "snapshot", filename: filename )
44+
record = FileRecord.create(file_type: "snapshot", filename: filename )
4545
record.file.attach(io: File.open(dump_file_location), filename: filename)
4646
record.update(url: record.file.service_url(filename: filename))
4747

@@ -109,7 +109,7 @@ def refresh_public_db(schema='ctgov')
109109
restore_database(schema, public_connection, fm.pg_dump_file)
110110
end
111111

112-
112+
113113
def clear_out_data_for(nct_ids)
114114
ids=nct_ids.map { |i| "'" + i.to_s + "'" }.join(",")
115115
Util::DbManager.loadable_tables.each { |table|
@@ -427,7 +427,7 @@ def schema_image
427427
}
428428
429429
END
430-
430+
431431
File.write("./public/static/documentation/schema.dot", graph)
432432
`dot -Tpng ./public/static/documentation/schema.dot -o ./public/static/documentation/aact_schema.png`
433433
end
@@ -528,11 +528,6 @@ def super_username
528528
AACT::Application::AACT_DB_SUPER_USERNAME
529529
end
530530

531-
def static_file_dir
532-
AACT::Application::AACT_STATIC_FILE_DIR
533-
end
534-
535-
536531
def public_connection
537532
db = @config[:public]
538533
return unless db
@@ -556,12 +551,12 @@ def restore_from_file(path_to_file: "#{Rails.root}/tmp/postgres_data.dmp", datab
556551
restore_database('normal', ActiveRecord::Base.connection, path_to_file)
557552
puts 'done'
558553
end
559-
554+
560555
def restore_from_url(params={})
561556
url = params[:url]
562557
database_name = params[:database_name] || 'aact'
563558
return unless url
564-
559+
565560
tries ||= 5
566561
file_path = "#{Rails.root}/tmp/snapshots"
567562
FileUtils.rm_rf(file_path)
@@ -593,7 +588,7 @@ def restore_from_url(params={})
593588
puts 'done'
594589

595590
restore_from_file({path_to_file: "#{file_path}/postgres_data.dmp", database: database_name})
596-
591+
597592
print 'removing temp folder...'
598593
FileUtils.rm_rf(file_path)
599594
puts 'done'

config/application.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ class Application < Rails::Application
3131
AACT_DB_SUPER_USERNAME = ENV['AACT_DB_SUPER_USERNAME'] || 'aact' # Name of postgres superuser that has permission to create a database.
3232
AACT_OWNER_EMAIL = ENV['AACT_OWNER_EMAIL'] # Don't define this if your email service is not setup
3333
AACT_ADMIN_EMAILS = ENV['AACT_ADMIN_EMAILS'] || "aact@your-org.org,admin@your-org.org" # Identifes who will receive load notifications
34-
AACT_STATIC_FILE_DIR = ENV['AACT_STATIC_FILE_DIR'] || '~/aact-files' # directory containing AACT static files such as the downloadable db snapshots
35-
RACK_TIMEOUT = ENV['RACK_TIMEOUT'] || 10
3634

37-
APPLICATION_HOST = 'localhost'
3835
AACT_HOST = ENV['AACT_HOST'] || 'localhost'
3936
if Rails.env != 'test'
4037
AACT_PUBLIC_HOSTNAME = ENV['AACT_PUBLIC_HOSTNAME'] || 'localhost'#Server on which the publicly accessible database resides

config/deploy.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
set :default_env, {
5252
'PATH' => ENV['AACT_PATH'] || "<server-path>/shared/bundle/ruby/2.4.5/bin:/opt/rh/rh-ruby24/root/usr/lib64",
5353
'LD_LIBRARY_PATH' => ENV['LD_LIBRARY_PATH'] || "/opt/rh/rh-ruby24/root/usr/lib64",
54-
'APPLICATION_HOST' => ENV['APPLICATION_HOST'] || 'localhost',
5554
'AACT_STATIC_FILE_DIR' => ENV['AACT_STATIC_FILE_DIR'] || '~/aact-files',
5655
'RUBY_VERSION' => ENV['RUBY_VERSION'] || 'ruby 2.4.5',
5756
'GEM_HOME' => ENV['GEM_HOME'] || '~/.gem/ruby',
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class FixIdInformationTable < ActiveRecord::Migration[6.0]
2+
def change
3+
rename_column :id_information, :id_type, :id_source
4+
add_column :id_information, :id_type, :string
5+
add_column :id_information, :id_type_description, :string
6+
add_column :id_information, :id_link, :string
7+
end
8+
end
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class AddOldNameTitleToResponsibleParties < ActiveRecord::Migration[6.0]
2+
def change
3+
add_column :responsible_parties, :old_name_title, :string
4+
end
5+
end
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
class AddAdultChildOlderAdultToEligibilities < ActiveRecord::Migration[6.0]
2+
def change
3+
add_column :eligibilities, :adult, :boolean
4+
add_column :eligibilities, :child, :boolean
5+
add_column :eligibilities, :older_adult, :boolean
6+
end
7+
end

db/structure.sql

Lines changed: 16 additions & 144 deletions
Original file line numberDiff line numberDiff line change
@@ -540,8 +540,11 @@ CREATE VIEW ctgov.all_group_types AS
540540
CREATE TABLE ctgov.id_information (
541541
id integer NOT NULL,
542542
nct_id character varying,
543+
id_source character varying,
544+
id_value character varying,
543545
id_type character varying,
544-
id_value character varying
546+
id_type_description character varying,
547+
id_link character varying
545548
);
546549

547550

@@ -1085,7 +1088,10 @@ CREATE TABLE ctgov.eligibilities (
10851088
population text,
10861089
criteria text,
10871090
gender_description text,
1088-
gender_based boolean
1091+
gender_based boolean,
1092+
adult boolean,
1093+
child boolean,
1094+
older_adult boolean
10891095
);
10901096

10911097

@@ -2236,7 +2242,8 @@ CREATE TABLE ctgov.responsible_parties (
22362242
name character varying,
22372243
title character varying,
22382244
organization character varying,
2239-
affiliation text
2245+
affiliation text,
2246+
old_name_title character varying
22402247
);
22412248

22422249

@@ -3815,10 +3822,10 @@ CREATE INDEX index_facility_contacts_on_contact_type ON ctgov.facility_contacts
38153822

38163823

38173824
--
3818-
-- Name: index_id_information_on_id_type; Type: INDEX; Schema: ctgov; Owner: -
3825+
-- Name: index_id_information_on_id_source; Type: INDEX; Schema: ctgov; Owner: -
38193826
--
38203827

3821-
CREATE INDEX index_id_information_on_id_type ON ctgov.id_information USING btree (id_type);
3828+
CREATE INDEX index_id_information_on_id_source ON ctgov.id_information USING btree (id_source);
38223829

38233830

38243831
--
@@ -4220,62 +4227,6 @@ CREATE INDEX "index_support.study_xml_records_on_nct_id" ON support.study_xml_re
42204227
CREATE TRIGGER category_insert_trigger INSTEAD OF INSERT ON ctgov.categories FOR EACH ROW EXECUTE FUNCTION ctgov.category_insert_function();
42214228

42224229

4223-
--
4224-
-- Name: baseline_counts baseline_counts_result_group_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4225-
--
4226-
4227-
ALTER TABLE ONLY ctgov.baseline_counts
4228-
ADD CONSTRAINT baseline_counts_result_group_id_fkey FOREIGN KEY (result_group_id) REFERENCES ctgov.result_groups(id);
4229-
4230-
4231-
--
4232-
-- Name: baseline_measurements baseline_measurements_result_group_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4233-
--
4234-
4235-
ALTER TABLE ONLY ctgov.baseline_measurements
4236-
ADD CONSTRAINT baseline_measurements_result_group_id_fkey FOREIGN KEY (result_group_id) REFERENCES ctgov.result_groups(id);
4237-
4238-
4239-
--
4240-
-- Name: design_group_interventions design_group_interventions_design_group_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4241-
--
4242-
4243-
ALTER TABLE ONLY ctgov.design_group_interventions
4244-
ADD CONSTRAINT design_group_interventions_design_group_id_fkey FOREIGN KEY (design_group_id) REFERENCES ctgov.design_groups(id);
4245-
4246-
4247-
--
4248-
-- Name: design_group_interventions design_group_interventions_intervention_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4249-
--
4250-
4251-
ALTER TABLE ONLY ctgov.design_group_interventions
4252-
ADD CONSTRAINT design_group_interventions_intervention_id_fkey FOREIGN KEY (intervention_id) REFERENCES ctgov.interventions(id);
4253-
4254-
4255-
--
4256-
-- Name: drop_withdrawals drop_withdrawals_result_group_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4257-
--
4258-
4259-
ALTER TABLE ONLY ctgov.drop_withdrawals
4260-
ADD CONSTRAINT drop_withdrawals_result_group_id_fkey FOREIGN KEY (result_group_id) REFERENCES ctgov.result_groups(id);
4261-
4262-
4263-
--
4264-
-- Name: facility_contacts facility_contacts_facility_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4265-
--
4266-
4267-
ALTER TABLE ONLY ctgov.facility_contacts
4268-
ADD CONSTRAINT facility_contacts_facility_id_fkey FOREIGN KEY (facility_id) REFERENCES ctgov.facilities(id);
4269-
4270-
4271-
--
4272-
-- Name: facility_investigators facility_investigators_facility_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4273-
--
4274-
4275-
ALTER TABLE ONLY ctgov.facility_investigators
4276-
ADD CONSTRAINT facility_investigators_facility_id_fkey FOREIGN KEY (facility_id) REFERENCES ctgov.facilities(id);
4277-
4278-
42794230
--
42804231
-- Name: active_storage_attachments fk_rails_c3b3935057; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
42814232
--
@@ -4284,86 +4235,6 @@ ALTER TABLE ONLY ctgov.active_storage_attachments
42844235
ADD CONSTRAINT fk_rails_c3b3935057 FOREIGN KEY (blob_id) REFERENCES ctgov.active_storage_blobs(id);
42854236

42864237

4287-
--
4288-
-- Name: intervention_other_names intervention_other_names_intervention_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4289-
--
4290-
4291-
ALTER TABLE ONLY ctgov.intervention_other_names
4292-
ADD CONSTRAINT intervention_other_names_intervention_id_fkey FOREIGN KEY (intervention_id) REFERENCES ctgov.interventions(id);
4293-
4294-
4295-
--
4296-
-- Name: milestones milestones_result_group_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4297-
--
4298-
4299-
ALTER TABLE ONLY ctgov.milestones
4300-
ADD CONSTRAINT milestones_result_group_id_fkey FOREIGN KEY (result_group_id) REFERENCES ctgov.result_groups(id);
4301-
4302-
4303-
--
4304-
-- Name: outcome_analyses outcome_analyses_outcome_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4305-
--
4306-
4307-
ALTER TABLE ONLY ctgov.outcome_analyses
4308-
ADD CONSTRAINT outcome_analyses_outcome_id_fkey FOREIGN KEY (outcome_id) REFERENCES ctgov.outcomes(id);
4309-
4310-
4311-
--
4312-
-- Name: outcome_analysis_groups outcome_analysis_groups_outcome_analysis_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4313-
--
4314-
4315-
ALTER TABLE ONLY ctgov.outcome_analysis_groups
4316-
ADD CONSTRAINT outcome_analysis_groups_outcome_analysis_id_fkey FOREIGN KEY (outcome_analysis_id) REFERENCES ctgov.outcome_analyses(id);
4317-
4318-
4319-
--
4320-
-- Name: outcome_analysis_groups outcome_analysis_groups_result_group_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4321-
--
4322-
4323-
ALTER TABLE ONLY ctgov.outcome_analysis_groups
4324-
ADD CONSTRAINT outcome_analysis_groups_result_group_id_fkey FOREIGN KEY (result_group_id) REFERENCES ctgov.result_groups(id);
4325-
4326-
4327-
--
4328-
-- Name: outcome_counts outcome_counts_outcome_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4329-
--
4330-
4331-
ALTER TABLE ONLY ctgov.outcome_counts
4332-
ADD CONSTRAINT outcome_counts_outcome_id_fkey FOREIGN KEY (outcome_id) REFERENCES ctgov.outcomes(id);
4333-
4334-
4335-
--
4336-
-- Name: outcome_counts outcome_counts_result_group_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4337-
--
4338-
4339-
ALTER TABLE ONLY ctgov.outcome_counts
4340-
ADD CONSTRAINT outcome_counts_result_group_id_fkey FOREIGN KEY (result_group_id) REFERENCES ctgov.result_groups(id);
4341-
4342-
4343-
--
4344-
-- Name: outcome_measurements outcome_measurements_outcome_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4345-
--
4346-
4347-
ALTER TABLE ONLY ctgov.outcome_measurements
4348-
ADD CONSTRAINT outcome_measurements_outcome_id_fkey FOREIGN KEY (outcome_id) REFERENCES ctgov.outcomes(id);
4349-
4350-
4351-
--
4352-
-- Name: outcome_measurements outcome_measurements_result_group_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4353-
--
4354-
4355-
ALTER TABLE ONLY ctgov.outcome_measurements
4356-
ADD CONSTRAINT outcome_measurements_result_group_id_fkey FOREIGN KEY (result_group_id) REFERENCES ctgov.result_groups(id);
4357-
4358-
4359-
--
4360-
-- Name: reported_events reported_events_result_group_id_fkey; Type: FK CONSTRAINT; Schema: ctgov; Owner: -
4361-
--
4362-
4363-
ALTER TABLE ONLY ctgov.reported_events
4364-
ADD CONSTRAINT reported_events_result_group_id_fkey FOREIGN KEY (result_group_id) REFERENCES ctgov.result_groups(id);
4365-
4366-
43674238
--
43684239
-- Name: sanity_checks fk_rails_9d86ec7e91; Type: FK CONSTRAINT; Schema: support; Owner: -
43694240
--
@@ -4414,6 +4285,7 @@ INSERT INTO "schema_migrations" (version) VALUES
44144285
('20220429175157'),
44154286
('20220512025646'),
44164287
('20220512030503'),
4417-
('20220512030831');
4418-
4419-
4288+
('20220512030831'),
4289+
('20220520124716'),
4290+
('20220520133313'),
4291+
('20220523123928');

0 commit comments

Comments
 (0)