TheThingsNetwork / lorawan-devices

Device Repository for LoRaWAN devices
Apache License 2.0
183 stars 360 forks source link

Generate CSV for Partner Portal #749

Closed LDannijs closed 3 months ago

LDannijs commented 4 months ago

Summary

Generate a csv file with information regarding all the devices in the Device Repository for use in the Partner Portal. Issue #745 @benolayinka

image

Changes

Checklist for Reviewers

Notes for Reviewers

Release Notes

benolayinka commented 4 months ago

As far as resizing images, I think @mjamescompton is using Hugo in this repo to build the website and might already be doing some image resizing

benolayinka commented 4 months ago

@LDannijs it looks like there are duplicate devices in the csv, is this maybe because it's generating one per profile or something? we need at least one unique identifier per device

@adriansmares I also broke the table at that API endpoint testing w dummy data, so I'll have to update the secret before we merge this

Screenshot 2024-02-22 at 11 26 08
LDannijs commented 4 months ago

Just took a look and it seems some devices are named differently in filename but have the same name/description. Minor changes usually, for example the AM319 has an AM319L model without lcd, but is named AM319 in device name. I'll see if i can update the titles of these devices.

johanstokking commented 4 months ago

@LDannijs probably good to add a validation for the uniqueness of the name then.

The namespace should however not be global; there can be multiple "LoRaWAN street light module" from different vendors.

What do we do with resizing images? Can we let the partner portal frontend do it? I'd prefer that anyway than doing it here.

LDannijs commented 4 months ago

@johanstokking good idea, i will add it to this PR

LDannijs commented 4 months ago

Alright this should fix it @benolayinka, can you check if the validation looks good @johanstokking?

benolayinka commented 4 months ago

@LDannijs moving csv.js to /bin breaks the makefile, and running node bin/csv.js throws an error because there is a relative ../vendor path somewhere. Can you please update csv.js so that it can be run from the makefile as node bin/csv.js, since that is how it will be run in production?

benolayinka commented 4 months ago

@LDannijs I tested the latest push and there is still one duplicate, "Flood Sensor"

Screenshot 2024-02-27 at 12 04 41
benolayinka commented 4 months ago

Yeah, I need a single unique identifying field. You could generate an ID as a hash of the name and vendor or something.

LDannijs commented 4 months ago

@benolayinka added an id field thats just device name + vendor, should do the trick. Rolled back some of those name changes too.

LDannijs commented 3 months ago

So i noticed Dragino has some devices missing in their index.yaml file, which doesn't make them show up on the site/stack, but i tried to fix them yet they have codec issues that i unfortunately cannot fix myself.

johanstokking commented 3 months ago

Thanks, this now looks good to me.

KrishnaIyer commented 3 months ago

@LDannijs: for future PRs use the format Closes #<issue number> in your description. This will automatically close the issue when the PR is merged.

johanstokking commented 3 months ago

@Jaime-Trinidad can you review so that we can merge this?

Jaime-Trinidad commented 3 months ago

@Jaime-Trinidad can you review so that we can merge this?

I reviewed and tested it, devices.csv looks fine.