Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
enedis-konnector
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
Container Registry
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
web-et-numerique
Factory
LLLE_Project
enedis-konnector
Merge requests
!12
fix: remove duplicate hydrateAndFilter
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
fix: remove duplicate hydrateAndFilter
fix/optimization
into
dev
Overview
0
Commits
2
Pipelines
0
Changes
3
Merged
Yoan VALLET
requested to merge
fix/optimization
into
dev
3 years ago
Overview
0
Commits
2
Pipelines
0
Changes
3
Expand
0
0
Merge request reports
Compare
dev
version 1
77c7b149
3 years ago
dev (base)
and
latest version
latest version
d1674e38
2 commits,
3 years ago
version 1
77c7b149
1 commit,
3 years ago
3 files
+
8
−
8
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
src/index.js
+
6
−
6
Options
@@ -19,15 +19,19 @@ moment.tz.setDefault('Europe/Paris') // set the timezone
/*** Connector Constants ***/
const
manualExecution
=
process
.
env
.
COZY_JOB_MANUAL_EXECUTION
===
'
true
'
?
true
:
false
// Period for daily data
const
startDailyDate
=
manualExecution
?
moment
().
subtract
(
12
,
'
month
'
)
:
moment
().
subtract
(
32
,
'
month
'
)
const
startDailyDateString
=
startDailyDate
.
format
(
'
YYYY-MM-DD
'
)
// Period for half and hour data
const
startLoadDate
=
moment
().
subtract
(
7
,
'
day
'
)
const
startLoadDateString
=
startLoadDate
.
format
(
'
YYYY-MM-DD
'
)
// Period to define if the history is loaded
const
checkHistoryDate
=
moment
().
subtract
(
8
,
'
day
'
)
const
endDate
=
moment
()
const
endDateString
=
endDate
.
format
(
'
YYYY-MM-DD
'
)
// Endpoints config
const
baseUrl
=
'
https://gw.prd.api.enedis.fr
'
const
dailyDataURL
=
`
${
baseUrl
}
/v4/metering_data/daily_consumption`
const
loadCurveURL
=
`
${
baseUrl
}
/v4/metering_data/consumption_load_curve`
@@ -359,13 +363,9 @@ async function processData(data, doctype, filterKeys) {
const
parsedData
=
JSON
.
parse
(
data
)
const
intervalData
=
parsedData
.
meter_reading
.
interval_reading
const
formatedData
=
await
formateData
(
intervalData
,
doctype
)
// Remove data for existing days into the DB
const
filteredData
=
await
hydrateAndFilter
(
formatedData
,
doctype
,
{
keys
:
filterKeys
,
})
// Store new day data
await
storeData
(
f
ilter
edData
,
doctype
,
filterKeys
)
return
filte
redData
const
storedData
=
await
storeData
(
f
ormat
edData
,
doctype
,
filterKeys
)
return
sto
redData
}
/**
Loading