survey-extraction/etl/simple_load_example.py
2025-03-28 16:09:03 +00:00

23 lines
689 B
Python

# A very simple script to read a presite note and load to a postgres database
import os
from etl.surveyedData.surveryedData import surveyedDataProcessor
from etl.db.db import get_db_session, init_db
from etl.transform.types import AssessorInfo
pre_site_note_path = os.path.join(os.getcwd(), "..", "example_data", "pre_site_note.pdf")
survey_one = surveyedDataProcessor("122 Fake Street", [pre_site_note_path])
assert survey_one.pre_site_note.assessor_information.accreditation_number == "QUID211435"
init_db()
assessor0 = AssessorInfo(
**survey_one.pre_site_note.assessor_information.__dict__
)
with get_db_session() as session:
session.add(assessor0)
session.commit()