Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By higgledy
#813337
I am new to processmaker, and workflows, too. My company tasked me to learn what metrics processmaker has available to compare with what metrics my company would like to track.

Is there a list somewhere of what metrics are collected?

Thanks
User avatar
By amosbatto
#813352
In the Community version, the user can see "Open Cases vs Completed Cases" dashlet under the Dashboards menu. If you want more dashlets, then you will need to create a plugin to add custom dashlets. See Plugin Development.

In the Enterprise Edition, there are a couple plugins that offer more metrics:
Advanced Dashboards (offers some dashlets and allows you to add custom dashlets with database queries)
Strategic Dashboards (KPIs) (calculates efficiency in several different ways and allows you calculate costs)
Simple Reporting
Data Reporting Tools
By higgledy
#813377
Thanks. But I am more interested in what metrics are captured by Processmaker out of the box? i.e. I need to use the ProcessMaker Rest API to get these metrics from the MySQL db. Therefore, which tables, etc. store these metrics? Thanks.
User avatar
By amosbatto
#813394
If you are using the Community Edition, then you will have to write your own SQL queries to calculate metrics.

If you want to do this via REST, then import my extraRest plugin:
(29 KiB) Downloaded 266 times
Then, you can call the POST http://{your-domain}/api/1.0/workflow/extrarest/sql endpoint like this:
Code: Select all
    $url = "/api/1.0/workflow/extrarest/sql";
    $sql = "SELECT APP_CURRENT_USER AS USER, COUNT(*) AS NUM_OVERDUE 
        FROM APP_CACHE_VIEW WHERE DATE(DEL_INIT_DATE) >= '2018-01-01' AND 
        DEL_FINISH_DATE IS NULL AND DEL_TASK_DUE_DATE < NOW() 
        GROUP BY USR_UID ORDER BY APP_CURRENT_USER";
    $oRet = pmRestRequest("POST", $url, array("sql"=>$sql), $oToken->access_token);
    if ($oRet->status == 200) {
        foreach ($oRet->response as $aRow) {
            print "User ".$aRow->USER." has ".$aRow->NUM_OVERDUE." overdue cases in year 2018.\n";
        }
    } 
If it doesn't work, then delete the processmaker/shared/sites/{workspace}/routes.php file and try again.
If you want to modify this endpoint, then edit the following code in the file processmaker/workflow/engine/plugins/extraRest/src/Services/Api/ExtraRest/Extra.php:
Code: Select all
    /**
     * Execute an SQL SELECT query in the current workspace's workflow database. 
     * By default, the initial workspace is named "wf_workflow". The results
     * are returned in a numbered array starting from 1, just like executeQuery().
     * 
     * Note: For security reasons, only SELECT statements in the current workspace's workflow
     * database are allowed. If thinking of modifying this endpoint to allow UPDATE, INSERT and DELETE
     * statements, then make sure to change the ProcessMaker configuration files. See:
     * http://wiki.processmaker.com/3.0/Consulting_the_ProcessMaker_databases#Protecting_PM_Core_Tables
     * 
     * 
     * @url POST /sql
     * @access protected
     * 
     * @param string $sql SQL SELECT statement to execute. {@from body}
     *   
     * @return array
     * 
     * @author Amos Batto <amos@processmaker.com>
     * @copyright Public Domain
     */
    public function postSql($sql) {
        $g = new G();
        $g->loadClass("pmFunctions");
        
        try {
            if (preg_match('/^\s*select\s/i', $sql) == 0) {
                throw new Exception("SQL must be a SELECT statement.");
            } 
        
            $aResult = executeQuery($sql);
        } 
        catch (Exception $e) {
            throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
        }
        
        $aRows = array();
        foreach ($aResult as $aRow) {
            $aRows[] = $aRow;
        }    
        return $aRows;   
    } 

Do you want a quick way to delete passwords from P[…]

Try the CloudMigration PST Converter to convert […]

In the rapidly evolving world of online sports be[…]

STEPN integrates social networking and games that […]