Compare commits
No commits in common. "feb52bf7a8d5b3d04bd3c5448c8e6486fa3adf25" and "83e2514bfbf1d4c2ecf3ff7d6f53a4c943732a63" have entirely different histories.
feb52bf7a8
...
83e2514bfb
|
|
@ -1,46 +1,12 @@
|
||||||
from typing import Dict, List
|
|
||||||
|
|
||||||
|
|
||||||
def validate_entities(entities):
|
def validate_entities(entities):
|
||||||
result = []
|
return entities
|
||||||
reduced_kpi: Dict[str, List[Dict[str, str | int]]] = {}
|
#todo
|
||||||
for item in entities:
|
valid = []
|
||||||
label = item["label"]
|
for entity in entities:
|
||||||
if label not in reduced_kpi:
|
if entity["type"] == "PERSON":
|
||||||
reduced_kpi[label] = []
|
if entity["name"] == "John Doe":
|
||||||
reduced_kpi[label].append(item)
|
valid.append(entity)
|
||||||
|
elif entity["type"] == "ORG":
|
||||||
for item in reduced_kpi.items():
|
if entity["name"] == "Exxeta":
|
||||||
if item[0] == "FONDSNAME":
|
valid.append(entity)
|
||||||
result.extend(item[1])
|
return valid
|
||||||
continue
|
|
||||||
elif item[0] == "DATUM":
|
|
||||||
result.extend(item[1])
|
|
||||||
continue
|
|
||||||
elif item[0] == "FONDSMANAGER":
|
|
||||||
result.extend(item[1])
|
|
||||||
continue
|
|
||||||
|
|
||||||
validated = False
|
|
||||||
for entity in item[1]:
|
|
||||||
if entity["status"] == "validated":
|
|
||||||
validated = True
|
|
||||||
|
|
||||||
if validated:
|
|
||||||
item_list = [x for x in item[1] if x["status"] == "validated"]
|
|
||||||
result.extend(item_list)
|
|
||||||
else:
|
|
||||||
result.extend(item[1])
|
|
||||||
|
|
||||||
return result
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
entities = [
|
|
||||||
{"label": "PERSON", "entity": "John Doe", "status": "validated"},
|
|
||||||
{"label": "PERSON", "entity": "Exxeta", "status": "invalid"},
|
|
||||||
{"label": "ORG", "entity": "Google", "status": "invalid"},
|
|
||||||
{"label": "FONDSNAME", "entity": "Microsoft", "status": "validated"},
|
|
||||||
{"label": "FONDSNAME", "entity": "Amazon", "status": "invalid"},
|
|
||||||
{"label": "FONDSNAME", "entity": "Apple", "status": "invalid"}
|
|
||||||
]
|
|
||||||
print(validate_entities(entities))
|
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,6 @@ function ExtractedResultsPage() {
|
||||||
} else {
|
} else {
|
||||||
const index = Number.parseInt(value);
|
const index = Number.parseInt(value);
|
||||||
setSelectedIndex(index);
|
setSelectedIndex(index);
|
||||||
setCurrentPage(kpiValues[index].page);
|
|
||||||
setCustomValue("");
|
setCustomValue("");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -105,7 +104,6 @@ function ExtractedResultsPage() {
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleRowClick = (index: number) => {
|
const handleRowClick = (index: number) => {
|
||||||
setCurrentPage(kpiValues[index].page);
|
|
||||||
setSelectedIndex(index);
|
setSelectedIndex(index);
|
||||||
setCustomValue("");
|
setCustomValue("");
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue