Add weather WebPart using Add-PnPClientSideWebPart is not setting location - powershell

I'm trying to add a weather WebPart on a modern page in SharePoint Online.
This is the PowerShell I'm executing:
$jsonProperties = '
{
"serverProcessedContent": {
"searchablePlainTexts": {
"webPartTitle": "Weather"
}
},
"properties": {
"temperatureUnit": "C",
"locations": [
{
"countryName": "Australia",
"name": "Manjimup, Australia",
"latitude": -34.24055862426758,
"longitude": 116.14610290527344,
"showCustomizedDisplayName": false
},
{
"countryName": "Australia",
"name": "Bega, Australia",
"latitude": -36.673919677734378,
"longitude": 149.84178161621095,
"showCustomizedDisplayName": false
}
]
}
}'
Add-PnPClientSideWebPart -Page https://mysharepointsite.sharepoint.com/Sites/MyPage -DefaultWebPartType Weather -WebPartProperties $jsonProperties
The WebPart is being added but there are no weather locations, as shown below.
What am I missing for the locations to be added to the WebPart?

I was missing the property "dataVersion": "1.2". The full JSON looks like this:
$jsonProperties = '
{
"dataVersion": "1.2",
"serverProcessedContent": {
"searchablePlainTexts": {
"webPartTitle": "Weather"
}
},
"properties": {
"temperatureUnit": "C",
"locations": [
{
"countryName": "Australia",
"name": "Manjimup, Australia",
"latitude": -34.24055862426758,
"longitude": 116.14610290527344,
"showCustomizedDisplayName": false
},
{
"countryName": "Australia",
"name": "Bega, Australia",
"latitude": -36.673919677734378,
"longitude": 149.84178161621095,
"showCustomizedDisplayName": false
}
]
}
}'

Related

Anyone know why code cannot insert the MongoDB by using MongoCompass, I'm sure the structure it's already correct

I planned to insert my code by MongoDB compass but when I clicked 'Insert' button, it only appears 'Inserting Document' but nothing happened even after I clicked the 'Insert' button many times and after that I try to refresh my MongoDB compass but nothing happened and the data is not inserted.
Here's my code:
{
"_id": "7",
"listing_id": "677728659232692395",
"arrival_date": new ISODate("2022-11-08T14:10:30Z"),
"departure_date": new ISODate("2022-11-15T14:10:30Z"),
"name": { first_name: "Gregorius", last_name: "Agung"
},
"email": "gregorius.agung04#gmail.com",
"contact": {
"daytime_phone": "0921970278",
"mobile": "0917820292",
"postal_address": {
"door": "5",
"floor": "12",
"street": "Swanston",
"suburb": "Weribee",
"state": "Victoria",
"country": "Australia",
"postal_code": "3003"
}, home_address: {
"door": "4",
"floor": "11",
"street": "Swanston",
"suburb": "Weribee",
"state": "Victoria",
"country": "Australia",
"postal_code": "3003"
}
},
"number_of_guests": 2,
"guests": [
{
"name": "Marvel",
"age": 22
},
{
"name": "Bryant",
"age": 23
}
],
"deposit_paid": {$numberDecimal: 120.01
},
"balance_due_amount": {$numberDecimal: 120.01
},
"balance_due_date": new ISODate(
"2022-11-08T14:10:30Z")
}
It seems your json is wrong. Some of the keys are not in quotes and for date insertion this is not working in compass.
I tried this and it is working
{
"_id": "7",
"listing_id": "677728659232692395",
"arrival_date": {
"$date": {
"$numberLong": "1667916630000"
}
},
"departure_date": {
"$date": {
"$numberLong": "1668521430000"
}
},
"name": {
"first_name": "Gregorius",
"last_name": "Agung"
},
"email": "gregorius.agung04#gmail.com",
"contact": {
"daytime_phone": "0921970278",
"mobile": "0917820292",
"postal_address": {
"door": "5",
"floor": "12",
"street": "Swanston",
"suburb": "Weribee",
"state": "Victoria",
"country": "Australia",
"postal_code": "3003"
},
"home_address": {
"door": "4",
"floor": "11",
"street": "Swanston",
"suburb": "Weribee",
"state": "Victoria",
"country": "Australia",
"postal_code": "3003"
}
},
"number_of_guests": 2,
"guests": [
{
"name": "Marvel",
"age": 22
},
{
"name": "Bryant",
"age": 23
}
],
"deposit_paid": {
"$numberDecimal": "120.01"
},
"balance_due_amount": {
"$numberDecimal": "120.01"
},
"balance_due_date": {
"$date": {
"$numberLong": "1667916630000"
}
}
}

Using JSON on Grafana's Worldmap Panel

The Worldmap Panel plugin for Grafana's documentation specifies the necessary input data like the following:
[
{
"key": "SE",
"latitude": 60.128161,
"longitude": 18.643501,
"name": "Sweden"
},
{
"key": "US",
"latitude": 37.09024,
"longitude": -95.712891,
"name": "United States"
}
]
Source: https://grafana.com/grafana/plugins/grafana-worldmap-panel/
I've tried inputting data by using a Zabbix data source and a JSON/JSONP endpoint under the panel's "Map Data Options".
JSON Endpoint Response Data:
[
{
"name": "United States",
"key": "US",
"longitude": -85.997,
"latitude": 37.7529
},
{
"name": "Australia",
"key": "AU",
"longitude": 151.2006,
"latitude": -33.8715
},
{
"name": "United States",
"key": "US",
"longitude": -122.0438,
"latitude": 37.3177
},
{
"name": "United Kingdom",
"key": "GB",
"longitude": -1.6451,
"latitude": 54.9749
},
{
"name": "Portugal",
"key": "PT",
"longitude": -8.6793,
"latitude": 41.1691
},
{
"name": "United States",
"key": "US",
"longitude": -96.6146,
"latitude": 33.6416
},
{
"name": "Egypt",
"key": "EG",
"longitude": 29.7432,
"latitude": 30.9977
},
{
"name": "United Kingdom",
"key": "GB",
"longitude": -0.2972,
"latitude": 51.5571
},
{
"name": "United States",
"key": "US",
"longitude": -97.0951,
"latitude": 32.8285
}
]
Zabbix Data Source:
[{"name":"Trinidad and Tobago","key":"TT","longitude":-61.4692,"latitude":10.2843},{"name":"Australia","key":"AU","longitude":151.2006,"latitude":-33.8715},{"name":"United Kingdom","key":"GB","longitude":-1.6451,"latitude":54.9749},{"name":"United States","key":"US","longitude":-96.6146,"latitude":33.6416},{"name":"United Kingdom","key":"GB","longitude":-0.2972,"latitude":51.5571},{"name":"Egypt","key":"EG","longitude":29.7432,"latitude":30.9977},{"name":"United States","key":"US","longitude":-97.0951,"latitude":32.8285}]
Both options show nothing on the map. I've tried various options and nothing seems to work.
Am I misunderstanding how the map should consume this data?
If so, how would I proceed with transforming the data from their respective source?
My Worldmap Panel Setup

can't able to store fhir resource in mongodb using asymmetrik mongodb fhir-core-server

i'm running node-fhir-server-mongo(Asymmetrik github repo)..when i put resource using PUT method and it stores in mongodb...everything works fine...but the data is partially stored...when i try to access the data i stored in database it only shows few pieces only...
below code is the data i want to store..
{
"resourceType": "Patient",
"id": "example3",
"text": {
"status": "generated",
},
"identifier": [
{
"use": "usual",
"type": {
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0203",
"code": "MR"
}
]
},
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345",
"period": {
"start": "2001-05-06"
},
"assigner": {
"display": "Acme Healthcare"
}
}
],
"active": true,
"name": [
{
"use": "official",
"family": "Chalmers",
"given": [
"Peter",
"James"
]
},
{
"use": "usual",
"given": [
"Jim"
]
},
{
"use": "maiden",
"family": "Windsor",
"given": [
"Peter",
"James"
],
"period": {
"end": "2002"
}
}
],
"telecom": [
{
"use": "home"
},
{
"system": "phone",
"value": "(03) 5555 6473",
"use": "work",
"rank": 1
},
{
"system": "phone",
"value": "(03) 3410 5613",
"use": "mobile",
"rank": 2
},
{
"system": "phone",
"value": "(03) 5555 8834",
"use": "old",
"period": {
"end": "2014"
}
}
],
"gender": "male",
"birthDate": "1974-12-25",
"_birthDate": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/patient-birthTime",
"valueDateTime": "1974-12-25T14:35:45-05:00"
}
]
},
"deceasedBoolean": false,
"address": [
{
"use": "home",
"type": "both",
"text": "534 Erewhon St PeasantVille, Rainbow, Vic 3999",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25"
}
}
],
"contact": [
{
"relationship": [
{
"coding": [
{
"system": "http://terminology.hl7.org/CodeSystem/v2-0131",
"code": "N"
}
]
}
],
"name": {
"family": "du Marché",
"_family": {
"extension": [
{
"url": "http://hl7.org/fhir/StructureDefinition/humanname-own-prefix",
"valueString": "VV"
}
]
},
"given": [
"Bénédicte"
]
},
"telecom": [
{
"system": "phone",
"value": "+33 (237) 998327"
}
],
"address": {
"use": "home",
"type": "both",
"line": [
"534 Erewhon St"
],
"city": "PleasantVille",
"district": "Rainbow",
"state": "Vic",
"postalCode": "3999",
"period": {
"start": "1974-12-25"
}
},
"gender": "female",
"period": {
"start": "2012"
}
}
],
"managingOrganization": {
"reference": "Organization/1"
} }
and the actual data is stored on the mongodb is....
_id: "example3" id: "example3" meta: Object versionId: "1" lastUpdated: "2022-06-28T08:44:44+00:00" resourceType: "Patient"
if anyone know the answer or how to solve please let me know....thanks in advance!

