-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
25 lines (17 loc) · 1.12 KB
/
Program.cs
File metadata and controls
25 lines (17 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using IPCAProcessor.Utils;
using IPCAProcessor.Models;
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
var extractedFileDirectory = Path.Combine(Environment.CurrentDirectory, "Output");
Directory.CreateDirectory(extractedFileDirectory);
await IPCASeriesDownloader.DownloadAndExtractAsync(extractedFileDirectory);
var ipcaSeries = IPCASeries.FromXls(Directory.GetFiles(extractedFileDirectory).Where(f => f.EndsWith("xls")).First());
var jsonData = ipcaSeries.ToJson(2010, 1, 2024, 12);
File.WriteAllText(Path.Combine(extractedFileDirectory, "IPCASeries.json"), jsonData);
ipcaSeries.Plot(IPCASeriesType.MonthlyVariation, 2010, 1, 2024, 12);
ipcaSeries.Plot(IPCASeriesType.ThreeMonthVariation, 2010, 1, 2024, 12);
ipcaSeries.Plot(IPCASeriesType.SixMonthVariation, 2010, 1, 2024, 12);
ipcaSeries.Plot(IPCASeriesType.TwelveMonthVariation, 2010, 1, 2024, 12);
ipcaSeries.Plot(IPCASeriesType.YearVariation, 2010, 1, 2024, 12);
ipcaSeries.ToCSV(2010, 1, 2024, 12);
var sqlData = ipcaSeries.ToSQL(2010, 1, 2024, 12);
File.WriteAllText(Path.Combine(extractedFileDirectory, "IPCASeries.sql"), sqlData);