-
Notifications
You must be signed in to change notification settings - Fork 14
Index 2016 tech architecture discussion #146
Comments
@pwalsh wrote:
|
I also think after some arch redesign it will be able to be a good maintainable static site with fast build time. Good thing about node.js static site generators - https://www.staticgen.com/ (filter by JavaScript) - for many of them |
@roll you mean still keeping it a distinct codebase though, right? nunjucks would be good and make porting almost trivial. I'm positive that the build times will be better with node, but also probably as you point out, removing that |
Yes, of course. |
My main point about improvements (speed, complexity) is to change data structures passed to templates (there is no difference with pelican or nodejs). Now we have main things like
leads for complex code like this - https://github.com/okfn/opendataindex/blob/master/themes/odi/templates/_scope.html#L17-L47 But having something like this
leads to template code just like:
etc So after changing it everything else will be much more easier. |
@roll +1. Great, thanks for the insights. |
Static site
Being a static site is a questionable solution for project with this amount of business logic. But It doesn't look like it's strongly necessary (cost, time) to rewrite it to be a dynamic site based on flask or expressjs for example.
Datapackage as a database
For building the site uses something like datapackage (csv files) as a database. Also this csv files can be downloaded. Here is a biggest area for improvements.
Static site (logic in templates) and csv files as a database are not flexible enough to play together. I suppose datapacakge can be used as a database for a dynamic site but not for static because there is an additional work (logic in templates) to get data from csv files.
Proposed solution is to have more normalized json files as a database:
odi download
saves json files with all information received from Census:entries.2013.json
entries.2014.json
places.json
odi prepare
generates json files with all additional data structures needed to be usedin templates (for example for optimization purposes).
odi populate
generates templatesodi build
builds the site (including csv files for downloading)Logic in templates
After switching database to json files amount of logic in templates has to be sharply reduced. For examples there is a recommendation to remove
_scope.html
at all as one point of failure, non debuggable code (because of bugs with the trace reporting in Pelican) and a bottle neck in sake of build time.If additional logic is still be needed it can be written as template filters. But I suppose there has to be a recommendation for future developers to avoid logic in templates as much as possible because it was the most time consuming place (understading, debugging) of Index 2015 work.
The text was updated successfully, but these errors were encountered: