Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate mock data json - structure #20

Merged
merged 1 commit into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}}