Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
v0.3 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.3
#
# Author:
# Massimo Menichinelli
# Website:
# http://openmetadesign.org
# http://openp2pdesign.org
# E-mail:
# info@openp2pdesign.org
# massimo.menichinelli@aalto.fi
#
# License: MIT License
#
import datetime
import networkx as nx
class Location(object):
"""A class for a location"""
def __init__(self, street="", number="", city="", postalcode="", country="", latitude="", longitude="", url=""):
self.street = street
self.number = number
self.city = city
self.postalcode = postalcode
self.country = country
self.latitude = latitude
self.longitude = longitude
self.url = url
class User(object):
"""A class for a User participating in the process"""
def __init__(self,
name="",
username="",
email=""):
self.name = name
self.username = username
self.email = email
class Time_interval(object):
"""A class for a time interval with a location"""
def __init__(self,
start=datetime.datetime(),
end=datetime.datetime(),
start_location=Location(),
end_location=Location()):
self.start = start
self.end = end
self.start_location = start_location
self.end_location = end_location
class Discussion(object):
"""A class for each discussion thread"""
def __init__(self,
id="",
title="",
start=datetime.datetime(),
labels="",
url=""):
self.id = id
self.title = title
self.labels = labels
self.start = start
self.url = url
class Activity_element(object):
"""A class for an activity element"""
def __init__(self,
id="",
name=""):
self.id = id
self.name = name
class Activity(object):
"""A class for an activity"""
def __init__(self,
id="",
number=0,
title="",
description="",
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(),
location=Location(),
discussion=Discussion()):
self.id = id
self.number = number
self.title = title
self.description = description
self.time = time
self.participation = participation
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,
id="",
type="",
resource="",
title="",
description="",
weight= 0,
first_node=Activity(),
second_node=Activity(),
direction="",
discussion=Discussion()):
self.id = id
self.type = type
self.description = description
self.resource = resource
self.title = title
self.weight = weight
self.first_node = first_node
self.second_node = second_node
self.discussion = discussion
self.direction = direction
class Contradiction(Object):
"""A class for each contradiction"""
def __init__(self,
id="",
title="",
description="",
kind="",
first_node=Activity(),
second_node=Activity(),
direction=True,
discussion=Discussion()):
self.id = id
self.title = title
self.description = description
self.kind = kind
self.first_node = first_node
self.second_node = second_node
self.discussion = discussion
self.direction = direction
class License(object):
"""A class for licenses for the project"""
def __init__(self,
name="",
url="",
discussion=Discussion()):
self.name = name
self.url = url
self.discussion = discussion
class Process(object):
"""A class for a process"""
def __init__(self,
id="",
title="",
activities=Activity(),
discussion=Discussion()):
self.id = id
self.title = title
self.activities = activities
self.discussion = discussion
class Separator(object):
"""A class for a seprator between processes"""
def __init__(self,
id="",
first="",
second="",
text=""):
self.id = id
self.first = first
self.second = second
self.text = text
class Version(object):
"""A class for versions of the project"""
def __init__(self,
number=0,
id="",
diff="",
updatedAt=datetime.datetime(),
updatedAtBy="",
updatedAtByID=""):
self.number = number
self.id = id
self.diff = diff
self.updatedAt = updatedAt
self.updatedAtBy = updatedAtBy
self.updatedAtByID = updatedAtByID
class Project(object):
"""A class for a meta-design project"""
def __init__(self,
id="",
title="",
description="",
license=License(),
release="",
createdBy="",
createdByID="",
createdAt=datetime.datetime(),
lastUpdatedAt=datetime.datetime(),
lastUpdatedAtBy="",
lastUpdatedAtByID="",
versions=Version(),
versionsCount=0,
designers=User(),
community="",
processes=Process(),
separators=Separator(),
flows=Flows(),
contradictions=Contradiction(),
activitiesCount=0):
self.id = id
self.title = title
self.description = description
self.license = license
self.release = release
self.createdBy = createdBy
self.createdByID = createdByID
self.createdAt = createdAt
self.lastUpdatedAt = lastUpdatedAt
self.lastUpdatedAtBy = lastUpdatedAtBy
self.lastUpdatedAtByID = lastUpdatedAtByID
self.versions = versions
self.versionsCount = versionsCount
self.designers = designers
self.community = community
self.processes = processes
self.separators = separators
self.flows = flows
self.contradictions = contradictions
self.activitiesCount = activitiesCount
if __name__ == "__main__":
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment