Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ETL process for migrating Schemes & Concepts from RDM tables to Lingo models #6

Merged
merged 53 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
81bf21d
Create RDM Migrator ETL module
johnatawnclementawn Jan 11, 2024
f2fd6e8
Stub out rdm migrator backend #2
johnatawnclementawn Jan 11, 2024
6595cd1
Stub out RDM migrator front end #2
johnatawnclementawn Jan 11, 2024
cd49d28
Move file to proper location #2
johnatawnclementawn Jan 25, 2024
e0f159c
Add migrate rdm task
johnatawnclementawn Jan 25, 2024
5317703
Gather graphs & init rdm migration on click submit #2
johnatawnclementawn Jan 25, 2024
0fa7faf
Update urls.py
johnatawnclementawn Jan 25, 2024
38fc806
Add further dependency and show/hide etl manager
johnatawnclementawn Jan 25, 2024
da587c8
Add button to kick off migration
johnatawnclementawn Jan 25, 2024
bd95c4f
Undo changes that caused malformed requests
johnatawnclementawn Jan 26, 2024
d91cf4b
Remove unused imports
johnatawnclementawn Jan 26, 2024
0ee7711
Place module in correct path #2
johnatawnclementawn Jan 26, 2024
08d6dd6
Make RDM migrator child class of BaseImport and cleanup unused import…
johnatawnclementawn Jan 28, 2024
00f9e1f
Make RDM migrator importer, not editor
johnatawnclementawn Jan 28, 2024
0e3fc53
nit #2
johnatawnclementawn Jan 31, 2024
deda1a3
Working on constructing tile data #2
johnatawnclementawn Jan 31, 2024
03c4e7e
Functional tile value generator #2
johnatawnclementawn Feb 5, 2024
4b5994a
Loading data into staging table #2
johnatawnclementawn Feb 6, 2024
b6e4acf
nit #2
johnatawnclementawn Feb 6, 2024
407d211
nit #2
johnatawnclementawn Feb 6, 2024
cb3e40d
Improve control flow and pass existing cursor #2
johnatawnclementawn Feb 6, 2024
ed2586a
Improve control flow #2
johnatawnclementawn Feb 6, 2024
58fb79d
Functional RDM etl creating new resources #2
johnatawnclementawn Feb 7, 2024
3165091
nit #2
johnatawnclementawn Feb 7, 2024
4c2b383
nit #2
johnatawnclementawn Feb 7, 2024
9e8feee
Functional ETL module for migrating RDM #2
johnatawnclementawn Feb 7, 2024
c6af024
Make rdm migrator reversible #2
johnatawnclementawn Feb 7, 2024
ec90031
Stub out using bulk_create #2
johnatawnclementawn Feb 8, 2024
be7745b
django will serialize json going into the db #2
johnatawnclementawn Feb 8, 2024
9afe9cc
Configure name & identifier mappings #2
johnatawnclementawn Feb 28, 2024
097f69e
Add relational views #2
johnatawnclementawn Feb 28, 2024
49d1c8c
Migrate relations to ADM models #2
johnatawnclementawn Feb 28, 2024
9870fcd
Model changes and concepts to facilitate demo of #2
johnatawnclementawn Feb 28, 2024
bf96dd1
stashing example concepts
johnatawnclementawn Feb 28, 2024
d804073
remove business data that conflict with graph changes
johnatawnclementawn Feb 28, 2024
d86f44c
Create relationships w/o using relational views #2
johnatawnclementawn Feb 29, 2024
cb69b0e
Move all processing to being processed thru celery #2
johnatawnclementawn Mar 4, 2024
02f6aa2
No longer using relational views #2
johnatawnclementawn Mar 4, 2024
b70b545
UI nits #2
johnatawnclementawn Mar 4, 2024
a02d759
remove unused import #2
johnatawnclementawn Mar 5, 2024
f97a249
nit #2
johnatawnclementawn Mar 5, 2024
64f4c20
Add altLabels and logic for celery/non celery #2
johnatawnclementawn Mar 5, 2024
df3fb1d
Improves UI sign posting and ETL status #2
johnatawnclementawn Mar 5, 2024
d7d0b64
nit #2
johnatawnclementawn Mar 5, 2024
df1ea4a
Cleaning up RDM to Lingo placeholder concepts #2
johnatawnclementawn Mar 11, 2024
e8af99e
Fixing graphs to point at correct RDM to Lingo placeholder concepts
johnatawnclementawn Mar 11, 2024
9a064ee
fix concept link #2
johnatawnclementawn Mar 13, 2024
9a07c3b
nit #2
johnatawnclementawn Mar 13, 2024
76f4a4b
Populate Part Of Scheme node #2
johnatawnclementawn Mar 13, 2024
29f11ca
Remove load errors on reverse migrate #2
johnatawnclementawn Mar 14, 2024
6056f19
Show etl manager for convenience
johnatawnclementawn Mar 14, 2024
ea69e3a
Adjust naming convention for Lingo etl module #2
johnatawnclementawn Apr 3, 2024
4344f91
Merge branch 'main' into 2_RDM_Migration_ETL
johnatawnclementawn May 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
332 changes: 332 additions & 0 deletions arches_rdm/etl_modules/migrate_to_lingo.py

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
define([
'knockout',
'knockout-mapping',
'jquery',
'uuid',
'arches',
'viewmodels/alert',
'viewmodels/alert-json',
'templates/views/components/etl_modules/migrate-to-lingo.htm',
], function(ko, koMapping, $, uuid, arches, AlertViewModel, JsonErrorAlertViewModel, migrateRDMTemplate) {
const viewModel = function(params) {
const self = this;

this.loadDetails = params.load_details;
this.state = params.state;
this.loading = params.loading || ko.observable();
this.alert = params.alert;
this.moduleId = params.etlmoduleid;
this.loadId = params.loadId || uuid.generate();
this.formData = new window.FormData();
this.graphs = ko.observable();
this.selectedLoadEvent = params.selectedLoadEvent || ko.observable();
this.formatTime = params.formatTime;
this.timeDifference = params.timeDifference;
this.activeTab = params.activeTab || ko.observable();
this.editHistoryUrl = `${arches.urls.edit_history}?transactionid=${ko.unwrap(params.selectedLoadEvent)?.loadid}`;

self.runRDMMigration = function() {
self.loading(true);
self.submit('start').then(data => {
params.activeTab("import");
self.formData.append('async', true);
self.submit('write').then(data => {
console.log(data.results);
}).fail(function(err) {
console.log(err);
self.alert(
new JsonErrorAlertViewModel(
'ep-alert-red',
err.responseJSON["data"],
null,
function(){}
)
)
}).always(() => {
self.loading(false);
});
}).fail(error => console.log(error.responseJSON.data));
};

this.submit = function(action) {
self.formData.append('action', action);
self.formData.append('loadid', self.loadId);
self.formData.append('module', self.moduleId);
return $.ajax({
type: "POST",
url: arches.urls.etl_manager,
data: self.formData,
cache: false,
processData: false,
contentType: false,
});
};
};
ko.components.register('migrate-to-lingo', {
viewModel: viewModel,
template: migrateRDMTemplate,
});
return viewModel;
});
69 changes: 69 additions & 0 deletions arches_rdm/migrations/0002_rdm_to_lingo_etl_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Generated by Django 4.2.8 on 2024-01-05 11:08

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('arches_rdm', '0001_initial'),
('models', '10260_add_iiifmanifest_globalid'),
]

