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

Catima import/export format #3

Open
kj7rrv opened this issue Jan 15, 2022 · 16 comments
Open

Catima import/export format #3

kj7rrv opened this issue Jan 15, 2022 · 16 comments

Comments

@kj7rrv
Copy link
Owner

kj7rrv commented Jan 15, 2022

This needs to support the Catima import/export format.

@kj7rrv
Copy link
Owner Author

kj7rrv commented Jan 16, 2022

It doesn't look like Python supports creating encrypted ZIP files, and it can only decrypt them very slowly. (see https://docs.python.org/3/library/zipfile.html) Do you think it would be okay to not support encrypting exports (and possibly take a long time to decrypt them), or should I find another way (such as wrapping a command-line program)? @TheLastProject

@TheLastProject
Copy link
Collaborator

Sounds quite okay to me to not support creating encrypted exports. Maybe something to add later if there is demand but I wouldn't bother with it for a first release at all

@kj7rrv
Copy link
Owner Author

kj7rrv commented Jan 16, 2022

Okay, sounds good

@kj7rrv
Copy link
Owner Author

kj7rrv commented Jan 17, 2022

If one card is deleted and another is created, is it okay to reuse the first card's ID for the second card, or are the IDs used to keep cards in order?

@TheLastProject
Copy link
Collaborator

The IDs are implemented in Android as an automatically incrementing primary DB column.

I think it is probably best to not reuse IDs, just to keep it consistent for possible future syncing systems. Right now it is just an implementation detail though.

@kj7rrv
Copy link
Owner Author

kj7rrv commented Jan 17, 2022

Okay, sounds good.

@kj7rrv
Copy link
Owner Author

kj7rrv commented Jan 18, 2022

It doesn't look like the export format supports cards with different card and barcode IDs?

@kj7rrv
Copy link
Owner Author

kj7rrv commented Jan 18, 2022

Also, what should be stored if there is no balance? @TheLastProject

@TheLastProject
Copy link
Collaborator

It doesn't look like the export format supports cards with different card and barcode IDs?

It does. If the barcode ID is different, it is in the export. Otherwise that field is just empty.

Also, what should be stored if there is no balance?

Then the balance field should be empty.

Here is an example export CSV I use for Android screenshots, maybe it helps.

2

_id
Fashion
Food
Health

_id,store,note,expiry,balance,balancetype,cardid,barcodeid,barcodetype,headercolor,starstatus,lastused
1,Clothes Store,Note about store,,0,,qw,,,-1784274,0,1642268279
2,Department Store,,,0,,A,,,-9977996,0,0
3,Grocery Store,,1453633200000,50,,dhd,,,-9977996,0,1642194048
4,Pharmacy,,,0,,dhshsvshs,,,-10902850,0,0
5,Restaurant,Note about restaurant here,,0,,98765432,,CODE_128,-10902850,0,1642249330
6,Shoe Store,,,0,,zhxbx,,AZTEC,-1784274,0,0

cardId,groupId
1,Fashion
3,Food
4,Health
5,Food
6,Fashion

@kj7rrv
Copy link
Owner Author

kj7rrv commented Jan 18, 2022

Oh okay. It looks like the export format wiki page shows an old format? It has barcodetype but not barcodeid.

@TheLastProject
Copy link
Collaborator

Hmm, barcodeid seems to be there?

I moved the documentation to https://github.com/CatimaLoyalty/Docs by the way, so we can use GitHub issues to track documentation issues and use pull requests.

@kj7rrv
Copy link
Owner Author

kj7rrv commented Jan 18, 2022

Yes, it is in the page about the URL format, but not the one about the export CSV format.
Thank you for moving the pages! That will definitely be helpful.

@TheLastProject
Copy link
Collaborator

Ah, the example export is outdated. Good catch. I've created CatimaLoyalty/Docs#1 for that, will probably fix that tomorrow.

@kj7rrv
Copy link
Owner Author

kj7rrv commented Jan 19, 2022

So it looks like 0 for lastused means no value?

@kj7rrv
Copy link
Owner Author

kj7rrv commented Jan 19, 2022

Also, is headercolor mandatory, and if not, what should be the default?

@TheLastProject
Copy link
Collaborator

So it looks like 0 for lastused means no value?

The Android client indeed currently sets lastused to 0 if the card has never been opened in the client yet.

Also, is headercolor mandatory, and if not, what should be the default?
headercolor is not mandatory. The Android client generates a random colour each time you generate a new card, but you can manually choose another colour or use a picture (then it calculates the colour based on the dominant colour of this picture).

I will try to be more explicit in the documentation, probably move the fields to its own page and add 2 columns: "Required in import/export" and "Required in share link".

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