Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
raven-administration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
raven
raven-administration
Commits
115a1d9c
Commit
115a1d9c
authored
9 months ago
by
Christoffer Stoll
Browse files
Options
Downloads
Patches
Plain Diff
Bug: The call to Dataflows.get_dataflows() is replaced with Dataflows.get_xml()
parent
9d550fa0
No related branches found
No related tags found
1 merge request
!26
Bug: The call to Dataflows.get_dataflows() is replaced with Dataflows.get_xml()
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.md
+6
-0
6 additions, 0 deletions
CHANGELOG.md
api/endpoints/data/dataflow/routes.py
+27
-23
27 additions, 23 deletions
api/endpoints/data/dataflow/routes.py
api/endpoints/version/routes.py
+1
-1
1 addition, 1 deletion
api/endpoints/version/routes.py
with
34 additions
and
24 deletions
CHANGELOG.md
+
6
−
0
View file @
115a1d9c
...
...
@@ -3,6 +3,12 @@
All notable changes to this project will be documented in this file.
Changes before version 3.1.0 is not included
## [3.1.1] - 2024-06-28
### Fixed
-
The call to Dataflows.get_dataflows() is replaced with Dataflows.get_xml()
## [3.1.0] - 2024-05-15
### Added
...
...
This diff is collapsed.
Click to expand it.
api/endpoints/data/dataflow/routes.py
+
27
−
23
View file @
115a1d9c
...
...
@@ -18,7 +18,7 @@ dataflow_endpoint = Blueprint('dataflow', __name__)
@jwt_required_with_exporting_claim
()
def
dataflows
():
m
=
DataflowModel
(
**
request
.
args
.
to_dict
())
xml
=
Dataflows
.
get_
dataflow
(
m
.
type
,
m
.
year
,
m
.
timezone
,
m
.
description
)
xml
=
Dataflows
.
get_
xml
(
m
.
type
,
m
.
year
,
m
.
timezone
,
m
.
description
)
if
xml
==
None
:
raise
BadRequest
(
"
Could not create xml for dataflow
"
+
m
.
type
)
...
...
@@ -41,7 +41,7 @@ def dataflows_e2a():
def
dataflows_reportnet3
():
if
not
current_app
.
config
[
'
SHOWREPORTNET3
'
]:
return
jsonify
({
"
error
"
:
"
Reportnet3 dataflow is not enabled
"
}),
403
m
=
DataflowModel
(
**
request
.
args
.
to_dict
())
data
=
Dataflows_reportnet3
.
get_dataflow
(
m
.
type
,
m
.
year
,
m
.
timezone
,
m
.
description
)
if
not
data
:
...
...
@@ -50,23 +50,23 @@ def dataflows_reportnet3():
# Create a zip file in memory
zip_buffer
=
BytesIO
()
with
zipfile
.
ZipFile
(
zip_buffer
,
"
w
"
,
zipfile
.
ZIP_DEFLATED
)
as
zip_file
:
if
isinstance
(
data
,
list
):
# Convert data to a DataFrame and write it to a single CSV file
df
=
pd
.
DataFrame
(
data
)
csv_buffer
=
BytesIO
()
df
.
to_csv
(
csv_buffer
,
index
=
False
)
csv_buffer
.
seek
(
0
)
zip_file
.
writestr
(
"
reportnet3_dataflow.csv
"
,
csv_buffer
.
getvalue
())
else
:
for
filename
,
df
in
data
.
items
():
# Convert df to a DataFrame if it's a list
if
isinstance
(
df
,
list
):
df
=
pd
.
DataFrame
(
df
)
# Convert each DataFrame to a CSV and add it to the zip file
csv_buffer
=
BytesIO
()
df
.
to_csv
(
csv_buffer
,
index
=
False
)
csv_buffer
.
seek
(
0
)
zip_file
.
writestr
(
filename
,
csv_buffer
.
getvalue
())
if
isinstance
(
data
,
list
):
# Convert data to a DataFrame and write it to a single CSV file
df
=
pd
.
DataFrame
(
data
)
csv_buffer
=
BytesIO
()
df
.
to_csv
(
csv_buffer
,
index
=
False
)
csv_buffer
.
seek
(
0
)
zip_file
.
writestr
(
"
reportnet3_dataflow.csv
"
,
csv_buffer
.
getvalue
())
else
:
for
filename
,
df
in
data
.
items
():
# Convert df to a DataFrame if it's a list
if
isinstance
(
df
,
list
):
df
=
pd
.
DataFrame
(
df
)
# Convert each DataFrame to a CSV and add it to the zip file
csv_buffer
=
BytesIO
()
df
.
to_csv
(
csv_buffer
,
index
=
False
)
csv_buffer
.
seek
(
0
)
zip_file
.
writestr
(
filename
,
csv_buffer
.
getvalue
())
# Get the bytes of the zip file
zip_buffer
.
seek
(
0
)
...
...
@@ -78,43 +78,47 @@ def dataflows_reportnet3():
return
response
@dataflow_endpoint.route
(
'
/api/dataflow/showreportnet3
'
,
methods
=
[
'
GET
'
])
@jwt_required
()
def
show_reportnet3
():
return
jsonify
({
"
showreportnet3
"
:
current_app
.
config
[
'
SHOWREPORTNET3
'
]})
@dataflow_endpoint.route
(
'
/api/dataflow/reportnet3/b
'
,
methods
=
[
'
GET
'
])
@jwt_required_with_exporting_claim
()
def
dataflows_reportnet3_b
():
if
not
current_app
.
config
[
'
SHOWREPORTNET3
'
]:
return
jsonify
({
"
error
"
:
"
Reportnet3 dataflow is not enabled
"
}),
403
data
=
Dataflows_reportnet3
.
get_dataflowB
()
if
not
data
:
raise
BadRequest
(
"
No data for dataflow B found
"
)
return
jsonify
(
data
)
@dataflow_endpoint.route
(
'
/api/dataflow/reportnet3/d/processes
'
,
methods
=
[
'
GET
'
])
@jwt_required_with_exporting_claim
()
def
dataflows_reportnet3_d_processes
():
if
not
current_app
.
config
[
'
SHOWREPORTNET3
'
]:
return
jsonify
({
"
error
"
:
"
Reportnet3 dataflow is not enabled
"
}),
403
data
=
Dataflows_reportnet3
.
get_processes
()
if
not
data
:
raise
BadRequest
(
"
No data for dataflow D Processes found
"
)
return
jsonify
(
data
)
@dataflow_endpoint.route
(
'
/api/dataflow/reportnet3/d/samplingpoints
'
,
methods
=
[
'
GET
'
])
@jwt_required_with_exporting_claim
()
def
dataflows_reportnet3_d_samplingpoints
():
if
not
current_app
.
config
[
'
SHOWREPORTNET3
'
]:
return
jsonify
({
"
error
"
:
"
Reportnet3 dataflow is not enabled
"
}),
403
data
=
Dataflows_reportnet3
.
get_samplingpoints
()
if
not
data
:
raise
BadRequest
(
"
No data for dataflow D Samplingpoints found
"
)
return
jsonify
(
data
)
\ No newline at end of file
return
jsonify
(
data
)
This diff is collapsed.
Click to expand it.
api/endpoints/version/routes.py
+
1
−
1
View file @
115a1d9c
...
...
@@ -3,7 +3,7 @@ from flask_jwt_extended import create_access_token
import
requests
version_endpoint
=
Blueprint
(
'
version
'
,
__name__
)
current_version
=
"
3.1.
0
"
current_version
=
"
3.1.
1
"
@version_endpoint.route
(
'
/api/version
'
,
methods
=
[
'
GET
'
])
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment