From bdb2e188a9406fd0ab90617f0b233455fac2dbfb Mon Sep 17 00:00:00 2001 From: pavel ilin Date: Mon, 11 May 2020 20:58:12 -0400 Subject: [PATCH] generate mock data structure --- mock-data-rails/db/seeds.rb | 2 +- mock-data/gen.rb | 24 ++++++++++++++++++++++++ mock-data/mockData.json | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 mock-data/gen.rb create mode 100644 mock-data/mockData.json diff --git a/mock-data-rails/db/seeds.rb b/mock-data-rails/db/seeds.rb index b6d6ec0..1954eb0 100644 --- a/mock-data-rails/db/seeds.rb +++ b/mock-data-rails/db/seeds.rb @@ -18,10 +18,10 @@ def generate_users(users) def generate_observations(entries) results = ['Minimal', 'Moderate', 'Severe', nil] confirmed = [true, false] + User.all.each { |user| user.virus_checks.create(coronavirus: confirmed.sample) - entries.times do |i| fever = results.sample case fever diff --git a/mock-data/gen.rb b/mock-data/gen.rb new file mode 100644 index 0000000..218da7f --- /dev/null +++ b/mock-data/gen.rb @@ -0,0 +1,24 @@ +require 'json' + +symptomes_keys = ['Chills', 'Shortnessof breath', 'Fatigue', 'Drycough', 'Severe', 'Bluishlips or face', 'Gastrointestinal', 'Headache', 'Lostsense of smell', 'Diarrhea'] +symptomes_values = ["None", "Minimal", "Moderate", "Severe"] +data = {} + +def gen (symptomes_keys, symptomes_values, data) + observation = {} + observations = 10 + + observations.times do |i| + symptomes_keys.each{ |n| + observation[n] = symptomes_values[0] + } + observation['temperature'] = 0 + observation['COVID'] = 0 + data[i] = observation + end + +end + +gen(symptomes_keys, symptomes_values, data) + +File.write("mockData.json", data.to_json) \ No newline at end of file diff --git a/mock-data/mockData.json b/mock-data/mockData.json new file mode 100644 index 0000000..cd26e7b --- /dev/null +++ b/mock-data/mockData.json @@ -0,0 +1 @@ +{"0":{"Chills":"None","Shortnessof breath":"None","Fatigue":"None","Drycough":"None","Severe":"None","Bluishlips or face":"None","Gastrointestinal":"None","Headache":"None","Lostsense of smell":"None","Diarrhea":"None","temperature":0,"COVID":0},"1":{"Chills":"None","Shortnessof breath":"None","Fatigue":"None","Drycough":"None","Severe":"None","Bluishlips or face":"None","Gastrointestinal":"None","Headache":"None","Lostsense of smell":"None","Diarrhea":"None","temperature":0,"COVID":0},"2":{"Chills":"None","Shortnessof breath":"None","Fatigue":"None","Drycough":"None","Severe":"None","Bluishlips or face":"None","Gastrointestinal":"None","Headache":"None","Lostsense of smell":"None","Diarrhea":"None","temperature":0,"COVID":0},"3":{"Chills":"None","Shortnessof breath":"None","Fatigue":"None","Drycough":"None","Severe":"None","Bluishlips or face":"None","Gastrointestinal":"None","Headache":"None","Lostsense of smell":"None","Diarrhea":"None","temperature":0,"COVID":0},"4":{"Chills":"None","Shortnessof breath":"None","Fatigue":"None","Drycough":"None","Severe":"None","Bluishlips or face":"None","Gastrointestinal":"None","Headache":"None","Lostsense of smell":"None","Diarrhea":"None","temperature":0,"COVID":0},"5":{"Chills":"None","Shortnessof breath":"None","Fatigue":"None","Drycough":"None","Severe":"None","Bluishlips or face":"None","Gastrointestinal":"None","Headache":"None","Lostsense of smell":"None","Diarrhea":"None","temperature":0,"COVID":0},"6":{"Chills":"None","Shortnessof breath":"None","Fatigue":"None","Drycough":"None","Severe":"None","Bluishlips or face":"None","Gastrointestinal":"None","Headache":"None","Lostsense of smell":"None","Diarrhea":"None","temperature":0,"COVID":0},"7":{"Chills":"None","Shortnessof breath":"None","Fatigue":"None","Drycough":"None","Severe":"None","Bluishlips or face":"None","Gastrointestinal":"None","Headache":"None","Lostsense of smell":"None","Diarrhea":"None","temperature":0,"COVID":0},"8":{"Chills":"None","Shortnessof breath":"None","Fatigue":"None","Drycough":"None","Severe":"None","Bluishlips or face":"None","Gastrointestinal":"None","Headache":"None","Lostsense of smell":"None","Diarrhea":"None","temperature":0,"COVID":0},"9":{"Chills":"None","Shortnessof breath":"None","Fatigue":"None","Drycough":"None","Severe":"None","Bluishlips or face":"None","Gastrointestinal":"None","Headache":"None","Lostsense of smell":"None","Diarrhea":"None","temperature":0,"COVID":0}} \ No newline at end of file