Jelastic API environment create trigger data - jelastic

The jelastic api environment.Trigger.AddTrigger takes "data" as parameter, but i cannot find what are all the different possible variables that i can use. Jelastic API docs just says "data : string , information about trigger". Is this "data" documented on somewhere else?
There are some JPS javascript/java examples that i have found, that are pointing me to the right direction, but more information would be nice to have.
https://github.com/jelastic-jps/magento-cluster/blob/master/scripts/addTriggers.js
https://docs.cloudscripting.com/0.99/examples/horizontal-scaling/
https://github.com/jelastic-jps/basic-examples/blob/master/automatic-horizontal-scaling/scripts/enableAutoScaling.js

The environment.Trigger.AddTrigger method requires a set of the parameters:
name - name of a notification trigger
nodeGroup - target node group (you can apply trigger to any node
group within the chosen environment)
period - load period for nodes
condition - rules for monitoring resources
type - comparison sign, the available values are GREATER and LESS
value - percentage of a resource that is monitored
resourceType - types of resources that are monitored by a trigger,
namely CPU, Memory (RAM), Network, Disk I/O, and Disk IOPS
valueType - measurement value. Here, PERCENTAGES is the only possible
measurement value. The available range is from 0 up to 100.
actions - object to describe a trigger action
type - trigger action, the available values are NOTIFY, ADD_NODE, and
REMOVE_NODE
customData:
notify - alert notification sent to a user via email
The following code shows how a new trigger can be created:
{
"type": "update",
"name": "AddTrigger",
"onInstall": {
"environment.trigger.AddTrigger": {
"data": {
"name": "new alert",
"nodeGroup": "sqldb",
"period": "10",
"condition": {
"type": "GREATER",
"value": "55",
"resourceType": "MEM",
"valueType": "PERCENTAGES"
},
"actions": [
{
"type": "NOTIFY",
"customData": {
"notify": false
}
}
]
}
}
}
}
More information about events and other CloudScripting language features you can find here.

Related

How i can get list of popular youtube channels per each country?

How i can get list of popular youtube channels per each country?
this service find solution
https://www.channelcrawler.com/eng/results2/281574
I tried youtube api but i didn't find, anyone know solution?
As mentioned, is not possible to get this information using the YouTube API directly, even in the FAQ of the page you shared says:
The Channel Crawler was made to discover new YouTube channels, based on your search criteria.
and:
The Channel Crawler uses advanced data collection methods in order to collect channel information from YouTube and store it in the database. Basically, it just checks the liked videos and comment sections of channels that are already in the database, in order to add more channels to it. You can also manually add a channel.
Following the highlighted information, I have this idea and you can try it too:
Use the search endpoint for search channels in a specific country and in a specific videoCategory, then, with the channelId returned in the results of the search, use the channel endpoint for get their country1.
1 take into account that some channels doesn't have the country value; in this case, you have to set another criteria(s) for determine whether the channel matches with your requirements.
Example:
Use the search endpoint for search channels in country/region Pakistan and in the videoCategory Sports - test it here:
URL:
https://youtube.googleapis.com/youtube/v3/search?part=id%2Csnippet&order=videoCount&q=Sports&regionCode=PK&key=[YOUR_API_KEY]
The results of this request are as follows:
{
"kind": "youtube#searchListResponse",
"etag": "0C7hSI3oNXJt66PsERuviVQcLCo",
"nextPageToken": "CAUQAA", // Remember the nextPageToken for get the next results.
"regionCode": "PK", // Region queried.
"pageInfo": {
"totalResults": 1000000, // Look the amount of data you have to check, filter and debug.
"resultsPerPage": 5 // Set "maxResults" parameter to "50" for get more results per page.
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "iSwEnBs_yV6lOIBubmRXVwjjujQ",
"id": {
"kind": "youtube#channel", // Make sure that this item is actually an channel.
"channelId": "UCo2TvjBHS1BtyIkeGGTMe6w"
},
"snippet": {
"publishedAt": "2018-07-28T18:34:04Z",
"channelId": "UCo2TvjBHS1BtyIkeGGTMe6w", // Use this value for the "channel" endpoint.
"title": "ONTime Sports",
"description": "قناة اون تايم سبورت واحدة من مجم...",
"thumbnails": { [thumbnails here...] },
"channelTitle": "ONTime Sports",
"liveBroadcastContent": "upcoming",
"publishTime": "2018-07-28T18:34:04Z"
}
},
[other results here...]
]
}
Use channel endpoint for get the channel detailed information - in this case, their country - test it here:
URL - using the channelId UCo2TvjBHS1BtyIkeGGTMe6w - obtained from the previous search results:
https://youtube.googleapis.com/youtube/v3/channels?part=id%2Csnippet&id=UCo2TvjBHS1BtyIkeGGTMe6w&key=[YOUR_API_KEY]
The results of this request are as follows:
{
"kind": "youtube#channelListResponse",
"etag": "8BfUXxlAEBLe7lBmih1JXUwZ394",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#channel",
"etag": "AFk5NCl9393ui58WyRf7WljoatE",
"id": "UCo2TvjBHS1BtyIkeGGTMe6w",
"snippet": {
"title": "ONTime Sports",
"description": "large description here...",
"customUrl": "ontimesportseg",
"publishedAt": "2018-07-28T18:34:04Z",
"thumbnails": {[thumbnails here]},
"localized": {
"title": "ONTime Sports",
"description": "large description here..."
},
"country": "EG" // This is the regionCode of the country this channels has provided.
}
}
]
}
Here, you can see that the value "country" for this channel is "EG" = Egypt2.
Then, repeat these steps with all countries and videoCategory for each country.
Considerations:
As I tested, the type parameter in search is not working as one might expect, in this case (for get channels only), use the order=viewCount combination of parameter=value. Even with this combination, make sure to check that the value of the kind attribute is: youtube#channel. Also, I search the videoCategory using its name, no its id - as it should be -, but, the API is not perfect, that's why I used the name of the videoCategory.
Even specifiyng the region parameter with a valid country, you might get results that are either from another countries or doesn't have the country attribute and value at all = and that's due the channel's popularity in the given country and public channel information. A simple example could be: ESPN, they probably have a YouTube channel for each country, but, their main channel is the most popular in all countries, so, in this case, you'll get the ESPN channel in english and that might differ from your expected results. You have to work with what YouTube provides.
As you notice, there are too many channels/results to debug, so, make sure to provide more filters and set your queries/search criteria and (once you get the desired results), store the valid results in a database or similar.
If you know specific channels that you know are popular in a given country, but, when you query that channel using the YouTube Data API, it doesn't bring the country value, you have to save that channel manually in your database and/or collect more information for automatically set if a channel is from a given country - this point is very related to my point # 2.

Transform raw txt data into FHIR resource in JSON

I'm new to FHIR and having some basic questions: I need to transform my raw txt data file into FHIR resource format for storage. Please find my questions and my solutions below and let me know if anything doesn't look appropriate. Thank you very much!
URL for category:code:system not resolved?
In the example of resource observation https://www.hl7.org/fhir/observation-example-sample-data.html. The URL for "category:code:system" can't be resolved (http://terminology.hl7.org/CodeSystem/observation-category). I wondered if I should use the following link instead https://www.hl7.org/fhir/codesystem-observation-category.html#observation-category for the system value?
"category": [
{
"coding": [
{
"system": "https://www.hl7.org/fhir/codesystem-observation-category.html#observation-category",
"code": "activity",
"display": "Activity"
}
]
}
]
If I can't find controlled terminology code (for example, SNOMED or LOINC) for my measurements, I use text instead to describe the measurement.
The measurements including: Rotation rate (x,y,z axis), acceleration (x,y,z axis) from apple watch accelerometer and gyroscope, type of utensil (fork, hand, ...) used during the meal and datetime the meal was started/end. I couldn't find appropriate controlled terminology for my measurements so I use text to describe, for example:
"code": {
"text": "acceleration"
}
Use observation resource for meal time and utensil records.
My raw data in txt file (Time:Event observed):
2019-05-23 17:01:31 +0000: meal started
2019-05-23 17:10:37 +0000: meal completed
2019-05-23 17:16:07 +0000: utensil used is 3
For FHIR version, as the 3 records belongs to the same session. I use 4 components to store all the information (Datetime meal started and completed, datetime when type of utensil was recorded, and type of utensil been used).
"component": [
{
"code": {
"text": "meal started"
},
"valueDateTime": "2019-05-23T17:01:31+00:00"
},
{
"code": {
"text": "meal completed"
},
"valueDateTime": "2019-05-23T17:10:37+00:00"
},
{
"code": {
"text": "datetime, untensil used"
},
"valueDateTime": "2019-05-23T17:16:07+00:00"
},
{
"code": {
"text": "utensil"
},
"valueString": [
"3"
]
}
The system of a coded type does not need to be a resolvable url. It is a unique identifier in the form of a url for the code system the code comes from. A url is more readable to human eyes than for example an OID, and as an added benefit there could be a server responding. Although for all the code systems I've seen used in FHIR, there is not. So in this case, you should just use http://terminology.hl7.org/CodeSystem/observation-category
If you need to verify the code+system, it is up to your implementation to either use a terminology service for that, or implement your own terminology validation.
For 2. and 3. it could be helpful to discuss your use case within the FHIR community on https://chat.fhir.org. There might be others working on similar projects, or to give you guidance on the best approach. It will be better for interoperability if you would use coded values. For example, I would not know what your utensil nr '3' is so that's not interoperable. If you had used the Snomed code for 'fork', that would have been be much clearer.

Alexa: Can we access the actual voice input by the user inside the lambda function?

Is it possible to access the text (converted from voice) spoken by the user? Is there a switch somewhere, which if enabled, the text is sent to the skill?
No, we won't get the entire user input.
However, we can capture parts of user speech by using slots. There are different slots types and the one which you should look into is AMAZON.SearchQuery.
AMAZON.SearchQuery slot type lets you capture less-predictable input that makes up the search query.
{
"intents": [
{
"name": "SearchIntent",
"slots": [
{
"name": "Query",
"type": "AMAZON.SearchQuery"
},
{
"name": "CityList",
"type": "AMAZON.US_CITY"
}
],
"samples": [
"search for {Query} near me",
"find out {Query}",
"search for {Query}",
"give me details about {CityList}"
]
}
]
}
More on AMAZON.SearchQuery here
There is AMAZON.LITERAL slot that passes the recognized words for the slot value with no conversion. But, its's not recommended. You cannot use AMAZON.LITERAL in a skill configured with a dialog model

jmeter json path Conditional Extraction at peer level

I'm using jmeter v2.13 and jp#gc - JSON Path Extractor.
Here is my JSON sample:
{
"views": [{
"id": 9701,
"name": " EBS: EAS: IDC (EAS MBT IDC)",
"canEdit": true,
"sprintSupportEnabled": true,
"filter": {
"id": 55464,
"name": "Filter for EBS: EAS: IDC & oBill Boar",
"query": "project = \"EBS: EAS: IDC\"",
"owner": {},
"canEdit": false,
"isOrderedByRank": true,
"permissionEntries": [{
"values": [{
"type": "Shared with the public",
"name": ""
}]
}]
},
"boardAdmins": {}
},
{}
]
}
Is it possible to extract views[x].id where there exists an entry views[x].filter.permissionEntries[*].values[*].type that equals Shared with the public?
How would I do it?
Thanks
JSON Query would look like this (I admit I didn't try it in JMeter)
$.views[?(#.filter[?(#.permissionEntries[?(#.values[?(#.type == "Shared with the public")])])])].id
Explanation:
We expect under root ($) to have views and for it to have property id. The rest (in []) are conditions to select only views items based on predefined condition. Hence $.views[conditions].id
Conditions in this case are coming one within the other, but main parts are:
We define condition as a filter ?(...)
We ask filter to look under current item (#) for a specific child item (.child), child may have its own conditions ([...]). Hence #.child[conditions]. That way we move through filter, permissionEntries, values
Finally we get to field values and filter it for a child type field with particular value Shared with the public. Hence #.type == "Shared with the public"
As you see it's not very intuitive, and JSON path is a bit limited. If this is a repetitive issue, and your JSON is even more complicated, you ay consider investing into a scriptable pre-processor (similar to the one explained here.

Output for SCIM User PUT method when updating a composite attribute

I have a user in mu user store with following attributes.
{
"id": "bfae138c-9f57-4ff1-ab63-599f2034371f",
"schemas":[
"urn:scim:schemas:core:1.0"
],
"name":{
"formatted": "Ms. Barbara J Jensen III",
"familyName": "Jensen",
"givenName": "Barbara"
},
"userName": "bjensen123",
"externalId": "bjensen",
"meta":{
"lastModified": "2015-05-25T08:59:28",
"location": "https://localhost:9443/wso2/scim/Users/bfae138c-9f57-4ff1-ab63-599f2034371f",
"created": "2015-05-25T08:59:28"
}
}
I'm sending a put request to this resource with following method body.
{
"schemas":["urn:scim:schemas:core:1.0"],
"userName":"bjensen123",
"name":{
"formatted":"Ms. Bb",
}
}
What should be the name attribute of my resulting resource?
"name":{
"formatted":"Ms. Bb",
}
or
"name":{
"formatted": "Ms. Bb",
"familyName": "Jensen",
"givenName": "Barbara"
}
The PUT request is to be handled as a complete update, as opposed to a PATCH, which would only update specified attributes, and is optional for the implementer (per the SCIM 1.1 spec). The intent of a PUT is that the requester first perform a read (GET) of the user, change the desired attributes, and provide a comprehensive update, to include those attributes that aren’t actually changing (password being the one exception). Any attributes that aren’t specified with values in the PUT request would be blown away. Thus, per your example, the PUT response would come back as:
"name":{"formatted":"Ms. Bb"}
If you don’t want to lose the familyName and givenName, you have to re-specify those as well (along with any other attributes that you don’t want to blow away). Here’s the spec definition:
http://www.simplecloud.info/specs/draft-scim-api-01.html

Resources