Export and generate links only accessible to auth'd user #2

Open
opened 2021-07-14 10:30:10 +02:00 by pratyush · 2 comments
Owner

@georg need your help with this a bit. Is the hugz.io concept you implemented similar.

I intend to have quite a few features and I have an option to use Limnoria’s HTTP server as well. For example it would be swell if I can export json, and import json with compliant applications. I want to use something like an index for each dose i.e. like a primary key. So then you can technically reference that allowing me to add commands like –annotate “details of any kind maybe even linking tripreports.”

export isnt just dumping it all. It could be filtered. Say i wanna retrieve all my mph doses so filtered queries.

And lastly … ircart if you want it. I wanna generate a graph of frequency of doses with substances. I took a look at some libraries.

TLDR i need auth fixed and then i need a sorta ‘api’ for users to interact with.

@georg need your help with this a bit. Is the hugz.io concept you implemented similar. I intend to have quite a few features and I have an option to use Limnoria's HTTP server as well. For example it would be swell if I can export json, and import json with compliant applications. I want to use something like an index for each dose i.e. like a primary key. So then you can technically reference that allowing me to add commands like --annotate "details of any kind maybe even linking tripreports." export isnt just dumping it all. It could be filtered. Say i wanna retrieve all my mph doses so filtered queries. And lastly ... ircart if you want it. I wanna generate a graph of frequency of doses with substances. I took a look at some libraries. TLDR i need auth fixed and then i need a sorta 'api' for users to interact with.
Owner

I did not see this til now. Where do you need “auth fixed” and what do you need an “api” interface to? Re: idose: To add primary key to doses you can store them in a SQL database, and then export to JSON from there. Or you use hashed key/value pairs in Redis, if you don’t intend them to be full-text searchable and only want to go by indexes.

I did not see this til now. Where do you need "auth fixed" and what do you need an "api" interface to? Re: idose: To add primary key to doses you can store them in a SQL database, and then export to JSON from there. Or you use hashed key/value pairs in Redis, if you don't intend them to be full-text searchable and only want to go by indexes.
Owner

Regarding export/import with compliant applications, I’ve made a drug logger for Android (https://play.google.com/store/apps/details?id=me.pred.imperium). Was told to share how I format the data for an entry, so here goes

{
            "key": "5430ed52-ba6d-4427-b304-7aaa7f503573 4e430eb0-8790-11eb-b4fe-191a5b9ab527",
            "stashKey": "285b360c-5dd0-40d9-b911-68195c3306c6 4e430eb0-8790-11eb-b7b8-c543c188db7c",
            "substanceName": "Amphetamine",
            "ROA": {
                "iconPath": "assets/icons/oral.svg",
                "name": "Oral",
                "dose": {
                    "units": null,
                    "threshold": null,
                    "light": null,
                    "common": null,
                    "strong": null,
                    "heavy": null
                },
                "duration": {
                    "total": null,
                    "onset": null,
                    "comeup": null,
                    "peak": null,
                    "offset": null,
                    "afterglow": null
                }
            },
            "amount": 97.0,
            "multiplier": 1.0,
            "externalUser": false,
            "date": {
                "day": 22,
                "month": 2,
                "year": 2021,
                "hour": 4,
                "minute": 28,
                "second": 27
            },
            "notes": "",
            "shortcutIndex": -1,
            "noteKeys": [],
            "substanceKey": 534,
            "stashBoxKey": 65
},

The key is the unique identifier for the entry. For importing, it’s not stricly necessary as the app will generate the identifier during import. But if it’s present, it’ll be imported. This is important if the imported log is from my own app as the stash needs to know the key for the entries.

My app uses stashes to organize drugs, so the app will present the available stashes as options for the entry. The stashKey field is the key for said stash. The app works without stashes though so entries with no stashKey are still valid entries.

substanceName determines what substance the entry contains, obviously.

The dose and duration fields for ROA are not needed for importing or exporting as the app will figure out the correct ROA based on the name field.

amount should be self explanatory. The multiplier is used for example when you got 3 pills at 5mg and use all 3. The amount would then be 5 and the multiplier would be 3.

externalUser is a property my app uses for when you’re sharing drugs from your own stash with others. This is used to ensure that the entry doesn’t count towards the user’s own statistics within the app.

An entry can contain a note of sorts, so notes got that covered.

shortcutIndex is used to determine if the entry is a shortcut and not a real “entry”. You can create shortcuts to drugs to quickly add an entry, prefilled. Might get deprecated in the future though.

You can create “note entries” for entries as well. noteKeys would hold a list of the notes added to said entry.

substanceKey is used internally in the app to refer to the index of the substance tied to the entry. This field is set while loading the log and is used internally to get the substance for the entry. Not needed for import/export.

stashBoxKey is much like substanceKey. It’s set while loading the log and is used internally to get the relevant stash. Not needed for import/export.

Regarding export/import with compliant applications, I've made a drug logger for Android (https://play.google.com/store/apps/details?id=me.pred.imperium). Was told to share how I format the data for an entry, so here goes ``` { "key": "5430ed52-ba6d-4427-b304-7aaa7f503573 4e430eb0-8790-11eb-b4fe-191a5b9ab527", "stashKey": "285b360c-5dd0-40d9-b911-68195c3306c6 4e430eb0-8790-11eb-b7b8-c543c188db7c", "substanceName": "Amphetamine", "ROA": { "iconPath": "assets/icons/oral.svg", "name": "Oral", "dose": { "units": null, "threshold": null, "light": null, "common": null, "strong": null, "heavy": null }, "duration": { "total": null, "onset": null, "comeup": null, "peak": null, "offset": null, "afterglow": null } }, "amount": 97.0, "multiplier": 1.0, "externalUser": false, "date": { "day": 22, "month": 2, "year": 2021, "hour": 4, "minute": 28, "second": 27 }, "notes": "", "shortcutIndex": -1, "noteKeys": [], "substanceKey": 534, "stashBoxKey": 65 }, ``` The key is the unique identifier for the entry. For importing, it's not stricly necessary as the app will generate the identifier during import. But if it's present, it'll be imported. This is important if the imported log is from my own app as the stash needs to know the key for the entries. My app uses stashes to organize drugs, so the app will present the available stashes as options for the entry. The stashKey field is the key for said stash. The app works without stashes though so entries with no stashKey are still valid entries. substanceName determines what substance the entry contains, obviously. The dose and duration fields for ROA are not needed for importing or exporting as the app will figure out the correct ROA based on the name field. amount should be self explanatory. The multiplier is used for example when you got 3 pills at 5mg and use all 3. The amount would then be 5 and the multiplier would be 3. externalUser is a property my app uses for when you're sharing drugs from your own stash with others. This is used to ensure that the entry doesn't count towards the user's own statistics within the app. An entry can contain a note of sorts, so notes got that covered. shortcutIndex is used to determine if the entry is a shortcut and not a real "entry". You can create shortcuts to drugs to quickly add an entry, prefilled. Might get deprecated in the future though. You can create "note entries" for entries as well. noteKeys would hold a list of the notes added to said entry. substanceKey is used internally in the app to refer to the index of the substance tied to the entry. This field is set while loading the log and is used internally to get the substance for the entry. Not needed for import/export. stashBoxKey is much like substanceKey. It's set while loading the log and is used internally to get the relevant stash. Not needed for import/export.
This repo is archived. You cannot comment on issues.
No description provided.