Coder Social home page Coder Social logo

cellnop's Introduction

cellNOP

Framework for Notification Oriented Paradigm with original logic-causal inference core developed with notifying cells.

Contents

Sample application

This example contains a segmentation module for CRM systems. The example segment is for customers who made a purchase and accessed the "Blue Shirt" product page.

import {
  Action,
  Condition,
  fbeMetaclass,
  Instigation,
  NotifyingHolon,
  Premise,
  Rule,
} from "https://raw.githubusercontent.com/hviana/cellNOP/main/mod.ts";

const ClientFBE = fbeMetaclass(
  "lastPurchase",
  "lastPageAccessed",
  function purchase(im: any, data: { [key: string]: any }) {
    return {
      lastPurchase: `Order ${Date.now()}`,
    };
  },
  function accessPageBlueTshirt(im: any, data: { [key: string]: any }) {
    return {
      lastPageAccessed: `Blue T-shirt`,
    };
  },
);
const SegmentFBE = fbeMetaclass(
  "clients",
  function addClientX(im: any, data: { [key: string]: any }) {
    if (!im["clients"]) {
      im["clients"] = [];
    }
    im["clients"].push("Client X");
    return {
      clients: im["clients"],
    };
  },
);

const clientX = new ClientFBE();
const segmentY = new SegmentFBE();
const premise1 = new NotifyingHolon({
  f: Premise.leftIsNot(undefined),
});
const premise2 = new NotifyingHolon({
  f: Premise.leftIs("Blue T-shirt"),
});
const condition = new NotifyingHolon({
  f: Condition.and,
});
const rule = new NotifyingHolon({
  f: Rule.default,
});
const action = new NotifyingHolon({
  f: Action.default,
});
const instigation = new NotifyingHolon({
  f: Instigation.default,
});
clientX.lastPurchase.connect({ left: premise1 });
clientX.lastPageAccessed.connect({ left: premise2 });
premise1.connect({ 1: condition });
premise2.connect({ 2: condition });
condition.connect({ default: rule });
rule.connect({ default: action });
action.connect({ default: instigation });
instigation.connect({ default: segmentY.addClientX });

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.