Skip to content

Commit

Permalink
deleted: batchpredict.py
Browse files Browse the repository at this point in the history
	modified:   openaicall.py
	modified:   tests/test_batchpredict.py
  • Loading branch information
PedroDnT committed Jun 24, 2024
1 parent 2846e87 commit 908cc25
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 56 deletions.
43 changes: 0 additions & 43 deletions batchpredict.py

This file was deleted.

13 changes: 1 addition & 12 deletions openaicall.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import json
import pandas as pd


def create_prompt(income_statement, balance_sheet):
prompt = f"""
Analyze the following financial statements to predict if the company's earnings will increase or decrease next year.
Expand Down Expand Up @@ -182,17 +181,6 @@ def get_predictions_ppxt(company_code):
return predictions

def process_response_ppxt(answer):
"""
Processes a list of responses, extracts data from a specific JSON structure,
and returns a formatted Pandas DataFrame.
Args:
answer: A list of dictionaries, where each dictionary represents a response.
Returns:
A Pandas DataFrame with extracted data formatted into columns:
'earnings direction', 'magnitude', 'confidence score', 'summary of rationale'.
"""
def clean_json(content):
content = content.replace('\n', '').replace('\\"', '"')
return json.loads(content)
Expand All @@ -213,6 +201,7 @@ def clean_json(content):
df['row_format'] = df.apply(lambda x: f"{x.get('earnings direction', '')}|{x.get('magnitude', '')}|{x.get('confidence score', '')}|{x.get('summary of rationale', '')}", axis=1)
#drop row_format column
df = df.drop(columns=['row_format'], axis=1)
# add column with company name
return df

if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion tests/test_batchpredict.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import unittest
from unittest.mock import patch
from batchpredict import get_predictions_for_valid_cvm_codes
from oldbatch.batchpredict import get_predictions_for_valid_cvm_codes

class TestBatchPredict(unittest.TestCase):
@patch('batchpredict.get_predictions')
Expand Down

0 comments on commit 908cc25

Please sign in to comment.