diff --git a/scripts/FeedbackProcessor.py b/scripts/FeedbackProcessor.py new file mode 100644 index 0000000..02185b1 --- /dev/null +++ b/scripts/FeedbackProcessor.py @@ -0,0 +1,69 @@ +import argparse +import datetime +import json + +def parse_feedback(json_path): + # open the file + with open(json_path, 'r') as f: + # read the file + data = f.read() + # convert to object + obj = json.loads(data) + # return the feedback + return obj + +def main(json_path): + feedbackObj = parse_feedback(json_path) + feedback = feedbackObj['data'] + metadata = feedbackObj['meta'] + creationTime = datetime.datetime.fromtimestamp(metadata['creationTime']) + easiness_values = [] + usefulness_values = [] + intervention_counts = {'testing': 0, 'understanding': 0, 'implementing': 0, 'evaluating': 0, 'designing': 0} + use_again_count = 0 + + for userFeedback in feedback: + keys = list(userFeedback) + for key in keys: + easiness_values.append(userFeedback[key]['easiness']) + usefulness_values.append(userFeedback[key]['usefulness']) + intervention_counts[userFeedback[key]["intervention"]] += 1 + if userFeedback[key]['useAgain']: + use_again_count += 1 + + # sort the values + easiness_values.sort() + usefulness_values.sort() + + # sort the intervention counts + intervention_counts = dict(sorted(intervention_counts.items(), key=lambda item: item[1], reverse=True)) + + + + print("############ FEEDBACK ANALYSIS ", creationTime, " ############") + print("Number of datapoints: ", len(feedback), "\n") + # print average, 20%, median, 80%, min, max of easiness and usefulness + print("Easiness average: ", sum(easiness_values) / len(easiness_values)) + print("Easiness 20%: ", easiness_values[int(len(easiness_values) * 0.2)]) + print("Easiness median: ", easiness_values[int(len(easiness_values) / 2)]) + print("Easiness 80%: ", easiness_values[int(len(easiness_values) * 0.8)]) + print("Easiness min: ", min(easiness_values)) + print("Easiness max: ", max(easiness_values), "\n") + print("Usefulness average: ", sum(usefulness_values) / len(usefulness_values)) + print("Usefulness 20%: ", usefulness_values[int(len(usefulness_values) * 0.2)]) + print("Usefulness median: ", usefulness_values[int(len(usefulness_values) / 2)]) + print("Usefulness 80%: ", usefulness_values[int(len(usefulness_values) * 0.8)]) + print("Usefulness min: ", min(usefulness_values)) + print("Usefulness max: ", max(usefulness_values), "\n") + print("Favourite ntervention counts: ", intervention_counts, "\n") + print("Use again: ", use_again_count * 100 / len(feedback), "%\n") + print("############ END OF FEEDBACK ANALYSIS ############") + +if __name__ == '__main__': + # get args from command line + parser = argparse.ArgumentParser() + parser.add_argument('--json', help='Path to feedback json file', required=True) + + args = parser.parse_args() + main(args.json) + \ No newline at end of file diff --git a/scripts/Pipfile b/scripts/Pipfile index c01d53e..d5d0cc2 100644 --- a/scripts/Pipfile +++ b/scripts/Pipfile @@ -6,6 +6,7 @@ name = "pypi" [packages] google-api-python-client = "*" oauth2client = "*" +argparse = "*" [dev-packages] diff --git a/scripts/Pipfile.lock b/scripts/Pipfile.lock index 5884a39..9882c9c 100644 --- a/scripts/Pipfile.lock +++ b/scripts/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "d03864209dbd6cd151a1552352bacd4e33a00511df42501f0c97bd7d6504edd5" + "sha256": "11aadb367afeeec07b962c67d1c8d2a0e42fe99de77ccbb602565627302e6c48" }, "pipfile-spec": 6, "requires": { @@ -16,6 +16,14 @@ ] }, "default": { + "argparse": { + "hashes": [ + "sha256:62b089a55be1d8949cd2bc7e0df0bddb9e028faefc8c32038cc84862aefdd6e4", + "sha256:c31647edb69fd3d465a847ea3157d37bed1f95f19760b11a47aa91c04b666314" + ], + "index": "pypi", + "version": "==1.4.0" + }, "cachetools": { "hashes": [ "sha256:6a94c6402995a99c3970cc7e4884bb60b4a8639938157eeed436098bf9831757", @@ -26,43 +34,43 @@ }, "certifi": { "hashes": [ - "sha256:84c85a9078b11105f04f3036a9482ae10e4621616db313fe045dd24743a0820d", - "sha256:fe86415d55e84719d75f8b69414f6438ac3547d2078ab91b67e779ef69378412" + "sha256:36973885b9542e6bd01dea287b2b4b3b21236307c56324fcc3f1160f2d655ed5", + "sha256:e232343de1ab72c2aa521b625c80f699e356830fd0e2c620b465b304b17b0516" ], - "markers": "python_full_version >= '3.6.0'", - "version": "==2022.6.15" + "markers": "python_version >= '3.6'", + "version": "==2022.9.14" }, "charset-normalizer": { "hashes": [ "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845", "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f" ], - "markers": "python_full_version >= '3.6.0'", + "markers": "python_version >= '3.6'", "version": "==2.1.1" }, "google-api-core": { "hashes": [ - "sha256:1d053734f14591939e7764e99c31253fed46bf2578da0dcd82821f17a6dd991c", - "sha256:325529859836a479244b0882c1a77320fd35cb108df2ec1232e3e908ea56eda4" + "sha256:92d17123cfe399b5ef7e026c63babf978d8475e1ac877919eb7933e25dea2273", + "sha256:e16c15a11789bc5a3457afb2818a3540a03f341e6e710d7f9bbf6cde2ef4a7c8" ], "markers": "python_version >= '3.7'", - "version": "==2.10.0" + "version": "==2.10.1" }, "google-api-python-client": { "hashes": [ - "sha256:3af6a181763a8cb18f2b9d973760ba32e4fe2af09e4ce06626ff6a53777c33fa", - "sha256:8f4eeed1b46f3f445307719aa3e9678e429d90c0af4f22ada707a72ba10fe02d" + "sha256:7b3295ee5f165726da1dbce9ed139fcf605efce634c94e586606e7b66b54a852", + "sha256:8307b85f0b8f84252747326de50eda279220cc1a3966d6b82e94486618275637" ], "index": "pypi", - "version": "==2.58.0" + "version": "==2.62.0" }, "google-auth": { "hashes": [ - "sha256:be62acaae38d0049c21ca90f27a23847245c9f161ff54ede13af2cb6afecbac9", - "sha256:ed65ecf9f681832298e29328e1ef0a3676e3732b2e56f41532d45f70a22de0fb" + "sha256:516e6623038b81430dd062a1a25ecd24f173d7c15cdf4e48a9e78bc87e97aeec", + "sha256:53bdc0c2b4e25895575779caef4cfb3a6bdff1b7b32dc38a654d71aba35bb5f8" ], "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4, 3.5'", - "version": "==2.11.0" + "version": "==2.11.1" }, "google-auth-httplib2": { "hashes": [ @@ -89,11 +97,11 @@ }, "idna": { "hashes": [ - "sha256:84d9dd047ffa80596e0f246e2eab0b391788b0503584e8945f2368256d2735ff", - "sha256:9d643ff0a55b762d5cdb124b8eaa99c66322e2157b69160bc32796e824360e6d" + "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4", + "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2" ], "markers": "python_version >= '3.5'", - "version": "==3.3" + "version": "==3.4" }, "oauth2client": { "hashes": [ @@ -105,23 +113,23 @@ }, "protobuf": { "hashes": [ - "sha256:011c0f267e85f5d73750b6c25f0155d5db1e9443cd3590ab669a6221dd8fcdb0", - "sha256:3ec6f5b37935406bb9df9b277e79f8ed81d697146e07ef2ba8a5a272fb24b2c9", - "sha256:5310cbe761e87f0c1decce019d23f2101521d4dfff46034f8a12a53546036ec7", - "sha256:5e0b272217aad8971763960238c1a1e6a65d50ef7824e23300da97569a251c55", - "sha256:5e0ce02418ef03d7657a420ae8fd6fec4995ac713a3cb09164e95f694dbcf085", - "sha256:5eb0724615e90075f1d763983e708e1cef08e66b1891d8b8b6c33bc3b2f1a02b", - "sha256:7b6f22463e2d1053d03058b7b4ceca6e4ed4c14f8c286c32824df751137bf8e7", - "sha256:a7faa62b183d6a928e3daffd06af843b4287d16ef6e40f331575ecd236a7974d", - "sha256:b04484d6f42f48c57dd2737a72692f4c6987529cdd148fb5b8e5f616862a2e37", - "sha256:b52e7a522911a40445a5f588bd5b5e584291bfc5545e09b7060685e4b2ff814f", - "sha256:bf711b451212dc5b0fa45ae7dada07d8e71a4b0ff0bc8e4783ee145f47ac4f82", - "sha256:e5c5a2886ae48d22a9d32fbb9b6636a089af3cd26b706750258ce1ca96cc0116", - "sha256:eb1106e87e095628e96884a877a51cdb90087106ee693925ec0a300468a9be3a", - "sha256:ee04f5823ed98bb9a8c3b1dc503c49515e0172650875c3f76e225b223793a1f2" + "sha256:07a0bb9cc6114f16a39c866dc28b6e3d96fa4ffb9cc1033057412547e6e75cb9", + "sha256:308173d3e5a3528787bb8c93abea81d5a950bdce62840d9760effc84127fb39c", + "sha256:4143513c766db85b9d7c18dbf8339673c8a290131b2a0fe73855ab20770f72b0", + "sha256:49f88d56a9180dbb7f6199c920f5bb5c1dd0172f672983bb281298d57c2ac8eb", + "sha256:6b1040a5661cd5f6e610cbca9cfaa2a17d60e2bb545309bc1b278bb05be44bdd", + "sha256:77b355c8604fe285536155286b28b0c4cbc57cf81b08d8357bf34829ea982860", + "sha256:7a6cc8842257265bdfd6b74d088b829e44bcac3cca234c5fdd6052730017b9ea", + "sha256:80e6540381080715fddac12690ee42d087d0d17395f8d0078dfd6f1181e7be4c", + "sha256:8f9e60f7d44592c66e7b332b6a7b4b6e8d8b889393c79dbc3a91f815118f8eac", + "sha256:9666da97129138585b26afcb63ad4887f602e169cafe754a8258541c553b8b5d", + "sha256:aa29113ec901281f29d9d27b01193407a98aa9658b8a777b0325e6d97149f5ce", + "sha256:b6cea204865595a92a7b240e4b65bcaaca3ad5d2ce25d9db3756eba06041138e", + "sha256:ba596b9ffb85c909fcfe1b1a23136224ed678af3faf9912d3fa483d5f9813c4e", + "sha256:c7c864148a237f058c739ae7a05a2b403c0dfa4ce7d1f3e5213f352ad52d57c6" ], "markers": "python_version >= '3.7'", - "version": "==4.21.5" + "version": "==4.21.6" }, "pyasn1": { "hashes": [ @@ -180,7 +188,7 @@ "sha256:90260d9058e514786967344d0ef75fa8727eed8a7d2e43ce9f4bcf1b536174f7", "sha256:e38464a49c6c85d7f1351b0126661487a7e0a14a50f1675ec50eb34d4f20ef21" ], - "markers": "python_version < '4' and python_full_version >= '3.6.0'", + "markers": "python_version >= '3.6' and python_version < '4'", "version": "==4.9" }, "six": { @@ -196,7 +204,7 @@ "sha256:4346edfc5c3b79f694bccd6d6099a322bbeb628dbf2cd86eea55a456ce5124f0", "sha256:830c08b8d99bdd312ea4ead05994a38e8936266f84b9a7878232db50b044e02e" ], - "markers": "python_full_version >= '3.6.0'", + "markers": "python_version >= '3.6'", "version": "==4.1.1" }, "urllib3": {