Conduct Legal Research with AI: Part 2
Integrating the Constitution to Neo4j
I am currenlty building a graph database of Supreme Court cases in neo4j to model the behavior and decison making of the court.
In this post, I include the classes that I will be using to create individual nodes for the articles, sections, clauses, and subclauses of the Consititution.
Later, these will be related to cases and subjecst in order to train a tensorflow algorithm to recommend case law by issue area and to predict the outcome of cases.
Workflow
The basic workflow requires creating a node and then submitting it to the neo4j db. My previous posts have documented this process in detail. Review blog.jnapolitano.io/neo4j_integration/ for more information.
Neomodel Api Classes
The neomodel classes below generate the nodes to be integrated into the database.
Article Class
=
=
=
=
=
=
=
Section Class
=
=
=
=
=
=
=
=
Clause Class
=
=
=
=
=
=
=
=
Subclause Class
=
=
=
=
=
=
=
=
#sub_clause = Relationship("Subclause", "IS_SUBCLAUSE_OF")
Sample Application
The application below creates a dataframe with node objects that will be uploaded to the neo4j database. In order to accomplish an upload the .save() function must be called on the object.
#from neomodel import (config, StructuredNode, StringProperty, IntegerProperty,
# UniqueIdProperty, RelationshipTo, BooleanProperty, EmailProperty, Relationship,db)
#import NeoNodes as nn
#import GoogleServices
#import sparkAPI as spark
=
=
=
return
=
return
=
#pprint(path)
=
return
=
return
#pprint(justice_df)
#pprint(df.columns)
# df.apply(lambda x: print(x), axis =1)
=
return
=
#pprint(outfile)
return
=
= -2
= *
=
=
return True
#neo_applified = instantiate_neo_model_api()
=
=
#pprint(file_list)
#master_subject_table = create_master_subject_table()
#json_pipeline(file_list=file_list, master_subject_table=master_subject_table)
=
=
=
=
#pprint(justice_df)