CISOOnline

Cybersecurity trends in SEC filings

The total cost in tokens for development, debugging, and running was around $15, not expensive, but not something I’d likely develop for every project I have. The bulk of that cost came with the refinement and the addition of additional verification checks to ensure the data was correct.  Next projects might try to do this on my local computer using a local LLM like llama3 using ollama or maybe an agent that allows queries to the dataset this project created.

GEMINI_PROMPT = """
Analyze this SEC 10-K document and extract the following cybersecurity information.
Return the response strictly as a JSON object with these exact keys:
{
 "senior_cyber": "Name or title of the senior person responsible for cybersecurity. Provide a one word response either CISO, CTO, CSO, CIO, or position title.",
 "report_to": "Title or name of who the senior cybersecurity person reports to. one word response either CEO,
CTO, CSO, CIO, position title, or unknown. ",
 "board": "The board committee overseeing cybersecurity  Provide a 1-3 word answer. ",
 "standards": "The cybersecurity standards/frameworks used use provide 5-7 word answer. If unknown, state unknown. use acronyms if available (e.g., NIST, NIST CSF, NIST CSF 2.0, ISO 27001)",
 "years_of_experience": integer representing years of experience (use 0 if unknown)
}
"""
MODEL_ID = 'gemini-2.5-flash'
—----
               # 6. Update PostgreSQL
               upsert_query = """
                   INSERT INTO company_cyber_filings_v1_4 (ticker, filing_date, senior_cyber, reports_to, board, st
andards, years_of_experience)
                   VALUES (%s, %s, %s,%s,%s,%s,%s)
                   ON CONFLICT (ticker, filing_date)  
                   DO UPDATE SET
                       senior_cyber = EXCLUDED.senior_cyber,
                       reports_to = EXCLUDED.reports_to,
                       board = EXCLUDED.board,
                       standards = EXCLUDED.standards,
                       years_of_experience = EXCLUDED.years_of_experience;
               """
               # 4. Upload file 
               formatted_date = f"{year}-{month}-{day}" # Formatted for standard SQL DATE
               cursor.execute(upsert_query, (
                   prefix,
                   formatted_date,
                   gemini_data.get("senior_cyber"),
                   gemini_data.get("report_to"),
                   gemini_data.get("board"),
                   gemini_data.get("standards"),
                   gemini_data.get("years_of_experience")
               ))
               cursor.execute(upsert_query, (prefix,f"{year}{month}{day}"))
               conn.commit()
               print(f"  -> Saved to database.")

This article is published as part of the Foundry Expert Contributor Network.
Want to join?



Source link