Git Product home page Git Product logo

grout-2018-fellowship's Introduction

Grout 2018 Fellowship

This repo stores issues, project boards, and documentation for the Grout fellowship, part of Azavea's 2018 Open Source Fellowship.

Documentation

The following documentation is included in the docs directory:

  • docs/concept-map.md: @jeancochrane's initial understanding of the Grout (formerly known as "Ashlar") suite.

  • docs/demo-framework.md: An architecture decision record (ADR) documenting the decision to use Vue.js for the demo app framework.

  • docs/rename-package.md: An ADR documenting the decision to rename the package from "Ashlar" to "Grout".

  • docs/foreign-keys.md: An ADR documenting the reasons and requirements for implementing a Record-to-Record foreign key field.

  • docs/nosql-backends.md: An ADR presenting research into possible NoSQL backends and service providers for Grout.

grout-2018-fellowship's People

Contributors

jeancochrane avatar ddohler avatar

Stargazers

 avatar Kathryn Killebrew avatar

Watchers

Justin Walgran avatar Scott Lederer avatar  avatar Chip Hitchens avatar James Cloos avatar Kathryn Killebrew avatar Vijay Lulla avatar Jeff Frankl avatar Matt Williams avatar Taylor avatar Peter Caisse avatar Brett Tackaberry avatar Azavea CI avatar Shreshth Khilani avatar James Santucci avatar  avatar  avatar Aaron Su avatar Luke McKinstry avatar  avatar  avatar

Forkers

jeancochrane

grout-2018-fellowship's Issues

Allow non-geospatial RecordTypes

