Closed matthieu-foucault closed 2 years ago
Hey team! Please add your planning poker estimate with ZenHub @AlexZorkin @dleard @pbastia
Thank you for the walk through @dleard, much appreciated. I look forward to seeing this in TEST where the data will be more representative. Awesome work.
Description:
An import of the operators needs to be triggered every time the SWRS data is being transformed, and when the application is deployed.
To avoid the issues encountered with CIIP when the data is copied across databases with pg_dump/pg_restore, the connection to the SWRS database should instead be done with a foreign data wrapper. The FDW can be created and removed during the job that imports the list of operators.
Acceptance Criteria:
Given that I am installing or upgrading the cas-cif helm chart When the database is setup (after the sqitch plan is deployed) Then a
cif_private.import_swrs_operators(host, dbname, port, user password)
postgres function is run to import the operators from SWRSGiven that the
cif_private.import_swrs_operators
function exists When it is invoked Then it:postgres_fdw
extensionswrs.organisation
table into thecif.operator
tableGiven that the
swrs.organisation
foreign table is setup When operators are imported from it Then only the latest record for eachswrs_organisation_id
is imported (most recent reporting year and report submission date) And only theswrs_organisation_id
,business_legal_name
andenglish_trade_name
are importedGiven that an operator was previously imported When importing the operators Then fields that were edited in the CIF app should not be overwritten (i.e. we need to track editing of the legal and trade names)
Development Checklist:
cif.operator
has aswrs_organisation_id
columncif.operator
haslegal_name_updated_by_cif_user
andtrade_name_updated_by_cif_user
boolean columns tracking whether the fields were edited via the CIF app. That could be done via a trigger that is disabled during the importNotes:
-
Personas: