valueflows / vf-apps

vf-apps has moved to https://lab.allmende.io/valueflows/vf-apps
11 stars 0 forks source link

Complex models vs simple UIs #8

Closed bhaugen closed 4 years ago

bhaugen commented 4 years ago

An experience report.

I'm hacking out a temporary app for the Madison WI Mutual Aid Network Everywhere Gardens project by forking our ancient valuenetwork software: https://github.com/mikorizal/valuenetwork

The structure for a garden is:

[Note: those are the names from our older software. In ValueFlows, ResourceType would be called ResourceSpecification.]

I put together a slide deck showing how you could create such an assembly by creating and connecting all of the components.

That's crazy!

So, before anybody decides to take revenge on me for cruel and unusual punishment, I simplified the process into one form: Screenshot from 2020-05-03 14-58-45

Here's the python code that assembled the components from the form:

            data = new_garden_form.cleaned_data
            garden_name = data['garden_name']
            gprt = EconomicResourceType.objects.get(name="Garden plot")
            address = data['address']
            garden_latitude = data['latitude']
            garden_longitude = data['longitude']
            qty = data['size_in_sq_ft']
            notes = data['description']
            loc = Location(
                name=garden_name,
                address=address,
                #Latitude and longitude are hidden fields in the form
                #set by the geolocator.
                latitude=garden_latitude,
                longitude=garden_longitude,
                )
            loc.save()
            garden = EconomicResource(
                resource_type=gprt,
                identifier=garden_name,
                quantity=qty,
                notes=notes,
                current_location=loc,
                )
            garden.save()

            provider = data['choose_known_provider']
            if not provider:
                new_provider = data['or_add_new_provider']
                at = data['new_provider_type']
                provider = EconomicAgent(
                        name=new_provider,
                        nick=new_provider,
                        agent_type=at,
                        primary_location=loc,
                        )
                provider.save()
            if provider:
                eg = EconomicAgent.objects.get(name="Everywhere Gardens")
                association_type = AgentAssociationType.objects.get(name="Garden Provider")
                if not provider.is_associate_of_type_with(eg, association_type):
                    association = AgentAssociation(
                        is_associate=provider,
                        has_associate=eg,
                        association_type=association_type,
                        )
                    association.save()
            owner_roles = AgentResourceRoleType.objects.filter(is_owner=True)
            if owner_roles:
                owner = owner_roles[0]
                ownership = AgentResourceRole(
                    agent=provider,
                    resource=garden,
                    role=owner,
                    is_contact=True,
                    )
                ownership.save()

You can also see by some of the hard-coded selections that this is a hack for this project and not a general-purpose solution for the multitudes and ages.

But this is an example of what a lot of people will need to do with VF models.

I think the complexity of the models is justified and necessary and may write a comment below explaining why, but enough for now to write up this experience.

fosterlynn commented 4 years ago

And weirdly (or not), I'm having a similar experience forking that same software and making a temporary solution for Guerrilla Media Collective. After working through it in the existing software, we had an offer to create a new UI from @dahacouk and Kendraio team, using valuenetwork as the backend. The simpler UI, as designed by GMC, is radically different from the valuenetwork interface. And much friendlier and simpler, for this group. But wouldn't work for most other groups.

Hmmmm, seems like a pattern here, although yes it's anecdotal. But not really unexpected.

(A side note: this software is mostly but not all VF, and has an api based on an earlier version of VF with compromises where the software wouldn't support VF.)

bhaugen commented 4 years ago

Some justification for the complexity of the models behind that garden form:

More complexities will emerge as gardeners want to schedule their work, perform soil analyses, get and plant seeds and seedlings, harvest and distribute food, etc.

dahacouk commented 4 years ago

Hi @bhaugen , won't it be great if the form got built by the "schema"? I appreciate that Kendraio might not be totally there yet in terms of mimicking the complexity of your mini app (above). And we already have our current ValueFlows challenge in progress – one at a time, eh? ;-) But I'd love to revisit this kind of mini app that you've created and see what it would take to build it in Kendraio – with the aim of enabling lesser (or non) developers to drag the required elements and create the rules to build this kind of thing. Hmm...

bhaugen commented 4 years ago

@dahacouk

I'd love to revisit this kind of mini app that you've created and see what it would take to build it in Kendraio – with the aim of enabling lesser (or non) developers to drag the required elements and create the rules to build this kind of thing.

Yes please! Let's do it!

almereyda commented 4 years ago

We have moved the ValueFlows organization from GitHub to https://lab.allmende.io/valueflows.

This issue has been closed here, and all further discussion on this issue can be done at

https://lab.allmende.io/valueflows/vf-apps/-/issues/8.

If you have not done so, you are very welcome to register at https://lab.allmende.io and join the ValueFlows organization there.