← Back to Pull requests

cleanup and adaptive use #5

Open
cdbattags opened this pull request with 47 lines diff across 4 files
View on GitHub
cdbattags cdbattags commented on Dec 28, 2019 00:04 UTC
Author

Hi @farhadab,

Just wanted to go ahead and get this work-in-progress PR up.

Lemme know if you have any thoughts. I'd like to extend this primarily for EPS data.

Diff: 47 lines (+27 / -20) across 4 files Reviewer: farhadab Review duration: 3649323m
All Vouch review confidence checks passed
Residual risk 0.05 = Change Risk (0.38) × (1 − Review Confidence (0.86)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.38 · 47 lines diff across 4 files
0.38
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.91 · 5 substantive comment(s)
0.91
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
85%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.232
Real PR Conversation Timeline
10 items
farhadab farhadab commented on code on Dec 31, 2019 03:19 UTC
Code Review
setup.py:1
@@ -34,7 +34,6 @@
     license=about['__license__'],
     packages=['edgar'],
     keywords=['sec', 'edgar', 'financials', 'stock', 'fundamental', 'analysis'],
-    python_requires="==3.7",

I’m not clear on why the python version requirement would be removed. I know that i had to upgrade my version of python for certain parts of the code (can’t specifically remember which) and it’s also generally best practice to establish a baseline version, so perhaps we can do a “>= 3.7“, or whatever the syntax is.

farhadab farhadab commented on code on Dec 31, 2019 03:20 UTC
Code Review
edgar/filing.py:1
@@ -18,34 +18,49 @@ class Statements:
     # To resolve "could not find anything for ShortName..." error, likely need
     # to add the appropriate ShortName from the FilingSummary.xml here.
     # TODO: perhaps add guessing/best match functionality to limit this list
-    income_statements = ['consolidated statements of income',
-                    'consolidated statements of operations',
-                    'consolidated statement of earnings',
-                    'condensed consolidated statements of income (unaudited)',
-                    'condensed consolidated statements of income',
-                    'condensed consolidated statements of operations (unaudited)',
-                    'condensed consolidated statements of operations',
-                    'condensed consolidated statement of earnings (unaudited)',
-                    'condensed consolidated statement of earnings',
-                    'condensed statements of income',
-                    'condensed statements of operations',
-                    'condensed statements of operations and comprehensive loss'
-                    ]
-    balance_sheets = ['consolidated balance sheets',
-                    'consolidated statement of financial position',
-                    'condensed consolidated statement of financial position (current period unaudited)',
-                    'condensed consolidated statement of financial position (unaudited)',
-                    'condensed consolidated statement of financial position',
-                    'condensed consolidated balance sheets (current period unaudited)',
-                    'condensed consolidated balance sheets (unaudited)',
-                    'condensed consolidated balance sheets',
-                    'condensed balance sheets'
-                    ]
-    cash_flows = ['consolidated statements of cash flows',
-                    'condensed consolidated statements of cash flows (unaudited)',
-                    'condensed consolidated statements of cash flows',
-                    'condensed statements of cash flows'
-                    ]
+    income_statements = [
+        'consolidated statements of income',
+        'consolidated statements of operations',
+        'consolidated statement of earnings',
+        'condensed consolidated statements of income (unaudited)',
+        'condensed consolidated statements of income',
+        'condensed consolidated statements of operations (unaudited)',
+        'condensed consolidated statements of operations',
+
+        'interim condensed consolidated statements of operations',

The main functional change in this PR appears to be updates to the constants in the Statements class for “interim” statements. Could you please add tests for these so that i have clear examples of what prompted this need and so we can be confident that the changes have any negative consequences? In initially developing those constants i recall that certain names didn’t actually correspond to the 10-q and 10-k reports that we’re concerned with, so i prefer we be safe.

farhadab farhadab commented on Dec 31, 2019 03:28 UTC
Reviewer

Hi Christian,

Thanks for your interest in the project and for taking the time to contribute. I hadn’t really imagined that others would want contribute, hence the lack of contribution policy, development branch, automated testing and building, etc. So bear with me...

Firstly, good catch on the setup.py not packaging the data folder up. I wasn't familiar with MANIFEST.in, but it appears to be a fine choice to solve this issue as unfortunately I don't see a way for setuptools to just default to include everything under source control (would be my ideal solution for this simple project). I've added comments in-line with my remaining thoughts, please have a look.

For the extensions, I think it will be best if we create feature requests and work from there. Once this PR goes through I'll at least add a dev branch, contribution guidelines, a feature request template, and perhaps look into CI so that things are smoother going forward.

Thanks again!
Farhad

cdbattags cdbattags commented on Jan 18, 2020 01:33 UTC
Author

Ok, PR should be good to go now!

cdbattags cdbattags commented on code on Jan 18, 2020 01:33 UTC
Code Review
setup.py:1
@@ -34,7 +34,6 @@
     license=about['__license__'],
     packages=['edgar'],
     keywords=['sec', 'edgar', 'financials', 'stock', 'fundamental', 'analysis'],
-    python_requires="==3.7",

fixed

cdbattags cdbattags commented on Jan 18, 2020 01:34 UTC
Author

I also went ahead and added a minimal Dockerfile for this as well for a personal project.

Open to adding some more tooling like that?

farhadab farhadab commented on Jan 18, 2020 04:37 UTC
Contributor

Thanks @cdbattags! I see you removed the "interim" statements from filing.py...You had mentioned that there were some examples of companies that you came across that this library didn't work for - were you able to find those?

And yes, docker tooling is a nice idea. I guess you mean that you just added it locally though, right? Because I don't see it added here. Either way, we can update the README for that too to offer an alternative way of installing using just docker build && docker run.

farhadab farhadab commented on code on May 06, 2020 17:36 UTC
Code Review
edgar/financials.py:1
@@ -251,13 +251,18 @@ def _get_statement_meta_data(rows):
                     title_repeat = 0 if 'colspan' not in info.attrs or int(info.attrs['colspan']) == 1 else int(info.attrs['colspan']) - 1
                     # first th with tl class has title and unit specification
                     info_list = info.find('div').get_text('|', strip=True).split('|')
+
                     # e.g. shares in Thousands, $ in Millions
-                    unit_text = info_list[1]
+                    unit_text = ''

@cdbattags just revisiting this PR...this one i'm not sure about. if you can find a case that doesn't have length 2 then i'd like to see it, otherwise i would actually prefer the runtime error here so that we're alerted to such cases.

povilonisl povilonisl commented on code on Feb 13, 2021 15:27 UTC
Code Review
edgar/financials.py:1
@@ -251,13 +251,18 @@ def _get_statement_meta_data(rows):
                     title_repeat = 0 if 'colspan' not in info.attrs or int(info.attrs['colspan']) == 1 else int(info.attrs['colspan']) - 1
                     # first th with tl class has title and unit specification
                     info_list = info.find('div').get_text('|', strip=True).split('|')
+
                     # e.g. shares in Thousands, $ in Millions
-                    unit_text = info_list[1]
+                    unit_text = ''

DBX 2019 (don't remember which statement), it doesn't provide a unit, hence number are good as they are.

Thank you for all the work you did.

Reviewers
Assignees
cdbattags cdbattags
Labels
risk: low confidence: 85.6% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 37.5% (MEDIUM) · Higher = larger blast radius
37.5%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 85.6% · Lower = rushed or shallow review
85.6%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 5.4% · Safe to merge
5.4%