As part for a Product Development Hiring Project for BriteCore. This is a solution for the problem where the data model is pretty rigid. This solution is focus to insurers can define their own custom data model for their risk.
For Backend I used Django and Django REST framework with two models:
class Risk(models.Model):
name = models.CharField(max_length=100)
description = models.CharField(max_length=500, blank=True)
def __str__(self):
return self.name
class Field(models.Model):
TYPE_CHOICES = (
('text', 'Text'),
('date', 'Date'),
('number', 'Number'),
)
name = models.CharField(max_length=100)
type = models.CharField(max_length=10, choices=TYPE_CHOICES,
default='text')
label = models.CharField(max_length=100)
risk = models.ForeignKey(Risk, on_delete=models.CASCADE)
def __str__(self):
return self.name
from risk.models import Risk, Field
Risk.objects.create(
name='automobile',
description='Risk for automobile insurance')
automobile = Risk.objects.create(
name='automobile',
description='Risk for automobile insurance')
Field.objects.create(
name='chassis',
type='text',
label='Chassis',
risk=automobile)
Field.objects.create(
name='color',
type='text',
label='Color',
risk=automobile)
Field.objects.create(
name='purchase_date',
type='date',
label='Purchase date',
risk=automobile)
Field.objects.create(
name='commercial_value',
type='number',
label='Commercial value',
risk=automobile)
person = Risk.objects.create(
name='person',
description='Risk for life insurance')
Field.objects.create(
name='first_name',
type='text',
label='First name',
risk=person)
Field.objects.create(
name='last_name',
type='text',
label='Last name',
risk=person)
Field.objects.create(
name='birth_date',
type='date',
label='Birth date',
risk=person)
For Frontend I used Vue.js and Boostrap
You can run the unit tests using the following command
python manage.py test
For Frontend I used Zappa
$ pip install zappa
$ zappa init
$ zappa deploy dev
Deploying..
Your application is now live at: https://itqbut4z6g.execute-api.us-east-1.amazonaws.com/dev/
Next you have to modify settings.py with credentials and host of AWS, then you can update your deploy:
$ zappa update dev
- Django - python Web framework
- Django REST framework - powerful and flexible toolkit for building Web APIs
- PostgreSQL - open source relational database
- Vue.js - JavaScript Framework
- Boostrap - open source toolkit for developing with HTML, CSS, and JS.
