From cac90831226ddcbbff455cd95c8ccff395b5f766 Mon Sep 17 00:00:00 2001
From: edmondsgarrett <43251554+edmondsgarrett@users.noreply.github.com>
Date: Mon, 8 May 2023 16:23:30 -0500
Subject: [PATCH] task/WP-89: Registration form UTH feedback (#152)
* Add registration id to success message for registration form
* Reg form changes: org type dropdown now passes correct org code back to db, removed submission type from form (and every other use of this field from views, forms, db util functions), and removed min/max length and pattern restrictions on entity license and NAIC codes
* Move file type selection to entities on reg form
* Database updates for moving file types to entities
* Change list registrations table & modal to show file types moved to entities
---
.../static/admin_regis_table/css/table.css | 6 +-
.../templates/list_registrations.html | 20 +-
.../templates/view_registration_modal.html | 26 +-
apcd-cms/src/apps/admin_regis_table/views.py | 73 ++---
.../registration_form_body.html | 303 +++++++-----------
.../registration_form_scripts.html | 83 ++++-
.../submission_form/submission_success.html | 2 +
apcd-cms/src/apps/registrations/views.py | 5 +-
apcd-cms/src/apps/utils/apcd_database.py | 74 +++--
9 files changed, 279 insertions(+), 313 deletions(-)
diff --git a/apcd-cms/src/apps/admin_regis_table/static/admin_regis_table/css/table.css b/apcd-cms/src/apps/admin_regis_table/static/admin_regis_table/css/table.css
index a06aa08d..2f562820 100644
--- a/apcd-cms/src/apps/admin_regis_table/static/admin_regis_table/css/table.css
+++ b/apcd-cms/src/apps/admin_regis_table/static/admin_regis_table/css/table.css
@@ -122,8 +122,6 @@
.registration-table td:nth-of-type(1):before { content: "Business Name"; }
.registration-table td:nth-of-type(2):before { content: "Type"; }
.registration-table td:nth-of-type(3):before { content: "Location"; }
- .registration-table td:nth-of-type(4):before { content: "Submission"; }
- .registration-table td:nth-of-type(5):before { content: "Registration Status"; }
- .registration-table td:nth-of-type(6):before { content: "Files to Submit"; }
- .registration-table td:nth-of-type(7):before { content: "Actions"; }
+ .registration-table td:nth-of-type(4):before { content: "Registration Status"; }
+ .registration-table td:nth-of-type(5):before { content: "Actions"; }
}
diff --git a/apcd-cms/src/apps/admin_regis_table/templates/list_registrations.html b/apcd-cms/src/apps/admin_regis_table/templates/list_registrations.html
index b9b0431f..551fb28f 100644
--- a/apcd-cms/src/apps/admin_regis_table/templates/list_registrations.html
+++ b/apcd-cms/src/apps/admin_regis_table/templates/list_registrations.html
@@ -36,29 +36,13 @@
{{r.biz_name}}
-
- {% if r.type == 'Pbm'%}
- Pharmacy Benefit Manager (PBM)
- {% else %}
- {{r.type}}
- {% endif %}
-
+ {{r.type}}
{{r.location}}
- {{r.sub_method}}
{{r.reg_status}}
-
-
- {% for file_type in r.files_type %}
- {% if file_type != None %}
- {{file_type}}
- {% endif %}
- {% endfor %}
-
-
{% include "view_registration_modal.html" %}
{% include "edit_registration_modal.html" %}
- {% include "create_submitter_modal.html" %}
+ {% include "create_submitter_modal.html" %}
Select Action
View Record
diff --git a/apcd-cms/src/apps/admin_regis_table/templates/view_registration_modal.html b/apcd-cms/src/apps/admin_regis_table/templates/view_registration_modal.html
index e2ca0a3a..e4ca8e7c 100644
--- a/apcd-cms/src/apps/admin_regis_table/templates/view_registration_modal.html
+++ b/apcd-cms/src/apps/admin_regis_table/templates/view_registration_modal.html
@@ -35,20 +35,6 @@ Organization
- File Submission
-
-
- Types of Files
- {% for file_type, file_type_selected in r.view_modal_content.files_type.items %}
- {% if file_type_selected %}
- {{file_type}}
- {% endif %}
- {% endfor %}
- Submission Method
- {{r.view_modal_content.sub_method}}
-
-
-
Entity/Entities Being Registered
{% for entity in r.view_modal_content.entities%}
@@ -62,6 +48,18 @@ Entity {{forloop.counter}}
{{entity.license}}
NAIC Company Code
{{entity.naic}}
+ File Submission
+
+
+ Types of Files
+ {% for file_type, file_type_selected in entity.files_type.items %}
+ {% if file_type_selected %}
+ {{file_type}}
+ {% endif %}
+ {% endfor %}
+
+
+
Coverage Estimates (Inclusive of all claims as of December 31 of previous year.)
Total Covered Lives
{{entity.no_covered}}
diff --git a/apcd-cms/src/apps/admin_regis_table/views.py b/apcd-cms/src/apps/admin_regis_table/views.py
index 0605dac2..8295bf0d 100644
--- a/apcd-cms/src/apps/admin_regis_table/views.py
+++ b/apcd-cms/src/apps/admin_regis_table/views.py
@@ -83,25 +83,22 @@ def get_context_data(self, registrations_content, registrations_entities, regist
context = super(RegistrationsTable, self).get_context_data(*args, **kwargs)
def _set_registration(reg, reg_ents, reg_conts):
+ org_types = {
+ 'carrier': 'Insurance Carrier',
+ 'tpa_aso': 'Plan Administrator¹ (TPA/ASO)',
+ 'pbm': 'Pharmacy Benefit Manager (PBM)'
+ }
return {
- 'biz_name': reg[13],
- 'type': reg[12].title() if reg[12] else None,
+ 'biz_name': reg[7],
+ 'type': org_types[reg[6]] if (reg[6] and reg[6] in org_types.keys()) else None,
'location': '{city}, {state}'.format
(
- city=reg[15],
- state=reg[16]
+ city=reg[9],
+ state=reg[10]
),
- 'files_type': [
- "Medical" if reg[6] else None,
- "Provider" if reg[5] else None,
- "Eligibility/Enrollment" if reg[4] else None,
- "Pharmacy" if reg[7] else None,
- "Dental" if reg[8] else None
- ],
- 'sub_method': reg[10],
- 'reg_status': reg[11].title(),
+ 'reg_status': reg[5].title(),
'reg_id': reg[0],
- 'view_modal_content': _set_modal_content(reg, reg_ents, reg_conts)
+ 'view_modal_content': _set_modal_content(reg, reg_ents, reg_conts, org_types)
}
def _set_entities(reg_ent):
return {
@@ -112,7 +109,14 @@ def _set_entities(reg_ent):
'naic': reg_ent[5] if reg_ent[5] else None,
'no_covered': reg_ent[6],
'ent_name': reg_ent[7],
- 'fein': reg_ent[8] if reg_ent[8] else None
+ 'fein': reg_ent[8] if reg_ent[8] else None,
+ 'files_type': {
+ "Eligibility/Enrollment": reg_ent[9],
+ "Provider": reg_ent[10],
+ "Medical": reg_ent[11],
+ "Pharmacy": reg_ent[12],
+ "Dental": reg_ent[13]
+ }
}
def _set_contacts(reg_cont):
@@ -137,32 +141,20 @@ def format_phone_number(num):
'role': reg_cont[3],
'name': reg_cont[4],
'phone': format_phone_number(reg_cont[5]),
- 'email': reg_cont[6]
+ 'email': reg_cont[6],
}
- def _set_modal_content(reg, reg_ent, reg_cont):
+ def _set_modal_content(reg, reg_ent, reg_cont, org_types):
return {
- 'biz_name': reg[13],
- 'type': reg[12].title() if reg[12] else None,
- 'city': reg[15],
- 'state': reg[16],
- 'address': reg[14],
- 'zip': reg[17],
- 'files_type': {
- "Eligibility/Enrollment": reg[4],
- "Provider": reg[5],
- "Medical": reg[6],
- "Pharmacy": reg[7],
- "Dental": reg[8]
- },
- 'for_self': reg[9],
- 'sub_method': reg[10],
+ 'biz_name': reg[7],
+ 'type': org_types[reg[6]] if (reg[6] and reg[6] in org_types.keys()) else None,
+ 'city': reg[9],
+ 'state': reg[10],
+ 'address': reg[8],
+ 'zip': reg[11],
+ 'for_self': reg[4],
'entities': [_set_entities(ent) for ent in reg_ent],
'contacts': [_set_contacts(cont) for cont in reg_cont],
- 'org_types': {
- 'Insurance Carrier': 'Insurance Carrier',
- 'Plan Administrator': 'Plan Administrator¹ (TPA/ASO)',
- 'Pbm': 'Pharmacy Benefit Manager (PBM)'
- },
+ 'org_types': org_types,
'us_state_list': [
'AL - Alabama',
'AK - Alaska',
@@ -220,14 +212,9 @@ def _set_modal_content(reg, reg_ent, reg_cont):
'WI - Wisconsin',
'WY - Wyoming'
],
- 'sub_methods': {
- 'sftp': 'SFTP',
- 'https': 'HTTPS',
- 'usb': 'Encrypted USB Drive'
- }
}
- context['header'] = ['Business Name', 'Type', 'Location', 'Submission Method', 'Registration Status', 'Files to Submit', 'Actions']
+ context['header'] = ['Business Name', 'Type', 'Location', 'Registration Status', 'Actions']
context['filter_options'] = ['All', 'Received', 'Processing', 'Complete']
registration_table_entries = []
for registration in registrations_content:
diff --git a/apcd-cms/src/apps/registrations/templates/submission_form/registration_form_body.html b/apcd-cms/src/apps/registrations/templates/submission_form/registration_form_body.html
index 86a4e4e1..fdcd326f 100644
--- a/apcd-cms/src/apps/registrations/templates/submission_form/registration_form_body.html
+++ b/apcd-cms/src/apps/registrations/templates/submission_form/registration_form_body.html
@@ -69,7 +69,7 @@
>
{% if r.view_modal_content %}
{% for type, display_text in r.view_modal_content.org_types.items %}
-
+
{{display_text}}
{% endfor %}
@@ -235,162 +235,6 @@
/>
- File Submission
-
-
- Types of Files*
-
-
- Eligibility/Enrollment files are mandatory. Select additional file types to be submitted.
-
-
-
-
-
-
Submission Method*
-
-
- At least one of the following must be selected.
-
-
-
-
-
-
{% if r.view_modal_content %}
Entity/Entities Being Registered
{% for entity in r.view_modal_content.entities %}
@@ -451,20 +295,17 @@
Your submission was successful.
+
+ Your registration ID is: {{ reg_id }} .
Go to Dashboard
diff --git a/apcd-cms/src/apps/registrations/views.py b/apcd-cms/src/apps/registrations/views.py
index d110c3bb..9096c8aa 100644
--- a/apcd-cms/src/apps/registrations/views.py
+++ b/apcd-cms/src/apps/registrations/views.py
@@ -67,8 +67,9 @@ def post(self, request):
template = loader.get_template('submission_form/submission_error.html')
response = HttpResponse(template.render({}, request))
else:
+ context = {'reg_id': reg_resp}
template = loader.get_template('submission_form/submission_success.html')
- response = HttpResponse(template.render({}, request))
+ response = HttpResponse(template.render(context, request))
tracker.create_ticket(
Queue=RT_QUEUE,
@@ -76,7 +77,7 @@ def post(self, request):
Text=description,
Requestors=email
)
-
+
return response
diff --git a/apcd-cms/src/apps/utils/apcd_database.py b/apcd-cms/src/apps/utils/apcd_database.py
index f40ae386..924ae6e2 100644
--- a/apcd-cms/src/apps/utils/apcd_database.py
+++ b/apcd-cms/src/apps/utils/apcd_database.py
@@ -90,13 +90,7 @@ def get_registrations(reg_id=None):
registrations.posted_date,
registrations.applicable_period_start,
registrations.applicable_period_end,
- registrations.file_me,
- registrations.file_pv,
- registrations.file_mc,
- registrations.file_pc,
- registrations.file_dc,
registrations.submitting_for_self,
- registrations.submission_method,
registrations.registration_status,
registrations.org_type,
registrations.business_name,
@@ -136,13 +130,7 @@ def create_registration(form):
posted_date,
applicable_period_start,
applicable_period_end,
- file_me,
- file_pv,
- file_mc,
- file_pc,
- file_dc,
submitting_for_self,
- submission_method,
registration_status,
org_type,
business_name,
@@ -150,19 +138,13 @@ def create_registration(form):
city,
state,
zip
- ) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
+ ) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
RETURNING registration_id"""
values = (
datetime.now(),
None,
None,
- True,
- True if 'types_of_files_provider' in form else False,
- True if 'types_of_files_medical' in form else False,
- True if 'types_of_files_pharmacy' in form else False,
- True if 'types_of_files_dental' in form else False,
True if form['on-behalf-of'] == 'true' else False,
- _clean_value(form['submission_method']),
'Received',
_clean_value(form['type']),
_clean_value(form['business-name']),
@@ -201,12 +183,7 @@ def update_registration(form, reg_id):
cur = conn.cursor()
operation = """UPDATE registrations
SET
- file_pv = %s,
- file_mc = %s,
- file_pc = %s,
- file_dc = %s,
submitting_for_self = %s,
- submission_method = %s,
org_type = %s,
business_name = %s,
mail_address = %s,
@@ -217,12 +194,7 @@ def update_registration(form, reg_id):
WHERE registration_id = %s
RETURNING registration_id"""
values = (
- True if 'types_of_files_provider' in form else False,
- True if 'types_of_files_medical' in form else False,
- True if 'types_of_files_pharmacy' in form else False,
- True if 'types_of_files_dental' in form else False,
True if form['on-behalf-of'] == 'true' else False,
- _clean_value(form['submission_method']),
_clean_value(form['type']),
_clean_value(form['business-name']),
_clean_value(form['mailing-address']),
@@ -268,7 +240,12 @@ def get_registration_entities(reg_id=None):
registration_entities.naic_company_code,
registration_entities.total_covered_lives,
registration_entities.entity_name,
- registration_entities.fein
+ registration_entities.fein,
+ registration_entities.file_me,
+ registration_entities.file_pv,
+ registration_entities.file_mc,
+ registration_entities.file_pc,
+ registration_entities.file_dc,
FROM registration_entities {f"WHERE registration_id = {str(reg_id)}" if reg_id is not None else ''}"""
cur = conn.cursor()
cur.execute(query)
@@ -301,7 +278,12 @@ def create_registration_entity(form, reg_id, iteration, from_update_reg=None):
_set_int(form['naic_company_code_{}'.format(str_end)]),
_set_int(form['total_covered_lives_{}'.format(str_end)]),
_clean_value(form['entity_name_{}'.format(str_end)]),
- _clean_value(form['fein_{}'.format(str_end)])
+ _clean_value(form['fein_{}'.format(str_end)]),
+ True,
+ True if 'types_of_files_provider_{}'.format(str_end) in form else False,
+ True if 'types_of_files_medical_{}'.format(str_end) in form else False,
+ True if 'types_of_files_pharmacy_{}'.format(str_end) in form else False,
+ True if 'types_of_files_dental_{}'.format(str_end) in form else False
)
else:
str_end = f'_{iteration}_{reg_id}' if from_update_reg else ''
@@ -313,7 +295,12 @@ def create_registration_entity(form, reg_id, iteration, from_update_reg=None):
_set_int(form[f'naic_company_code{str_end}']),
_set_int(form[f'total_covered_lives{str_end}']),
_clean_value(form[f'entity_name{str_end}']),
- _clean_value(form[f'fein{str_end}'])
+ _clean_value(form[f'fein{str_end}']),
+ True,
+ True if 'types_of_files_provider{}'.format(str_end) in form else False,
+ True if 'types_of_files_medical{}'.format(str_end) in form else False,
+ True if 'types_of_files_pharmacy{}'.format(str_end) in form else False,
+ True if 'types_of_files_dental{}'.format(str_end) in form else False
)
operation = """INSERT INTO registration_entities(
@@ -324,8 +311,13 @@ def create_registration_entity(form, reg_id, iteration, from_update_reg=None):
naic_company_code,
total_covered_lives,
entity_name,
- fein
- ) VALUES (%s,%s,%s,%s,%s,%s,%s,%s)"""
+ fein,
+ file_me,
+ file_pv,
+ file_mc,
+ file_pc,
+ file_dc
+ ) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"""
conn = psycopg2.connect(
host=APCD_DB['host'],
@@ -370,6 +362,10 @@ def update_registration_entity(form, reg_id, iteration, no_entities):
_set_int(form['total_covered_lives_{}'.format(str_end)]),
_clean_value(form['entity_name_{}'.format(str_end)]),
_clean_value(form['fein_{}'.format(str_end)]),
+ form['types_of_files_provider_{}'.format(str_end)],
+ form['types_of_files_medical_{}'.format(str_end)],
+ form['types_of_files_pharmacy_{}'.format(str_end)],
+ form['types_of_files_dental_{}'.format(str_end)],
reg_id,
form[f'ent_id_{iteration}']
)
@@ -389,7 +385,11 @@ def update_registration_entity(form, reg_id, iteration, no_entities):
naic_company_code = %s,
total_covered_lives = %s,
entity_name = %s,
- fein = %s
+ fein = %s,
+ file_pv = %s,
+ file_mc = %s,
+ file_pc = %s,
+ file_dc = %s
WHERE registration_id = %s AND registration_entity_id = %s
"""
cur = conn.cursor()
@@ -646,14 +646,13 @@ def create_submitter(form, reg_data):
file_mc,
file_pc,
file_dc,
- submission_method,
submitting_for_self,
submitter_code,
payor_code,
encryption_key,
created_at,
status
- ) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
+ ) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)
RETURNING submitter_id"""
values = (
reg_data[0],
@@ -663,7 +662,6 @@ def create_submitter(form, reg_data):
reg_data[4],
reg_data[7],
reg_data[8],
- reg_data[10],
reg_data[9],
form['submit_code'],
_set_int(form['payor_code']),