Skip to content

Commit 5488564

Browse files
author
AnitaCao
committedOct 29, 2014
Added all the concepts from the questionnaire, which is 16 questions (5 concepts for each question)
1 parent cd17ad0 commit 5488564

File tree

2 files changed

+1466
-16
lines changed

2 files changed

+1466
-16
lines changed
 

‎concepts/concepts.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,38 @@
88
json_file = open('json_file.json')
99
concepts = json.load(json_file)
1010

11-
url = "http://localhost:8080/openmrs/ws/rest/v1/concept/"
11+
1212

1313
for key in concepts.keys():
14+
15+
url = "http://localhost:8080/openmrs/ws/rest/v1/concept/"
1416
answer_uuids = []
1517
question_uuid = ""
1618
question_answer_dict = concepts[key]
1719
for key1 in question_answer_dict.keys():
1820
if "question" in key1:
21+
1922
r = requests.post(url, data=json.dumps(question_answer_dict[key1]), headers=headers, auth=('admin', 'Admin123'))
23+
2024
for key2 in r.json().keys():
21-
if "uuid" in key2:
22-
question_uuid = r.json()[key2]
25+
if "uuid" in key2:
26+
question_uuid = r.json()[key2]
27+
2328
elif "answer" in key1 :
2429
answersList = question_answer_dict[key1]
2530
for answer in answersList:
31+
2632
r = requests.post(url, data=json.dumps(answer), headers=headers, auth=('admin', 'Admin123'))
33+
2734
for key2 in r.json().keys():
2835
if "uuid" in key2:
2936
answer_uuids.append(r.json()[key2])
3037

31-
for subKey in question_answer_dict.keys():
32-
if "question" in subKey:
38+
for key1 in question_answer_dict.keys():
39+
if "question" in key1:
3340
url = url+question_uuid
41+
3442
answerPost = {"answers": answer_uuids}
3543
r = requests.post(url, data=json.dumps(answerPost), headers=headers, auth=('admin', 'Admin123'))
44+
3645

‎concepts/json_file.json

+1,452-11
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.