In Short DeepSee is an analytics tool to incorporate Actionable BI views of your data embedded within your application.  DeepSee sits right on top of your application data store so there is no extract or transformation of data.  This allows the dashboards created to be as up-to-date with transactional events as is appropriate up to near real-time.  Users of these dashboard can then initiate action within the application directly from the Analytical view hence the "Actionable BI" label.

A great way to get started is to go to our online learning portal.    Here is a link to the learning resource guide for DeepSee.  https://learning.intersystems.com/course/view.php?id=19 

Let me recap what I think I understand.  You have a business service that uses an inbound file adapter.  The OnProcessInput method of that service builds the message that then gets sent into the production.  The input parameter of the OnProcessInput is a file character stream of some kind.  You want to get the filename associated to that stream to add to your message.

If all the above is true then you need to access the 'filename' property of the stream.  Note that the exact property may depend on the stream class being used.  'Filename' will work with any file based stream in the %Stream package or those stream classes defined in %Library.  If this stream is of type Ens.StreamContainer then use the 'OriginalFilename' property.

If I am still not clear perhaps you could share at least some of the implementation of you OnProcessInput method and the details of the message class you are building.

One other question would be how are you trying to incorporate the source filename into the output filename?  Are you using the %f filespec?

There are a number of reasons why building a REST service off a CSP page would be bad.  They all come down to that a CSP page does not implement all the features of a "proper" REST service.  REST is really not that difficult in Cache once you get the basics down.  Just to be sure you are looking at the right documentation here is a link to the most recent.  

http://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY=...

It is not clear from your question if this is in Cache or Ensemble.  In practice setting up the service itself is best done in Cache even in you are using Ensemble.  EnsLib.REST.Service does not, as of yet, provide a full implementation of the %CSP.REST class that it inherits from.   It WILL work, however there may be some features of %CSP.REST that you can not take advantage of.  I don't have a list of those.  Post a follow up question if that is of interest and the information can be dug up. 

When you look at a REST service call from you need to breakdown the URL to understand how this is implement in Cache.  Take www.somecompany.com/api/v1/person/1,  there are three sections we are worried about

server:  www.somecompany.com

CSP Web Application: /api/v1  - this is setup in the system management portal under security->Applications-

resource being accessed: /person/1 - this is mapped in a Class that inherits from %CSP.REST in an XDATA block as shown below.  The '1' in this case is a data value indicating which person record you want to access and is also part of the mapping.  Here is what that class might look like:

Class Example.RESTservice extends %CSP.REST {

XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap" ]
{
<Routes>
<Route Url="/Person/:ID" Method="Get" Call="RetrievePerson" />
<Route Url="/test" Method="GET" Call="TestService" />
</Routes>
}

Classmethod RetreivePerson(ID as %String) as %Status

{

// code to retreive the person record and format the response which is simple "written" out from this method

//be sure to put a proper HTTP status in the %response.status property and a correct content type

// (ie. application/json) in %response.ContentType

}

}

Note the :ID in the map of the URL. This indicates a data value that is to be passed to the class method that is called.  If there are multiple data values they are passed to each parameter of the method in order they occur.  The name in the URL has no real meaning.  These data parameters can also appear in any place in the URL so www.somecompany.com/api/v1/1/person could also be a valid URL.

Now tie this together by putting your REST class name that you just created (ie Example.RESTservice) in the Dispatch Class field of the web application.  Now anything that is part of the URL that is past the CSP web application will be forwarded to the dispatch class to be handled.

Hope this helps

I attempted this with the following query:

SELECT Name,%VID,ID,Age FROM
   (SELECT TOP 10 * FROM Sample.Person )
ORDER BY Name

Here are the results:  You can see that the %VID column does not correspond to the returned result set.

#NameLiteral_2IDAge
1Adam,Tara P.7759
2Brown,Orson X.8892
3Hernandez,Kim J.1123
4Kelvin,Dick J.6612
5Orwell,Andrew T.9946
6Page,Lawrence C.3367
7Quixote,Andrew Q.4473
8Williams,Stuart O.101077
9Yakulis,Fred X.2282
10Zemaitis,Emilio Q.5557

I had a client that had this exact problem.   The JSON interfaces that exist today intentionally try to take a concise approach rather than try to provide options to handle every possible situation.   Bottom-line is that this means for this situation you will need to create your own method of handling this.  The good is that this is not necessarily too difficult to create a flexible methodology to do this.  

What my client did was to create a code generation method that would introspect on the class definition at compile time and produce a method that would build a Proxy object (old way, 2016 and higher would use Dynamic Object structures) of exactly what they wanted to have in the JSON.  Then the method to produce the JSON from an object would use the Proxy or Dynamic object.   For this client they created a parameter on the class that provided direction regarding how to handle collection properties.  

It may also be possible to create a general utility class that defines  new property parameters to manage this and the code generation method.   Then have the your classes inherit from this to add in the desired functionality. 

If you are publishing a RESTful service then you don't set the Accepted Content type.  This is for the client to inform you as to what they responses they can accept.  So your rest service would examine this value to verify that you can supply the type of response the client will accept.  You would access this value using this syntax:

 

%request.CgiEnvs("HTTP_ACCEPT")

Problem with giving recommendations on how to minimize this is that there are many causes and many potential resolutions.  Some solutions will not be acceptable.  The simplest solution would be to create a database to hold this global and any other you don't need journaled.   Set this database to not be journaled and map that global to this database.  Of course you may want to have the database journaled.  Now you have to dig in further as others have suggested and determine why there is so much activity hitting this global.  It could be a routine that can be adjusted to generate less global activity.   I had a similar situation where the problem was traced to the fact that for every iteration of a process loop the global was updated.  The same record could be touched hundreds of times.  The solution was to hold the updates in a process private global (not journaled) and then do a single pass to update the records.

 

Hope this helps.

I will leave the logging issue alone as I don't see it as being the main point of the example.  It could also be a thread by itself.

The issue of using a bunch of $$$ISERR or other error condition checks is exactly why I like using throw with try/catch.  I disagree that it should only be for errors outside of the application's control.  However it is true that most of the time you are dealing with a fatal error.  Fatal that is to the current unit of work being performed, not necessarily to the entire process.

I will often use code like

set RetStatus = MyObj.Method() 

throw:$$$ISERR(RetStatus) ##class(%Exception.StatusException).CreateFromStatus(RetStatus)

The post conditional on the throw can take many forms, this is just one example.

Where I put the Try/Catch depends on many factors such as:

  • Where do I want recovery to happen?
  • use of the method and my code 
  • readability and maintainability of the code
  • ...

I the case of nested loops mentioned I think this is a great way to abort the process and return to a point, whether in this program or one farther up the stack, where the process can be cleanly recovered or aborted.