add_migrate_to_lingo = """
INSERT INTO etl_modules (
etlmoduleid,
name,
description,
etl_type,
component,
componentname,
modulename,
classname,
config,
icon,
slug,
helpsortorder,
helptemplate,
reversible)
VALUES (
'11cad3ca-e155-44b1-9910-c50b3def47f6',
'Migrate to Lingo',
'Migrate schemes and concepts from the RDM to Arches Lingo',
'import',
'views/components/etl_modules/migrate-to-lingo',
'migrate-to-lingo',
'migrate_to_lingo.py',
'RDMMtoLingoMigrator',
'{"bgColor": "#ffa564", "circleColor": "#ffd2b1", "show": true}',
'fa fa-usb',
'migrate-to-lingo',
6,
'migrate-to-lingo-help',
true);
"""
remove_migrate_to_lingo = """
DELETE FROM load_staging WHERE loadid IN (SELECT loadid FROM load_event WHERE etl_module_id = '11cad3ca-e155-44b1-9910-c50b3def47f6');
DELETE FROM load_errors WHERE loadid IN (SELECT loadid FROM load_event WHERE etl_module_id = '11cad3ca-e155-44b1-9910-c50b3def47f6');
DELETE FROM load_event WHERE etl_module_id = '11cad3ca-e155-44b1-9910-c50b3def47f6';
DELETE FROM etl_modules WHERE etlmoduleid = '11cad3ca-e155-44b1-9910-c50b3def47f6';
"""

#TODO: Remove operation before shipping to users
show_etl_manager = """
UPDATE plugins SET config = '{"show": true}' WHERE pluginid = '7720e9fa-876c-4127-a77a-b099cd2a5d45';
"""
hide_etl_manager = """
UPDATE plugins SET config = '{"show": false}' WHERE pluginid = '7720e9fa-876c-4127-a77a-b099cd2a5d45';
"""

operations = [
migrations.RunSQL(
add_migrate_to_lingo,
remove_migrate_to_lingo,
),
migrations.RunSQL(
show_etl_manager,
hide_etl_manager,
),
]

This file was deleted.

This file was deleted.

Loading