EntityScript

Draft 1.01:
Index







Sections: Status -> Approved

1.) EntityScript™ Overview - Overview of the project

2.) .entity/.ds Lookups - Overview of basic .entity and .ds file relationships. An overview of each file.

3.) Special File Types - Overview of special types of methods, files, and types in C.ORE™

4.) Log File Types - Overview of Logging within C.ORE™

5.) Using OpenPackager™ - Overview of the OpenPackager™ project and details regarding using the sub-system for organizing the base system and addons.

6.) Locations - Overview of various parts of the IPDVC™ file system

7.) System Audits - Overview of various audit mechanisms present in C.ORE™ and how to use them.

8.) C.ORE™ Scripts - Overview of scripts that run in C.ORE™, the purpose they have, overview of some scripting philosophy, and some usage examples.

9.) Startup - Step-by-step process of startup routines and how to extend them

10.) C.ORE™: AirEP™ file system (Access Identity Ring Entertainment Platform: AirEP™ - Understand more about the Access, Identity, Ring

11.) Keys: Each of the built-in keys that can be used to retrieve meta-information in C.ORE™

12.) How-to: Additional Notes

13.) Moderation: Basic moderation principles

14.) Social Pledge: Basic social-pledge for your interface and who you interact with

15.) Disclaimers: Basic recommendations for your interface and dealing with various types of commerce

16.) Additional Resources: Dig deeper into the technical stack, program methods, variables, and other happenings within CORE.HOST™

core_architect




"""
Copyright (C) 2020 New Entity Operations Inc.

ALL RIGHTS RESERVED

core_architect is a module to establish handlers for various digital
groupings and class structures. 

You start with a simple object and can built out of it. When you build out of it
you can make the system ‘ingest_commands’ based off of types enforced here.

For those groupings or use them to make
quantified/qualifying ouput according to base example methods.

The first example is a basic online digital card system:

It operates according to a transaction/digital-card format.

"""
from OPENPACKAGER.internal.ingest_commands import (
 DeductionObject, Vectorize
)
from OPENPACKAGER.internal.constructed_class import (
 blob_object, transactions
)
## Imports: Custom
from core_middlelayer import (
 DIRDATA,
 OUTPUT_ENTITY,
 OUTPUT_ENTITY_FRESH,
 OUTPUT_ENTITY_CHECK,
 OUTPUT_ENTITY_UPDATE,
 OUTPUT_VECTORIZED_DATA,
 OUTPUT_FLUSH,
 OUTPUT_UPDATE_SLUG
)
## Establish Vector Buckets
CODE_BUCKET=[]
CARD_BUCKET=[]
TYPE_BUCKET=[]
AMOUNT_BUCKET=[]
DATE_BUCKET=[]
TO_BUCKET=[]

## Establish Dynamic Bucket Classes
class AddDynamicValue:
    """
    The base class that can be expanded on to follow the add, edit, delete
    format.

    """
    # Common Data Setup Classes
    class Code:
     """
     A status code that links to a exact digital transaction

     """
     def __init__(self):
      print(self)
      input("Enter in a Code")
    class Card:
     """
     A descriptive name of a digital-transaction origin type

     """
     def __init__(self):
      print(self)
      input("Enter in a Card")
    class Type:
     """
     A Type of digital-transaction

     """
     def __init__(self):
      print(self)
      input("Enter in a Type")

    class Amount:
     """
     A qualified Amount total that represent a unit of a group that can be
     quantified

     """
     def __init__(self):
      print(self)
      input("Enter an Amount")

    class Date:
     """
     The machine or general time of the digital-transaction

     """
     def __init__(self):
      print(self)
      input("Enter a date")

    # Program dependent utility command
    class To:
     """
     Who did this digital-transaction go to?

     """
     def __init__(self):
      print(self)
      input("Who did this go to?")

## Establish a ID to Key relationship bucket
ID_BUCKET = []

class Id:
    """
    'ID_BUCKET' is always added first. In the event
    that there are no other fields, it still gets setup

    """
    def zoom():
     """
     First run through ca.Id.zoom() returns nothing

     However, this then writes the null value 0 to ID_BUCKET

     Afterwards, whenever it runs, it'll remove that value
     and update the list with new values, only executing the null
     value removal during the first pass.

     Now, each additional ca.Id.zoom() just adds to
     the list

     """
     if len(ID_BUCKET) < 1:
      ID_BUCKET.append(0)
     else:
      if ID_BUCKET[0] == 0:
       ID_BUCKET.clear()
       FormIdInput = input("Please add an id")
       ID_BUCKET.append(FormIdInput)
      else:
       FormIdInput = input("Please add an id")
       ID_BUCKET.append(FormIdInput)

    def __init__(self):
     print(self)
     # Mock: Setup code goes here.

## Erect a general 'KeyConstructor'
class KeyConstructor:
    def __init__(self, id, code, card, type, amount, date , to):
     self.id = id
     self.code = code
     self.card = card
     self.type = type
     self.amount = amount
     self.date = date
     self.to = to
    def __str__(self):
     return 'KeyConstructor({self.id}, {self.code},  {self.card}, ' \
      '{self.type},  {self.amount},  {self.date},  {self.to})'.format(self=self)
    def __repr__(self):
     return 'KeyConstructor({self.id}, {self.code},  {self.card}, ' \
      '{self.type},  {self.amount},  {self.date},  {self.to})'.format(self=self)

## Print out the header to orient the reader
ConstructedClass = KeyConstructor(
 'id', 'code', 'card', 'type', 'amount', 'date', 'to'
)
print(ConstructedClass)

## Execute various Operations
def construct_ledger():
    global transactions
    from OPENPACKAGER.internal.constructed_class import transactions

def check_entity_fresh():
    with open(DIRDATA+OUTPUT_ENTITY, 'w') as file:
     file.write("")
    print(
     "----- Wiped Records: Starting Resync -----"
    )
    file.close()

def check_entity():
    total = 0

    with open(DIRDATA+OUTPUT_ENTITY, 'r') as file:
     for line in file:
      try:
       num = float(line)
       total += num
      except:
       ValueError
       print('{} is not a number!'.format(line))

    print('You have: {} Records in this Entity'.format(total))

    file.close()

## Establish excess information buckets
Flush_Buckett = []
## Generate desired outputs
def generate_Amount():
    for i in transactions:
     zX = i[3]
     # Add each value to the flush buckett
     Flush_Buckett.append(zX)
     update_entity()

def update_entity():
    with open(DIRDATA+OUTPUT_ENTITY_UPDATE, 'w') as file:
     for i in Flush_Buckett:
      file.write('%s\n' % i)
    file.close()

def entity():
    update_entity()

## retrieval vectorized_data by keys
def vectorize_data(by_key):
    with open(DIRDATA+OUTPUT_VECTORIZED_DATA, 'r') as file:
     line_by_line = file.readlines()
     return(line_by_line[by_key+8])
    file.close()

## Test Construct
# Test: Vectorized
# >>> print(vectorize_data(1))
# Test: Specific Field
# >>> print(vectorize_data(2[0]))

## destroy buckets
def flush():
    with open(DIRDATA+OUTPUT_FLUSH, 'w') as file:
     for i in Flush_Buckett:
      file.write('%s\n' % i)
    file.close()

## transactions are already an exceptable list construct, so branch it
Slug_Buckett = transactions

## Automation: Cleanup routines
def update_slug():
    with open(DIRDATA+OUTPUT_UPDATE_SLUG, 'w') as file:
     for i in Slug_Buckett:
      file.write('%s\n' % i.__repr__())
    file.close()

def slug():
    update_slug()

def automate():
    print(
     "----- Starting Automate: Resyncing now... -----"
    )
    construct_ledger()
    check_entity_fresh()
    generate_Amount()
    entity()
    check_entity()
    flush()
    slug()



Return HOME