zukunft / zukunft.com

Calculating with RDF data.
GNU Affero General Public License v3.0
7 stars 2 forks source link

zukunft.com

Calculating with RDF data.

This program should

Install

To install this version 0.0.3 use a LAMP server (https://wiki.debian.org/LaMp) and 1) copy all files to the www root path (e.g. /var/www/html/) 2) copy all files of bootstrap 4.1.3 or higher to /var/www/html/lib_external/bootstrap/4.1.3/ 3) copy all files of fontawesome to /var/www/html/lib_external/fontawesome/ 4) create a user "zukunft_db_root" in Postgres or MySQL and remember the password 5) execute the script "src/main/php/db/.../zukunft_structure.sql" in MySQL to create the database zukunft_structure 6) change the password "xxx" in db_link/zu_lib_sql_link.php with the password used in 2) 7) test if the installation is running fine by calling http://yourserver.com/test/test.php

Additional for development

on debian systems

Planned changes

For versions 0.0.4 these changes are planned

and for versions 0.0.5

Coding Guidelines

this code follows the principle of Antoine de Saint-Exupéry

"Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y a plus rien à retrancher."

Or in English: "reduce to the max"

The code use for zukunft.com should be as simple as possible and have only a few dependencies and each part as capsuled as possible, so basically follow the Zen of Python https://www.python.org/dev/peps/pep-0020/ The minimal requirements are a LAMP server (https://wiki.debian.org/LaMp) and an HTML (using some HTML5 features) browser. If you see anything that does not look simple to you, please request a change on https://github.com/zukunft/zukunft.com or write an email to timon@zukunft.com

Target user experience:

General coding principles:

  1. Don't repeat yourself: one point of change (https://en.wikipedia.org/wiki/Don%27t_repeat_yourself) (but coded repeating by intention can be used)
  2. test: each facade function should have a unit test called from test_units.php or test_unit_db.php with zukunft.com/test a complete unit and integration test best: first write the test and then the code
  3. only needed dependencies: use the least external code possible because https://archive.fosdem.org/2021/schedule/event/dep_as_strong_as_the_weakest_link/
  4. best guess: assume almost everything can happen and in case of incomplete data use best guess assumptions to complete the process but report the assumption to the calling function and create the message to the user if all assumptions are collected
  5. never change a running system (until you have a very, very good reason)
  6. one click update: allow to update a pod with one click on the fly (https://en.wikipedia.org/wiki/Continuous_delivery)
  7. log in/out: all user changes and data im- and export are logged with an undo and redo option
  8. small code package: split if function and classes are getting too big or at least the most important functions within a class should be on top of each class
  9. error detection and tracking: in case something unexpected happens the code should try to create an internal error message to enable later debugging
  10. self speaking error messages
  11. shared api with in code auto check
  12. capsule: each class and method should check the consistency of the input parameters at the beginning

Coding team suggestions

Decisions

Naming conventions for vars:

backend - main

backend - core

backend - admin

backend - internal

object extensions

frontend:

to be deprecated:

database change setup

User Sandbox: values, formulas, formula_links, views and view elements are included in the user sandbox, which means, each user can exclude or adjust single entries

to avoid confusion words, formula names, triples (verbs) and value_phrase_links are excluded from the user sandbox, but a normal user can change the name, which will hopefully not happen often.

for words, formulas and verbs the user can add a specific name in any language

Admin edit: for triples (verbs), phrase_types, link_types, formula_types there is only one valid record and only an admin user is allowed to change it, which is also because these tables have a code id

Sources: every user can change it, but there is only one valid row

Saving: there are several methods to save user data

Fixed server splitting (if not hadoop is used as the backend) To split the load between to several servers it is suggested to move one word and all it's related values and results to a second server further splitting can be done by another word to split in hierarchy order e.g. use company as the first splitter and than ABB, Daimler, ... as the second or CO2 as the second tree in this case the CO2 balance of ABB will be on the "Company ABB server", but all other CO2 data will be on en "environment server" the word graph should stay on the main server for consistency reasons

code links

types (like words types or view types) are used to assign coded functionality to some words or views. This implies that a type always must have a code_id. This code_id is also used for system im- and export.

function naming

all classes should have these functions:

All objects needs to have the functions dsp_id and name. These two functions should never all any debug functionality, because they can be called from the debug functions

*_test - the unit test function which should be below each function e.g. the function prg_version_is_older is tested by prg_version_is_older_test

functions of this library

prefix for functions in this library: zu_*

This library contains general functions like debug or string that could also be taken from another framework

all functions that could potentially go wrong have the parameter debug, so that the administrator can find out more details about what has gone wrong a positive debug value means that the user wants to see some debug message

debug functions

zu_debug - for interactive debugging (since version 0.0.3 based on a global $debug var, because meanwhile the PhpStorm has a debugger) zu_msg - write a message to the system log for later debugging zu_info - info message zu_warning - log a warning message if log level is set to warning zu_err - log an error message zu_fatal - log an fatal error message and call a database cleanup zu_start - open the database and display the header zu_end - close the database

display functions - that all objects should have

name - the most useful name of the object for the user dsp_id - the name including the database id for debugging zu_dsp_bool -

admin

Technical

usability

UI

view

Table view

value view

word view

formula

log

export

import

features

Bugs

Prio 2: