Connect to the postgres database (README for creds).
Then search for the key that's not being properly mapped.
vitalsigns=# SELECT * FROM data_input_ref_val_data WHERE key_value LIKE '18312';
table_id | key_value | return_value | effective_date
----------+-----------+--------------------+---------------------
35873981 | 18312 | MELISSA FRIER | 2023-02-03 00:00:00
35873980 | 18312 | PATILLAR, DOMINQUE | 2010-01-01 00:00:00
35873980 | 18312 | PHILLIPS, ASHLEY | 2010-01-01 00:00:00
27122 | 18312 | Ready | 2010-01-01 00:00:00
(4 rows)
There's a duplicated entry here, so we should delete the wrong one.
Just to be sure that this won't affect other tables, we can search for its usage on all processing layouts.
vitalsigns=# SELECT * FROM data_layout_field_param WHERE param_value LIKE '35873980' ORDER BY layout_id,field_id;
layout_id | field_id | param_name | param_value
-----------+----------+------------+-------------
11138967 | 55 | refTableId | 35873980
11138968 | 16 | refTableId | 35873980
11138969 | 15 | refTableId | 35873980
(3 rows)
Then we check those layouts to make sure that they all follow the same logic.
If this is not the case, you might need to create a new layout (call Melky).
vitalsigns=# SELECT * FROM data_layout_field WHERE layout_id = 11138967;
layout_id | field_id | field_name | field_path | field_type
-----------+----------+------------+------------+------------
11138967 | 55 | Agent Name | | 7
11138967 | 56 | Supervisor | | 7
(2 rows)
vitalsigns=# SELECT * FROM data_layout_field WHERE layout_id = 11138968;
layout_id | field_id | field_name | field_path | field_type
-----------+----------+------------+------------+------------
11138968 | 16 | Agent Name | | 7
11138968 | 17 | Supervisor | | 7
(2 rows)
vitalsigns=# SELECT * FROM data_layout_field WHERE layout_id = 11138969;
layout_id | field_id | field_name | field_path | field_type
-----------+----------+----------------------------+------------------+------------
11138969 | 15 | Agent Name | | 7
11138969 | 16 | Supervisor Name | | 7
11138969 | 37 | Free Reason From JSON | free-reason | 0
11138969 | 26 | Free Reason Filtered | | 20
11138969 | 25 | Free Reason Code | free-reason-code | 20
11138969 | 38 | Free Reason Code From JSON | free-reason-code | 0
(6 rows)
In this case, this reference table is only for "Agent Name" everywhere, so we can delete it.
First create the select to make sure that it's the only returning entry, since this table is constantly updating.
vitalsigns=# SELECT * FROM data_input_ref_val_data WHERE table_id = 35873980 AND key_value = '18312' AND return_value = 'PATILLAR, DOMINQUE';
table_id | key_value | return_value | effective_date
----------+-----------+--------------------+---------------------
35873980 | 18312 | PATILLAR, DOMINQUE | 2010-01-01 00:00:00
(1 row)
vitalsigns=# DELETE FROM data_input_ref_val_data WHERE table_id = 35873980 AND key_value = '18312' AND return_value = 'PATILLAR, DOMINQUE';
DELETE 1