From 74d828a4bfad37a9caacf42f180a0881219b8eb5 Mon Sep 17 00:00:00 2001 From: Daniel Weller Date: Fri, 30 Aug 2024 10:40:39 +0200 Subject: [PATCH 1/5] majority vote & daniel's approach --- majority-vote/.gitignore | 2 + majority-vote/README.md | 34 +++ majority-vote/daniel/__init__.py | 0 majority-vote/daniel/answer_question.py | 79 +++++++ ...b7cb83115789346e2a9efc7e2e640851653ff.json | 73 +++++++ ...6c1b29566acc1eafc704ee5737fb3ae6f3d1d.json | 37 ++++ ...5cfe0d7bbf59e186492bfbe1b5002d44af332.json | 37 ++++ ...25836a5d7cb75489f6d93a3b1cf2b8f039bf2.json | 121 +++++++++++ ...c5097dfc6e83505fd2259ad862dcec11a3f96.json | 43 ++++ ...04e0248ecf758990a0ab77bd69344be63bcf4.json | 37 ++++ ...e213e4e689294ebae809bfa6a1b5024076286.json | 55 +++++ ...4e041732c9841d5423e6ea0bbd6a0320df9ff.json | 25 +++ ...041c3e6909d92a7a88e4fb10dd8651df33228.json | 85 ++++++++ ...4bac4a4815e616d84083ad4d3844655321215.json | 139 ++++++++++++ ...bbc64a4160b9946fea7a895f80e6201f52f27.json | 61 ++++++ ...8f748262b8ffa62de6484143ff55b38af24c7.json | 61 ++++++ ...1e552b18e116105d9125d9becafa443950e97.json | 97 +++++++++ ...b7204b91cbe7709bd3218e7d2d0c2b8dbb438.json | 103 +++++++++ ...757d27fa67cd347d9f046b939a911f5c9a08d.json | 67 ++++++ ...8d7d79152d61279eda1cfb58b8236ce2f82fa.json | 43 ++++ majority-vote/majority_vote/__init__.py | 0 majority-vote/majority_vote/__main__.py | 56 +++++ majority-vote/questions.json | 202 ++++++++++++++++++ majority-vote/requirements.txt | 4 + majority-vote/results.json | 202 ++++++++++++++++++ 25 files changed, 1663 insertions(+) create mode 100644 majority-vote/.gitignore create mode 100644 majority-vote/README.md create mode 100644 majority-vote/daniel/__init__.py create mode 100644 majority-vote/daniel/answer_question.py create mode 100644 majority-vote/daniel/knowledge_base/053b7cb83115789346e2a9efc7e2e640851653ff.json create mode 100644 majority-vote/daniel/knowledge_base/3696c1b29566acc1eafc704ee5737fb3ae6f3d1d.json create mode 100644 majority-vote/daniel/knowledge_base/40b5cfe0d7bbf59e186492bfbe1b5002d44af332.json create mode 100644 majority-vote/daniel/knowledge_base/4b525836a5d7cb75489f6d93a3b1cf2b8f039bf2.json create mode 100644 majority-vote/daniel/knowledge_base/608c5097dfc6e83505fd2259ad862dcec11a3f96.json create mode 100644 majority-vote/daniel/knowledge_base/71b04e0248ecf758990a0ab77bd69344be63bcf4.json create mode 100644 majority-vote/daniel/knowledge_base/99be213e4e689294ebae809bfa6a1b5024076286.json create mode 100644 majority-vote/daniel/knowledge_base/9ff4e041732c9841d5423e6ea0bbd6a0320df9ff.json create mode 100644 majority-vote/daniel/knowledge_base/bd5041c3e6909d92a7a88e4fb10dd8651df33228.json create mode 100644 majority-vote/daniel/knowledge_base/d734bac4a4815e616d84083ad4d3844655321215.json create mode 100644 majority-vote/daniel/knowledge_base/d81bbc64a4160b9946fea7a895f80e6201f52f27.json create mode 100644 majority-vote/daniel/knowledge_base/dd78f748262b8ffa62de6484143ff55b38af24c7.json create mode 100644 majority-vote/daniel/knowledge_base/dfb1e552b18e116105d9125d9becafa443950e97.json create mode 100644 majority-vote/daniel/knowledge_base/e51b7204b91cbe7709bd3218e7d2d0c2b8dbb438.json create mode 100644 majority-vote/daniel/knowledge_base/ea0757d27fa67cd347d9f046b939a911f5c9a08d.json create mode 100644 majority-vote/daniel/knowledge_base/faf8d7d79152d61279eda1cfb58b8236ce2f82fa.json create mode 100644 majority-vote/majority_vote/__init__.py create mode 100644 majority-vote/majority_vote/__main__.py create mode 100644 majority-vote/questions.json create mode 100644 majority-vote/requirements.txt create mode 100644 majority-vote/results.json diff --git a/majority-vote/.gitignore b/majority-vote/.gitignore new file mode 100644 index 0000000..3b72af0 --- /dev/null +++ b/majority-vote/.gitignore @@ -0,0 +1,2 @@ +.env +__pycache__ diff --git a/majority-vote/README.md b/majority-vote/README.md new file mode 100644 index 0000000..6e370ca --- /dev/null +++ b/majority-vote/README.md @@ -0,0 +1,34 @@ +# Answer by Majority Vote + +The intention of this app is that for our collective answer to each question, we each run our individual answer and choose the one that has a majority. + +## Setup + +Create a `.env` file containing an OpenAI API key. Example: + +``` +OPENAI_API_KEY=sk-proj-thisisafakeapikey +``` + +Install requirements. +``` +pip install -r requirements.txt +``` + +## Adding your solution + +Make a python package like `daniel`. It should have a function +like this: + +``` +def answer_question(question, schema): + ... +``` + +Include this function in the list `answer_functions` in `__main__.py`. + +## Running it + +``` +python -m majority_vote +``` \ No newline at end of file diff --git a/majority-vote/daniel/__init__.py b/majority-vote/daniel/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/majority-vote/daniel/answer_question.py b/majority-vote/daniel/answer_question.py new file mode 100644 index 0000000..65b13d4 --- /dev/null +++ b/majority-vote/daniel/answer_question.py @@ -0,0 +1,79 @@ +import os +import json +from pydantic import BaseModel +from typing import Optional + +OPENAI_MODEL = "gpt-4o-2024-08-06" +KNOWLEDGE_BASE_PATH = 'daniel/knowledge_base' + + +# Initialize an empty list to store the dictionaries +json_list = [] + +# Iterate over each file in the directory +for filename in os.listdir(KNOWLEDGE_BASE_PATH): + if filename.endswith('.json'): # Check if the file is a JSON file + filepath = os.path.join(KNOWLEDGE_BASE_PATH, filename) + with open(filepath, 'r') as json_file: + data = json.load(json_file) # Load the JSON file into a dict + json_list.append(data) # Append the dict to the list + +# Now json_list contains all the JSON files as dicts +database = [ + { + "company_name": x["company_name"], + "data_points": x["data_points"], + "company_role_assignments": x["company_role_assignments"] if "company_role_assignments" in x else None + } + for x in json_list +] + +class NumberResponse(BaseModel): + answer: Optional[float] + + +class NameResponse(BaseModel): + person_name: Optional[str] + + +class BooleanResponse(BaseModel): + answer: Optional[bool] + + +def answer_question(question, schema): + system_prompt = ("You are an assistant with the task of answering QUESTIONS based on a KNOWLEDGE DATABASE. " + "If you cannot answer the question, indicate this with a `null` response.") + + prompt = ("QUESTION\n\n" + f"{question}\n\n" + "KNOWLEDGE DATABASE\n\n" + f"{json.dumps(database)}") + + from openai import OpenAI + client = OpenAI() + + messages = [ + {"role": "system", "content": system_prompt}, + {"role": "user", "content": prompt}, + ] + + match schema: + case "number": + response_format = NumberResponse + value_extractor = lambda x: x.answer + case "name": + response_format = NameResponse + value_extractor = lambda x: x.person_name + case "boolean": + response_format = BooleanResponse + value_extractor = lambda x: x.answer + case _: + raise f"unknown schema {schema}" + + response = client.beta.chat.completions.parse( + model=OPENAI_MODEL, + messages=messages, + response_format=response_format + ) + + return value_extractor(response.choices[0].message.parsed) diff --git a/majority-vote/daniel/knowledge_base/053b7cb83115789346e2a9efc7e2e640851653ff.json b/majority-vote/daniel/knowledge_base/053b7cb83115789346e2a9efc7e2e640851653ff.json new file mode 100644 index 0000000..d8c903c --- /dev/null +++ b/majority-vote/daniel/knowledge_base/053b7cb83115789346e2a9efc7e2e640851653ff.json @@ -0,0 +1,73 @@ +{ + "company_name": "Global Medical REIT Inc.", + "data_points": [ + { + "metric_type": "market capitalization", + "value": 693.0, + "currency": "USD", + "point_in_time": "2022-06-30" + }, + { + "metric_type": "Number of stores", + "value": 189.0, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "research and development expenses", + "value": 16.545, + "currency": "USD", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "research and development expenses", + "value": 16.453, + "currency": "USD", + "point_in_time": "2021-12-31" + }, + { + "metric_type": "Gross Profit Margin", + "value": 39.984, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "customer acquisition spending", + "value": 14.611, + "currency": "USD", + "point_in_time": "2022-03-25" + }, + { + "metric_type": "Return on Assets (ROA)", + "value": 4.2, + "currency": null, + "point_in_time": "2022-02-24" + } + ], + "role_assignments": [ + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Jeffrey Busch", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Robert Kiernan", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Operating Officer (COO)", + "person_name": "Alfonzo Leon", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Legal Officer (CLO)", + "person_name": "Jamie Barber", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/3696c1b29566acc1eafc704ee5737fb3ae6f3d1d.json b/majority-vote/daniel/knowledge_base/3696c1b29566acc1eafc704ee5737fb3ae6f3d1d.json new file mode 100644 index 0000000..ad66eeb --- /dev/null +++ b/majority-vote/daniel/knowledge_base/3696c1b29566acc1eafc704ee5737fb3ae6f3d1d.json @@ -0,0 +1,37 @@ +{ + "company_name": "Zegona Communications plc", + "data_points": [ + { + "metric_type": "sustainability initiatives spending", + "value": 4.5, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "sustainability initiatives spending", + "value": 4.5, + "currency": null, + "point_in_time": "2021-12-31" + } + ], + "role_assignments": [ + { + "role_type": "Board Chairman", + "person_name": "Eamonn O'Hare", + "role_assignment_started_as_iso_date": "2023-04-06", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Eamonn O'Hare", + "role_assignment_started_as_iso_date": "2023-04-06", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Operating Officer (COO)", + "person_name": "Robert Samuelson", + "role_assignment_started_as_iso_date": "2023-04-06", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/40b5cfe0d7bbf59e186492bfbe1b5002d44af332.json b/majority-vote/daniel/knowledge_base/40b5cfe0d7bbf59e186492bfbe1b5002d44af332.json new file mode 100644 index 0000000..0c5587c --- /dev/null +++ b/majority-vote/daniel/knowledge_base/40b5cfe0d7bbf59e186492bfbe1b5002d44af332.json @@ -0,0 +1,37 @@ +{ + "company_name": "Calyxt, Inc.", + "data_points": [ + { + "metric_type": "market capitalization", + "value": 5446012.0, + "currency": "USD", + "point_in_time": "2022-06-30" + } + ], + "role_assignments": [ + { + "role_type": "Board Chairman", + "person_name": "Yves Ribeill", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Michael A. Carr", + "role_assignment_started_as_iso_date": "2021-07-15", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "William F. Koschak", + "role_assignment_started_as_iso_date": "2018-12-21", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Legal Officer (CLO)", + "person_name": "Debra Frimerman", + "role_assignment_started_as_iso_date": "2019-01-21", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/4b525836a5d7cb75489f6d93a3b1cf2b8f039bf2.json b/majority-vote/daniel/knowledge_base/4b525836a5d7cb75489f6d93a3b1cf2b8f039bf2.json new file mode 100644 index 0000000..ddb912a --- /dev/null +++ b/majority-vote/daniel/knowledge_base/4b525836a5d7cb75489f6d93a3b1cf2b8f039bf2.json @@ -0,0 +1,121 @@ +{ + "company_name": "TD SYNNEX", + "data_points": [ + { + "metric_type": "market capitalization", + "value": 4311515318.0, + "currency": "USD", + "point_in_time": "2022-05-31" + }, + { + "metric_type": "Number of stores", + "value": 23.0, + "currency": null, + "point_in_time": "2022-11-30" + }, + { + "metric_type": "Gross Profit Margin", + "value": 6.26, + "currency": null, + "point_in_time": "2022-11-30" + }, + { + "metric_type": "Gross Profit Margin", + "value": 5.98, + "currency": null, + "point_in_time": "2021-11-30" + }, + { + "metric_type": "research and development expenses", + "value": 117000000.0, + "currency": "USD", + "point_in_time": "2022-11-30" + }, + { + "metric_type": "customer acquisition spending", + "value": 125016000.0, + "currency": "USD", + "point_in_time": "2022-11-30" + }, + { + "metric_type": "operating margin", + "value": 21.3, + "currency": null, + "point_in_time": "2022-11-30" + }, + { + "metric_type": "operating margin", + "value": 15.3, + "currency": null, + "point_in_time": "2021-11-30" + }, + { + "metric_type": "operating margin", + "value": 23.3, + "currency": null, + "point_in_time": "2020-11-30" + }, + { + "metric_type": "Return on Assets (ROA)", + "value": 159910.0, + "currency": "USD", + "point_in_time": "2020-11-30" + }, + { + "metric_type": "Return on Assets (ROA)", + "value": 220154.0, + "currency": "USD", + "point_in_time": "2021-11-30" + }, + { + "metric_type": "Return on Assets (ROA)", + "value": 492136.0, + "currency": "USD", + "point_in_time": "2022-11-30" + }, + { + "metric_type": "Return on Assets (ROE)", + "value": 276237.0, + "currency": "USD", + "point_in_time": "2020-11-30" + }, + { + "metric_type": "Return on Assets (ROE)", + "value": 246331.0, + "currency": "USD", + "point_in_time": "2021-11-30" + }, + { + "metric_type": "Return on Assets (ROE)", + "value": 334994.0, + "currency": "USD", + "point_in_time": "2022-11-30" + } + ], + "role_assignments": [ + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Rich Hume", + "role_assignment_started_as_iso_date": "2021-09-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Richard Hume", + "role_assignment_started_as_iso_date": "2021-09-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Marshall Witt", + "role_assignment_started_as_iso_date": "2013-04-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Board Chairman", + "person_name": "Dennis Polk", + "role_assignment_started_as_iso_date": "2021-09-01", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/608c5097dfc6e83505fd2259ad862dcec11a3f96.json b/majority-vote/daniel/knowledge_base/608c5097dfc6e83505fd2259ad862dcec11a3f96.json new file mode 100644 index 0000000..31831dd --- /dev/null +++ b/majority-vote/daniel/knowledge_base/608c5097dfc6e83505fd2259ad862dcec11a3f96.json @@ -0,0 +1,43 @@ +{ + "company_name": "Sandwell Aquatics Centre", + "data_points": [ + { + "metric_type": "market capitalization", + "value": 86.6, + "currency": "GBP", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "research and development expenses", + "value": 0.095, + "currency": "GBP", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "operating margin", + "value": 6.8, + "currency": null, + "point_in_time": "2022-12-31" + } + ], + "role_assignments": [ + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Mark Smith", + "role_assignment_started_as_iso_date": "2015-01-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Trevor Taylor", + "role_assignment_started_as_iso_date": "2011-10-31", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Board Chairman", + "person_name": "Ian Lawson", + "role_assignment_started_as_iso_date": "2018-10-01", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/71b04e0248ecf758990a0ab77bd69344be63bcf4.json b/majority-vote/daniel/knowledge_base/71b04e0248ecf758990a0ab77bd69344be63bcf4.json new file mode 100644 index 0000000..af1cccc --- /dev/null +++ b/majority-vote/daniel/knowledge_base/71b04e0248ecf758990a0ab77bd69344be63bcf4.json @@ -0,0 +1,37 @@ +{ + "company_name": "Motus GI Holdings, Inc.", + "data_points": [ + { + "metric_type": "market capitalization", + "value": 14600000.0, + "currency": "USD", + "point_in_time": "2022-06-30" + } + ], + "role_assignments": [ + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Timothy P. Moran", + "role_assignment_started_as_iso_date": "2018-10-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Operating Officer (COO)", + "person_name": "Mark Pomeranz", + "role_assignment_started_as_iso_date": "2018-10-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Andrew Taylor", + "role_assignment_started_as_iso_date": "2017-08-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Board Chairman", + "person_name": "David Hochman", + "role_assignment_started_as_iso_date": "2016-01-01", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/99be213e4e689294ebae809bfa6a1b5024076286.json b/majority-vote/daniel/knowledge_base/99be213e4e689294ebae809bfa6a1b5024076286.json new file mode 100644 index 0000000..d24cef3 --- /dev/null +++ b/majority-vote/daniel/knowledge_base/99be213e4e689294ebae809bfa6a1b5024076286.json @@ -0,0 +1,55 @@ +{ + "company_name": "Limbach Holdings, Inc.", + "data_points": [ + { + "metric_type": "research and development expenses", + "value": 6.5, + "currency": "USD", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Debt-To-Equity ratio", + "value": 0.33, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "sustainability initiatives spending", + "value": 2.4, + "currency": "USD", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Gross Profit Margin", + "value": 18.9, + "currency": null, + "point_in_time": "2022-12-31" + } + ], + "role_assignments": [ + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Michael M. McCann", + "role_assignment_started_as_iso_date": "2023-03-28", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Jayme L. Brooks", + "role_assignment_started_as_iso_date": "2019-10-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Operating Officer (COO)", + "person_name": "Michael M. McCann", + "role_assignment_started_as_iso_date": "2019-11-01", + "role_assignment_ended_as_iso_date": "2023-03-28" + }, + { + "role_type": "Board Chairman", + "person_name": "Gordon G. Pratt", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/9ff4e041732c9841d5423e6ea0bbd6a0320df9ff.json b/majority-vote/daniel/knowledge_base/9ff4e041732c9841d5423e6ea0bbd6a0320df9ff.json new file mode 100644 index 0000000..0d30973 --- /dev/null +++ b/majority-vote/daniel/knowledge_base/9ff4e041732c9841d5423e6ea0bbd6a0320df9ff.json @@ -0,0 +1,25 @@ +{ + "company_name": "VENUS METALS CORPORATION LIMITED", + "data_points": [ + { + "metric_type": "market capitalization", + "value": 15446040.0, + "currency": "AUD", + "point_in_time": "2022-09-15" + } + ], + "role_assignments": [ + { + "role_type": "Board Chairman", + "person_name": "Peter Charles Hawkins", + "role_assignment_started_as_iso_date": "2019-07-31", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Matthew Vernon Hogan", + "role_assignment_started_as_iso_date": "2006-12-22", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/bd5041c3e6909d92a7a88e4fb10dd8651df33228.json b/majority-vote/daniel/knowledge_base/bd5041c3e6909d92a7a88e4fb10dd8651df33228.json new file mode 100644 index 0000000..6d9e763 --- /dev/null +++ b/majority-vote/daniel/knowledge_base/bd5041c3e6909d92a7a88e4fb10dd8651df33228.json @@ -0,0 +1,85 @@ +{ + "company_name": "NICE", + "data_points": [ + { + "metric_type": "market capitalization", + "value": 5600.0, + "currency": "USD", + "point_in_time": "2023-03-20" + }, + { + "metric_type": "operating margin", + "value": 28.0, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Number of stores", + "value": 85.0, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Gross Profit Margin", + "value": 68.7, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Return on Assets (ROA)", + "value": 23.0, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "research and development expenses", + "value": 306073.0, + "currency": "USD", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "research and development expenses", + "value": 271187.0, + "currency": "USD", + "point_in_time": "2021-12-31" + }, + { + "metric_type": "research and development expenses", + "value": 218182.0, + "currency": "USD", + "point_in_time": "2020-12-31" + } + ], + "role_assignments": [ + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Barak Eilam", + "role_assignment_started_as_iso_date": "2014-04-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Beth Gaspich", + "role_assignment_started_as_iso_date": "2016-10-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Board Chairman", + "person_name": "David Kostman", + "role_assignment_started_as_iso_date": "2013-02-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Barak Eilam", + "role_assignment_started_as_iso_date": "2023-03-30", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Beth Gaspich", + "role_assignment_started_as_iso_date": "2023-03-30", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/d734bac4a4815e616d84083ad4d3844655321215.json b/majority-vote/daniel/knowledge_base/d734bac4a4815e616d84083ad4d3844655321215.json new file mode 100644 index 0000000..82a6897 --- /dev/null +++ b/majority-vote/daniel/knowledge_base/d734bac4a4815e616d84083ad4d3844655321215.json @@ -0,0 +1,139 @@ +{ + "company_name": "Nykredit", + "data_points": [ + { + "metric_type": "Gross Profit Margin", + "value": 56.68, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Number of stores", + "value": 912.0, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Number of stores", + "value": 775.0, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "operating margin", + "value": 39.98, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "market capitalization", + "value": 96858.0, + "currency": "EUR", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "sustainability initiatives spending", + "value": 4000.0, + "currency": "USD", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Debt-To-Equity ratio", + "value": 15.0, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Return on Assets (ROA)", + "value": 0.59, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Return on Assets (ROE)", + "value": 8.64, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "operating margin", + "value": 62.39, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "operating margin", + "value": 62.69, + "currency": null, + "point_in_time": "2021-12-31" + }, + { + "metric_type": "Debt-To-Equity ratio", + "value": 15.81, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Debt-To-Equity ratio", + "value": 17.88, + "currency": null, + "point_in_time": "2021-12-31" + }, + { + "metric_type": "market capitalization", + "value": 88658.0, + "currency": "GBP", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "market capitalization", + "value": 93595.0, + "currency": "GBP", + "point_in_time": "2021-12-31" + } + ], + "role_assignments": [ + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Michael Rasmussen", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Board Chairman", + "person_name": "Merete Eldrup", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Michael Rasmussen", + "role_assignment_started_as_iso_date": "2013-09-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Tonny Thierry Andersen", + "role_assignment_started_as_iso_date": "2019-06-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Operating Officer (COO)", + "person_name": "David Hellemann", + "role_assignment_started_as_iso_date": "2016-09-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Legal Officer (CLO)", + "person_name": "Anders Jensen", + "role_assignment_started_as_iso_date": "2014-10-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Board Chairman", + "person_name": "Merete Eldrup", + "role_assignment_started_as_iso_date": "2010-03-24", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/d81bbc64a4160b9946fea7a895f80e6201f52f27.json b/majority-vote/daniel/knowledge_base/d81bbc64a4160b9946fea7a895f80e6201f52f27.json new file mode 100644 index 0000000..65cec07 --- /dev/null +++ b/majority-vote/daniel/knowledge_base/d81bbc64a4160b9946fea7a895f80e6201f52f27.json @@ -0,0 +1,61 @@ +{ + "company_name": "Air Products", + "data_points": [ + { + "metric_type": "operating margin", + "value": 18.4, + "currency": null, + "point_in_time": "2022-09-30" + }, + { + "metric_type": "Number of stores", + "value": 226.0, + "currency": null, + "point_in_time": "2022-09-30" + }, + { + "metric_type": "market capitalization", + "value": 55200.0, + "currency": "USD", + "point_in_time": "2022-03-31" + }, + { + "metric_type": "Return on Assets (ROA)", + "value": 2.3, + "currency": null, + "point_in_time": "2022-09-30" + }, + { + "metric_type": "Gross Profit Margin", + "value": 26.5, + "currency": null, + "point_in_time": "2022-09-30" + } + ], + "role_assignments": [ + { + "role_type": "Chief Legal Officer (CLO)", + "person_name": "Sean D. Major", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Melissa Schaeffer", + "role_assignment_started_as_iso_date": "2021-08-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Seifi Ghasemi", + "role_assignment_started_as_iso_date": "2014-01-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Board Chairman", + "person_name": "Seifi Ghasemi", + "role_assignment_started_as_iso_date": "2014-01-01", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/dd78f748262b8ffa62de6484143ff55b38af24c7.json b/majority-vote/daniel/knowledge_base/dd78f748262b8ffa62de6484143ff55b38af24c7.json new file mode 100644 index 0000000..f9649c3 --- /dev/null +++ b/majority-vote/daniel/knowledge_base/dd78f748262b8ffa62de6484143ff55b38af24c7.json @@ -0,0 +1,61 @@ +{ + "company_name": "Accuray Incorporated", + "data_points": [ + { + "metric_type": "market capitalization", + "value": 365403546.0, + "currency": "USD", + "point_in_time": "2021-12-31" + }, + { + "metric_type": "research and development expenses", + "value": 47.6, + "currency": "USD", + "point_in_time": "2022-06-30" + }, + { + "metric_type": "Gross Profit Margin", + "value": 43.1, + "currency": null, + "point_in_time": "2022-06-30" + } + ], + "role_assignments": [ + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Joshua H. Levine", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": "2020-06-22" + }, + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Suzanne Winter", + "role_assignment_started_as_iso_date": "2021-07-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Board Chairman", + "person_name": "Michael S. Humphries", + "role_assignment_started_as_iso_date": "2022-04-07", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Joshua H. Levine", + "role_assignment_started_as_iso_date": "2014-10-01", + "role_assignment_ended_as_iso_date": "2022-06-30" + }, + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Suzanne Winter", + "role_assignment_started_as_iso_date": "2022-07-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Ali Pervaiz", + "role_assignment_started_as_iso_date": "2022-05-09", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/dfb1e552b18e116105d9125d9becafa443950e97.json b/majority-vote/daniel/knowledge_base/dfb1e552b18e116105d9125d9becafa443950e97.json new file mode 100644 index 0000000..21a64d7 --- /dev/null +++ b/majority-vote/daniel/knowledge_base/dfb1e552b18e116105d9125d9becafa443950e97.json @@ -0,0 +1,97 @@ +{ + "company_name": "Kooth Plc", + "data_points": [ + { + "metric_type": "market capitalization", + "value": 6000000000.0, + "currency": "USD", + "point_in_time": "2022-01-01" + }, + { + "metric_type": "research and development expenses", + "value": 3100000.0, + "currency": "GBP", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Number of stores", + "value": 60.0, + "currency": null, + "point_in_time": "2022-01-01" + }, + { + "metric_type": "Return on Assets (ROA)", + "value": 21.0, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Gross Profit Margin", + "value": 70.0, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Return on Assets (ROA)", + "value": 19.0, + "currency": null, + "point_in_time": "2021-12-31" + }, + { + "metric_type": "Gross Profit Margin", + "value": 68.9, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "market capitalization", + "value": 6480000000.0, + "currency": "USD", + "point_in_time": "2021-12-31" + }, + { + "metric_type": "market capitalization", + "value": 1670000000.0, + "currency": "GBP", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "market capitalization", + "value": 1670000000.0, + "currency": "GBP", + "point_in_time": "2021-12-31" + } + ], + "role_assignments": [ + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Tim Barker", + "role_assignment_started_as_iso_date": "2020-01-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Sanjay Jawa", + "role_assignment_started_as_iso_date": "2020-03-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Operating Officer (COO)", + "person_name": "Kate Newhouse", + "role_assignment_started_as_iso_date": "2020-05-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Board Chairman", + "person_name": "Peter Whiting", + "role_assignment_started_as_iso_date": "2020-05-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Legal Officer (CLO)", + "person_name": "Sue Bailey", + "role_assignment_started_as_iso_date": "2020-08-01", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/e51b7204b91cbe7709bd3218e7d2d0c2b8dbb438.json b/majority-vote/daniel/knowledge_base/e51b7204b91cbe7709bd3218e7d2d0c2b8dbb438.json new file mode 100644 index 0000000..fa830f4 --- /dev/null +++ b/majority-vote/daniel/knowledge_base/e51b7204b91cbe7709bd3218e7d2d0c2b8dbb438.json @@ -0,0 +1,103 @@ +{ + "company_name": "Ethernity Networks Ltd", + "data_points": [ + { + "metric_type": "market capitalization", + "value": 19.44, + "currency": "GBP", + "point_in_time": "2017-06-30" + }, + { + "metric_type": "Debt-To-Equity ratio", + "value": 0.71, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Number of stores", + "value": 0.0, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "research and development expenses", + "value": 6.62, + "currency": "USD", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Gross Profit Margin", + "value": 54.41, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "operating margin", + "value": -296.5, + "currency": null, + "point_in_time": "2022-12-31" + }, + { + "metric_type": "market capitalization", + "value": 0.81, + "currency": "USD", + "point_in_time": "2022-12-31" + }, + { + "metric_type": "Number of stores", + "value": 0.0, + "currency": null, + "point_in_time": "2021-12-31" + }, + { + "metric_type": "market capitalization", + "value": 1.2, + "currency": "USD", + "point_in_time": "2021-12-31" + }, + { + "metric_type": "operating margin", + "value": -240.37, + "currency": null, + "point_in_time": "2021-12-31" + }, + { + "metric_type": "research and development expenses", + "value": 5.55, + "currency": "USD", + "point_in_time": "2021-12-31" + } + ], + "role_assignments": [ + { + "role_type": "Board Chairman", + "person_name": "Yosi Albagli", + "role_assignment_started_as_iso_date": "2021-03-10", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "David Levi", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Mark Reichenberg", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Legal Officer (CLO)", + "person_name": "Chen Saft-Feiglin", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Board Chairman", + "person_name": "Richard Bennett", + "role_assignment_started_as_iso_date": "2022-04-07", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/ea0757d27fa67cd347d9f046b939a911f5c9a08d.json b/majority-vote/daniel/knowledge_base/ea0757d27fa67cd347d9f046b939a911f5c9a08d.json new file mode 100644 index 0000000..e170a05 --- /dev/null +++ b/majority-vote/daniel/knowledge_base/ea0757d27fa67cd347d9f046b939a911f5c9a08d.json @@ -0,0 +1,67 @@ +{ + "company_name": "Canadian Banc Corp.", + "data_points": [ + { + "metric_type": "Gross Profit Margin", + "value": 0.657, + "currency": null, + "point_in_time": "2022-11-30" + }, + { + "metric_type": "operating margin", + "value": 0.1, + "currency": null, + "point_in_time": "2022-11-30" + }, + { + "metric_type": "Number of stores", + "value": 12.0, + "currency": null, + "point_in_time": "2022-11-30" + }, + { + "metric_type": "Return on Assets (ROA)", + "value": 0.072, + "currency": null, + "point_in_time": "2022-11-30" + }, + { + "metric_type": "research and development expenses", + "value": 3.2, + "currency": "USD", + "point_in_time": "2022-11-30" + }, + { + "metric_type": "research and development expenses", + "value": 3.5, + "currency": "USD", + "point_in_time": "2021-11-30" + }, + { + "metric_type": "market capitalization", + "value": 345.4, + "currency": "USD", + "point_in_time": "2022-11-30" + } + ], + "role_assignments": [ + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Wayne Finch", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Financial Officer (CFO)", + "person_name": "Silvia Gomes", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Board Chairman", + "person_name": "Peter Cruickshank", + "role_assignment_started_as_iso_date": null, + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/faf8d7d79152d61279eda1cfb58b8236ce2f82fa.json b/majority-vote/daniel/knowledge_base/faf8d7d79152d61279eda1cfb58b8236ce2f82fa.json new file mode 100644 index 0000000..f8486ba --- /dev/null +++ b/majority-vote/daniel/knowledge_base/faf8d7d79152d61279eda1cfb58b8236ce2f82fa.json @@ -0,0 +1,43 @@ +{ + "company_name": "EMT", + "data_points": [ + { + "metric_type": "market capitalization", + "value": 0.0125, + "currency": "OTHER", + "point_in_time": "2022-06-30" + }, + { + "metric_type": "research and development expenses", + "value": 556353.0, + "currency": "OTHER", + "point_in_time": "2022-06-30" + }, + { + "metric_type": "operating margin", + "value": 4.515336, + "currency": "OTHER", + "point_in_time": "2022-06-30" + } + ], + "role_assignments": [ + { + "role_type": "Chief Executive Officer (CEO)", + "person_name": "Gary Lyons", + "role_assignment_started_as_iso_date": "2010-06-02", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Operating Officer (COO)", + "person_name": "Mathew Walker", + "role_assignment_started_as_iso_date": "2012-09-01", + "role_assignment_ended_as_iso_date": null + }, + { + "role_type": "Chief Legal Officer (CLO)", + "person_name": "Teck Wong", + "role_assignment_started_as_iso_date": "2021-03-22", + "role_assignment_ended_as_iso_date": null + } + ] +} \ No newline at end of file diff --git a/majority-vote/majority_vote/__init__.py b/majority-vote/majority_vote/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/majority-vote/majority_vote/__main__.py b/majority-vote/majority_vote/__main__.py new file mode 100644 index 0000000..86cf4ab --- /dev/null +++ b/majority-vote/majority_vote/__main__.py @@ -0,0 +1,56 @@ +import json +import random +from collections import Counter +from typing import Callable, Optional + +import daniel.answer_question + +from dotenv import load_dotenv + + +def majorities(items): + # Count occurrences of each item + counts = Counter(items) + + # Find the maximum occurrence + max_count = max(counts.values()) + + # Extract items that have the maximum occurrence + result = [item for item, count in counts.items() if count == max_count] + + return result + + +def majority_vote(items): + result = majorities(items) + # If there's a tie, return a random item from those that are tied. + return random.choice(result) + +load_dotenv() + +AnswerFunction = Callable[[str, str], Optional[str]] + +answer_functions = [ daniel.answer_question.answer_question ] + +results = [] + +with open('questions.json', 'r') as json_file: + items = json.load(json_file) + + for item in items: + question = item["question"] + print(f"Processing question: {question}") + + answers = [ answer_question(question, item["schema"]) for answer_question in answer_functions] + answer = majority_vote(answers) + + print(f"Answer: {answer}") + + results.append({ + "question": question, + "schema": item["schema"], + "answer": answer + }) + +with open('results.json', 'w') as json_file: + json.dump(results, json_file, indent=4) \ No newline at end of file diff --git a/majority-vote/questions.json b/majority-vote/questions.json new file mode 100644 index 0000000..944b5ef --- /dev/null +++ b/majority-vote/questions.json @@ -0,0 +1,202 @@ +[ + { + "question": "How much did \"Accuray Incorporated\" spend on risk management in Q2 2022?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the CEO in the company \"Zegona Communications plc\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Global Medical REIT Inc.\" have a greater Debt-to-Equity ratio than \"Zegona Communications plc\" in Q2 2021?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"Accuray Incorporated\" have in the end of fiscal year 2021?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Sandwell Aquatics Centre\" spend on R&D in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the CFO in the company \"EMT\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Calyxt, Inc.\" have a greater Return on Assets (ROA) than \"Global Medical REIT Inc.\" in Q2 2023?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"OTC_UNCIF\" have in the end of fiscal year 2022?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Accuray Incorporated\" spend on customer acquisition in Q2 2021?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the CEO in the company \"Accuray Incorporated\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Comet Holding AG\" have a greater Operating Margin than \"Ethernity Networks Ltd\" in Q2 2022?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"VENUS METALS CORPORATION LIMITED\" have in the end of fiscal year 2022?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Ethernity Networks Ltd\" spend on R&D in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the COO in the company \"Sandwell Aquatics Centre\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Calyxt, Inc.\" have a greater market capitalization than \"NICE\" in Q2 2022?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"Renishaw plc\" have in the end of fiscal year 2023?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"TD SYNNEX\" spend on R&D in Q2 2022?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the CFO in the company \"TD SYNNEX\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Eurocell PLC\" have a greater Return on Equity (ROE) than \"Strike Energy Limited\" in Q2 2022?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"OTC_UNCIF\" have in the end of fiscal year 2023?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"EMT\" spend on customer acquisition in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the Board Chairman in the company \"Motus GI Holdings, Inc.\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Calyxt, Inc.\" have a greater Operating Margin than \"Banque Cantonale Vaudoise\" in Q2 2023?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"EMT\" have in the end of fiscal year 2023?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Ethernity Networks Ltd\" spend on customer acquisition in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the CFO in the company \"Ethernity Networks Ltd\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Canadian Banc Corp.\" have a greater Return on Assets (ROA) than \"VENUS METALS CORPORATION LIMITED\" in Q2 2021?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"VENUS METALS CORPORATION LIMITED\" have in the end of fiscal year 2023?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Motus GI Holdings, Inc.\" spend on sustainability initiatives in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the Board Chairman in the company \"Renishaw plc\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Canadian Banc Corp.\" have a greater Gross Profit Margin than \"Motus GI Holdings, Inc.\" in Q2 2022?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"VENUS METALS CORPORATION LIMITED\" have in the end of fiscal year 2021?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Renishaw plc\" spend on risk management in Q2 2022?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the Board Chairman in the company \"TD SYNNEX\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Banque Cantonale Vaudoise\" have a greater Operating Margin than \"Zegona Communications plc\" in Q2 2021?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"Strike Energy Limited\" have in the end of fiscal year 2021?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Ethernity Networks Ltd\" spend on customer acquisition in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the Chief Legal Officer in the company \"Nykredit\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Comet Holding AG\" have a greater Operating Margin than \"Calyxt, Inc.\" in Q2 2021?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"EMT\" have in the end of fiscal year 2022?", + "schema": "number", + "answer": null + } +] \ No newline at end of file diff --git a/majority-vote/requirements.txt b/majority-vote/requirements.txt new file mode 100644 index 0000000..2cd5960 --- /dev/null +++ b/majority-vote/requirements.txt @@ -0,0 +1,4 @@ +python_dotenv==1.0.1 +pypdf2==3.0.1 +tiktoken==0.7.0 +openai==1.42.0 \ No newline at end of file diff --git a/majority-vote/results.json b/majority-vote/results.json new file mode 100644 index 0000000..6d70c4f --- /dev/null +++ b/majority-vote/results.json @@ -0,0 +1,202 @@ +[ + { + "question": "How much did \"Accuray Incorporated\" spend on risk management in Q2 2022?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the CEO in the company \"Zegona Communications plc\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Global Medical REIT Inc.\" have a greater Debt-to-Equity ratio than \"Zegona Communications plc\" in Q2 2021?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"Accuray Incorporated\" have in the end of fiscal year 2021?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Sandwell Aquatics Centre\" spend on R&D in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the CFO in the company \"EMT\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Calyxt, Inc.\" have a greater Return on Assets (ROA) than \"Global Medical REIT Inc.\" in Q2 2023?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"OTC_UNCIF\" have in the end of fiscal year 2022?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Accuray Incorporated\" spend on customer acquisition in Q2 2021?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the CEO in the company \"Accuray Incorporated\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Comet Holding AG\" have a greater Operating Margin than \"Ethernity Networks Ltd\" in Q2 2022?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"VENUS METALS CORPORATION LIMITED\" have in the end of fiscal year 2022?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Ethernity Networks Ltd\" spend on R&D in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the COO in the company \"Sandwell Aquatics Centre\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Calyxt, Inc.\" have a greater market capitalization than \"NICE\" in Q2 2022?", + "schema": "boolean", + "answer": false + }, + { + "question": "How many stores did \"Renishaw plc\" have in the end of fiscal year 2023?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"TD SYNNEX\" spend on R&D in Q2 2022?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the CFO in the company \"TD SYNNEX\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Eurocell PLC\" have a greater Return on Equity (ROE) than \"Strike Energy Limited\" in Q2 2022?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"OTC_UNCIF\" have in the end of fiscal year 2023?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"EMT\" spend on customer acquisition in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the Board Chairman in the company \"Motus GI Holdings, Inc.\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Calyxt, Inc.\" have a greater Operating Margin than \"Banque Cantonale Vaudoise\" in Q2 2023?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"EMT\" have in the end of fiscal year 2023?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Ethernity Networks Ltd\" spend on customer acquisition in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the CFO in the company \"Ethernity Networks Ltd\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Canadian Banc Corp.\" have a greater Return on Assets (ROA) than \"VENUS METALS CORPORATION LIMITED\" in Q2 2021?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"VENUS METALS CORPORATION LIMITED\" have in the end of fiscal year 2023?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Motus GI Holdings, Inc.\" spend on sustainability initiatives in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the Board Chairman in the company \"Renishaw plc\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Canadian Banc Corp.\" have a greater Gross Profit Margin than \"Motus GI Holdings, Inc.\" in Q2 2022?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"VENUS METALS CORPORATION LIMITED\" have in the end of fiscal year 2021?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Renishaw plc\" spend on risk management in Q2 2022?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the Board Chairman in the company \"TD SYNNEX\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Banque Cantonale Vaudoise\" have a greater Operating Margin than \"Zegona Communications plc\" in Q2 2021?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"Strike Energy Limited\" have in the end of fiscal year 2021?", + "schema": "number", + "answer": null + }, + { + "question": "How much did \"Ethernity Networks Ltd\" spend on customer acquisition in Q2 2023?", + "schema": "number", + "answer": null + }, + { + "question": "Who is the Chief Legal Officer in the company \"Nykredit\"?", + "schema": "name", + "answer": null + }, + { + "question": "Did \"Comet Holding AG\" have a greater Operating Margin than \"Calyxt, Inc.\" in Q2 2021?", + "schema": "boolean", + "answer": null + }, + { + "question": "How many stores did \"EMT\" have in the end of fiscal year 2022?", + "schema": "number", + "answer": 0.0 + } +] \ No newline at end of file From 26a9688060842d2d5aaabd4420d2307cbe972e6c Mon Sep 17 00:00:00 2001 From: Daniel Weller Date: Fri, 30 Aug 2024 10:57:42 +0200 Subject: [PATCH 2/5] fix: knowledge base json --- majority-vote/daniel/answer_question.py | 6 ++++-- majority-vote/results.json | 16 ++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/majority-vote/daniel/answer_question.py b/majority-vote/daniel/answer_question.py index 65b13d4..a26ca62 100644 --- a/majority-vote/daniel/answer_question.py +++ b/majority-vote/daniel/answer_question.py @@ -1,5 +1,6 @@ import os import json +from datetime import datetime from pydantic import BaseModel from typing import Optional @@ -23,7 +24,7 @@ { "company_name": x["company_name"], "data_points": x["data_points"], - "company_role_assignments": x["company_role_assignments"] if "company_role_assignments" in x else None + "role_assignments": x["role_assignments"] } for x in json_list ] @@ -42,7 +43,8 @@ class BooleanResponse(BaseModel): def answer_question(question, schema): system_prompt = ("You are an assistant with the task of answering QUESTIONS based on a KNOWLEDGE DATABASE. " - "If you cannot answer the question, indicate this with a `null` response.") + "If you cannot answer the question, indicate this with a `null` response. " + f"The current date is {datetime.today().strftime('%Y-%m-%d')}") prompt = ("QUESTION\n\n" f"{question}\n\n" diff --git a/majority-vote/results.json b/majority-vote/results.json index 6d70c4f..288dca6 100644 --- a/majority-vote/results.json +++ b/majority-vote/results.json @@ -7,7 +7,7 @@ { "question": "Who is the CEO in the company \"Zegona Communications plc\"?", "schema": "name", - "answer": null + "answer": "Eamonn O'Hare" }, { "question": "Did \"Global Medical REIT Inc.\" have a greater Debt-to-Equity ratio than \"Zegona Communications plc\" in Q2 2021?", @@ -47,7 +47,7 @@ { "question": "Who is the CEO in the company \"Accuray Incorporated\"?", "schema": "name", - "answer": null + "answer": "Suzanne Winter" }, { "question": "Did \"Comet Holding AG\" have a greater Operating Margin than \"Ethernity Networks Ltd\" in Q2 2022?", @@ -87,7 +87,7 @@ { "question": "Who is the CFO in the company \"TD SYNNEX\"?", "schema": "name", - "answer": null + "answer": "Marshall Witt" }, { "question": "Did \"Eurocell PLC\" have a greater Return on Equity (ROE) than \"Strike Energy Limited\" in Q2 2022?", @@ -107,7 +107,7 @@ { "question": "Who is the Board Chairman in the company \"Motus GI Holdings, Inc.\"?", "schema": "name", - "answer": null + "answer": "David Hochman" }, { "question": "Did \"Calyxt, Inc.\" have a greater Operating Margin than \"Banque Cantonale Vaudoise\" in Q2 2023?", @@ -117,7 +117,7 @@ { "question": "How many stores did \"EMT\" have in the end of fiscal year 2023?", "schema": "number", - "answer": null + "answer": 0.0 }, { "question": "How much did \"Ethernity Networks Ltd\" spend on customer acquisition in Q2 2023?", @@ -127,7 +127,7 @@ { "question": "Who is the CFO in the company \"Ethernity Networks Ltd\"?", "schema": "name", - "answer": null + "answer": "Mark Reichenberg" }, { "question": "Did \"Canadian Banc Corp.\" have a greater Return on Assets (ROA) than \"VENUS METALS CORPORATION LIMITED\" in Q2 2021?", @@ -167,7 +167,7 @@ { "question": "Who is the Board Chairman in the company \"TD SYNNEX\"?", "schema": "name", - "answer": null + "answer": "Dennis Polk" }, { "question": "Did \"Banque Cantonale Vaudoise\" have a greater Operating Margin than \"Zegona Communications plc\" in Q2 2021?", @@ -187,7 +187,7 @@ { "question": "Who is the Chief Legal Officer in the company \"Nykredit\"?", "schema": "name", - "answer": null + "answer": "Anders Jensen" }, { "question": "Did \"Comet Holding AG\" have a greater Operating Margin than \"Calyxt, Inc.\" in Q2 2021?", From 6559eba839976c87c37972cadc5b84d6854ff7eb Mon Sep 17 00:00:00 2001 From: Daniel Weller Date: Mon, 2 Sep 2024 09:18:16 +0200 Subject: [PATCH 3/5] do not count None answers when taking majority --- majority-vote/majority_vote/__main__.py | 19 +++++++++++++------ majority-vote/results.json | 4 ++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/majority-vote/majority_vote/__main__.py b/majority-vote/majority_vote/__main__.py index 86cf4ab..6046425 100644 --- a/majority-vote/majority_vote/__main__.py +++ b/majority-vote/majority_vote/__main__.py @@ -22,9 +22,14 @@ def majorities(items): def majority_vote(items): - result = majorities(items) - # If there's a tie, return a random item from those that are tied. - return random.choice(result) + not_none_items = [item for item in items if item is not None] + # Only return None if all items are None. + if len(not_none_items) == 0: + return None + else: + result = majorities(items) + # If there's a tie, return a random item from those that are tied. + return random.choice(result) load_dotenv() @@ -41,10 +46,12 @@ def majority_vote(items): question = item["question"] print(f"Processing question: {question}") - answers = [ answer_question(question, item["schema"]) for answer_question in answer_functions] - answer = majority_vote(answers) + answers = [ answer_question(question, item["schema"]) for answer_question in answer_functions ] + print(f"All answers: {answers}") - print(f"Answer: {answer}") + answer = majority_vote(answers) + print(f"Chosen answer: {answer}") + print() results.append({ "question": question, diff --git a/majority-vote/results.json b/majority-vote/results.json index 288dca6..108cad2 100644 --- a/majority-vote/results.json +++ b/majority-vote/results.json @@ -117,7 +117,7 @@ { "question": "How many stores did \"EMT\" have in the end of fiscal year 2023?", "schema": "number", - "answer": 0.0 + "answer": null }, { "question": "How much did \"Ethernity Networks Ltd\" spend on customer acquisition in Q2 2023?", @@ -197,6 +197,6 @@ { "question": "How many stores did \"EMT\" have in the end of fiscal year 2022?", "schema": "number", - "answer": 0.0 + "answer": null } ] \ No newline at end of file From cdd64951a18fac1736d5e2c68e2bd2a9da52fef3 Mon Sep 17 00:00:00 2001 From: Daniel Weller Date: Tue, 3 Sep 2024 13:11:21 +0200 Subject: [PATCH 4/5] remove daniel's approach; add sample --- majority-vote/daniel/__init__.py | 0 majority-vote/daniel/answer_question.py | 81 ---------- ...b7cb83115789346e2a9efc7e2e640851653ff.json | 73 --------- ...6c1b29566acc1eafc704ee5737fb3ae6f3d1d.json | 37 ----- ...5cfe0d7bbf59e186492bfbe1b5002d44af332.json | 37 ----- ...25836a5d7cb75489f6d93a3b1cf2b8f039bf2.json | 121 --------------- ...c5097dfc6e83505fd2259ad862dcec11a3f96.json | 43 ------ ...04e0248ecf758990a0ab77bd69344be63bcf4.json | 37 ----- ...e213e4e689294ebae809bfa6a1b5024076286.json | 55 ------- ...4e041732c9841d5423e6ea0bbd6a0320df9ff.json | 25 ---- ...041c3e6909d92a7a88e4fb10dd8651df33228.json | 85 ----------- ...4bac4a4815e616d84083ad4d3844655321215.json | 139 ------------------ ...bbc64a4160b9946fea7a895f80e6201f52f27.json | 61 -------- ...8f748262b8ffa62de6484143ff55b38af24c7.json | 61 -------- ...1e552b18e116105d9125d9becafa443950e97.json | 97 ------------ ...b7204b91cbe7709bd3218e7d2d0c2b8dbb438.json | 103 ------------- ...757d27fa67cd347d9f046b939a911f5c9a08d.json | 67 --------- ...8d7d79152d61279eda1cfb58b8236ce2f82fa.json | 43 ------ majority-vote/majority_vote/__main__.py | 7 +- majority-vote/requirements.txt | 3 - majority-vote/results.json | 80 +++++----- majority-vote/sample/__init__.py | 4 + 22 files changed, 48 insertions(+), 1211 deletions(-) delete mode 100644 majority-vote/daniel/__init__.py delete mode 100644 majority-vote/daniel/answer_question.py delete mode 100644 majority-vote/daniel/knowledge_base/053b7cb83115789346e2a9efc7e2e640851653ff.json delete mode 100644 majority-vote/daniel/knowledge_base/3696c1b29566acc1eafc704ee5737fb3ae6f3d1d.json delete mode 100644 majority-vote/daniel/knowledge_base/40b5cfe0d7bbf59e186492bfbe1b5002d44af332.json delete mode 100644 majority-vote/daniel/knowledge_base/4b525836a5d7cb75489f6d93a3b1cf2b8f039bf2.json delete mode 100644 majority-vote/daniel/knowledge_base/608c5097dfc6e83505fd2259ad862dcec11a3f96.json delete mode 100644 majority-vote/daniel/knowledge_base/71b04e0248ecf758990a0ab77bd69344be63bcf4.json delete mode 100644 majority-vote/daniel/knowledge_base/99be213e4e689294ebae809bfa6a1b5024076286.json delete mode 100644 majority-vote/daniel/knowledge_base/9ff4e041732c9841d5423e6ea0bbd6a0320df9ff.json delete mode 100644 majority-vote/daniel/knowledge_base/bd5041c3e6909d92a7a88e4fb10dd8651df33228.json delete mode 100644 majority-vote/daniel/knowledge_base/d734bac4a4815e616d84083ad4d3844655321215.json delete mode 100644 majority-vote/daniel/knowledge_base/d81bbc64a4160b9946fea7a895f80e6201f52f27.json delete mode 100644 majority-vote/daniel/knowledge_base/dd78f748262b8ffa62de6484143ff55b38af24c7.json delete mode 100644 majority-vote/daniel/knowledge_base/dfb1e552b18e116105d9125d9becafa443950e97.json delete mode 100644 majority-vote/daniel/knowledge_base/e51b7204b91cbe7709bd3218e7d2d0c2b8dbb438.json delete mode 100644 majority-vote/daniel/knowledge_base/ea0757d27fa67cd347d9f046b939a911f5c9a08d.json delete mode 100644 majority-vote/daniel/knowledge_base/faf8d7d79152d61279eda1cfb58b8236ce2f82fa.json create mode 100644 majority-vote/sample/__init__.py diff --git a/majority-vote/daniel/__init__.py b/majority-vote/daniel/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/majority-vote/daniel/answer_question.py b/majority-vote/daniel/answer_question.py deleted file mode 100644 index a26ca62..0000000 --- a/majority-vote/daniel/answer_question.py +++ /dev/null @@ -1,81 +0,0 @@ -import os -import json -from datetime import datetime -from pydantic import BaseModel -from typing import Optional - -OPENAI_MODEL = "gpt-4o-2024-08-06" -KNOWLEDGE_BASE_PATH = 'daniel/knowledge_base' - - -# Initialize an empty list to store the dictionaries -json_list = [] - -# Iterate over each file in the directory -for filename in os.listdir(KNOWLEDGE_BASE_PATH): - if filename.endswith('.json'): # Check if the file is a JSON file - filepath = os.path.join(KNOWLEDGE_BASE_PATH, filename) - with open(filepath, 'r') as json_file: - data = json.load(json_file) # Load the JSON file into a dict - json_list.append(data) # Append the dict to the list - -# Now json_list contains all the JSON files as dicts -database = [ - { - "company_name": x["company_name"], - "data_points": x["data_points"], - "role_assignments": x["role_assignments"] - } - for x in json_list -] - -class NumberResponse(BaseModel): - answer: Optional[float] - - -class NameResponse(BaseModel): - person_name: Optional[str] - - -class BooleanResponse(BaseModel): - answer: Optional[bool] - - -def answer_question(question, schema): - system_prompt = ("You are an assistant with the task of answering QUESTIONS based on a KNOWLEDGE DATABASE. " - "If you cannot answer the question, indicate this with a `null` response. " - f"The current date is {datetime.today().strftime('%Y-%m-%d')}") - - prompt = ("QUESTION\n\n" - f"{question}\n\n" - "KNOWLEDGE DATABASE\n\n" - f"{json.dumps(database)}") - - from openai import OpenAI - client = OpenAI() - - messages = [ - {"role": "system", "content": system_prompt}, - {"role": "user", "content": prompt}, - ] - - match schema: - case "number": - response_format = NumberResponse - value_extractor = lambda x: x.answer - case "name": - response_format = NameResponse - value_extractor = lambda x: x.person_name - case "boolean": - response_format = BooleanResponse - value_extractor = lambda x: x.answer - case _: - raise f"unknown schema {schema}" - - response = client.beta.chat.completions.parse( - model=OPENAI_MODEL, - messages=messages, - response_format=response_format - ) - - return value_extractor(response.choices[0].message.parsed) diff --git a/majority-vote/daniel/knowledge_base/053b7cb83115789346e2a9efc7e2e640851653ff.json b/majority-vote/daniel/knowledge_base/053b7cb83115789346e2a9efc7e2e640851653ff.json deleted file mode 100644 index d8c903c..0000000 --- a/majority-vote/daniel/knowledge_base/053b7cb83115789346e2a9efc7e2e640851653ff.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "company_name": "Global Medical REIT Inc.", - "data_points": [ - { - "metric_type": "market capitalization", - "value": 693.0, - "currency": "USD", - "point_in_time": "2022-06-30" - }, - { - "metric_type": "Number of stores", - "value": 189.0, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "research and development expenses", - "value": 16.545, - "currency": "USD", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "research and development expenses", - "value": 16.453, - "currency": "USD", - "point_in_time": "2021-12-31" - }, - { - "metric_type": "Gross Profit Margin", - "value": 39.984, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "customer acquisition spending", - "value": 14.611, - "currency": "USD", - "point_in_time": "2022-03-25" - }, - { - "metric_type": "Return on Assets (ROA)", - "value": 4.2, - "currency": null, - "point_in_time": "2022-02-24" - } - ], - "role_assignments": [ - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Jeffrey Busch", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Robert Kiernan", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Operating Officer (COO)", - "person_name": "Alfonzo Leon", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Legal Officer (CLO)", - "person_name": "Jamie Barber", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/3696c1b29566acc1eafc704ee5737fb3ae6f3d1d.json b/majority-vote/daniel/knowledge_base/3696c1b29566acc1eafc704ee5737fb3ae6f3d1d.json deleted file mode 100644 index ad66eeb..0000000 --- a/majority-vote/daniel/knowledge_base/3696c1b29566acc1eafc704ee5737fb3ae6f3d1d.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "company_name": "Zegona Communications plc", - "data_points": [ - { - "metric_type": "sustainability initiatives spending", - "value": 4.5, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "sustainability initiatives spending", - "value": 4.5, - "currency": null, - "point_in_time": "2021-12-31" - } - ], - "role_assignments": [ - { - "role_type": "Board Chairman", - "person_name": "Eamonn O'Hare", - "role_assignment_started_as_iso_date": "2023-04-06", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Eamonn O'Hare", - "role_assignment_started_as_iso_date": "2023-04-06", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Operating Officer (COO)", - "person_name": "Robert Samuelson", - "role_assignment_started_as_iso_date": "2023-04-06", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/40b5cfe0d7bbf59e186492bfbe1b5002d44af332.json b/majority-vote/daniel/knowledge_base/40b5cfe0d7bbf59e186492bfbe1b5002d44af332.json deleted file mode 100644 index 0c5587c..0000000 --- a/majority-vote/daniel/knowledge_base/40b5cfe0d7bbf59e186492bfbe1b5002d44af332.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "company_name": "Calyxt, Inc.", - "data_points": [ - { - "metric_type": "market capitalization", - "value": 5446012.0, - "currency": "USD", - "point_in_time": "2022-06-30" - } - ], - "role_assignments": [ - { - "role_type": "Board Chairman", - "person_name": "Yves Ribeill", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Michael A. Carr", - "role_assignment_started_as_iso_date": "2021-07-15", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "William F. Koschak", - "role_assignment_started_as_iso_date": "2018-12-21", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Legal Officer (CLO)", - "person_name": "Debra Frimerman", - "role_assignment_started_as_iso_date": "2019-01-21", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/4b525836a5d7cb75489f6d93a3b1cf2b8f039bf2.json b/majority-vote/daniel/knowledge_base/4b525836a5d7cb75489f6d93a3b1cf2b8f039bf2.json deleted file mode 100644 index ddb912a..0000000 --- a/majority-vote/daniel/knowledge_base/4b525836a5d7cb75489f6d93a3b1cf2b8f039bf2.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "company_name": "TD SYNNEX", - "data_points": [ - { - "metric_type": "market capitalization", - "value": 4311515318.0, - "currency": "USD", - "point_in_time": "2022-05-31" - }, - { - "metric_type": "Number of stores", - "value": 23.0, - "currency": null, - "point_in_time": "2022-11-30" - }, - { - "metric_type": "Gross Profit Margin", - "value": 6.26, - "currency": null, - "point_in_time": "2022-11-30" - }, - { - "metric_type": "Gross Profit Margin", - "value": 5.98, - "currency": null, - "point_in_time": "2021-11-30" - }, - { - "metric_type": "research and development expenses", - "value": 117000000.0, - "currency": "USD", - "point_in_time": "2022-11-30" - }, - { - "metric_type": "customer acquisition spending", - "value": 125016000.0, - "currency": "USD", - "point_in_time": "2022-11-30" - }, - { - "metric_type": "operating margin", - "value": 21.3, - "currency": null, - "point_in_time": "2022-11-30" - }, - { - "metric_type": "operating margin", - "value": 15.3, - "currency": null, - "point_in_time": "2021-11-30" - }, - { - "metric_type": "operating margin", - "value": 23.3, - "currency": null, - "point_in_time": "2020-11-30" - }, - { - "metric_type": "Return on Assets (ROA)", - "value": 159910.0, - "currency": "USD", - "point_in_time": "2020-11-30" - }, - { - "metric_type": "Return on Assets (ROA)", - "value": 220154.0, - "currency": "USD", - "point_in_time": "2021-11-30" - }, - { - "metric_type": "Return on Assets (ROA)", - "value": 492136.0, - "currency": "USD", - "point_in_time": "2022-11-30" - }, - { - "metric_type": "Return on Assets (ROE)", - "value": 276237.0, - "currency": "USD", - "point_in_time": "2020-11-30" - }, - { - "metric_type": "Return on Assets (ROE)", - "value": 246331.0, - "currency": "USD", - "point_in_time": "2021-11-30" - }, - { - "metric_type": "Return on Assets (ROE)", - "value": 334994.0, - "currency": "USD", - "point_in_time": "2022-11-30" - } - ], - "role_assignments": [ - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Rich Hume", - "role_assignment_started_as_iso_date": "2021-09-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Richard Hume", - "role_assignment_started_as_iso_date": "2021-09-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Marshall Witt", - "role_assignment_started_as_iso_date": "2013-04-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Board Chairman", - "person_name": "Dennis Polk", - "role_assignment_started_as_iso_date": "2021-09-01", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/608c5097dfc6e83505fd2259ad862dcec11a3f96.json b/majority-vote/daniel/knowledge_base/608c5097dfc6e83505fd2259ad862dcec11a3f96.json deleted file mode 100644 index 31831dd..0000000 --- a/majority-vote/daniel/knowledge_base/608c5097dfc6e83505fd2259ad862dcec11a3f96.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "company_name": "Sandwell Aquatics Centre", - "data_points": [ - { - "metric_type": "market capitalization", - "value": 86.6, - "currency": "GBP", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "research and development expenses", - "value": 0.095, - "currency": "GBP", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "operating margin", - "value": 6.8, - "currency": null, - "point_in_time": "2022-12-31" - } - ], - "role_assignments": [ - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Mark Smith", - "role_assignment_started_as_iso_date": "2015-01-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Trevor Taylor", - "role_assignment_started_as_iso_date": "2011-10-31", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Board Chairman", - "person_name": "Ian Lawson", - "role_assignment_started_as_iso_date": "2018-10-01", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/71b04e0248ecf758990a0ab77bd69344be63bcf4.json b/majority-vote/daniel/knowledge_base/71b04e0248ecf758990a0ab77bd69344be63bcf4.json deleted file mode 100644 index af1cccc..0000000 --- a/majority-vote/daniel/knowledge_base/71b04e0248ecf758990a0ab77bd69344be63bcf4.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "company_name": "Motus GI Holdings, Inc.", - "data_points": [ - { - "metric_type": "market capitalization", - "value": 14600000.0, - "currency": "USD", - "point_in_time": "2022-06-30" - } - ], - "role_assignments": [ - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Timothy P. Moran", - "role_assignment_started_as_iso_date": "2018-10-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Operating Officer (COO)", - "person_name": "Mark Pomeranz", - "role_assignment_started_as_iso_date": "2018-10-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Andrew Taylor", - "role_assignment_started_as_iso_date": "2017-08-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Board Chairman", - "person_name": "David Hochman", - "role_assignment_started_as_iso_date": "2016-01-01", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/99be213e4e689294ebae809bfa6a1b5024076286.json b/majority-vote/daniel/knowledge_base/99be213e4e689294ebae809bfa6a1b5024076286.json deleted file mode 100644 index d24cef3..0000000 --- a/majority-vote/daniel/knowledge_base/99be213e4e689294ebae809bfa6a1b5024076286.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "company_name": "Limbach Holdings, Inc.", - "data_points": [ - { - "metric_type": "research and development expenses", - "value": 6.5, - "currency": "USD", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Debt-To-Equity ratio", - "value": 0.33, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "sustainability initiatives spending", - "value": 2.4, - "currency": "USD", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Gross Profit Margin", - "value": 18.9, - "currency": null, - "point_in_time": "2022-12-31" - } - ], - "role_assignments": [ - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Michael M. McCann", - "role_assignment_started_as_iso_date": "2023-03-28", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Jayme L. Brooks", - "role_assignment_started_as_iso_date": "2019-10-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Operating Officer (COO)", - "person_name": "Michael M. McCann", - "role_assignment_started_as_iso_date": "2019-11-01", - "role_assignment_ended_as_iso_date": "2023-03-28" - }, - { - "role_type": "Board Chairman", - "person_name": "Gordon G. Pratt", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/9ff4e041732c9841d5423e6ea0bbd6a0320df9ff.json b/majority-vote/daniel/knowledge_base/9ff4e041732c9841d5423e6ea0bbd6a0320df9ff.json deleted file mode 100644 index 0d30973..0000000 --- a/majority-vote/daniel/knowledge_base/9ff4e041732c9841d5423e6ea0bbd6a0320df9ff.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "company_name": "VENUS METALS CORPORATION LIMITED", - "data_points": [ - { - "metric_type": "market capitalization", - "value": 15446040.0, - "currency": "AUD", - "point_in_time": "2022-09-15" - } - ], - "role_assignments": [ - { - "role_type": "Board Chairman", - "person_name": "Peter Charles Hawkins", - "role_assignment_started_as_iso_date": "2019-07-31", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Matthew Vernon Hogan", - "role_assignment_started_as_iso_date": "2006-12-22", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/bd5041c3e6909d92a7a88e4fb10dd8651df33228.json b/majority-vote/daniel/knowledge_base/bd5041c3e6909d92a7a88e4fb10dd8651df33228.json deleted file mode 100644 index 6d9e763..0000000 --- a/majority-vote/daniel/knowledge_base/bd5041c3e6909d92a7a88e4fb10dd8651df33228.json +++ /dev/null @@ -1,85 +0,0 @@ -{ - "company_name": "NICE", - "data_points": [ - { - "metric_type": "market capitalization", - "value": 5600.0, - "currency": "USD", - "point_in_time": "2023-03-20" - }, - { - "metric_type": "operating margin", - "value": 28.0, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Number of stores", - "value": 85.0, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Gross Profit Margin", - "value": 68.7, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Return on Assets (ROA)", - "value": 23.0, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "research and development expenses", - "value": 306073.0, - "currency": "USD", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "research and development expenses", - "value": 271187.0, - "currency": "USD", - "point_in_time": "2021-12-31" - }, - { - "metric_type": "research and development expenses", - "value": 218182.0, - "currency": "USD", - "point_in_time": "2020-12-31" - } - ], - "role_assignments": [ - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Barak Eilam", - "role_assignment_started_as_iso_date": "2014-04-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Beth Gaspich", - "role_assignment_started_as_iso_date": "2016-10-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Board Chairman", - "person_name": "David Kostman", - "role_assignment_started_as_iso_date": "2013-02-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Barak Eilam", - "role_assignment_started_as_iso_date": "2023-03-30", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Beth Gaspich", - "role_assignment_started_as_iso_date": "2023-03-30", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/d734bac4a4815e616d84083ad4d3844655321215.json b/majority-vote/daniel/knowledge_base/d734bac4a4815e616d84083ad4d3844655321215.json deleted file mode 100644 index 82a6897..0000000 --- a/majority-vote/daniel/knowledge_base/d734bac4a4815e616d84083ad4d3844655321215.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "company_name": "Nykredit", - "data_points": [ - { - "metric_type": "Gross Profit Margin", - "value": 56.68, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Number of stores", - "value": 912.0, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Number of stores", - "value": 775.0, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "operating margin", - "value": 39.98, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "market capitalization", - "value": 96858.0, - "currency": "EUR", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "sustainability initiatives spending", - "value": 4000.0, - "currency": "USD", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Debt-To-Equity ratio", - "value": 15.0, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Return on Assets (ROA)", - "value": 0.59, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Return on Assets (ROE)", - "value": 8.64, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "operating margin", - "value": 62.39, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "operating margin", - "value": 62.69, - "currency": null, - "point_in_time": "2021-12-31" - }, - { - "metric_type": "Debt-To-Equity ratio", - "value": 15.81, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Debt-To-Equity ratio", - "value": 17.88, - "currency": null, - "point_in_time": "2021-12-31" - }, - { - "metric_type": "market capitalization", - "value": 88658.0, - "currency": "GBP", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "market capitalization", - "value": 93595.0, - "currency": "GBP", - "point_in_time": "2021-12-31" - } - ], - "role_assignments": [ - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Michael Rasmussen", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Board Chairman", - "person_name": "Merete Eldrup", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Michael Rasmussen", - "role_assignment_started_as_iso_date": "2013-09-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Tonny Thierry Andersen", - "role_assignment_started_as_iso_date": "2019-06-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Operating Officer (COO)", - "person_name": "David Hellemann", - "role_assignment_started_as_iso_date": "2016-09-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Legal Officer (CLO)", - "person_name": "Anders Jensen", - "role_assignment_started_as_iso_date": "2014-10-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Board Chairman", - "person_name": "Merete Eldrup", - "role_assignment_started_as_iso_date": "2010-03-24", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/d81bbc64a4160b9946fea7a895f80e6201f52f27.json b/majority-vote/daniel/knowledge_base/d81bbc64a4160b9946fea7a895f80e6201f52f27.json deleted file mode 100644 index 65cec07..0000000 --- a/majority-vote/daniel/knowledge_base/d81bbc64a4160b9946fea7a895f80e6201f52f27.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "company_name": "Air Products", - "data_points": [ - { - "metric_type": "operating margin", - "value": 18.4, - "currency": null, - "point_in_time": "2022-09-30" - }, - { - "metric_type": "Number of stores", - "value": 226.0, - "currency": null, - "point_in_time": "2022-09-30" - }, - { - "metric_type": "market capitalization", - "value": 55200.0, - "currency": "USD", - "point_in_time": "2022-03-31" - }, - { - "metric_type": "Return on Assets (ROA)", - "value": 2.3, - "currency": null, - "point_in_time": "2022-09-30" - }, - { - "metric_type": "Gross Profit Margin", - "value": 26.5, - "currency": null, - "point_in_time": "2022-09-30" - } - ], - "role_assignments": [ - { - "role_type": "Chief Legal Officer (CLO)", - "person_name": "Sean D. Major", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Melissa Schaeffer", - "role_assignment_started_as_iso_date": "2021-08-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Seifi Ghasemi", - "role_assignment_started_as_iso_date": "2014-01-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Board Chairman", - "person_name": "Seifi Ghasemi", - "role_assignment_started_as_iso_date": "2014-01-01", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/dd78f748262b8ffa62de6484143ff55b38af24c7.json b/majority-vote/daniel/knowledge_base/dd78f748262b8ffa62de6484143ff55b38af24c7.json deleted file mode 100644 index f9649c3..0000000 --- a/majority-vote/daniel/knowledge_base/dd78f748262b8ffa62de6484143ff55b38af24c7.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "company_name": "Accuray Incorporated", - "data_points": [ - { - "metric_type": "market capitalization", - "value": 365403546.0, - "currency": "USD", - "point_in_time": "2021-12-31" - }, - { - "metric_type": "research and development expenses", - "value": 47.6, - "currency": "USD", - "point_in_time": "2022-06-30" - }, - { - "metric_type": "Gross Profit Margin", - "value": 43.1, - "currency": null, - "point_in_time": "2022-06-30" - } - ], - "role_assignments": [ - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Joshua H. Levine", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": "2020-06-22" - }, - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Suzanne Winter", - "role_assignment_started_as_iso_date": "2021-07-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Board Chairman", - "person_name": "Michael S. Humphries", - "role_assignment_started_as_iso_date": "2022-04-07", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Joshua H. Levine", - "role_assignment_started_as_iso_date": "2014-10-01", - "role_assignment_ended_as_iso_date": "2022-06-30" - }, - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Suzanne Winter", - "role_assignment_started_as_iso_date": "2022-07-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Ali Pervaiz", - "role_assignment_started_as_iso_date": "2022-05-09", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/dfb1e552b18e116105d9125d9becafa443950e97.json b/majority-vote/daniel/knowledge_base/dfb1e552b18e116105d9125d9becafa443950e97.json deleted file mode 100644 index 21a64d7..0000000 --- a/majority-vote/daniel/knowledge_base/dfb1e552b18e116105d9125d9becafa443950e97.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "company_name": "Kooth Plc", - "data_points": [ - { - "metric_type": "market capitalization", - "value": 6000000000.0, - "currency": "USD", - "point_in_time": "2022-01-01" - }, - { - "metric_type": "research and development expenses", - "value": 3100000.0, - "currency": "GBP", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Number of stores", - "value": 60.0, - "currency": null, - "point_in_time": "2022-01-01" - }, - { - "metric_type": "Return on Assets (ROA)", - "value": 21.0, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Gross Profit Margin", - "value": 70.0, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Return on Assets (ROA)", - "value": 19.0, - "currency": null, - "point_in_time": "2021-12-31" - }, - { - "metric_type": "Gross Profit Margin", - "value": 68.9, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "market capitalization", - "value": 6480000000.0, - "currency": "USD", - "point_in_time": "2021-12-31" - }, - { - "metric_type": "market capitalization", - "value": 1670000000.0, - "currency": "GBP", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "market capitalization", - "value": 1670000000.0, - "currency": "GBP", - "point_in_time": "2021-12-31" - } - ], - "role_assignments": [ - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Tim Barker", - "role_assignment_started_as_iso_date": "2020-01-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Sanjay Jawa", - "role_assignment_started_as_iso_date": "2020-03-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Operating Officer (COO)", - "person_name": "Kate Newhouse", - "role_assignment_started_as_iso_date": "2020-05-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Board Chairman", - "person_name": "Peter Whiting", - "role_assignment_started_as_iso_date": "2020-05-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Legal Officer (CLO)", - "person_name": "Sue Bailey", - "role_assignment_started_as_iso_date": "2020-08-01", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/e51b7204b91cbe7709bd3218e7d2d0c2b8dbb438.json b/majority-vote/daniel/knowledge_base/e51b7204b91cbe7709bd3218e7d2d0c2b8dbb438.json deleted file mode 100644 index fa830f4..0000000 --- a/majority-vote/daniel/knowledge_base/e51b7204b91cbe7709bd3218e7d2d0c2b8dbb438.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "company_name": "Ethernity Networks Ltd", - "data_points": [ - { - "metric_type": "market capitalization", - "value": 19.44, - "currency": "GBP", - "point_in_time": "2017-06-30" - }, - { - "metric_type": "Debt-To-Equity ratio", - "value": 0.71, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Number of stores", - "value": 0.0, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "research and development expenses", - "value": 6.62, - "currency": "USD", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Gross Profit Margin", - "value": 54.41, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "operating margin", - "value": -296.5, - "currency": null, - "point_in_time": "2022-12-31" - }, - { - "metric_type": "market capitalization", - "value": 0.81, - "currency": "USD", - "point_in_time": "2022-12-31" - }, - { - "metric_type": "Number of stores", - "value": 0.0, - "currency": null, - "point_in_time": "2021-12-31" - }, - { - "metric_type": "market capitalization", - "value": 1.2, - "currency": "USD", - "point_in_time": "2021-12-31" - }, - { - "metric_type": "operating margin", - "value": -240.37, - "currency": null, - "point_in_time": "2021-12-31" - }, - { - "metric_type": "research and development expenses", - "value": 5.55, - "currency": "USD", - "point_in_time": "2021-12-31" - } - ], - "role_assignments": [ - { - "role_type": "Board Chairman", - "person_name": "Yosi Albagli", - "role_assignment_started_as_iso_date": "2021-03-10", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "David Levi", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Mark Reichenberg", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Legal Officer (CLO)", - "person_name": "Chen Saft-Feiglin", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Board Chairman", - "person_name": "Richard Bennett", - "role_assignment_started_as_iso_date": "2022-04-07", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/ea0757d27fa67cd347d9f046b939a911f5c9a08d.json b/majority-vote/daniel/knowledge_base/ea0757d27fa67cd347d9f046b939a911f5c9a08d.json deleted file mode 100644 index e170a05..0000000 --- a/majority-vote/daniel/knowledge_base/ea0757d27fa67cd347d9f046b939a911f5c9a08d.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "company_name": "Canadian Banc Corp.", - "data_points": [ - { - "metric_type": "Gross Profit Margin", - "value": 0.657, - "currency": null, - "point_in_time": "2022-11-30" - }, - { - "metric_type": "operating margin", - "value": 0.1, - "currency": null, - "point_in_time": "2022-11-30" - }, - { - "metric_type": "Number of stores", - "value": 12.0, - "currency": null, - "point_in_time": "2022-11-30" - }, - { - "metric_type": "Return on Assets (ROA)", - "value": 0.072, - "currency": null, - "point_in_time": "2022-11-30" - }, - { - "metric_type": "research and development expenses", - "value": 3.2, - "currency": "USD", - "point_in_time": "2022-11-30" - }, - { - "metric_type": "research and development expenses", - "value": 3.5, - "currency": "USD", - "point_in_time": "2021-11-30" - }, - { - "metric_type": "market capitalization", - "value": 345.4, - "currency": "USD", - "point_in_time": "2022-11-30" - } - ], - "role_assignments": [ - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Wayne Finch", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Financial Officer (CFO)", - "person_name": "Silvia Gomes", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Board Chairman", - "person_name": "Peter Cruickshank", - "role_assignment_started_as_iso_date": null, - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/daniel/knowledge_base/faf8d7d79152d61279eda1cfb58b8236ce2f82fa.json b/majority-vote/daniel/knowledge_base/faf8d7d79152d61279eda1cfb58b8236ce2f82fa.json deleted file mode 100644 index f8486ba..0000000 --- a/majority-vote/daniel/knowledge_base/faf8d7d79152d61279eda1cfb58b8236ce2f82fa.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "company_name": "EMT", - "data_points": [ - { - "metric_type": "market capitalization", - "value": 0.0125, - "currency": "OTHER", - "point_in_time": "2022-06-30" - }, - { - "metric_type": "research and development expenses", - "value": 556353.0, - "currency": "OTHER", - "point_in_time": "2022-06-30" - }, - { - "metric_type": "operating margin", - "value": 4.515336, - "currency": "OTHER", - "point_in_time": "2022-06-30" - } - ], - "role_assignments": [ - { - "role_type": "Chief Executive Officer (CEO)", - "person_name": "Gary Lyons", - "role_assignment_started_as_iso_date": "2010-06-02", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Operating Officer (COO)", - "person_name": "Mathew Walker", - "role_assignment_started_as_iso_date": "2012-09-01", - "role_assignment_ended_as_iso_date": null - }, - { - "role_type": "Chief Legal Officer (CLO)", - "person_name": "Teck Wong", - "role_assignment_started_as_iso_date": "2021-03-22", - "role_assignment_ended_as_iso_date": null - } - ] -} \ No newline at end of file diff --git a/majority-vote/majority_vote/__main__.py b/majority-vote/majority_vote/__main__.py index 6046425..cb12da2 100644 --- a/majority-vote/majority_vote/__main__.py +++ b/majority-vote/majority_vote/__main__.py @@ -3,7 +3,7 @@ from collections import Counter from typing import Callable, Optional -import daniel.answer_question +import sample from dotenv import load_dotenv @@ -35,7 +35,8 @@ def majority_vote(items): AnswerFunction = Callable[[str, str], Optional[str]] -answer_functions = [ daniel.answer_question.answer_question ] +# TODO: Remove the sample answer_question function; add real functions. +answer_functions = [ sample.answer_question ] results = [] @@ -56,7 +57,7 @@ def majority_vote(items): results.append({ "question": question, "schema": item["schema"], - "answer": answer + "answer": "n/a" if answer is None else answer }) with open('results.json', 'w') as json_file: diff --git a/majority-vote/requirements.txt b/majority-vote/requirements.txt index 2cd5960..2035bca 100644 --- a/majority-vote/requirements.txt +++ b/majority-vote/requirements.txt @@ -1,4 +1 @@ python_dotenv==1.0.1 -pypdf2==3.0.1 -tiktoken==0.7.0 -openai==1.42.0 \ No newline at end of file diff --git a/majority-vote/results.json b/majority-vote/results.json index 108cad2..1ad4e00 100644 --- a/majority-vote/results.json +++ b/majority-vote/results.json @@ -2,201 +2,201 @@ { "question": "How much did \"Accuray Incorporated\" spend on risk management in Q2 2022?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "Who is the CEO in the company \"Zegona Communications plc\"?", "schema": "name", - "answer": "Eamonn O'Hare" + "answer": "n/a" }, { "question": "Did \"Global Medical REIT Inc.\" have a greater Debt-to-Equity ratio than \"Zegona Communications plc\" in Q2 2021?", "schema": "boolean", - "answer": null + "answer": "n/a" }, { "question": "How many stores did \"Accuray Incorporated\" have in the end of fiscal year 2021?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "How much did \"Sandwell Aquatics Centre\" spend on R&D in Q2 2023?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "Who is the CFO in the company \"EMT\"?", "schema": "name", - "answer": null + "answer": "n/a" }, { "question": "Did \"Calyxt, Inc.\" have a greater Return on Assets (ROA) than \"Global Medical REIT Inc.\" in Q2 2023?", "schema": "boolean", - "answer": null + "answer": "n/a" }, { "question": "How many stores did \"OTC_UNCIF\" have in the end of fiscal year 2022?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "How much did \"Accuray Incorporated\" spend on customer acquisition in Q2 2021?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "Who is the CEO in the company \"Accuray Incorporated\"?", "schema": "name", - "answer": "Suzanne Winter" + "answer": "n/a" }, { "question": "Did \"Comet Holding AG\" have a greater Operating Margin than \"Ethernity Networks Ltd\" in Q2 2022?", "schema": "boolean", - "answer": null + "answer": "n/a" }, { "question": "How many stores did \"VENUS METALS CORPORATION LIMITED\" have in the end of fiscal year 2022?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "How much did \"Ethernity Networks Ltd\" spend on R&D in Q2 2023?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "Who is the COO in the company \"Sandwell Aquatics Centre\"?", "schema": "name", - "answer": null + "answer": "n/a" }, { "question": "Did \"Calyxt, Inc.\" have a greater market capitalization than \"NICE\" in Q2 2022?", "schema": "boolean", - "answer": false + "answer": "n/a" }, { "question": "How many stores did \"Renishaw plc\" have in the end of fiscal year 2023?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "How much did \"TD SYNNEX\" spend on R&D in Q2 2022?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "Who is the CFO in the company \"TD SYNNEX\"?", "schema": "name", - "answer": "Marshall Witt" + "answer": "n/a" }, { "question": "Did \"Eurocell PLC\" have a greater Return on Equity (ROE) than \"Strike Energy Limited\" in Q2 2022?", "schema": "boolean", - "answer": null + "answer": "n/a" }, { "question": "How many stores did \"OTC_UNCIF\" have in the end of fiscal year 2023?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "How much did \"EMT\" spend on customer acquisition in Q2 2023?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "Who is the Board Chairman in the company \"Motus GI Holdings, Inc.\"?", "schema": "name", - "answer": "David Hochman" + "answer": "n/a" }, { "question": "Did \"Calyxt, Inc.\" have a greater Operating Margin than \"Banque Cantonale Vaudoise\" in Q2 2023?", "schema": "boolean", - "answer": null + "answer": "n/a" }, { "question": "How many stores did \"EMT\" have in the end of fiscal year 2023?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "How much did \"Ethernity Networks Ltd\" spend on customer acquisition in Q2 2023?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "Who is the CFO in the company \"Ethernity Networks Ltd\"?", "schema": "name", - "answer": "Mark Reichenberg" + "answer": "n/a" }, { "question": "Did \"Canadian Banc Corp.\" have a greater Return on Assets (ROA) than \"VENUS METALS CORPORATION LIMITED\" in Q2 2021?", "schema": "boolean", - "answer": null + "answer": "n/a" }, { "question": "How many stores did \"VENUS METALS CORPORATION LIMITED\" have in the end of fiscal year 2023?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "How much did \"Motus GI Holdings, Inc.\" spend on sustainability initiatives in Q2 2023?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "Who is the Board Chairman in the company \"Renishaw plc\"?", "schema": "name", - "answer": null + "answer": "n/a" }, { "question": "Did \"Canadian Banc Corp.\" have a greater Gross Profit Margin than \"Motus GI Holdings, Inc.\" in Q2 2022?", "schema": "boolean", - "answer": null + "answer": "n/a" }, { "question": "How many stores did \"VENUS METALS CORPORATION LIMITED\" have in the end of fiscal year 2021?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "How much did \"Renishaw plc\" spend on risk management in Q2 2022?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "Who is the Board Chairman in the company \"TD SYNNEX\"?", "schema": "name", - "answer": "Dennis Polk" + "answer": "n/a" }, { "question": "Did \"Banque Cantonale Vaudoise\" have a greater Operating Margin than \"Zegona Communications plc\" in Q2 2021?", "schema": "boolean", - "answer": null + "answer": "n/a" }, { "question": "How many stores did \"Strike Energy Limited\" have in the end of fiscal year 2021?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "How much did \"Ethernity Networks Ltd\" spend on customer acquisition in Q2 2023?", "schema": "number", - "answer": null + "answer": "n/a" }, { "question": "Who is the Chief Legal Officer in the company \"Nykredit\"?", "schema": "name", - "answer": "Anders Jensen" + "answer": "n/a" }, { "question": "Did \"Comet Holding AG\" have a greater Operating Margin than \"Calyxt, Inc.\" in Q2 2021?", "schema": "boolean", - "answer": null + "answer": "n/a" }, { "question": "How many stores did \"EMT\" have in the end of fiscal year 2022?", "schema": "number", - "answer": null + "answer": "n/a" } ] \ No newline at end of file diff --git a/majority-vote/sample/__init__.py b/majority-vote/sample/__init__.py new file mode 100644 index 0000000..97233c7 --- /dev/null +++ b/majority-vote/sample/__init__.py @@ -0,0 +1,4 @@ +# This is a sample 'answer_question' function that always answers 'I have no answer'. + +def answer_question(question, schema): + return None \ No newline at end of file From 5fcbe7c34545803a13c9f928803602e4fe96727f Mon Sep 17 00:00:00 2001 From: Daniel Weller <56622988+danielweller-swp@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:11:57 +0200 Subject: [PATCH 5/5] Update README.md --- majority-vote/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/majority-vote/README.md b/majority-vote/README.md index 6e370ca..4bc4281 100644 --- a/majority-vote/README.md +++ b/majority-vote/README.md @@ -17,7 +17,7 @@ pip install -r requirements.txt ## Adding your solution -Make a python package like `daniel`. It should have a function +Make a python package like `sample`. It should have a function like this: ``` @@ -31,4 +31,4 @@ Include this function in the list `answer_functions` in `__main__.py`. ``` python -m majority_vote -``` \ No newline at end of file +```