Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
wendelin
Commits
54c47e5e
Commit
54c47e5e
authored
Nov 27, 2017
by
Klaus Wölfel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
data analysis creation: automaticall add items such as device configuration and data configuration
parent
41fc9bb3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
19 deletions
+24
-19
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/ERP5Site_createDataAnalysisList.py
...al_skins/erp5_wendelin/ERP5Site_createDataAnalysisList.py
+24
-19
No files found.
bt5/erp5_wendelin/SkinTemplateItem/portal_skins/erp5_wendelin/ERP5Site_createDataAnalysisList.py
View file @
54c47e5e
...
...
@@ -25,7 +25,7 @@ for movement in portal_catalog(query):
if
movement
.
DataIngestionLine_hasMissingRequiredItem
():
raise
ValueError
(
"Transformation requires movement to have "
+
"aggregated data ingestion batch"
)
d
ata_ingestion
=
movement
.
getParentValue
()
d
elivery
=
movement
.
getParentValue
()
# Get applicable transformation
for
transformation
in
portal_catalog
(
portal_type
=
"Data Transformation"
,
...
...
@@ -35,23 +35,24 @@ for movement in portal_catalog(query):
data_analysis
=
portal_catalog
.
getResultValue
(
portal_type
=
"Data Analysis"
,
specialise_relative_url
=
transformation
.
getRelativeUrl
(),
causality_relative_url
=
d
ata_ingestion
.
getRelativeUrl
())
causality_relative_url
=
d
elivery
.
getRelativeUrl
())
if
data_analysis
is
not
None
:
continue
data_supply
=
delivery
.
getSpecialiseValueList
(
portal_type
=
"Data Supply"
)
# Create Analysis
data_analysis
=
portal
.
data_analysis_module
.
newContent
(
portal_type
=
"Data Analysis"
,
title
=
transformation
.
getTitle
(),
reference
=
d
ata_ingestion
.
getReference
(),
reference
=
d
elivery
.
getReference
(),
start_date
=
now
,
specialise_value
=
transformation
,
causality_value
=
d
ata_ingestion
,
source
=
d
ata_ingestion
.
getSource
(),
source_section
=
d
ata_ingestion
.
getSourceSection
(),
source_project
=
d
ata_ingestion
.
getSourceProject
(),
destination
=
d
ata_ingestion
.
getDestination
(),
destination_section
=
d
ata_ingestion
.
getDestinationSection
(),
destination_project
=
d
ata_ingestion
.
getDestinationProject
())
specialise_value
_list
=
[
transformation
]
+
data_supply
,
causality_value
=
d
elivery
,
source
=
d
elivery
.
getSource
(),
source_section
=
d
elivery
.
getSourceSection
(),
source_project
=
d
elivery
.
getSourceProject
(),
destination
=
d
elivery
.
getDestination
(),
destination_section
=
d
elivery
.
getDestinationSection
(),
destination_project
=
d
elivery
.
getDestinationProject
())
# create input and output lines
for
transformation_line
in
transformation
.
objectValues
(
...
...
@@ -62,14 +63,8 @@ for movement in portal_catalog(query):
if
isinstance
(
quantity
,
tuple
):
quantity
=
quantity
[
0
]
aggregate_set
=
set
()
# manually add device
and device configuration
to every line
# manually add device to every line
aggregate_set
.
add
(
movement
.
getAggregateDevice
())
# workaround the case that no device configuration portal type exists
# without this work around aggregate from any portal type
# would be returned, because getAggregateValue(portal_type=[]) does not
# return None as expected. This must be fixed properly in generic erp5
if
portal
.
getPortalDeviceConfigurationTypeList
():
aggregate_set
.
add
(
movement
.
getAggregateDeviceConfiguration
())
if
transformation_line
.
getPortalType
()
==
\
"Data Transformation Resource Line"
:
# at the moment, we only check for positive or negative quantity
...
...
@@ -107,13 +102,23 @@ for movement in portal_catalog(query):
item
=
module
.
newContent
(
portal_type
=
item_type
,
title
=
transformation
.
getTitle
(),
reference
=
"%s-%s"
%
(
transformation
.
getTitle
(),
data_ingestion
.
getReference
()),
delivery
.
getReference
()),
version
=
'001'
)
try
:
item
.
validate
()
except
AttributeError
:
pass
aggregate_set
.
add
(
item
.
getRelativeUrl
())
elif
transformation_line
.
getPortalType
()
==
\
"Data Transformation Operation Line"
:
# find other items such as device configuration and data configuration
# from data ingestion and data supply
composed
=
data_analysis
.
asComposedDocument
()
line_list
=
[
l
for
l
in
delivery
.
objectValues
(
portal_type
=
"Data Ingestion Line"
)]
line_list
+=
[
l
for
l
in
composed
.
objectValues
(
portal_type
=
"Data Supply Line"
)]
for
line
in
line_list
:
if
line
.
getResourceValue
().
getPortalType
()
==
"Data Operation"
:
aggregate_set
.
update
(
line
.
getAggregateList
())
data_analysis
.
newContent
(
portal_type
=
"Data Analysis Line"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment