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

Support GasReserve Data #58

Closed
rhazn opened this issue Nov 25, 2022 · 1 comment
Closed

Support GasReserve Data #58

rhazn opened this issue Nov 25, 2022 · 1 comment
Assignees

Comments

@rhazn
Copy link
Contributor

rhazn commented Nov 25, 2022

The Bundesnetzagentur publishes easy to parse CSV files here: https://www.bundesnetzagentur.de/DE/Gasversorgung/aktuelle_gasversorgung/_svg/Indikator3_Speicher/Indikator_Speicher.html?nn=1077982

A roughly working model is at the end of this description as "Gas Reserve Model", the file content as "CSV File Content".

Issues:

  • The header row includes a "." and spaces in names leading to Could not write to postgres database. syntax error at or near "." in these queries: CREATE TABLE IF NOT EXISTS Gas (.;Kritisch;Angespannt;Stabil;Speicherstand IST;gesetzliche Ziele text);, we should make sure those work by adding '' around column names in the postgres
  • Not all columns contain every datapoint, an easy fix (that is better than not being able to parse it) would be to drop rows that are not complete
  • The first value is a date string, we could add a build in datatype "date" that can parse it and save it as date in postgres

CSV File Content

.;Kritisch;Angespannt;Stabil;Speicherstand IST;gesetzliche Ziele
01.11.2022;95,0;95,0;100,0;99,19;95,00
02.11.2022;95,0;95,0;100,0;99,30;
03.11.2022;95,0;95,0;100,0;99,26;
04.11.2022;94,9;95,0;100,0;99,26;
05.11.2022;94,9;94,9;100,0;99,38;
06.11.2022;94,8;94,9;100,0;99,54;
07.11.2022;94,6;94,8;100,0;99,55;
08.11.2022;94,4;94,6;100,0;99,56;
09.11.2022;94,2;94,4;100,0;99,62;
10.11.2022;93,9;94,2;100,0;99,72;
11.11.2022;93,7;94,0;100,0;99,75;
12.11.2022;93,4;93,8;100,0;99,89;
13.11.2022;93,1;93,6;100,0;100,00;
14.11.2022;92,7;93,3;100,0;99,95;
15.11.2022;92,4;93,1;100,0;99,94;
16.11.2022;92,0;92,8;100,0;99,98;
17.11.2022;91,6;92,5;100,0;99,90;
18.11.2022;91,2;92,2;100,0;99,80;
19.11.2022;90,7;91,9;100,0;99,68;
20.11.2022;90,3;91,5;100,0;99,55;
21.11.2022;89,7;91,1;100,0;99,38;
22.11.2022;89,2;90,7;100,0;99,26;
23.11.2022;88,6;90,3;100,0;98,95;
24.11.2022;88,0;89,8;100,0;;
25.11.2022;87,4;89,3;100,0;;
26.11.2022;86,8;88,9;100,0;;
27.11.2022;86,2;88,4;100,0;;
28.11.2022;85,5;87,9;100,0;;
29.11.2022;84,9;87,3;100,0;;
30.11.2022;84,2;86,8;100,0;;
01.12.2022;83,5;86,3;100,0;;
02.12.2022;82,8;85,8;100,0;;
03.12.2022;82,1;85,2;100,0;;
04.12.2022;81,4;84,7;100,0;;
05.12.2022;80,7;84,1;100,0;;
06.12.2022;80,0;83,6;100,0;;
07.12.2022;79,3;83,1;100,0;;
08.12.2022;78,6;82,6;100,0;;
09.12.2022;77,9;82,0;100,0;;
10.12.2022;77,2;81,5;100,0;;
11.12.2022;76,5;81,0;100,0;;
12.12.2022;75,7;80,4;100,0;;
13.12.2022;75,0;79,8;100,0;;
14.12.2022;74,2;79,3;100,0;;
15.12.2022;73,5;78,7;100,0;;
16.12.2022;72,8;78,2;100,0;;
17.12.2022;72,1;77,7;100,0;;
18.12.2022;71,4;77,2;100,0;;
19.12.2022;70,7;76,7;100,0;;
20.12.2022;70,0;76,2;100,0;;
21.12.2022;69,3;75,7;100,0;;
22.12.2022;68,6;75,2;100,0;;
23.12.2022;67,9;74,7;100,0;;
24.12.2022;67,2;74,2;100,0;;
25.12.2022;66,4;73,6;100,0;;
26.12.2022;65,7;73,0;100,0;;
27.12.2022;64,9;72,4;100,0;;
28.12.2022;64,1;71,8;100,0;;
29.12.2022;63,3;71,3;100,0;;
30.12.2022;62,5;70,7;100,0;;
31.12.2022;61,8;70,2;100,0;;
01.01.2023;61,1;69,7;100,0;;
02.01.2023;60,5;69,3;100,0;;
03.01.2023;59,8;68,8;100,0;;
04.01.2023;59,2;68,4;100,0;;
05.01.2023;58,6;68,0;100,0;;
06.01.2023;57,9;67,5;100,0;;
07.01.2023;57,3;67,1;100,0;;
08.01.2023;56,6;66,6;100,0;;
09.01.2023;55,9;66,2;100,0;;
10.01.2023;55,3;65,7;100,0;;
11.01.2023;54,6;65,2;100,0;;
12.01.2023;53,9;64,8;100,0;;
13.01.2023;53,3;64,3;100,0;;
14.01.2023;52,6;63,8;100,0;;
15.01.2023;51,9;63,4;100,0;;
16.01.2023;51,2;62,9;100,0;;
17.01.2023;50,5;62,4;100,0;;
18.01.2023;49,8;61,9;100,0;;
19.01.2023;49,1;61,4;100,0;;
20.01.2023;48,4;60,9;100,0;;
21.01.2023;47,6;60,4;100,0;;
22.01.2023;46,9;59,8;100,0;;
23.01.2023;46,1;59,2;100,0;;
24.01.2023;45,3;58,7;100,0;;
25.01.2023;44,6;58,2;100,0;;
26.01.2023;43,9;57,7;100,0;;
27.01.2023;43,2;57,2;100,0;;
28.01.2023;42,5;56,7;100,0;;
29.01.2023;41,9;56,3;100,0;;
30.01.2023;41,3;55,9;100,0;;
31.01.2023;40,6;55,4;100,0;;
01.02.2023;40,0;55,0;100,0;;40,00
02.02.2023;39,4;54,6;100,0;;
03.02.2023;38,8;54,2;100,0;;
04.02.2023;38,1;53,7;100,0;;
05.02.2023;37,4;53,2;100,0;;
06.02.2023;36,7;52,7;100,0;;
07.02.2023;36,0;52,2;100,0;;
08.02.2023;35,2;51,7;100,0;;
09.02.2023;34,5;51,1;100,0;;
10.02.2023;33,7;50,5;100,0;;
11.02.2023;32,9;50,0;100,0;;
12.02.2023;32,1;49,4;100,0;;
13.02.2023;31,4;48,8;100,0;;
14.02.2023;30,7;48,3;100,0;;
15.02.2023;30,0;47,8;100,0;;
16.02.2023;29,3;47,4;100,0;;
17.02.2023;28,7;46,9;100,0;;
18.02.2023;28,1;46,5;100,0;;
19.02.2023;27,6;46,2;100,0;;
20.02.2023;27,0;45,9;100,0;;
21.02.2023;26,5;45,5;100,0;;
22.02.2023;26,0;45,2;100,0;;
23.02.2023;25,4;44,8;100,0;;
24.02.2023;24,9;44,5;100,0;;
25.02.2023;24,3;44,1;100,0;;
26.02.2023;23,8;43,7;100,0;;
27.02.2023;23,2;43,3;100,0;;
28.02.2023;22,6;42,9;100,0;;
01.03.2023;22,0;42,5;100,0;;
02.03.2023;21,4;42,1;100,0;;
03.03.2023;20,8;41,6;100,0;;
04.03.2023;20,2;41,3;100,0;;
05.03.2023;19,7;40,9;100,0;;
06.03.2023;19,2;40,6;100,0;;
07.03.2023;18,7;40,3;100,0;;
08.03.2023;18,3;40,0;100,0;;
09.03.2023;17,8;39,7;100,0;;
10.03.2023;17,5;39,5;100,0;;
11.03.2023;17,1;39,3;100,0;;
12.03.2023;16,7;39,1;100,0;;
13.03.2023;16,4;38,9;100,0;;
14.03.2023;16,1;38,7;100,0;;
15.03.2023;15,7;38,5;100,0;;
16.03.2023;15,4;38,3;100,0;;
17.03.2023;15,0;38,0;100,0;;
18.03.2023;14,6;37,8;100,0;;
19.03.2023;14,2;37,5;100,0;;
20.03.2023;13,8;37,2;100,0;;
21.03.2023;13,4;37,0;100,0;;
22.03.2023;13,0;36,7;100,0;;
23.03.2023;12,7;36,5;100,0;;
24.03.2023;12,4;36,3;100,0;;
25.03.2023;12,1;36,1;100,0;;
26.03.2023;11,9;35,9;100,0;;
27.03.2023;11,7;35,8;100,0;;
28.03.2023;11,5;35,7;100,0;;
29.03.2023;11,4;35,7;100,0;;
30.03.2023;11,3;35,7;100,0;;
31.03.2023;11,3;35,6;100,0;;
01.04.2023;11,2;35,6;100,0;;

Gas Reserve Model

block GasReserveExtractor oftype CSVFileExtractor {
	url: "https://www.bundesnetzagentur.de/_tools/SVG/js2/_functions/csv_export.html?view=renderCSV&id=1089590";
}

layout GasReserveLayout {
	header row 1: text;
	column A: text;
	column B: decimal;
	column C: decimal;
	column D: decimal;
	column E: decimal;
	column F: decimal;
}

block GasReserveValidator oftype LayoutValidator {
	layout: GasReserveLayout;
}

block GasReserveLoader oftype PostgresLoader {
	host: requires HUB_DB_HOST;
	port: requires HUB_DB_PORT;
	username: requires HUB_DB_USERNAME;
	password: requires HUB_DB_PASSWORD;
	database: requires HUB_DB_DATABASE;
	table: requires HUB_DB_TABLE;
}

pipe {
	from: GasReserveExtractor;
	to: GasReserveValidator;
}

pipe {
	from: GasReserveValidator;
	to: GasReserveLoader;
}
felix-oq added a commit that referenced this issue Nov 29, 2022
felix-oq added a commit that referenced this issue Dec 1, 2022
@felix-oq felix-oq self-assigned this Dec 2, 2022
@felix-oq
Copy link
Contributor

felix-oq commented Dec 5, 2022

Completed as we won't implement a built in date type until value types are added to the language.

@felix-oq felix-oq closed this as completed Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants