Reads a company filing you supply and writes notes on what it says - segments, risks, management commentary - into a Google Doc.
Uses
Google Docs
OpenAI
Write research notes from a company filing
companyName to blank.Set companyName to blank.filingSource to blank.Set filingSource to blank.notesDocumentLink to blank.Set notesDocumentLink to blank.topics to:Set topics to:Segment performance
Stated risks
Management commentary and outlookmaxFilingCharacters to 200000.Set maxFilingCharacters to 200000.notesDocumentLink split by /d/ and save it as notesLinkTail.Get the last item of notesDocumentLink split by /d/ and save it as notesLinkTail.notesLinkTail split by / and save it as notesDocumentId.Get the first item of notesLinkTail split by / and save it as notesDocumentId.notesDocumentId is emptyIf notesDocumentId is emptyYes
No
No steps
filingText to blank.Set filingText to blank.sourceLabel to blank.Set sourceLabel to blank.filingSource starts with httpIf filingSource starts with httpYes
filingSource doesn't contain /d/If filingSource doesn't contain /d/Yes
No
No steps
filingSource split by /d/ and save it as filingLinkTail.Get the last item of filingSource split by /d/ and save it as filingLinkTail.filingLinkTail split by / and save it as filingDocumentId.Get the first item of filingLinkTail split by / and save it as filingDocumentId.filingDocumentId is emptyIf filingDocumentId is emptyYes
No
No steps
sourceLabel to filingSource.Change sourceLabel to filingSource.readErrorIf a step below fails, save the error as readErrorTry
filingDocumentId. Save it as filingDocument.Read filingDocumentId. Save it as filingDocument.filingDocument.text and save it as filingText.Trim filingDocument.text and save it as filingText.On error
readError as text.Show in the output: Could not read the filing document: readError as text.No
sourceLabel to text pasted into the 'filingSource' step.Change sourceLabel to text pasted into the 'filingSource' step.filingSource and save it as filingText.Trim filingSource and save it as filingText.filingText is emptyIf filingText is emptyYes
No
No steps
filingText to maxFilingCharacters characters and save it as filingExtract.Shorten filingText to maxFilingCharacters characters and save it as filingExtract.filingText and save it as filingLength.Count the characters in filingText and save it as filingLength.filingExtract and save it as readLength.Count the characters in filingExtract and save it as readLength.filingLength as a number with thousands separators with 0 decimal places and save it as filingCount.Format filingLength as a number with thousands separators with 0 decimal places and save it as filingCount.readLength as a number with thousands separators with 0 decimal places and save it as readCount.Format readLength as a number with thousands separators with 0 decimal places and save it as readCount.Read all @filingCount characters of the filing. and save it as readLine.Build the text Read all @filingCount characters of the filing. and save it as readLine.readLength is less than filingLengthIf readLength is less than filingLengthYes
Read @readCount of @filingCount characters of the filing (cut short: the rest was not read; paste the sections you need, such as Risk Factors or Management's D... and save it as readLine.Build the text Read @readCount of @filingCount characters of the filing (cut short: the rest was not read; paste the sections you need, such as Risk Factors or Management's D... and save it as readLine.No
No steps
topics by a new line and save it as topicList.Split topics by a new line and save it as topicList.sections to an empty list.Set sections to an empty list.topicsWithoutNotes to an empty list.Set topicsWithoutNotes to an empty list.topicsNotCovered to an empty list.Set topicsNotCovered to an empty list.topicsWithNotes to an empty list.Set topicsWithNotes to an empty list.aiProblem to blank.Set aiProblem to blank.topicLine in topicList:For each topicLine in topicList:topicLine and save it as topic.Trim topicLine and save it as topic.topic is emptyIf topic is emptyYes
No
No steps
notes to blank.Set notes to blank.covered to blank.Set covered to blank.notesErrorIf a step below fails, save the error as notesErrorTry
companyName Topic: topic Filing extract: filingExtract and save it as topicReading.Run an AI agent: Company: companyName Topic: topic Filing extract: filingExtract and save it as topicReading.covered to topicReading.output.covered.Change covered to topicReading.output.covered.topicReading.output.notes and save it as notes.Trim topicReading.output.notes and save it as notes.On error
aiProblem to notesError.message.Change aiProblem to notesError.message.covered is noIf covered is noYes
topic to the end of topicsNotCovered and save it as topicsNotCovered.Add topic to the end of topicsNotCovered and save it as topicsNotCovered.No
No steps
covered is not yes or notes is emptyIf covered is not yes or notes is emptyYes
topic to the end of topicsWithoutNotes and save it as topicsWithoutNotes.Add topic to the end of topicsWithoutNotes and save it as topicsWithoutNotes.No
No steps
topicAdd topic
notes to the end of sections and save it as sections.topic to the end of topicsWithNotes and save it as topicsWithNotes.Add topic to the end of topicsWithNotes and save it as topicsWithNotes.topicsNotCovered with , and save it as notCoveredList.Join topicsNotCovered with , and save it as notCoveredList.topicsWithoutNotes with , and save it as withoutNotesList.Join topicsWithoutNotes with , and save it as withoutNotesList.sections is emptyIf sections is emptyYes
topicsWithoutNotes isn't emptyIf topicsWithoutNotes isn't emptyYes
withoutNotesList, so nothing was added to the notes document. Check that the OpenAI connection is working, then run it again. aiProblem.Stop and report a problem: No notes came back for withoutNotesList, so nothing was added to the notes document. Check that the OpenAI connection is working, then run it again. aiProblem.No
No steps
notCoveredList) is covered in the part of the filing that was read, so nothing was added to the notes document. readLine Check the topics in the 'topics' step, or give it the part of the filing that covers them.Stop and report a problem: None of the topics (notCoveredList) is covered in the part of the filing that was read, so nothing was added to the notes document. readLine Check the topics in the 'topics' step, or give it the part of the filing that covers them.No
No steps
sections with a blank line and save it as notesText.Join sections with a blank line and save it as notesText.notCoveredLine to blank.Set notCoveredLine to blank.topicsNotCovered isn't emptyIf topicsNotCovered isn't emptyYes
notCoveredLine to Change notCoveredLine to
Not covered in the part of the filing that was read: notCoveredList.No
No steps
failedLine to blank.Set failedLine to blank.topicsWithoutNotes isn't emptyIf topicsWithoutNotes isn't emptyYes
No notes came back for: @withoutNotesList (the AI step did not answer; run it again with just these in 'topics') and save it as failedLine.Build the text No notes came back for: @withoutNotesList (the AI step did not answer; run it again with just these in 'topics') and save it as failedLine.No
No steps
notesDocumentId.Add the heading '@companyName - filing research notes - today's date' to notesDocumentId.notesDocumentId.Add text to notesDocumentId.notesText
Source: sourceLabel
readLine@notCoveredLine@failedLine
These notes describe what the filing says. They are not investment advice - there is no recommendation, rating, price target or view on the company in them - and every figure should be checked against the fili...topicsWithNotes with , and save it as withNotesList.Join topicsWithNotes with , and save it as withNotesList.topicsWithoutNotes isn't emptyIf topicsWithoutNotes isn't emptyYes
withNotesList were added to the notes document, but no notes came back for withoutNotesList. Run it again with just those in the 'topics' step. aiProblem.Stop and report a problem: Notes on withNotesList were added to the notes document, but no notes came back for withoutNotesList. Run it again with just those in the 'topics' step. aiProblem.No
No steps
notCoveredNote to blank.Set notCoveredNote to blank.topicsNotCovered isn't emptyIf topicsNotCovered isn't emptyYes
Not covered in the part that was read: @notCoveredList. and save it as notCoveredNote.Build the text Not covered in the part that was read: @notCoveredList. and save it as notCoveredNote.No
No steps
withNotesList to the notes document. readLine@notCoveredNote.Finish the run: Added notes on withNotesList to the notes document. readLine@notCoveredNote.