Another interesting insight from the dev process for the demo app (#15): If #32 gets added to Grout, then for data modelling purposes it would be useful to permit the user to define RecordTypes that are not fundamentally geospatial in nature. For instance, if we're collecting Records in a PosterRecordType, we might be interested in having a PosterSeries RecordType that each Poster can point to in a field like Poster.series that would allow us to group together posters that are identical but that are deployed in different locations. In this case, it wouldn't really make sense to have date/time or geospatial data associated with PosterSeries Records.

Update the version of json-editor in the schema editor

The schema editor currently uses an Azavea-maintained fork of Jeremy Dorn's json-editor library. Jeremy Dorn's version of the library has since been deprecated in favor of a community-maintained fork.

We should update the schema editor to use the actively-maintained version of JSON Editor. This work will involve auditing the Azavea fork to see what features we use that aren't in core, and making sure that those changes are included in whatever version we use (whether it means updating the Azavea fork, or trying to get those changes accepted into the core).

Determine the domain of the demo app

As part of developing Ashlar, I want to build a demo app on top of it to demonstrate its capabilities. My two ideas are:

  1. An app for archiving public posters for events stapled to street lamps in Philly
  2. An app for cataloguing architectural features of Philly rowhouses

I prefer 1 to 2, but 1 was an idea brainstormed in tandem with some folks at William Way, so I need to talk with them and set some expectations first. If 2 seems more feasible, I need to figure out how to constrain the scope of it such that it's simple and doable with my current knowledge.

I should get this done this sprint so that development can start on the demo app as soon as possible.

Figure out foreign keys for the demo app

The demo app needs to somehow be able to filter Events according to the Posters that reference them, and vice versa. There are a couple ways of doing this: #32 is the most complicated, but we could also implement a more naive solution (similar to what DRIVER does) and simply duplicate reference data inside the Records in question. Either way, let's figure out our approach this sprint cycle.

Build a backend for the reference implementation

The reference implementation backend should allow a user to edit RecordTypes, RecordSchemas, and Records. While technically an "admin" interface, it won't deal with any kind of authentication stuff.

Improve demo app styles

There are a few style improvements I'd like to make to the demo app, including:

  • Make the map/sidebar take up the full screen
  • Flesh out the detail view modal
  • Show short description on map popover
  • Add "Read more" prompt to long description
  • Make sidebar scrollable when filters overflow screen
  • Display images
  • Change title
  • Icons
  • Better typography
  • Nicer colors
  • Add new data

Make sure date filter considers `occurred_to` field

Looking at the code, it seems like the current implementation of the date filter doesn't factor the occurred_to field into its query. Here's the line that produces the ultimate queryset:

return queryset.filter(occurred_from__gte=min_date, occurred_from__lte=max_date)

This may be an artifact from a time when only occurred_from was supported. In order to consider occurred_to, it should probably be:

return queryset.filter(occurred_from__gte=min_date, occurred_to__lte=max_date)

Here are a few things we need to do to make that happen:

  1. Make sure the tests cover date ranges (right now they only test Records where occurred_from = occurred_to, which is likely the reason we missed this)
  2. Change the date filter to consider occurred_to, as above
  3. Introduce field validation to make sure that if occurred_from or occurred_to is present in a create operation but its partner isn't, that the partner field gets assigned the value for the present field

This work is related to a refactor I'm already doing in #9, so I'll fix it there.

Split off the JS API and distribute it on NPM

The DRIVER frontend apps already sort of implement a JS API for making it easier to interact with Ashlar from the client side. Splitting this off into a separate module packaged via e.g. NPM would be a big boost to frontend development.

Prepare talks

I have two talks to prepare on Grout for the week of 8/13:

  • Project presentation, Wednesday 8/15 (~5 min lightning talk, project overview)
  • TSM presentation, Friday 8/17 (~20 min talk, technical deep dive)

Both talks should be semi-finished by Monday, 8/13 for the practice run-through.

Rob prefers we use Google Slides for these talks

Split off the schema editor into its own library

The schema editor that was built into DRIVER is a nice component of the Ashlar toolkit, but it's currently tightly integrated with the reference implementation. It should live in its own library instead.

Project direction brainstorming / planning

Some starting context: azavea/fellowship-program-website#26

There are several options for how to develop Ashlar as part of this fellowship. We "picked" one as part of the discussion above, but that doesn't have to be the final decision. So it would be good to have a brainstorming and planning session to revisit that discussion and make a final decision now that @jeancochrane has gotten started on the project.

The goals of this discussion will be:

  1. Review possible development goals for this project and discuss their benefits and drawbacks
  2. If we think there is an obviously best development path, choose it. If not, we should figure out what information we need in order to make a decision.
  3. Either way we go with number 2, come up with a series of tasks to either begin implementing our preferred solution, or to begin gathering information necessary to make the decision.

Support Python 3.7

There's no reason Grout shouldn't support Python 3.7, but currently we don't test against it. Let's update the tests to run against Python 3.7 so that we can add official support.

Project roadmap

Let's have a meeting to talk about the future of Grout and put together a project roadmap.

Restrict HTTP write methods in the Grout Server API

Currently, Grout Server is configured to permit access to all HTTP methods from any user; it assumes that, like DRIVER, your API is only accessible to authenticated users.

It would be more useful to set the default permissions to IsAuthenticatedOrReadOnly, which would allow anyone to use read-only methods but would restrict write methods to logged-in users.

Build a demo app using the Ashlar suite

Time permitting, it would be awesome to build a simple app using the Ashlar suite/toolkit to demonstrate its usefulness and put its different components to the test.

Port the schema editor to a Django admin module

Ashlar works well as a standalone DB server supporting a JS frontend, but it would also be nice to allow users to use it as a pluggable Django app. An important part of supporting this capability is porting the backend components (schema editor and data collector) to Django's admin system.

Allow foreign key relationships between Records

One interesting insight gleaned from the demo app development process (#15) is that it could be useful for some use cases if we were to extend the relationship field type to permit a pointer to a Record from a different RecordType (e.g. if I have two RecordTypes, Poster and Event, there could exist a field Poster.event in the RecordSchema that points to a UUID for an Event Record).

This could get hairy for a few reasons:

  1. Foreign key coherence is not guaranteed in NoSQL systems, so pointers could wind up empty
  2. As far as we know, JSONSchema has no built-in foreign key validation
  3. Introducing foreign keys could be a big performance hit to filtering if Postgres' jsonb data type does naive table scans (although the Django docs seem to indicate that jsonb permits indexing, which is perhaps a sign that filtering could have better performance)

Before jumping into this, we should do some research to see what the current state of the art is for foreign keys in JSONSchema.

Change authentication token routes in Grout Server

Right now the default route for getting an authentication token from the Grout Server API is /api-token-auth/. All other API methods are served from /api/. This makes it annoying to run a Grout Server under a reverse proxy -- all calls to /api/ can be safely redirected to the running Grout Server, but /api-token-auth/ either A) requires its own location block or B) gets caught by the default / location block and passed to the wrong process/directory.

This whole situation would be simpler if the token request endpoint was underneath the /api/ location -- something like /api/token/.

Support Python 3

