TNRIS / api.tnris.org

Django RESTful API and PostgreSQL backend database management system for maintaining and serving Texas GIO's available data and content.

Home Page:https://api.tnris.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tnris Document form enhancement - either upload doc or provide url string

jwhaney opened this issue · comments

This is something that just came up from FR. She wants to provide a full video recording of the most recent GIS Community meeting that happened this past October. The video is like 5 hours or something long (she says like 5GB or something) and its captioned/transcribed. The most logical thing is for her to upload it to the TNRIS youtube account, which I believe she is going to do. However, she also wants it to show up (as a link) on the GIO page in the section "Past GIS Community Meeting Presentations:" which we have setup to grab from the API (in Tnris Documents w/ GIS Community Meeting Notes flag = True).

The problem is that the current Tnris Documents form in the API console only accepts file uploads. I believe an enhancement to accept file upload OR url string might be a solution. There can't be both of course, so the logic would only accept one or the other.

Tnris.org GIO page past GIS community meeting presentations section is where the current file uploads show and where the new video urls would render as well:
Screen Shot 2020-12-03 at 10 16 53 AM

Visualizing what I'm thinking here:
Screen Shot 2020-12-03 at 10 24 12 AM

I realize this is going to require a front-end change as well so i'll add an issue there too. I haven't been able to think about this for too long, so if anyone has a better idea please comment here. I'm good with handling this in whatever way makes the most sense. I think if we decide to do the above for the Community meetings (comm_note), we should also do the same for the Solutions group meetings (sgm_note) as well.

If it's possible, I think FR would like to see this capability in the next couple weeks, but that's not a hard deadline per se.

commented

this seems like a one-off or extremely rare case. i think the most proper solution might be for one of us to just grab a copy of her video and upload it to s3 directly ourselves. then we can manually add the record to the tnris documents table in the database. doing it manually would be easier and faster than an enhancement; like you mentioned, doing an enhancement would require several nuance updates on the frontend and backend. could just be checked as community meeting notes.

another idea, considering this is a special case, would be for one of us to do the manual upload but not check it as notes for either community or solutions group meetings. just add a little snippet of html on tnris.org for the download link and let it sit for a year.

another idea would be for @geochik to do her youtube upload, then we just add the little snippet of html on tnris.org to embed the video and let it sit for a year.

but is it a special case? we are now in the world of remote work and virtual meetings where these type of recordings are likely to be more prevalent. I don't see that going away. I asked FR this exact question, whether or not she saw more recordings for future meetings and she said she did because the people are asking for them.

to address the upload to s3 idea, i thought about that but then thought again about operation tiny receipt and our recent cleanup of s3. doesn't make sense to host 5GB ourselves if we can upload it to youtube. also, if it's hosted the way we host documents now in s3, will a video preview or will it download to the user? doubtful they want a 5GB download.

i don't know, that's just my take on it. i'm fine with talking about this further though or going with one of your recommendations if that's the consensus.

commented

makes sense. touché.

Yep. 4.7 Gb. I apologize for the wrench. I attempted to sign into our YouTube account and thought it worked (w/regular TNRIS sign on), I could not find where to upload the video. Perhaps there is another login I should be using for TNRIS? The video is located on the S: drive so I don't have a problem uploading it.....as long as I can find the right account or way to do it. I suppose it was CL that uploaded all the other TNRIS YouTube videos?
Thanks for you assistance with this!

Perhaps there is another login I should be using for TNRIS? The video is located on the S: drive so I don't have a problem uploading it.....as long as I can find the right account or way to do it. I suppose it was CL that uploaded all the other TNRIS YouTube videos?
Thanks for you assistance with this!

@geochik, just chatted you the info you need

@adambreznicky a quick note i just thought about regarding model changes. i think the parsing of the document_url to get the document_name is actually done on the backend, not the frontend like i mentioned before. so my thought is we can keep the document_url in the same format and pretty much alone as far as the db goes, but the document_name may need to change because if a generic youtube url is pasted in for that db value, it may cause an error, or at the least the parsed text won't make sense. maybe that field should be removed in the model and replaced by a new text input field for document_title that the user types manually? just some thoughts i had.

commented

after a shallow investigation, i think you're right @jwhaney. the api already delivers the field document_name for the frontend to use. it's populated programmatically within forms.py --> handle_doc() based on the chosen uploaded file.

so, as per our phone call, i think the only real steps to make this enhancement happen are to

  1. updated the forms.py handle_doc() function to no longer programmatically populate the document_name field, and to display it in the console instead; making sure this new document_name is a required field.
  2. update the admin.py class to handle the proper display of this url field and disabled document_name (when populated)
  3. update the form to run a validation before save and error if a new record is trying to do a file upload as well as populate a url.
  4. ensure the help text properly explains the usage of only the file upload OR direct populating of the url. should be only available for new records. existing records should continue to be completely disabled unless deleting.
  5. add the url string input to the form alongside the choose file, and handle the file upload OR the url string input when adding to the database based on which one was populated for the new record

i may be missing a minor thing or two in the list but generally that should cover it. if @ctrepka wants to work on this as a means of playin with the api more, Go For It!!! Otherwise i'll be happy to knock this out in the near future

commented

resolved via commit c779cd5