Why is the conditional subschema (JSON Schema Draft7) validation not working?

Ref: https://json-schema.org/understanding-json-schema/reference/conditionals.html
- Schema snippet
"properties": {
"country": {
"default": "United States of America",
"enum": [
"United States of America",
"Canada"
]
},
"address": {
"properties": {
"AddressLine1": {
"type": "string"
},
"if": {
"properties": {
"country": {
"const": "United States of America"
}
}
},
"then": {
"postal_code": {
"type": "integer"
}
},
"else": {
"postal_code": {
"type": "string"
}
}
},
"required": [
"AddressLine1",
"postal_code"
]
Sample Data 1 - Expected Pass
{
"address": {
"AddressLine1": "Address Line 1 in US",
"postal_code": 11779
}
}
Sample Data 2 - Expected Fail
{
"address": {
"AddressLine1": "Address Line 1 in Canada",
"postal_code": "RA90 188"
}
}
I expected the 2nd sample to fail but it passes without any issues. I am using PowerShell Test-JSON for validation
You forgot to wrap postal_code in "properties": { ... } in your then and else clauses.

How to query api with filter options

I am trying filter the response city wise. I am not able to understand how to query filter parameters.
I have tried different ways but with no success. This is the response without applying filter. But I want filter it for a particular city.
{
"index_name": "3b01bcb8-0b14-4abf-b6f2-c1bfd384ba69",
"title": "Real time Air Quality Index from various location",
"desc": "Real time Air Quality Index from various location",
"org_type": "Central",
"org": [
"Ministry of Environment and Forests",
"Central Pollution Control Board"
],
"sector": [
"Industrial Air Pollution"
],
"source": "data.gov.in",
"catalog_uuid": "a3e7afc6-b799-4ede-b143-8e074b27e0621",
"visualizable": "1",
"active": "1",
"created": 1543320551,
"updated": 1559683085,
"created_date": "2018-11-27T17:39:11Z",
"updated_date": "2019-06-05T02:48:05Z",
"target_bucket": {
"index": "air_quality",
"type": "a3e7afc6-b799-4ede-b143-8e074b27e0621",
"field": "3b01bcb8-0b14-4abf-b6f2-c1bfd384ba69"
},
"field": [
{
"id": "id",
"name": "id",
"type": "double"
},
{
"id": "country",
"name": "country",
"type": "keyword"
},
{
"id": "state",
"name": "state",
"type": "keyword"
},
{
"id": "city",
"name": "city",
"type": "keyword"
},
{
"id": "station",
"name": "station",
"type": "keyword"
},
{
"id": "last_update",
"name": "last_update",
"type": "date"
},
{
"id": "pollutant_id",
"name": "pollutant_id",
"type": "keyword"
},
{
"id": "pollutant_min",
"name": "pollutant_min",
"type": "double"
},
{
"id": "pollutant_max",
"name": "pollutant_max",
"type": "double"
},
{
"id": "pollutant_avg",
"name": "pollutant_avg",
"type": "double"
},
{
"id": "pollutant_unit",
"name": "pollutant_unit",
"type": "keyword"
}
],
"status": "ok",
"message": "Resource detail",
"total": 1000,
"count": 10,
"limit": "10",
"offset": "8",
"records": [
{
"id": "13",
"country": "India",
"state": "Andhra_Pradesh",
"city": "Rajamahendravaram",
"station": "Anand Kala Kshetram, Rajamahendravaram - APPCB",
"last_update": "05-06-2019 02:00:00",
"pollutant_id": "CO",
"pollutant_min": "2",
"pollutant_max": "50",
"pollutant_avg": "28",
"pollutant_unit": "NA"
},
{
"id": "14",
"country": "India",
"state": "Andhra_Pradesh",
"city": "Rajamahendravaram",
"station": "Anand Kala Kshetram, Rajamahendravaram - APPCB",
"last_update": "05-06-2019 02:00:00",
"pollutant_id": "OZONE",
"pollutant_min": "37",
"pollutant_max": "132",
"pollutant_avg": "71",
"pollutant_unit": "NA"
}
{
"id": "16",
"country": "India",
"state": "Andhra_Pradesh",
"city": "Tirupati",
"station": "Tirumala, Tirupati - APPCB",
"last_update": "05-06-2019 02:00:00",
"pollutant_id": "PM10",
"pollutant_min": "33",
"pollutant_max": "72",
"pollutant_avg": "55",
"pollutant_unit": "NA"
}
],
"version": "2.1.0"
}
This is only documentation on how to do filtering.
properties: OrderedMap { "id": OrderedMap { "type": "integer" }, "date": OrderedMap { "type": "integer" } }
How to form request url for filtering the response?
yes the documentation is very poor, but still out of many trials I got it work like
this
https://api.data.gov.in/resource/3b01bcb8-0b14-4abf-b6f2-c1bfd384ba69?api-key=<your key>&format=json&offset=0&limit=10
&filters[pollutant_id]=NO2