Git Product home page Git Product logo

predix-analytics-sample's Introduction

Predix Analytics Samples

A collection of samples for use with Predix Analytics services.

Sample Analytics

These are sample analytics written for use with Predix Analytics:

  • demo-adder: A simple analytic that takes 2 numbers as input and returns their sum. It has been implemented in Java, Matlab (r2011b), and Python.
  • demo-timeseries-adder: Takes 2 arrays of timeseries data and returns a timeseries array that contains the sums at each timestamp. Currently available in Java.
  • demo-timeseries-adder-with-model: Takes 2 arrays of timeseries data and returns a timeseries array that contains the sums at each timestamp, adjusted by a threshold value provided in a trained model. Currently available in Java and Python.
  • demo-RTM-loco: A reference analytic that is used to calculate locomotive efficiency using a linear regression model. It has been implemented in Java, Matlab (r2011b), and Python.
  • miners-rule: A sample analytic that performs a Miner's Rule operation on 2 timeseries arrays and returns a timeseries array. Currently only available in Java.
  • simple-linear-regression:๐Ÿ†• A sample analytic that performs a simple linear regression with two arrays as input and returns the p-value, r-value, slope, intercept and standard error. Currently only available in Python 3.

For more information on developing analytics for use with Predix Analytics, see Analytic Development on Predix IO.

Sample Orchestration Workflows

Sample Orchestration Workflows

You can find more information on configuring and running orchestrations on Predix IO.

Postman Collections

Sample Postman Collections

Once you have created your instance of either the Analytics Catalog or Analytics Runtime service, you can use the sample Postman collections to customize your REST requests and test them out to aid in implementing your applications.

Custom Data Connector

Sample Custom Data Connectors

These are sample custom data connector implementations to connect to various data sources

predix-analytics-sample's People

Contributors

212472312 avatar allen-chu-ge avatar btmurrell avatar dependabot[bot] avatar erwin-cabral-ge avatar stevewinkler avatar tun-chang-ge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

predix-analytics-sample's Issues

Build Failure when running mvn spring-boot:run command from terminal

I am following the steps mentioned in the article but when i run mvn spring-boot:run command I get the below error:
2018-02-07 09:25:10,266 14246 [main] ERROR o.s.boot.SpringApplication - Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.api.FlywayException: Unable to obtain Jdbc connection from DataSource
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)
at com.ge.predix.analytics.customconnector.refimpl.postgresdb.PostgresRefImplConnectorApplication.main(PostgresRefImplConnectorApplication.java:53)
Caused by: org.flywaydb.core.api.FlywayException: Unable to obtain Jdbc connection from DataSource
at org.flywaydb.core.internal.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:56)
at org.flywaydb.core.Flyway.execute(Flyway.java:1385)
at org.flywaydb.core.Flyway.migrate(Flyway.java:1006)
at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
... 16 common frames omitted
Caused by: java.sql.SQLException: Unable to open a test connection to the given database. JDBC url = jdbc:postgresql://localhost:5432/analytics?searchpath=turbine, username = turbine. Terminating connection pool. Original Exception: ------
org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "turbine"
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:451)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:223)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at org.postgresql.jdbc.PgConnection.(PgConnection.java:211)
at org.postgresql.Driver.makeConnection(Driver.java:407)
at org.postgresql.Driver.connect(Driver.java:275)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256)
at com.jolbox.bonecp.BoneCP.(BoneCP.java:305)
at com.jolbox.bonecp.BoneCPDataSource.maybeInit(BoneCPDataSource.java:150)
at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:112)
at org.flywaydb.core.internal.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:50)
at org.flywaydb.core.Flyway.execute(Flyway.java:1385)
at org.flywaydb.core.Flyway.migrate(Flyway.java:1006)
at org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer.afterPropertiesSet(FlywayMigrationInitializer.java:66)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:776)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:369)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:313)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)
at com.ge.predix.analytics.customconnector.refimpl.postgresdb.PostgresRefImplConnectorApplication.main(PostgresRefImplConnectorApplication.java:53)

at com.jolbox.bonecp.BoneCP.<init>(BoneCP.java:312)
at com.jolbox.bonecp.BoneCPDataSource.maybeInit(BoneCPDataSource.java:150)
at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:112)
at org.flywaydb.core.internal.util.jdbc.JdbcUtils.openConnection(JdbcUtils.java:50)
... 21 common frames omitted

Caused by: org.postgresql.util.PSQLException: FATAL: Ident authentication failed for user "turbine"
at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:451)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:223)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:66)
at org.postgresql.jdbc.PgConnection.(PgConnection.java:211)
at org.postgresql.Driver.makeConnection(Driver.java:407)
at org.postgresql.Driver.connect(Driver.java:275)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at com.jolbox.bonecp.BoneCP.obtainRawInternalConnection(BoneCP.java:256)
at com.jolbox.bonecp.BoneCP.(BoneCP.java:305)
... 24 common frames omitted
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:10 min
[INFO] Finished at: 2018-02-07T09:25:10+00:00
[INFO] Final Memory: 35M/366M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.4.0.RELEASE:run (default-cli) on project postgresdb-ref-impl-data-connector: Could not exec java: Application finished with non-zero exit code: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

could you please look into the issue?

multiStepOrchestration initial data missing certain signals

When I run the two step orchestration, there's error:
outputCDM, sensor1Stress and sensor2Stress are needed in the Miner Rule calculation but data are not provided in the initial TimeSeries data. Also they're not defined in the asset model.json

Which signals are the output of calculation, it seems not defined in assets.

{
  "orchestrationRequestId": "2755a2fb-6e5e-48ca-bbdd-0f17ef560bf5",
  "status": "FAILED",
  "orchestrationExecutionStatus": [
    {
      "contextId": "2755a2fb-6e5e-48ca-bbdd-0f17ef560bf5-/assets/minersRuleOrch32-UUID",
      "assetId": "/assets/minersRuleOrch32-UUID",
      "status": "FAILED",
      "orchestrationStepStatus": [
        {
          "status": "FAILED",
          "analyticId": "282410d0-10df-4c82-bea9-516034a53a08",
          "analyticName": "MinersRule",
          "analyticVersion": "v1",
          "analyticRequestId": "c8905f46-f429-11e6-a1f6-9a3c031653a6-minersRule",
          "stepId": "minersRule",
          "startTime": 1487237118300,
          "endTime": 1487237121800,
          "output": null,
          "errorResponse": {
            "code": "ANAEXE009",
            "severity": "1",
            "detail": "Unable to retrieve analytic input data for analytic id 282410d0-10df-4c82-bea9-516034a53a08. Cause: Data service returned 500: {\"code\":\"ANADATA022\",\"severity\":\"2  \",\"detail\":\"Unable to process tag query for asset Id /assets/minersRuleOrch32-UUID Cause: \\nUnable to find tag name for field name 'sensor2Stress' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'sensor3Stress' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'inputCDM' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'sensor1Stress' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'outputCDM' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\n\",\"message\":\"Unable to process tag query for asset Id /assets/minersRuleOrch32-UUID Cause: \\nUnable to find tag name for field name 'sensor2Stress' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'sensor3Stress' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'inputCDM' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'sensor1Stress' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'outputCDM' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\n\",\"parameters\":[\"/assets/minersRuleOrch32-UUID\",\"\\nUnable to find tag name for field name 'sensor2Stress' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'sensor3Stress' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'inputCDM' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'sensor1Stress' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\nUnable to find tag name for field name 'outputCDM' for asset id '/assets/minersRuleOrch32-UUID' from default query..\\n\"]}",
            "message": "Unable to retrieve analytic input data for analytic id 282410d0-10df-4c82-bea9-516034a53a08.",
            "parameters": []
          }
        },
        {
          "status": "COMPLETED",
          "analyticId": "ce2b2395-2661-400f-90ab-1fc0e57f7f6e",
          "analyticName": "java-timeseries-demo-adder",
          "analyticVersion": "1.0",
          "analyticRequestId": "c8905f46-f429-11e6-a1f6-9a3c031653a6-demoAdder",
          "stepId": "demoAdder",
          "startTime": 1487237097800,
          "endTime": 1487237115950,
          "output": null,
          "errorResponse": null
        }
      ],
      "startTime": 1487237097710,
      "endTime": 1487237121800,
      "errorResponse": null
    },

my tag map

[
  {
    "name": "KW",
    "timeseries_tag_id": "32_KW_33-UUID"
  },
  {
    "name": "vibration",
    "timeseries_tag_id": "32_vibration_34-UUID"
  },
  {
    "name": "local Rh",
    "timeseries_tag_id": "32_local_rh_35-UUID"
  },
  {
    "name": "bearing temperature",
    "timeseries_tag_id": "32_bearing_temperature_36-UUID"
  },
  {
    "name": "vibration1",
    "timeseries_tag_id": "32_vibration1_42-UUID"
  },
  {
    "name": "currentCDM",
    "timeseries_tag_id": "32_CDM_44-UUID"
  }
]

test failed when running "mvn clean install"

Results :

Failed tests:
ApiV1AnalyticsCustomdataResourceTest.testPostRead:66 field[fieldId=vibration].data[0] Could not find match for element [1398445998000,1000.33] ; field[fieldId=exhaust_gas_temp].data[0] Could not find match for element [1398445998000,200.42]

Tests run: 1, Failures: 1, Errors: 0, Skipped: 0

Ability to specify additional channels for Python analytics

For Python analytics, within the config.json file, is there a way to add or modify the Python channels that search for package dependencies?

Within a standard .condarc file for Python, developers can add custom channels. This is especially useful for packages that are not available from the open source community.

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.