Skip to content

Instantly share code, notes, and snippets.

@openp2pdesign
Last active June 23, 2016 19:06
Show Gist options
  • Save openp2pdesign/dba8cdfa0c4293b2d5e93f6a0835a755 to your computer and use it in GitHub Desktop.
Save openp2pdesign/dba8cdfa0c4293b2d5e93f6a0835a755 to your computer and use it in GitHub Desktop.
A first draft of the classes that define the Open Meta-Design framework. To be developed in a complete repository soon.
# -*- coding: utf-8 -*-
#
# Open MetaDesign Classes v0.2
#
# Author:
# Massimo Menichinelli
# Website:
# http://openmetadesign.org
# http://openp2pdesign.org
# E-mail:
# [email protected]
# [email protected]
#
# License: MIT License
#
import datetime
import networkx as nx
class Location(object):
"""A class for a location"""
def __init__(self, where="", url=""):
self.where = where
self.url = url
class Person(object):
"""A class for a person participating in the process"""
def __init__(self,
name="",
username="",
email="",
where=Location()):
self.name = name
self.username = username
self.email = email
self.where = where
class Time_interval(object):
"""A class for a time interval with a location"""
def __init__(self,
start=datetime.datetime(),
end=datetime.datetime(),
start_where=Location(),
end_where=Location()):
self.start = start
self.end = end
self.start_where = start_where
self.end_where = end_where
class Issue(object):
"""A class for each issue in the discussion thread"""
def __init__(self,
date=datetime.datetime(),
author=Person(),
content=""):
self.date = date
self.author = author
self.content = content
class Discussion(object):
"""A class for each discussion thread"""
def __init__(self,
title="",
start=datetime.datetime(),
label="",
author=Person(),
thread=Issue(),
contradiction=Contradiction(),
status=""):
self.title = title
self.labels = label
self.comment = ""
self.author = author
self.start = start
self.thread = thread
self.status = status
self.contradiction = contradiction
class Activity_element(object):
"""A class for an activity element"""
def __init__(self,
kind="",
description="",
where=Location()):
self.type = kind
self.description = description
self.where = Location()
class Activity(object):
"""A class for an activity"""
def __init__(self,
title="",
verb="",
subject=Activity_element(),
object=Activity_element(),
tools=Activity_element(),
community=Activity_element(),
rules=Activity_element(),
roles=Activity_element(),
outcome=Activity_element(),
participation="",
time=Time_interval(),
where=Location(),
discussion=Discussion()):
self.title = title
self.verb = verb
self.time = time
self.participation = participation
self.participation_levels = [
"No participation",
"Indirect participation",
"Consultative participation",
"Shared control",
"Full control"
]
self.subject = subject
self.object = object
self.outcome = outcome
self.tools = tools
self.community = community
self.rules = rules
self.roles = roles
self.where = where
self.discussion = discussion
class Flow(object):
"""A class for each flow in a process"""
def __init__(self,
resource="",
title="",
weight=0.0,
edge=[],
first_node=Activity(),
second_node=Activity(),
reciprocal=True,
discussion=Discussion()):
self.resource = resource
self.options = [
'information or digital resources',
'financial resources',
'material resources'
]
self.title = title
self.weight = weight
self.first_node = first_node
self.second_node = second_node
self.discussion = discussion
self.reciprocal = reciprocal
self.edge = [first_node, second_node]
class Contradiction(Object):
"""A class for each contradiction"""
def __init__(self,
kind="",
content="",
edge=[],
first_node=Activity(),
second_node=Activity(),
reciprocal=True,
discussion=Discussion()):
self.options = [
'primary',
'secondary',
'tertiary',
'quaternary'
]
self.kind = kind
self.first_node = first_node
self.second_node = second_node
self.discussion = discussion
self.reciprocal = reciprocal
self.edge = [first_node, second_node]
class License(object):
"""A class for licenses for the project"""
def __init__(self,
name="",
url="",
legal="",
discussion=Discussion()):
self.name = name
self.deed_url = url
self.legal_url = legal
self.discussion = discussion
class Process(object):
"""A class for a process"""
def __init__(self,
title="",
activities=Activity(),
flows=Flow(),
participants=Person(),
where=Location(),
discussion=Discussion()):
self.title = title
self.activities = activities
self.network = nx.Digraph()
self.flows = flows
self.discussion = discussion
class Project(object):
"""A class for a meta-design project"""
def __init__(self,
title="",
abstract="",
version="",
founders=Person(),
processes=Process(),
license=License(),
where=Location(),
discussion=Discussion()):
self.title = title
self.abstract = abstract
self.version = version
self.founders = founders
self.license = license
self.where = where
self.processes = processes
self.discussion = discussion
if __name__ == "__main__":
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment