This version has been updated for an ENV driven build thru the deploy_sql.py file. The SQLAlchemy build has also been modified to work with MySQL/MariaDB. Nothing major has been changed besides that.
You probably know what you're doing if you're messing with this, so hopefully you don't need support. 🙂
- Failed foreign key constraint party.py#L844 party.py#L871
Due to some odd issue with relationship_type_code
& relationship_begin_date
- an error is popping up on build.
This is a DB error and not an error with SQLAlchemy. Following is the error message:
sqlalchemy.exc.DatabaseError: (mysql.connector.errors.DatabaseError) 1822 (HY000): Failed to add the foreign key constraint. Missing index for constraint 'party_relationship_role_ibfk_3' in the referenced table 'party_relationship'
[SQL:
CREATE TABLE party_relationship_role (
party_relationship_role_id INTEGER NOT NULL AUTO_INCREMENT,
party_id INTEGER,
related_party_id INTEGER,
relationship_type_code VARCHAR(10),
relationship_begin_date DATE,
party_role_code VARCHAR(10),
role_begin_date DATE,
PRIMARY KEY (party_relationship_role_id),
FOREIGN KEY(party_id) REFERENCES party_relationship (party_id),
FOREIGN KEY(related_party_id) REFERENCES party_relationship (related_party_id),
FOREIGN KEY(relationship_begin_date) REFERENCES party_relationship (begin_date),
FOREIGN KEY(party_role_code) REFERENCES party_role (party_role_code)
)
PCDM is a SQLAlchemy implementation of Object Management Group's Property Casualty Data Model. The Property Casualty Data Model is a relational database schema that closely resembles the backend of an insurance company. This package allows you to deploy a SQLite database within seconds for testing, and can be tweaked to support Postgres and other relational database systems.
PCDM contains 256 tables from 13 subject area models (SAMs):
- Party - all persons, organizations, and groups involved in the insurance agreement
- Account and Agreement - customer, insurer, and vendor agreements
- Policy - policy information
- Claim - claim information
- Assessment - information pertaining to assesment (credit scoring, appraisals)
- Agreement Role - roles involved in agreements (providers, producers, suppliers)
- Claim Role - roles involved in claims (claimaints, adjusters)
- Staffing Role - roles involved in staffing (employees and contractors)
- Party Subtype - groupings and subgroupings of parties
- Insurable Object - things that can be insured (vehicles, structures)
- Money - transaction information
- Event - event information
- Product - product information (line of business, limits, coverage)
According to the Object Management Group:
Anyone can download specifications from the OMG website for free, write software implementations that conform to the specifications, and use them, give them away, or sell them. Neither OMG membership nor license is required for this.
This repository requires sqlalchemy, so install it if you don't have it:
pip3 install sqlalchemy
or
pip3 install -r requirements.txt
The file deploy_sqlite contains a script that can be used to deploy a SQLite database:
git clone https://github.com/genedan/PCDM
cd PCDM
python3 deploy_sqlite.py
This package is also available on PyPI:
pip3 install pcdm