M17-Project / REPEATER

Repeater Entry Provides Extremely Accurate and True Estimates of Range
2 stars 4 forks source link

Barebones Chirp CSV Export #3

Open tarxvftech opened 2 years ago

tarxvftech commented 2 years ago

Make a view that allows for creating and downloading CSV files in the Chirp format, like so:

Location,Name,Frequency,Duplex,Offset,Tone,rToneFreq,cToneFreq,DtcsCode,DtcsPolarity,Mode,TStep,Skip,Comment,URCALL,RPT1CALL,RPT2CALL,DVCODE
1,6m Call,52.525000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,,,
2,2m Call,146.520000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,,,
3,220 Call,223.500000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,,,
4,70cm Call,446.000000,,0.000000,,88.5,88.5,023,NN,FM,5.00,,,,,,

The Location column is just a row number, and should start at 1 for the first data row and increase monotonically for each row. Name and Frequency are the only fields you need to fill in, as the rest are undocumented or finicky at the moment and can be saved for later work. You can see many fields in the example above are empty, as there's nothing between the commas that separate fields. Use a Repeater model's freq.out_freq value for the Frequency column.

The view should just list all repeaters, for now.

Kabiirk commented 2 years ago

Hi,

I'm new to django, but as per my understanding views are functions in django. and you want to create a view(function) in views.py that allows you to export data as CSV (Chirp format) from the database shown at https://repeater.m17project.org/repeater (screenshot below for reference) image

Please correct wherever required. If my understanding is correct, please assign this issue to me.

Regards

tarxvftech commented 2 years ago

Yes! :grin: Please also attach the view in urls.py so it can be used (perhaps at /repeaters/csv? Your choice) My goal is to have a button on that page you have screenshotted that will export the database in this Chirp format.

Also, if it's possible, I'd like visiting that view to download the csv file rather than showing text on the screen, but this is not necessary to be accepted. It should however render the csv file directly, i.e. don't render it into a template.

Later (if you want another PR) I would like to add filtering based on name and tags in the database, so that the export only contains matching entries. That would involve some UI work too.

tarxvftech commented 2 years ago

Live on the site! I'm going to keep this open until I confirm the file generated works in Chirp itself (which will probably take some small tweaks to the fields, e.g. newlines and the way Chirp handles frequencies) but it's largely done thanks to @Kabiirk. Thank you! :grin:

tarxvftech commented 2 years ago

You can ignore the github CI error, it did actually deploy just fine. I'm looking into why it's reporting 'failing' even though it worked fine. Update: Looks like flyctl somehow forgot how to find the app? even though it deploy fined. I deployed from my laptop and that seems to have reset it. Other people have reported this issue in the fly forums and github issues without a solid response, so i expect it'll pop up again.

Kabiirk commented 2 years ago

You're welcome, thanks for your guidance !