예제 #1
0
class DepositPointIsle(Agent):
    """ A group of DepositPoints that belong together in a geographic area. This can be useful for calculations at
    DepositPointIsle level where there are more than one DepositPoint in a place and users tend to use them
    indifferently resulting in irregular measurements"""

    location = OrionCoordinatesField(blank=True,)
    address = OrionTextField(blank=True, max_length=1024)
    description = OrionTextField(blank=True)
    features = OrionTextField(blank=True)

    refDepositPoints = OrionRefList()
    areaServed = OrionCharField(blank=True, max_length=1024)
    dateModified = OrionDateTimeField(blank=True, null=True)
    dateCreated = OrionDateTimeField(blank=True, null=True)
예제 #2
0
class Strategy(OrionEntity):
    name = OrionCharField(max_length=1024)
    description = OrionTextField()
    startDate = OrionDateTimeField()
    endDate = OrionDateTimeField()
    executor = OrionCharField(max_length=1024)
    keyMessages = OrionTextField()
    monitoringStrategy = OrionTextField()
    promoter = OrionCharField(max_length=1024)
    url = OrionURLField()
    refActions = OrionRefList()
    refTargetGroups = OrionRefList()
    refWasteStages = OrionRefList()
    refWasteStreams = OrionRefList()
    resultsFeedback = OrionTextField()
예제 #3
0
class Transaction(FamilyOrionEntity):
    FAMILY = "Transaction"

    refEmitter = OrionRef(
        blank=True,
        help_text="Transaction's emitter entity containing an Agent ID.")
    refReceiver = OrionRef(
        help_text="Transaction's receiver entity containing an Agent ID.")
    refCapturer = OrionRef(
        blank=True,
        help_text="Reference to the Id of the Device entity if exists, that captured the transaction containing an "
                  "Agent ID..")
    date = OrionDateTimeField(
        help_text="Timestamp which represents when the transaction was made")
    emittedResources = OrionListField(
        help_text="JSON ARRAY [{ refResource : resourceID_X , amount : amount1 , unit : ""KGM"" , ...},{ refResource : "
                  "resourceID_X , amount : amount2 , unit : ""KGM"" , ... },... ]")
    receivedResources = OrionListField(
        help_text="JSON ARRAY [{ refResource : resourceID_X , amount : amount1 , unit : 'KGM' , ... },"
                  "{ refResource : resourceID_X , amount : amount2 , unit :'KGM' , ... },... ]")
    incorrect = OrionDateTimeField(
        blank=True, null=True,
        help_text="Default to null or nor existing. In order not to delete any transaction, If one is incorrect to mark"
                  " it as incorrect and do not use it in calculations. But keep it in the database to know.")
    incorrectReason = OrionTextField(
        blank=True,
        help_text="Explanation if necessary of what it is incorrect or what changes have been handmade.For example: "
                  "'Bad transaction because of sensor error"" , ""refEmitter has been manually changed from citizen:31 "
                  "to citizen:523' , etc")
예제 #4
0
class Waste(Resource):
    CLASS_ORION_TYPE = "Waste"

    wasteCode = OrionCharField(max_length=1024,
                               blank=True,
                               help_text="LER waste code.")
    definitionSource = OrionTextField(
        blank=True, help_text="Where this characterization comes from")
    image = OrionCharField(max_length=2048,
                           blank=True,
                           help_text="Image for this waste.")
예제 #5
0
class ResourceCollection(FamilyOrionEntity):
    FAMILY = "ResourceCollection"

    name = OrionCharField(max_length=1024, blank=True,
                          help_text="SortingType Name. Example 'Color Glass collection'")
    description = OrionTextField(max_length=1024, blank=True,
                                 help_text="SortingType description. Example 'Collection of colored glass bottles'")

    regulation = OrionCharField(
        max_length=1024, blank=True)
    refResources = OrionRefList(
        help_text="List of waste entities composing the SortingType. Example [waste:6, waste18]")
예제 #6
0
class Resource(FamilyOrionEntity):
    FAMILY = "Resource"

    name = OrionCharField(
        max_length=1024,
        help_text="Waste Name. Example 'Green glass bottle'")

    description = OrionTextField(
        help_text="Waste help_text. Example 'Bottle made of green glass'", blank=True)

    refCategory = OrionRef(
        help_text="Reference to category entity this belongs. Example [wastecategory:9[]")
예제 #7
0
class ResourceCategory(FamilyOrionEntity):
    FAMILY = "ResourceCategory"

    name = OrionCharField(
        max_length=1024, blank=True,
        help_text="WasteCategory Name. Example 'Glass bottles'", )

    description = OrionTextField(
        max_length=1024, blank=True,
        help_text="WasteCategory description. Example 'Glass bottles including whiteand green glass'")

    ref_resources = OrionRefList(
        help_text="List of waste entities composing the ResourceCategory. Example [waste:6, waste:18]")
예제 #8
0
class DepositPoint(Agent):
    """Place where waste is deposited for its collection. It cover from traditional containers to less usual methods
    such as a personal plastic bag (in door2door systems), pneumatic waste dumpsters, fixed collection centers,mobile
    collection centers, etc."""

    serialNumber = OrionCharField(blank=True, max_length=1024)

    refSortingType = OrionRef()
    description = OrionTextField(blank=True,)
    storedWasteOrigin = OrionCharField(blank=True, max_length=1024)
    fillingLevel = OrionFloatField(blank=True)
    cargoWeight = OrionFloatField(blank=True)
    temperature = OrionFloatField(blank=True)
    methaneConcentration = OrionFloatField(blank=True)
    regulations = OrionCharField(blank=True, max_length=1024)
    responsible = OrionCharField(max_length=1024)
    owner = OrionCharField(max_length=1024)

    dateServiceStarted = OrionDateTimeField(blank=True, null=True)
    dateLastEmptying = OrionDateTimeField(blank=True, null=True)
    nextActuationDeadline = OrionDateTimeField(blank=True, null=True)

    # http://schema.org/openingHours
    actuationHours = OrionCharField(blank=True, max_length=1024)
    openingHours = OrionCharField(blank=True, max_length=1024)

    dateLastCleaning = OrionDateTimeField(blank=True, null=True)
    nextCleaningDeadline = OrionDateTimeField(blank=True, null=True)

    status = OrionCharField(blank=True, max_length=1024)
    color = OrionCharField(blank=True, max_length=1024)
    image = OrionURLField(blank=True)
    annotations = OrionTextField(blank=True)
    areaServed = OrionCharField(blank=True, max_length=1024)
    dateModified = OrionDateTimeField(blank=True, null=True)
    refDevice = OrionRef(blank=True)
예제 #9
0
class Agent(FamilyOrionEntity):
    """Each instance where waste is created, transformed or consumed, belonging to a WasteEntityType and containing the
    location of the entity together with specific features"""
    FAMILY = "Agent"

    location = OrionCoordinatesField(blank=True)
    address = OrionTextField(blank=True)
    name = OrionCharField(max_length=1024)
    refType = OrionRef()
    refInputs = OrionRefList(null=True)
    refOutputs = OrionRefList(null=True)
    refAgentCollection = OrionRef(null=True)
    # Not included any optional attributes define them into subclasses

    class Meta:
        abstract = True
예제 #10
0
class SortingType(ResourceCollection):
    CLASS_ORION_TYPE = "SortingType"

    shape = OrionCharField(
        max_length=1024,
        blank=True,
        help_text=
        "If the shape of the container is very relevant or representative for the sorting type (mainly for "
        "the sorting game) specify the shape of the container. Accepted values: the shapes provided by the "
        "sorting game.")
    color = OrionCharField(
        max_length=1024,
        blank=True,
        help_text="Sorting type's associated color. Example 'Green'")
    annotations = OrionTextField(
        max_length=1024,
        blank=True,
        help_text=
        "Attribute reserved for annotations (incidences, remarks, etc.)")
    wasteCharacterization = OrionJSONField(
        blank=True,
        null=True,
        help_text=
        "{wasteCategory_X : {amount: X, unit: KGM}, WasteCategory_Y : {amount: Y, unit: KGM}...}...}"
    )
    wasteCharacterizationTime = OrionDateTimeField(
        blank=True,
        null=True,
        help_text=
        "Timestamp at which the wasteCharacterization field was updated")
    area_served = OrionCharField(
        max_length=1024,
        blank=True,
        help_text=
        "Higher level area to which the sorting type belongs to. It can be used to define the "
        "area where the sorting type is applied, etc.")
예제 #11
0
class Action(OrionEntity):
    refStrategy = OrionRef(help_text="")
    name = OrionCharField(max_length=1024, help_text="")
    description = OrionTextField(help_text="")
    status = OrionCharField(max_length=1024, help_text="")
    startDate = OrionDateTimeField(help_text="")
    endDate = OrionDateTimeField(help_text="")
    areaServed = OrionCharField(max_length=1024, help_text="")
    areaDescription = OrionCharField(max_length=1024, help_text="")
    communicationTools = OrionCharField(max_length=1024, help_text="")
    costs = OrionDecimalField(max_digits=10, decimal_places=2, help_text="", )
    economicalImpact = OrionDecimalField(max_digits=10, decimal_places=2, help_text="")
    environmentalImpact = OrionTextField(help_text="")
    otherImpact = OrionTextField(help_text="")
    isBestPractice = OrionBooleanField(help_text="")
    lessonsLearnt = OrionTextField(help_text="")
    monitoringMethodology = OrionTextField(help_text="")
    otherInformation = OrionTextField(help_text="")
    otherTools = OrionTextField(help_text="")
    socialImpact = OrionTextField(help_text="")
    successKeyPoints = OrionTextField(help_text="")
    trainingTools = OrionTextField(help_text="")
    refWasteStages = OrionRef(help_text="")
    refWasteStreams = OrionRefList(help_text="")
    url = OrionURLField()

    @property
    def url_link(self):
        return SafeString('<a href="' + self.url + '" >View</a>')

    @property
    def strategy(self):
        strategies = {
            "1": "General sensitization Campaign",
            "2": "Education Centers Actions",
            "3": "Food Waste Prevention Campaign",
            "4": "Commercial Activities Campaign",
            "5": "Composting",
            "6": "PAYT",
            "7": "Zero Waste Ecosystems",

            "8": "Miscellaneous",
            "9": "Citizens' Sensitization - Funny Door to Door Sensitization",
            "10": "Zero Waste Campaigns -Virtuous Households",
            "11": "Zero Waste Events",
            "12": "PAYT Introduction - Communication",
            "13": "Promotion Campaign of Reusable Nappies",
            "14": "Reusable Nappies Campaign - Nursery Schools",

            "15": "Educational Centers Activities",
            "16": "Actions at Technical University",
            "17": "Food Separate Collection and Treatment",
            "18": "Commercial Activities Campaign",
            "19": "Collection of Nappies",
            "20": "ID/PAYT Containers System",
            "21": "Tourist Engagement",
            "22": "Waste4Think Schools",
            "23": "Zero Waste Events",
        }
        
        return strategies[self.refStrategy.split(":")[1]]