Skip to content

Commit b65ed3a

Browse files
committed
We are GPLv2. Also add documentation.
1 parent 9ff8509 commit b65ed3a

21 files changed

Lines changed: 710 additions & 5 deletions

LICENCE.md

Lines changed: 361 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# RemaTransactionParser
2+
3+
RemaTransactionParser is an utility for converting the JSON files exported by the GDRP data export tool of Rema 1000 (Norwegian grocery store) to more easily digestible formats - Excel 2003+ (XLSX) or a Database Import Script (SQL).
4+
5+
Once the data has been exported to Excel or a Database, it may be further analyzed to calculate the amount spent per product (or a group of products) in any given period. This may be useful for finding ways of reducing your monthly food expenditures (at least in Rema 1000 stores).
6+
7+
# Getting started
8+
## JSON File
9+
Due to new GDPR regulations, Rema 1000 has added an automated mechanism for retrieving all the transaction data associated with your user in the "Æ" Customer Loyalty App/Program. Depending on how much you do your grocery shopping in Rema 1000, this may be every grocery shopping trip since 2017, broken into invidual transactions and receipt entries.
10+
11+
To request this data, open the "Æ" app, then click the "profile" button to the right in the bottom menu bar. Then choose _"Vilkår og personvern"_, and click the blue button _"Vis mine data"_ in the resulting window. Click _"Gi meg innsyn i mine data"_, and enter an email address where you want the ZIP-file with the exported data to be sent.
12+
13+
Rema 100 will also send a password by SMS to the same phone number during login in the "Æ" app. This password must be used to decompress the ZIP-file, and extract the containing JSON-file.
14+
15+
## Install
16+
Before running RemaTransactionParser, first ensure that you have Java 8 or later installed on your system (check by running _java --version_). Download the latest version of Java either from java.com, adoptopenjdk.net or using the package manager of your operating system (if any).
17+
18+
To install RemaTransactionParser, download the latest release from "Releases", and simply extract (or build - see below) RemaTransactionParser to a folder. Optionally, you may add this folder to your PATH variable. Otherwise, always specify RemaTransactionParser by its full file path, or navigate to the folder (_cd_) in the command line.
19+
20+
## Running
21+
Executing the following command in the command line will convert the JSON-file to an Excel/SQL file. Substitue _source-json_ and _destination-file_ with the corresponding correct file paths:
22+
```bat
23+
RemaTransactionParser source-json destination-file
24+
```
25+
The file extension of _destination-file_ specifies the output format - either XLSX or SQL. You may override this behavior by using the -format flag.
26+
27+
## Command Line
28+
The full documentation of the command line arguments:
29+
```
30+
RemaTransactionParser [-f format] [-s] [-h] source destination
31+
-f format Specify the output format, either XLSX (Excel 2003) or SQL
32+
(Database Export script for SQLite). If not specified, the
33+
output file extension will be used instead.
34+
-s Enable stream mode, allowing the program to use standard
35+
output or standard input instead of the file system. Format
36+
must be specified if no output file is specified.
37+
-h Show this help text.
38+
source Path to the JSON-file with the exported Rema 1000 data.
39+
May be omitted in stream mode.
40+
destination Path to the output XLSX- or SQL-file where the conversion
41+
output will be written. May be omitted in stream mode.
42+
```
43+
44+
# Building
45+
The following dependencies must be installed to build RemaTransactionParser:
46+
- [Java 8](https://www.oracle.com/technetwork/java/javase/downloads/index.html) or later
47+
- [Maven](https://maven.apache.org/)
48+
49+
Then run _mvn package_ in the root RemaTransactionParser folder (with pom.xml). The final shaded JAR file can be found in _target/RemaTransactionParser.jar_.
50+
51+
Script files (.bat or .sh) are stored inside _release/_.
52+
53+
License
54+
----
55+
GPLv2

pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@
4141
<groupId>org.apache.maven.plugins</groupId>
4242
<artifactId>maven-shade-plugin</artifactId>
4343
<version>2.3</version>
44+
<configuration>
45+
<finalName>RemaTransactionParser</finalName>
46+
</configuration>
4447
<executions>
4548
<execution>
4649
<phase>package</phase>

src/main/java/com/comphenix/rema1000/Application.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* RemaTransactionParser - Utility program for converting Rema 1000 GDRP data JSON export files
3+
* Copyright (C) 2018 Kristian S. Stangeland
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the
6+
* GNU General Public License as published by the Free Software Foundation; either version 2 of
7+
* the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with this program;
14+
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
15+
* 02111-1307 USA
16+
*/
117
package com.comphenix.rema1000;
218

319
import com.comphenix.rema1000.io.excel.ExcelWriter;
@@ -121,8 +137,8 @@ public static void main(String[] args) throws IOException {
121137
System.out.println(" (Database Export script for SQLite). If not specified, the");
122138
System.out.println(" output file extension will be used instead.");
123139
System.out.println(" -s Enable stream mode, allowing the program to use standard");
124-
System.out.println(" output or standard input instead of the file system. Format must");
125-
System.out.println(" be specified if no output file is specified.");
140+
System.out.println(" output or standard input instead of the file system. Format");
141+
System.out.println(" must be specified if no output file is specified.");
126142
System.out.println(" -h Show this help text.");
127143
System.out.println(" source Path to the JSON-file with the exported Rema 1000 data.");
128144
System.out.println(" May be omitted in stream mode.");

src/main/java/com/comphenix/rema1000/DestinationFormat.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/**
2+
* RemaTransactionParser - Utility program for converting Rema 1000 GDRP data JSON export files
3+
* Copyright (C) 2018 Kristian S. Stangeland
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the
6+
* GNU General Public License as published by the Free Software Foundation; either version 2 of
7+
* the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with this program;
14+
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
15+
* 02111-1307 USA
16+
*/
117
package com.comphenix.rema1000;
218

319
public enum DestinationFormat {

src/main/java/com/comphenix/rema1000/io/AbstractTableWriter.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* RemaTransactionParser - Utility program for converting Rema 1000 GDRP data JSON export files
3+
* Copyright (C) 2018 Kristian S. Stangeland
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the
6+
* GNU General Public License as published by the Free Software Foundation; either version 2 of
7+
* the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with this program;
14+
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
15+
* 02111-1307 USA
16+
*/
117
package com.comphenix.rema1000.io;
218

319
import java.io.IOException;

src/main/java/com/comphenix/rema1000/io/DataTableConverter.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* RemaTransactionParser - Utility program for converting Rema 1000 GDRP data JSON export files
3+
* Copyright (C) 2018 Kristian S. Stangeland
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the
6+
* GNU General Public License as published by the Free Software Foundation; either version 2 of
7+
* the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with this program;
14+
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
15+
* 02111-1307 USA
16+
*/
117
package com.comphenix.rema1000.io;
218

319
import com.comphenix.rema1000.model.*;

src/main/java/com/comphenix/rema1000/io/DataWriter.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* RemaTransactionParser - Utility program for converting Rema 1000 GDRP data JSON export files
3+
* Copyright (C) 2018 Kristian S. Stangeland
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the
6+
* GNU General Public License as published by the Free Software Foundation; either version 2 of
7+
* the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with this program;
14+
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
15+
* 02111-1307 USA
16+
*/
117
package com.comphenix.rema1000.io;
218

319
import java.io.IOException;

src/main/java/com/comphenix/rema1000/io/TableWriter.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/*
2+
* RemaTransactionParser - Utility program for converting Rema 1000 GDRP data JSON export files
3+
* Copyright (C) 2018 Kristian S. Stangeland
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the
6+
* GNU General Public License as published by the Free Software Foundation; either version 2 of
7+
* the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with this program;
14+
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
15+
* 02111-1307 USA
16+
*/
117
package com.comphenix.rema1000.io;
218

319
import java.io.IOException;

src/main/java/com/comphenix/rema1000/io/excel/CellStyle.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1+
/*
2+
* RemaTransactionParser - Utility program for converting Rema 1000 GDRP data JSON export files
3+
* Copyright (C) 2018 Kristian S. Stangeland
4+
*
5+
* This program is free software; you can redistribute it and/or modify it under the terms of the
6+
* GNU General Public License as published by the Free Software Foundation; either version 2 of
7+
* the License, or (at your option) any later version.
8+
*
9+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10+
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11+
* See the GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License along with this program;
14+
* if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
15+
* 02111-1307 USA
16+
*/
117
package com.comphenix.rema1000.io.excel;
218

319
import org.dhatim.fastexcel.Worksheet;
420

521
import java.sql.Date;
622
import java.time.Instant;
7-
import java.time.ZonedDateTime;
823

924
@FunctionalInterface
1025
public interface CellStyle {

0 commit comments

Comments
 (0)