Skip to content

Commit

Permalink
Merge pull request #20 from pavel-ilin/pavel-ilin
Browse files Browse the repository at this point in the history
Generate mock data json - structure
  • Loading branch information
ngiangre authored May 12, 2020
2 parents 234c07b + bdb2e18 commit 8ce92c3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mock-data-rails/db/seeds.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions mock-data/gen.rb
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions mock-data/mockData.json
Original file line number Diff line number Diff line change
@@ -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}}

0 comments on commit 8ce92c3

Please sign in to comment.