-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Splitting into separate apps #215
Comments
Great to meet you OCP team :) I agree and actually commented yesterday with @bum2 something along these lines in a Telegram chat. I'll write a brief summary of what I think.
100% correct. Today if I want to pull some changes from OCP into DEEP for instance I'd have a big pile of difficult to merge conflicts. Plus not only across forks, also, as you mention, across branches.
I could break down, at least, into two modules: core and manufacture. Also make Sensorica specific stuff (related to manufacturing) into a different app inheriting the base classes. Imho this could be, ideally, the way to follow for the different forks. One core app: valueaccouting; made of different generic REA modules. And then users of that app. Kind of following the Pinax project spirit. So whichever project interested in valuenetworks can use valueaccounting as a dependency for its models and perhaps some views. But this is kind of an ultimate goal. A first refactoring step perhaps would be breaking down into modules (users, demand, supply, inventory, etc) the views.py file. And also accommodate to the new Django class based views whenever is possible. I'd be happy to participate in that work. Perhaps we'd temporarily refork your repository for this task, work on pull requests and then integrate them back into DEEP. I'll ask Numa :) |
Another way to think about it is to separate the main REA concepts into separate apps:
Might also want to separate out apps for some specialties:
Another possibility, that could go along with separating into apps, would be an overall set of abstract model classes and navigation to tie things together. |
P.S. I think it would be good to write up something for the Django users group to get some advice and maybe even some help. This could become an important Django project. People talk often about wanting to do ERP-like apps in Django, and if we separate out some reusable apps, they could be used in a lot of settings. I also think that economic networks are emerging all over the place, and NRP-like systems will become more important than individual enterprises as in ERP. I'll try to write a rough draft later today and pass it around for comment. |
One more thing: I think we should set up a new repo for the refactoring, or maybe more than one if we end up with more than one approach to refactoring that people want to try. That way, the different forks could keep going, since production systems might be using them until the refactoring gets stabilized. The refactoring repo could start with a set of internal refactored apps, that could then be made into their own app repos if and when they look good. If I remember correctly, this is how Pinax did things at first. |
Hey! I'm a bit confused about terminology. I see clearly how to split the file valuenetwork/valueaccounting/models.py into a unique package called "models" (a subdir with |
I think so. If we separate the system into different apps, it will break the live sites. That's why I think we need to keep the forks going as long as a live site is depending on one. The apps will set up their own database tables, prefixed with the app name, like appname_modelname. The columns could be the same. The data would need to be migrated from the old tables to the new tables. Easiest way might be dump into json file, change table names in json file, load into refactored db. |
Ok, then we'll need a new repo and we'll have absolute freedom for refactoring in differents apps. It sounds good to me. |
I think it could be nice if I would finish the current issue (user invitation into the system), today or tomorrow tops, and also if @bhaugen would help me on the travisci branch so we have continuous integration in the new repo. Also the travisci repo has a few other enhancements. Once I am done with user invitations I, or anybody else who wants to, can take on the task of diff'ing OCP & DEEP and merging bug fixes as well :) |
Rough draft of post to https://groups.google.com/forum/#!forum/django-usersPlease suggest, or just make, improvements.Dear Django people, We are working on an open-source Django system that has grown both in terms of user and developer communities and also size of code base. It is in production with 370 users that we know of. It has several names, but one is NRP, which stands for Network Resource Planning system, as contrasted with ERP, which stands for Enterprise Resource Planning. NRP has the same scope as ERP, but is for economic networks, not single enterprises. And it is aimed at communities who are experimenting with cooperative economic systems. We want to refactor the system. It has become too big and unmanagable. So we are looking for advice on how to refactor. Here's the original repo: https://github.com/valnet/valuenetwork which is being used by http://www.sensorica.co/ Here's an overview slide deck of the the original system. The forks have added other features. We think if we refactor this software, many of the features could be reusable by other projects that are not necessarily aimed at the same kinds of user communities. For example, any supply chain or business joint venture is an economic network, and many LLCs are actually networks under the covers. Moreover, we think that economic networks and ecosystems are the wave of the future, more than individual companies. But some of the features of this software base would also be useable by individual organizations. The system is based on the Resource-Event-Agent (REA) model, which is a much simpler basis for business systems than the usual ERP model. Here's how REA applies to supply chains, for example. Here's our current discussion about how to do it: #215 Anyway, we will be grateful for any advice, and if anybody wants to help, that would be even better. [Edit: sent] https://groups.google.com/forum/#!topic/django-users/9OU0TfwcmTQ |
Maybe should put an REA overview into the message to django-users, too... |
You can make explicit that this sofware is in production with many users. |
Done. Also added links to the user orgs. |
One thought: if the final goal is to make a downloable package from pip or something like that, I think it has no sense in splitting in so many apps, as mostly they depend in the other ones. So when one installs it in django, he/she'll have to setup many apps in settings.py Maybe it's better a simple app very well modularized. |
Good question. I think some of the separatable apps could be used independently, like Agent and Resource. See: But we might want to have a whole kit and kaboodle pip installable too. |
One more idea: let's figure out what is the minimum set of changes that would allow everybody to use the same repo for the core of the system, and separate out only the differences for the first stage of refactoring. I don't know off hand what that would be, and it wouldn't cover the original version that Sensorica is using now, just the OCP and DEEP versions. If we can get one version that both OCP and DEEP could use, with separate apps for their differences, then we could upgrade the core repo to the latest version of Django before we do more refactoring. |
👍 Probably best to look at all the commits, but off the top of my head, here is one option: starting with the DEEP version, making the FairCoin interface configurable, include @bum2 's changes to OCP after the DEEP fork, and make the OCP hard-codings configurable (if needed, I'm not sure how @bhaugen handled that in the DEEP version). |
If you think is good to use the General app, which is proposed in the 'project-planning' branch, then that can be a basic module for mapping resource types, exchange types and skills (like it is now in test at testocp), but also entities, locations, resources (artworks) and the most important: Relations.
But i agree with @XaviP that split the code in files and not the app in apps is easier... nevertheless it depends on where we want to go. |
I think we need to work out a principled relationship between your General ontology and the REA ontology. Not good to have dueling ontologies. |
In the FC tech chat, Enric mentioned that he would like to see all DEEP planned features included in the main OCP branch. In this case we would just need to figure out what DEEP would use from OCP. But in more general terms I think it will depend on each user/agent to choose what to use or not. Also because a new user will need to "learn" the platform and if all tools are available at once it might be too overwhelming. Ideally the admin team installing the platform would untick all tools that are not needed to them. Much like Odoo/Wezer/MAP right now. And every agent should be able to enable or disable those tools too, IMHO. |
A bit more thinking about the General app: It is already separated out into its own app, so depending on how entangled it is in the logic of the rest of the system, other groups could decide to use it or not. That will also be the case with several other features that arose from one group and the other groups will need to decide if they want them or not. That includes the planned DEEP features and maybe the whole work app. Another one is the faceted classification, which also overlaps with the General app. I don't personally care whether the facets or the General survive the merger, but I think it would be a fatal error to damage any of the REA concepts, relationships, or logic. If you don't know why, I can explain at sleep-inducing length. |
@numapanuma wrote:
I think that would require separating into apps, in the Django architecture: as in the installed_apps list in settings.py. |
@bum2 do you think we need to merge in the project-planning branch before doing the upgrade? I think it might make it easier if we do. Then let's think about those implications. If not, then I'd suggest we wait to merge, and you can keep working in the branch until it is done. That decision will help set the course in some ways. |
In terms of longer range thoughts about the general app, I think there will need to be some different offerings based on how the larger scope networks (like Freedom Coop and GoPacifia) want to operate, in terms of degrees of autonomy vs centralization. I think different networks will have different thoughts, especially as they are all experimenting. Besides the question of tree based taxonomy vs facet values, @bum2 's integration of his general app (as far as I understand the implications) tends towards more centralization of the configuration, that is every group will use the agreed upon taxonomy of resource types and exchange types. It envisions a more coordinated network, and emphasizes inter-trading more than internal operations of each group node (collective, project, etc.). Alternatively, one could tend more towards allowing groups to set their own configuration tailored exactly to their needs, without having to agree with everyone else, and see everyone else's configuration all the time. Or one could create some combination so that inter-trading and supply chains are encouraged within the larger network but individual groups can still configure their own operations specifically and privately without that data bothering others and vice versa. Bumbum and I have been back and forth a lot on this in the Freedom Coop context, and have not yet managed to discuss it with admins or project coordinators besides Zumbrunn, mostly due to people being too busy. Bumbum, I'm trying to be very fair here, so please correct anything I said that doesn't reflect your thoughts. I am fine with whatever Freedom Coop decides (or implements without deciding for that matter). But I do think that if the general app is used, it should be done in a way that other networks can plug something different in. Ah the wonderful possibilities of this modular refactoring! It may be that the current work app should become the general app integrated app, at least for the purposes of upgrading the Django versions (assuming @escanda hasn't done too much work there). |
We would go for that too. But if:
That would be awesome. |
Yup, I agree, that would be pretty nice all around. |
All the REA concepts, relations and logics are great and are the ones the valuenetwork provides. They can be mapped into General but only if we wish (resources as artworks, agents as humans, locations as spaces, etc), but the point is more how far we want to go inside the valuenetwork app or into the work app... what about making a relations of 'needed' or 'wished' resource types?, or skills 'learning', 'teaching', 'searching' ... i mean, the multiple relations and possible views and uses of the system... Basically the models are Data in the db, so i think more about common data related to common Apps, and particularities of each 'fork' related to additional custom Apps build on top of that general-common tables of data (which we can share, like the born of a common ontology of types, skills, relations, a repo of worldwide entities, locations, etc)... just the info that is intended to be 'public' or common... Then the custom apps of each network can hold the private information of memberships process, tools like invoicing, the custom types required, etc... The 'project-planning' branch already uses types and skills from the General app, and filters them by context, so types and skills can be defined 'only for a project' or choose a broader context like 'the whole sector' or 'the whole ocp'. That already works in test. |
I think those decisions should be driven by real-life use cases from one or more of the groups. |
Currencies should be treated as resources and resource types, but not all units. Like, a liter or a meter are not resources, they are just units of measure. Currency units of measure and currency resources are a little odd in that the same name applies to both, and it seems like a duplication. Probably is, but I don't know how to eliminate the duplication. However, currencies at rest are stored in something, and whatever they are stored in (piggy bank, bank account, FairCoin Wallet or Address) is a resource. (Did that all make sense?) |
I think what you said is exactly how to eliminate the duplication. The resources are always the stock or storage. "FairCoin", "Canadian Dollars", etc. would never be a resource or resource type, only a unit of measure. (This is my conclusion from Sensorica's experience.) |
Ok with me. |
@bum2 is this a recent change? Last I tested exchange types in testocp, they could not be defined only for a project. But if so, awesome! |
About the membership process, i have placed the flexible multi-project system with custom forms and so on but the initial FC membership workflow is not using that system... In order to merge this (will be wonderful for modularity) what is required is to separate the 'share' payment and wallet behavior from the join-a-project common stuff, like the management of the join-requests from the project view, communicating with and accepting or declining memberships, etc. The FC members project can have a Tag or special Type that makes it behave as requiring a share payed with faircoins, after the form is filled and the user is created as candidate. That part can happen or not in other projects, but the whole join-a-project flow system can be totally common. About the Units as Resources, i think they are defined by their type, and in some cases a resource can act as a Unit, and we can manage multiple unit accounting, by considering different currencies or hours in a timebank (as 'value units'), but have othe totals for liters, kilos, etc. From the General view, units are non-material artworks (creations) like 'resources' and have types to define them and records to define their ratio relations.
What i've added is the abbility to 'edit' an exchange type by his creator (or a superuser) and there he can choose a different context for the exchange type recently created... like in the 'new resource type' or 'new skill' (works similar). This is not yet including the edition of the transfer-types sequence, but we can do it later (even editing each transfer in the exchange type). Actually the sequence is inherited from parents exchange type, and the resource branch for the 'main' transfer (inherit_types=True) is defined for this 'custom' exchange type, so when in the exchange logging page the dropdowns are small. I've placed two docs about the situation in the 'project-planning' branch https://github.com/FreedomCoop/valuenetwork/files/797991/OCP.General_1.docx and about the General app itself https://github.com/FreedomCoop/valuenetwork/files/797990/GeneralApp_1.docx (sorry, github didn't get my .odt nor my .pdf, so i converted to docx and that worked)... |
I doubt that you can make liters and kilos into resources in any meaningful way. Each of the REA concepts has a reason for existence, and shit won't work if you misunderstand them. |
Hey man, I agree totally with the REA concepts, but as you said they are both sometimes (resource types and unit types) and for me is not a problem, coexists even as a concept with an history, or other 'classes', being the same name, from different perspectives... |
in a exchange office, the resources we manage are currencies, even physical fiat and digital fiat, social currencies, etc... how can we track them in ocp? as resource types, or? |
Resources and resource types and units and unit types are not the same, even if they have the same name. They are functionally and conceptually different, and behave differently economically and in accounting. Currencies seems to be confusing, but if you are tracking quantities of currencies, like how many FairCoins do you have, they are resources. |
P.S. if you want to think about liters as a resource, you need to specify, liters of what resource type? Liters of milk? Liters of beer? |
Agree. The resource type of that resource is not FairCoin, it is something like FairCoin Address. And the resource itself is some address in a wallet. Or for physical fiat, the resource can be a bank account, or a virtual account that is part of a bank account, or a specific box of cash under the counter. The resource type then would be Bank Account or Virtual Account or Cashbox. Does that make sense? |
Doesn't matter the type of 'liquid' in this case, if it is useful for a project to see totals in that unit (because they used it), they should be able to choose it and see totals using any unit type (not only value)... or see their faircoins balance in other units, etc. It is just about having enough future flexibility, and use the ratio converter tables between units, etc. Maybe a transport project want to track kilometers or whatever unit desired... |
Sure. But now you are talking about conversions between units of measure of the same resource. I'm trying to establish the difference between units of measure, and resources which might be measured in units of measure. Like liters of beer, vs ounces of beer. Or liters of milk, vs quarts of milk. But there is no mathematical formula that will convert liters of milk to ounces of beer. |
The recipients of the currencies are resources of course (accounts, boxes), but the coins inside are also resources, even physical or virtual, so a balance is an amount of resources of some type, stored in another resource which can be a private account or fairaddress... if we move coins between agents we are moving resources of certain type, with a related unit to define value...
of course you can't convert between some different branches of units, mainly from same branch only or what makes sense... (hectares-to-squaremeters, tons-to-kilos, etc) |
... but we digress... 😄 |
Yes, and that seems to be a cause of confusion. Faircoin is (in OCP) both the name of a unit and the name of a resource type. But those are different concepts, even if they have the same name. It's like sex and sex: one is a gender, the other is an enjoyable activity that might result in babies.
Those are not different branches, beer and milk are different resource types. |
Totally true... let's focus the splitting issue... for me the point was to think about common data in order to see the needed splittings in the code, so common apps can share also common data on them for all 'forks'... |
But anyway, the work required to split the code is not for this next release, so first i want to focus on the subject explained in the docs... if we add or not the General app and the types trees, and to which extend we want to use or not other structures offered by that app, like the relations or the unit-ratios, the regions, etc. If we achieve a working release that covers some of this and we are all happy with that, then we can think again about how it makes sense to split the code... |
Don't get me wrong, I like the General app. But I also have worked with REA for 20 years, and it has been beaten up around the world for 30+ years, and is an international standard, and it has proven to work. So if the General ontology and the REA ontology want to co-exist in the same system, they need to figure out how they work together, and what is what in terms of concepts and relationships. And what is a unit and what is a resource type. |
@bum2 do you have an estimate on when this release that includes the general app will be ready? It also needs to be tested by FC admin people, who show no sign of testing it. Even enough to discuss if they agree it is a requirement. |
That depends not only of my roadmap but also of the missing testing and feedback from coop admins or project coordinators, so i'm developing kind of blind, and just me and sometimes @fosterlynn are testing things. By the way, my roadmap is + o - at #184 but also other things happen around in other sites (and a pending huge migration) and is hard to find enough concentration on ocp... |
Just some questions: this General app is a separate app from the "core" app, right? Can we focus in this issue about the way we are going to refactor the core? Or do we need to discuss if this app goes into the core? Is this the goal of all this chat? Sorry to not understand all concepts you are talking about. |
Yep. IMHO I would refactor first valueaccounting to make it as generic as possible so apps as general can derive its classes with minimum effort. BTW, I created an organization called django-rea on which to host the artifacts of the refactor. @bhaugen will be the owner once he accepts the invitation, and of course, if he agrees :) |
Accepted invitation. Can we have more owners? I am not enough. |
Yep, as many as you want. I made you already owner. In your profile settings there's a tab at the bottom where you can manage the organization. |
Yes, that is a difficult way to develop. 😞 But it looks like the reality for the moment, as you and others have requested help testing with no answer.
Given all of this, I think we should go ahead without this branch, and get to the minimum joint repo in the simplest way possible. What do others think? |
Let's move the refactoring discussion to django-rea/rea-project#1 |
Collecting info about ways to separate an app into several.
As a first step, models.py and views.py can be splitted into separate files. This can be an improvement to avoid merge problems, if different developers works in the same app. Can be better for document each model and view too. Maybe this can be a good idea for valuenetwork/valueaccounting/models.py (12k lines) and valuenetwork/valueaccounting/views.py (13k lines) as this app is like the core of the project, so no need to separate it in different apps (not sure, please correct me):
The text was updated successfully, but these errors were encountered: