docstr: /models/{name}/run
  
  schema:
    {
      predictedFieldName: value
      timestamp: %m/%d/%y %H:%M
    }
    NOTE: predictedFieldName MUST be the same name specified when
          creating the model.
  
  returns:
  {
    "predictionNumber":<number of record>,
    "anomalyScore":anomalyScore
  }
docstr_tok: ["\/models\/","{","name","}","\/run","schema",":","{","predictedFieldName",":","value","timestamp",":","%","m\/","%","d\/","%","y","%","H",":","%","M","}","NOTE",":","predictedFieldName","MUST","be","the","same","name","specified","when","creating","the","model",".","returns",":","{","``","predictionNumber","''",":","<","number","of","record",">",",","``","anomalyScore","''",":","anomalyScore","}"]
code: def POST(self, name):
      """
      /models/{name}/run
  
      schema:
        {
          predictedFieldName: value
          timestamp: %m/%d/%y %H:%M
        }
        NOTE: predictedFieldName MUST be the same name specified when
              creating the model.
  
      returns:
      {
        "predictionNumber":<number of record>,
        "anomalyScore":anomalyScore
      }
      """
      global g_models
  
      data = json.loads(web.data())
      data["timestamp"] = datetime.datetime.strptime(
          data["timestamp"], "%m/%d/%y %H:%M"
      )
  
      if name not in g_models.keys():
          raise web.notfound(
              "Model with name <%s> does not exist." % name
          )
  
      modelResult = g_models[name].run(data)
      predictionNumber = modelResult.predictionNumber
      anomalyScore = modelResult.inferences["anomalyScore"]
  
      return json.dumps(
          {
              "predictionNumber": predictionNumber,
              "anomalyScore": anomalyScore,
          }
      )
  
file_path: nupic-legacy/src/nupic/simple_server.py
imports: import os
  import sys
  import datetime
  import json
  import web
  from nupic.frameworks.opf.model_factory import ModelFactory
label_desc: Use image node_id 1 for calling the ModelRunner obj's underlying member method code with example usage: obj.POST(name) and returns: json