Ashlar currently only supports Python 2.7. It would be nice to support Python 3.3 - 3.6.

Strip down Ashlar data model

Ashlar's models currently include tables and fields that are specific to the DRIVER implementation. For better abstraction, these tables should be removed from Ashlar and moved to DRIVER.

Blog post

Time permitting, I'd love to write a blog post to wrap up the fellowship.

Write documentation

An open source project is no use without good docs. Ashlar in particular would benefit from a detailed description of the data model and API, as well as step-by-step instructions for incorporating it into different types of projects and customizing it.

Package Ashlar for easy deployment

Related to #17, Ashlar will be more useful the easier it is to plug into a project. We should improve packaging and design it with specific implementations in mind, including:

  • Dockerized setup for running as a standalone DB server with a JS app
    x. Setups with and without backend UI
    x. Potentially, templates for different kinds of app
  • PyPi distribution for Django projects

Evaluate alternative NoSQL database backends

Postgres is Ashlar's heaviest dependency, and a barrier to simple deployment. It would be nice to allow alternative NoSQL database backends that wouldn't require so much configuration. This will involve some research to determine an appropriate library/service, since the database needs to be:

  • Easy to configure and deploy
  • Support simple filtering/querying
  • Either free or cheap

Validate Records against their schema before creating them

In a twist of fate, it turns out that there's no built-in validation to make sure that a new Record matches its schema in the REST API. In DRIVER, the schema editor takes care of schema validation, which is why we hadn't noticed it before.

The RecordSchema model has a validate_json method that seems primed to perform this kind of validation:

def validate_json(self, json_dict):
    """Validates a JSON-like dictionary against this object's schema
    :param json_dict: Python dict representing json to be validated against self.schema
    :return: None if validation succeeds; jsonschema.exceptions.ValidationError if failure
             (or jsonschema.exceptions.SchemaError if the schema is invalid)
    """
    return jsonschema.validate(json_dict, self.schema)

We should build this validation into the Record viewset and make sure that it's tested.

Schema editor bug fixes

I caught a couple of bugs in the schema editor this week, which you can see on the issues page. Time permitting, it'd be really nice to close these out, since a few of them prevent the schema editor from fully working.

Support Django versions 2.0, 2.1, and dev

djsonb is the only dependency currently preventing Ashlar from being compatible with Django 2.0+. Once that dependency is removed (#12), we should support these versions of Django.

Fix regression in JSONB filters

At some point (most likely in the course of #12) we introduced a bug into Grout that is causing jsonb filters to never return Records, even when the condition should pass. Per @flibbertigibbet's description:

On entering any text in the search, I get no results, even if the text is an exact match. Clearing the filter still returns the one sample record.

Create repo for a reference implementation

For sprint 1, we're going to build a reference implementation for Ashlar as it exists now. This reference implementation will need a repo. The repo should live under the Azavea organization.

Decide on framework(s) for demo app

Before getting started on the demo app, I'd like to cut a clear path forward in terms of the technologies that I'll use to implement it. In general terms, I can see possibilities:

  • Pluggable Django app
    • Pro: Technology that I'm already very familiar with
    • Con: Not a great learning opportunity; puts most of our up-front investment in a narrow range of users (Django)
  • Single-page JS app
    • Pro: Nice opportunity to learn a frontend framework
    • Con: More work to get me set up; deciding on what framework to use is riskier, sets up path dependence going forward

This might be a good opportunity to write up an ADR.

Related to #15 and #7.

Rename all references to Ashlar

Following #26, all references to "Ashlar" will need to change.

These steps include, but are not necessarily limited to:

  • Rename the core library on GitHub
    • Either:
      1. Create a new repo for the project, fork Ashlar, and move the code over; or
      2. Rename the repo on GitHub (confirm that the old URL will continue to redirect)
  • Update the core library code to refer to the new name instead of ashlar internally, in all imports and namespaces
  • Rename repos that reference the name "Ashlar", including;
    - ashlar-2018-fellowship
    - ashlar-blueprint

Improve the syntax for JSON querying/filtering

One of Ashlar's cool features is that you can query and filter arbitrarily-nested JSON over a REST API. There's been a lot of work in adjacent problem domains since 2015, however, and I think the syntax for the queries could be greatly improved by incorporating some lessons from those domains.

Relevant work includes:

  • GraphQL: complex JSON-based web API query language
  • glom: library/syntax for nested search of Python dicts

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.