Skip to content

Commit db5649d

Browse files
committed
Fixed typo in README
1 parent 46077af commit db5649d

24 files changed

+1213
-2
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import re
2+
import os
3+
import argparse
4+
import numpy as np
5+
import pandas as pd
6+
7+
categories = ['lab test', 'physical', 'date', 'dosage', 'risk', 'severity', 'diagnosis']
8+
9+
def check_correctness(answer: str, ground_truth, calid, upper_limit, lower_limit):
10+
11+
calid = int(calid)
12+
13+
if calid in [13, 68]:
14+
# Output Type: date
15+
if answer == ground_truth:
16+
correctness = 1
17+
else:
18+
correctness = 0
19+
elif calid in [69]:
20+
# Output Type: integer (A, B)
21+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", ground_truth)
22+
ground_truth = f"({match.group(1)}, {match.group(3)})"
23+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", answer)
24+
if match:
25+
weeks = match.group(1)
26+
days = match.group(3)
27+
answer = f"({weeks}, {days})"
28+
if eval(answer) == eval(ground_truth):
29+
correctness = 1
30+
else:
31+
correctness = 0
32+
else:
33+
correctness = 0
34+
elif calid in [4, 15, 16, 17, 18, 20, 21, 25, 27, 28, 29, 32, 33, 36, 43, 45, 48, 51, 69]:
35+
# Output Type: integer A
36+
answer = round(eval(answer))
37+
if answer == eval(ground_truth):
38+
correctness = 1
39+
else:
40+
correctness = 0
41+
elif calid in [2, 3, 5, 6, 7, 8, 9, 10, 11, 19, 22, 23, 24, 26, 30, 31, 38, 39, 40, 44, 46, 49, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67]:
42+
# Output Type: decimal
43+
answer = eval(answer)
44+
if answer >= eval(lower_limit) and answer <= eval(upper_limit):
45+
correctness = 1
46+
else:
47+
correctness = 0
48+
else:
49+
raise ValueError(f"Unknown calculator ID: {calid}")
50+
return correctness
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import re
2+
import os
3+
import argparse
4+
import numpy as np
5+
import pandas as pd
6+
7+
categories = ['lab test', 'physical', 'date', 'dosage', 'risk', 'severity', 'diagnosis']
8+
9+
def check_correctness(answer: str, ground_truth, calid, upper_limit, lower_limit):
10+
11+
calid = int(calid)
12+
13+
if calid in [13, 68]:
14+
# Output Type: date
15+
16+
17+
if answer == ground_truth:
18+
correctness = 1
19+
else:
20+
correctness = 0
21+
elif calid in [69]:
22+
# Output Type: integer (A, B)
23+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", ground_truth)
24+
ground_truth = f"({match.group(1)}, {match.group(3)})"
25+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", answer)
26+
if match:
27+
weeks = match.group(1)
28+
days = match.group(3)
29+
answer = f"({weeks}, {days})"
30+
if eval(answer) == eval(ground_truth):
31+
correctness = 1
32+
else:
33+
correctness = 0
34+
else:
35+
correctness = 0
36+
elif calid in [4, 15, 16, 17, 18, 20, 21, 25, 27, 28, 29, 32, 33, 36, 43, 45, 48, 51, 69]:
37+
# Output Type: integer A
38+
answer = round(eval(answer))
39+
if answer == eval(ground_truth):
40+
correctness = 1
41+
else:
42+
correctness = 0
43+
elif calid in [2, 3, 5, 6, 7, 8, 9, 10, 11, 19, 22, 23, 24, 26, 30, 31, 38, 39, 40, 44, 46, 49, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67]:
44+
# Output Type: decimal
45+
answer = eval(answer)
46+
if answer >= eval(lower_limit) and answer <= eval(upper_limit):
47+
correctness = 1
48+
else:
49+
correctness = 0
50+
else:
51+
raise ValueError(f"Unknown calculator ID: {calid}")
52+
return correctness
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import re
2+
import os
3+
import argparse
4+
import numpy as np
5+
import pandas as pd
6+
7+
categories = ['lab test', 'physical', 'date', 'dosage', 'risk', 'severity', 'diagnosis']
8+
9+
def check_correctness(answer: str, ground_truth, calid, upper_limit, lower_limit):
10+
11+
calid = int(calid)
12+
13+
if calid in [13, 68]:
14+
# Output Type: date
15+
16+
17+
if answer == ground_truth:
18+
correctness = 1
19+
else:
20+
correctness = 0
21+
elif calid in [69]:
22+
# Output Type: integer (A, B)
23+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", ground_truth)
24+
ground_truth = f"({match.group(1)}, {match.group(3)})"
25+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", answer)
26+
if match:
27+
weeks = match.group(1)
28+
days = match.group(3)
29+
answer = f"({weeks}, {days})"
30+
if eval(answer) == eval(ground_truth):
31+
correctness = 1
32+
else:
33+
correctness = 0
34+
else:
35+
correctness = 0
36+
elif calid in [4, 15, 16, 17, 18, 20, 21, 25, 27, 28, 29, 32, 33, 36, 43, 45, 48, 51, 69]:
37+
# Output Type: integer A
38+
answer = round(eval(answer))
39+
if answer == eval(ground_truth):
40+
correctness = 1
41+
else:
42+
correctness = 0
43+
elif calid in [2, 3, 5, 6, 7, 8, 9, 10, 11, 19, 22, 23, 24, 26, 30, 31, 38, 39, 40, 44, 46, 49, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67]:
44+
# Output Type: decimal
45+
answer = eval(answer)
46+
if answer >= eval(lower_limit) and answer <= eval(upper_limit):
47+
correctness = 1
48+
else:
49+
correctness = 0
50+
else:
51+
raise ValueError(f"Unknown calculator ID: {calid}")
52+
return correctness
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import re
2+
import os
3+
import argparse
4+
import numpy as np
5+
import pandas as pd
6+
7+
categories = ['lab test', 'physical', 'date', 'dosage', 'risk', 'severity', 'diagnosis']
8+
9+
def check_correctness(answer: str, ground_truth, calid, upper_limit, lower_limit):
10+
11+
calid = int(calid)
12+
13+
if calid in [13, 68]:
14+
# Output Type: date
15+
16+
17+
18+
if answer == ground_truth:
19+
correctness = 1
20+
else:
21+
correctness = 0
22+
elif calid in [69]:
23+
# Output Type: integer (A, B)
24+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", ground_truth)
25+
ground_truth = f"({match.group(1)}, {match.group(3)})"
26+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", answer)
27+
if match:
28+
weeks = match.group(1)
29+
days = match.group(3)
30+
answer = f"({weeks}, {days})"
31+
if eval(answer) == eval(ground_truth):
32+
correctness = 1
33+
else:
34+
correctness = 0
35+
else:
36+
correctness = 0
37+
elif calid in [4, 15, 16, 17, 18, 20, 21, 25, 27, 28, 29, 32, 33, 36, 43, 45, 48, 51, 69]:
38+
# Output Type: integer A
39+
answer = round(eval(answer))
40+
if answer == eval(ground_truth):
41+
correctness = 1
42+
else:
43+
correctness = 0
44+
elif calid in [2, 3, 5, 6, 7, 8, 9, 10, 11, 19, 22, 23, 24, 26, 30, 31, 38, 39, 40, 44, 46, 49, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67]:
45+
# Output Type: decimal
46+
answer = eval(answer)
47+
if answer >= eval(lower_limit) and answer <= eval(upper_limit):
48+
correctness = 1
49+
else:
50+
correctness = 0
51+
else:
52+
raise ValueError(f"Unknown calculator ID: {calid}")
53+
return correctness
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import re
2+
import os
3+
import argparse
4+
import numpy as np
5+
import pandas as pd
6+
7+
categories = ['lab test', 'physical', 'date', 'dosage', 'risk', 'severity', 'diagnosis']
8+
9+
def check_correctness(answer: str, ground_truth, calid, upper_limit, lower_limit):
10+
11+
calid = int(calid)
12+
13+
if calid in [13, 68]:
14+
# Output Type: date
15+
16+
17+
if answer == ground_truth:
18+
correctness = 1
19+
else:
20+
correctness = 0
21+
elif calid in [69]:
22+
# Output Type: integer (A, B)
23+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", ground_truth)
24+
ground_truth = f"({match.group(1)}, {match.group(3)})"
25+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", answer)
26+
if match:
27+
weeks = match.group(1)
28+
days = match.group(3)
29+
answer = f"({weeks}, {days})"
30+
if eval(answer) == eval(ground_truth):
31+
correctness = 1
32+
else:
33+
correctness = 0
34+
else:
35+
correctness = 0
36+
elif calid in [4, 15, 16, 17, 18, 20, 21, 25, 27, 28, 29, 32, 33, 36, 43, 45, 48, 51, 69]:
37+
# Output Type: integer A
38+
answer = round(eval(answer))
39+
if answer == eval(ground_truth):
40+
correctness = 1
41+
else:
42+
correctness = 0
43+
elif calid in [2, 3, 5, 6, 7, 8, 9, 10, 11, 19, 22, 23, 24, 26, 30, 31, 38, 39, 40, 44, 46, 49, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67]:
44+
# Output Type: decimal
45+
answer = eval(answer)
46+
if answer >= eval(lower_limit) and answer <= eval(upper_limit):
47+
correctness = 1
48+
else:
49+
correctness = 0
50+
else:
51+
raise ValueError(f"Unknown calculator ID: {calid}")
52+
return correctness
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import re
2+
import os
3+
import argparse
4+
import numpy as np
5+
import pandas as pd
6+
7+
categories = ['lab test', 'physical', 'date', 'dosage', 'risk', 'severity', 'diagnosis']
8+
9+
def check_correctness(answer: str, ground_truth, calid, upper_limit, lower_limit):
10+
11+
calid = int(calid)
12+
13+
if calid in [13, 68]:
14+
# Output Type: date
15+
16+
17+
18+
if answer == ground_truth:
19+
correctness = 1
20+
else:
21+
correctness = 0
22+
elif calid in [69]:
23+
# Output Type: integer (A, B)
24+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", ground_truth)
25+
ground_truth = f"({match.group(1)}, {match.group(3)})"
26+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", answer)
27+
if match:
28+
weeks = match.group(1)
29+
days = match.group(3)
30+
answer = f"({weeks}, {days})"
31+
if eval(answer) == eval(ground_truth):
32+
correctness = 1
33+
else:
34+
correctness = 0
35+
else:
36+
correctness = 0
37+
elif calid in [4, 15, 16, 17, 18, 20, 21, 25, 27, 28, 29, 32, 33, 36, 43, 45, 48, 51, 69]:
38+
# Output Type: integer A
39+
answer = round(eval(answer))
40+
if answer == eval(ground_truth):
41+
correctness = 1
42+
else:
43+
correctness = 0
44+
elif calid in [2, 3, 5, 6, 7, 8, 9, 10, 11, 19, 22, 23, 24, 26, 30, 31, 38, 39, 40, 44, 46, 49, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67]:
45+
# Output Type: decimal
46+
answer = eval(answer)
47+
if answer >= eval(lower_limit) and answer <= eval(upper_limit):
48+
correctness = 1
49+
else:
50+
correctness = 0
51+
else:
52+
raise ValueError(f"Unknown calculator ID: {calid}")
53+
return correctness
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import re
2+
import os
3+
import argparse
4+
import numpy as np
5+
import pandas as pd
6+
from datetime import datetime
7+
8+
9+
categories = ['lab test', 'physical', 'date', 'dosage', 'risk', 'severity', 'diagnosis']
10+
11+
def check_correctness(answer: str, ground_truth, calid, upper_limit, lower_limit):
12+
13+
calid = int(calid)
14+
15+
if calid in [13, 68]:
16+
# Output Type: date
17+
18+
19+
20+
if answer == ground_truth:
21+
correctness = 1
22+
else:
23+
correctness = 0
24+
elif calid in [69]:
25+
# Output Type: integer (A, B)
26+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", ground_truth)
27+
ground_truth = f"({match.group(1)}, {match.group(3)})"
28+
match = re.search(r"\(?[\"\']?(\d+)\s*(weeks?)?[\"\']?,?\s*[\"\']?(\d+)\s*(days?)?[\"\']?\s*\)?", answer)
29+
if match:
30+
weeks = match.group(1)
31+
days = match.group(3)
32+
answer = f"({weeks}, {days})"
33+
if eval(answer) == eval(ground_truth):
34+
correctness = 1
35+
else:
36+
correctness = 0
37+
else:
38+
correctness = 0
39+
elif calid in [4, 15, 16, 17, 18, 20, 21, 25, 27, 28, 29, 32, 33, 36, 43, 45, 48, 51, 69]:
40+
# Output Type: integer A
41+
answer = round(eval(answer))
42+
if answer == eval(ground_truth):
43+
correctness = 1
44+
else:
45+
correctness = 0
46+
elif calid in [2, 3, 5, 6, 7, 8, 9, 10, 11, 19, 22, 23, 24, 26, 30, 31, 38, 39, 40, 44, 46, 49, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67]:
47+
# Output Type: decimal
48+
answer = eval(answer)
49+
if answer >= eval(lower_limit) and answer <= eval(upper_limit):
50+
correctness = 1
51+
else:
52+
correctness = 0
53+
else:
54+
raise ValueError(f"Unknown calculator ID: {calid}")
55+
return correctness

0 commit comments

Comments
 (0)