handle items with poorly formatted b params, and mmoved to single objective function

This commit is contained in:
Josh Burman
2021-12-18 07:20:39 +00:00
parent da5e06cb59
commit 45380e9f00
3 changed files with 18 additions and 22 deletions

View File

@ -13,20 +13,22 @@ def items_csv_to_dict(items_csv_reader, irt_model):
else:
item = { 'attributes': [] }
for key, col in enumerate(headers):
if key == 0:
item[col] = row[key]
# b param - tmep fix! use irt model b param for proper reference
elif key == (1 - len(headers)):
item['b_param'] = row[key]
elif key > 1:
item['attributes'].append({
'id': col,
'value': row[key],
'type': 'metadata'
})
# ensure that the b param is formatted correctly
if len(re.findall(".", row[len(headers) - 1])) >= 3:
for key, col in enumerate(headers):
if key == 0:
item[col] = row[key]
# b param - tmep fix! use irt model b param for proper reference
elif key == len(headers) - 1:
item['b_param'] = row[key]
elif key > 1 and key < len(headers) - 1:
item['attributes'].append({
'id': col,
'value': row[key],
'type': 'metadata'
})
items.append(item)
items.append(item)
return items