checking everything in

parser
youainti 4 years ago
parent f3d73a5ac1
commit e4971ae2f6

@ -39,12 +39,8 @@ class VersionData():
self._completion_date = None
self._completion_date_category = None
self._overall_status = None
#Study Design
self._enrollment = None
self._enrollment_category = None
#Sponsors and Collaborators
self._sponsor = None
#self._sponsor_category = None #I don't believe this is included in the raw data
self._responsible_party = None
@ -361,17 +357,26 @@ def get_data_from_versions(nct_id,html, version_a_int, version_b_int):
if __name__ == "__main__":
for file in ["NCT00658567", "NCT01303796"]:
with open("./{}.html".format(file)) as fh:
version1, version2 = get_data_from_versions(file, fh.read(), 1,2)
print(version1.__dict__) #order messed up somewhere:w
print(version2.__dict__) #order messed up somewhere:w
with psycopg2.connect(dbname="aact_db", user="root", password="root",host="localhost") as db_connection:
#pull the requests from the db
with db_connection.cursor() as curse:
sql = """
SELECT nct_id, version_a,version_b, html
FROM http.responses
"""
responses = curse.execute(sql)
for response in responses.fetch_all():
#
nct_id, version_a, version_b, html = response
version1, version2 = get_data_from_versions(nct_id, html, version_a, version_b)
if version_b == version_a + 1:
version1.load_to_db(db_connection)
version2.load_to_db(db_connection)
else:
version2.load_to_db(db_connection)
with psycopg2.connect(dbname="aact_db", user="root", password="root",host="will-office") as db_connection:
version1.load_to_db(db_connection)
version2.load_to_db(db_connection)
#print(db_connection)
"""
Documentation:

Loading…
Cancel
Save