lib/health-data-standards/import/bundle/importer.rb in health-data-standards-3.4.6 vs lib/health-data-standards/import/bundle/importer.rb in health-data-standards-3.5.0
- old
+ new
@@ -73,11 +73,11 @@
def self.save_system_js_fn(name, fn)
fn = "function () {\n #{fn} \n }"
Mongoid.default_session['system.js'].find('_id' => name).upsert(
{
"_id" => name,
- "value" => Moped::BSON::Code.new(fn)
+ "value" => BSON::Code.new(fn)
}
)
end
# A utility function for finding files in a bundle. Strip a file path of it's extension and just give the filename.
@@ -138,17 +138,15 @@
puts "\rLoading: Patients Complete "
end
def self.unpack_and_store_valuesets(zip, bundle)
entries = zip.glob(SOURCE_ROOTS[:valuesets])
- bulk = []
entries.each_with_index do |entry, index|
vs = HealthDataStandards::SVS::ValueSet.new(unpack_json(entry))
vs['bundle_id'] = bundle.id
- bulk << vs
+ HealthDataStandards::SVS::ValueSet.collection.insert(vs.as_document)
report_progress('Value Sets', (index*100/entries.length)) if index%10 == 0
end
- HealthDataStandards::SVS::ValueSet.collection.insert(bulk.map {|vs| vs.as_document})
puts "\rLoading: Value Sets Complete "
end
def self.unpack_and_store_results(zip, type, measure_ids, bundle)
zip.glob(File.join(SOURCE_ROOTS[:results],'*.json')).each do |entry|