Structured data for company with two (or more) branches - structured-data

I'm trying to figure out how to implement structured data for my company with 2 branches. The branches are in the same city, but there is not head offfice or a difference in hierarchy. The branches do not have their own landing page on the website. It's a dentist office so I wanted to use LocalBusiness -> Dentist.
Because I found that nesting the data was better then to separate the data, I thought of using #brancheOf or #subOrganization. However when I try this the testing tool tells me these properties do not work with #type 'Dentist'. Can somebody give me some advise on how to continue? This is what I had so far:
<script type='application/ld+json'>
{
"#context": "http://www.schema.org",
"#type": "Dentist",
"name": "",
"url": "",
"sameAs": [
""
],
"logo": "",
"image": "",
"description": "",
"address": {
"#type": "PostalAddress",
"streetAddress": "",
"addressLocality": "",
"addressRegion": "",
"postalCode": "",
"addressCountry": ""
},
"geo": {
"#type": "",
"latitude": "",
"longitude": ""
},
"hasMap": "",
"openingHours": "Mo 09:00-17:30 Tu 08:30-17:30 We, Th, Fr 08:00-17:30",
"contactPoint": {
"#type": "",
"contactType": "",
"telephone": "",
"email": ""
},
"#subarganization": "http://www.schema.org",
"#type": "Dentist" (I didn't continue here because I got the error, but I would enter address details etc. from the second branch).
}
</script>

Related

cosmos cannot delete the duplicate uuid

Hello I post this little message to know if it is possible to delete
The model is as below:
Create Log data
{
"publisherID": "",
"managerID": "",
"mediaID": "",
"type": "",
"ip": "",
"userAgent": "",
"playerRes": "",
"title": "",
"playerName": "",
"videoTimeCode": 0,
"geo": {
"country": "",
"region": "",
"city": "",
"ll": []
},
"date": "",
"uuid": "",
"id": ""
}
Select all log data: SELECT * FROM a
[
{
"publisherID": "{ID}",
"mediaID": "{ID}",
"type": "Load",
"ip": "67.69.69.41",
"userAgent": "Mozilla/5.0 (Android 11; Mobile; rv:91.0) Gecko/91.0 Firefox/91.0",
"parentReferrer": "link.com",
"title": "title here",
"playerName": "page",
"videoTimeCode": 0,
"geo": {
"country": "CA",
"region": "Ontario",
"city": "Guelph",
"ll": [
43.5588,
-80.3004
]
}
}
]
[SQL-QUERY]: 01 - does not work because there are always duplicate uuids
I want to have all the requests of type progress type: 'Progress'
Organize progress type data by minute according to the date
SELECT COUNT(c.uuid) as total,
left(c.date,16) as time
FROM c
WHERE c.mediaID = '{ID}'
AND (c.date BETWEEN '2021-08-02T14:48:00.000Z' AND '2021-09-03T14:48:00.000Z')
GROUP BY c.uuid, left(c.date, 16)
[
{
"total": 9,
"time": "2021-09-03T14:07"
},
{
"total": 40,
"time": "2021-09-02T12:51"
},
{
"total": 51,
"time": "2021-09-02T12:50"
}
]
[SQL-QUERY]: 02 - cosmos error !
Syntax error, incorrect syntax near 'DISTINCT'.
SELECT COUNT(DISTINCT c.uuid) as total, left(c.date,16) as time
FROM c
WHERE c.mediaID = 'ckpwphqbj10852aav7ib0713o8'
AND (c.date BETWEEN '2021-08-02T14:48:00.000Z' AND '2021-09-03T14:48:00.000Z')
GROUP BY c.uuid, left(c.date, 16)
I want to delete duplicate uuids and then group unique uuids by date
are you looking for this?
counting distinct uuid:
SELECT COUNT(distinct c.uuid) as total, left(c.date,16) as time
FROM c
WHERE c.postID = '155478'
AND (c.date BETWEEN '2021-08-02T14:48:00.000Z' AND '2021-09-03T14:48:00.000Z')
GROUP BY left(c.date, 16)

Recursive updating of Mongoose document

I am currently trying to implement symmetrical (AES256-GCM) encryption to a document before it gets saved into the database. Therefore I have hooked into the pre('save') method to grab data and encrypt it before it gets saved to the database. I need to do this to meet regulations which require all medical data to be encrypted and can only be decrypted by the user who owns the data. This is was for a bit of background
So I have a complex schema setup for the user which contains a lot of PII information so I can't post an example but I can give you a sanitised JSON structure of the data, that doesn't give away what I am working on. (NDAs...).
{
"title": "",
"firstName": "",
"lastName": "",
"XXXXXXXXXX": [{
"XXX": "",
"XXX": "",
"XXX": "",
"XXX": "",
"XXX": "",
"XXX": "",
"XXX": "",
"XXX": ""
}],
"contact": {
"contactNumbers": [{
"type": "",
"number": ""
}],
"emailAddresses": [{
"type": "",
"address": ""
}]
},
"XXX": {
"XXX": {
"XXX": "",
"firstName": "",
"lastName": "",
"XXX": ""
},
"XXX": [{
"XXX": "",
"firstName": "",
"lastName": "",
"XXX": ""
}],
"name": "",
"XXX": "",
"XXX": "",
"XXX": ""
},
"XXX": [{
"name": "",
"number": ""
}],
"XXX": [{
"code": "",
"name": "",
"XXX": "",
"XXX": ""
}],
"XXX": [{
"code": "",
"name": "",
"XXX": "",
"XXX": ""
}],
"XXX": [{
"name": "",
"XXX": "",
"contactNumber": "",
"emailAddress": "",
"address": {
"street1": "",
"street2": "",
"suburb": "",
"city": "",
"province": "",
"country": "",
"postalCode": ""
}
}]
}
So I have been trying to recursively loop through the data so that I can encrypt each field before saving the document. I came across the following package which somewhat works. It doesn't recurse into the arrays. I tried converting the document into a JSON Object to make it easier to work with. Which didn't help much besides removing the metadata from the document object.
I was trying to write a cursive function (C# is my wheelhouse) but I cannot access the length of the children of a JSON object so I couldn't recurse on that.
I would greatly appreciate it if someone has a solution to recursing through a Mongoose document, because I am stumped.
Okay, so that package I mentioned did the trick. There is an unspecified option that treats arrays as objects which allows the iterator to recurse into the arrays. So the working iterator looks as follows:
let iterator = require('object-recursive-iterator');
iterator.forAll(jsonProfile, (path, key, obj) => {
obj[key] = 'processed';
}, {treatArrayAsObject: true});
Hope this helps someone in the future.

can we modifiy the transaction record in hyperledger composer

I have a transacton called updatewarranty.In that updatewarranty transaction i am updating a asset called warranty.
This is my json
{
"$class": "org.network.warranty.Transfer",
"TransferId": "9427",
"AuthKey": "",
"TransferDate": "2018-06-30T05:50:32.767Z",
"customer": {
"$class": "org.network.warranty.Customer",
"CustomerId": "2599",
"Address1": "",
"Address2": "",
"Authkey": "",
"City": "",
"Country": "",
"Email": "",
"Mobile": "",
"State": "",
"UserType": 0
},
"retailer": {
"$class": "org.network.warranty.Retailer",
"RetailerId": "8389",
"Address1": "",
"Address2": "",
"Authkey": "",
"City": "",
"Country": "",
"Email": "",
"Mobile": "",
"State": "",
"UserType": 0
},
"warranty": {
"$class": "org.network.warranty.Warranty",
"WarrentyId": "0766",
"End_Date": "2018-06-30T05:50:32.767Z",
"Start_Date": "2018-06-30T05:50:32.767Z",
"IS_Internationaly_Valid": "",
"Item_QRCode": ""
}
}
I have a transaction named getwarranty which takes the warranty id as input.
this is my json
{
"$class": "org.network.warranty.getWarranty",
"warranty": "resource:org.network.warranty.Warranty#0766"
}
When i see the transaction record for getwarranty i dont have the entire transfer record. I have only this information
{
"$class": "org.network.warranty.getWarranty",
"warranty": "resource:org.network.warranty.Warranty#0766",
"transactionId": "6e35c9cb-d3a6-41d8-8c95-fa22c7681824",
"timestamp": "2018-06-30T05:50:54.851Z"
}
how can i get the warranty asset?

python runs slow while executing below piece of code

tag_api=”htpps://url....”
json_data=requests.get(tag_api)
length=len(json_data[‘tags’])
line=0
while length>=2:
if line<=lenght-1:
with open(‘file.txt’,’a’) as fp:
fp.write(json_data[‘tags’][line][‘name’])
line=line+1
While I run this code it gets slow at while loop. Do you suggest what could be the issue?
{ {
{ "id": "",
"category": "",
"type": "",
"tags": { "id": "", "name": "" }
{ "id": "", "name": "" } },
{ "id": "",
"category": "",
"type": "",
"tags": { "id": "", "name": "" } },
{ "id": "",
"category": "",
"type": "",
"tags": { "id": "", "name": "" } },
{ "id": "",
"category": "",
"type": "",
"tags": { "id": "", "name": "" }
{ "id": "", "name": "" } },
} }
I am trying to get the tags that have more than two index and write to a file
Opening a file (and closing it) are quite slow operations. Since it's the same file every time, you should move the opening out as far as possible.

Gmail Markup for Multiple Events

I'm developing event markup using json-ld to be included with confirmation emails.
Some of my events are recurring at regular intervals. However, recurring events are not supported by the latest Schema.org specifications so I've followed the advice offered here: http://lists.w3.org/Archives/Public/public-vocabs/2011Dec/0062.html and decided to embed a json list of the individual events.
The json-ld passes the tests in the Email Markup Tester provided by google (https://www.google.com/webmasters/markup-tester/u/0/).
However, when I test the google calendar integration by sending the email to myself, only 1 out of 6 events in the series appears in my calendar (oddly, it's neither the first or last event in the list).
Does gmail markup support multiple events in the same email? If so is there a better way to do it?
Example Markup:
<script type="application/ld+json">
[
{
"reservationNumber": "7e15afb6b2485005e55481be58de4141b70f85006bd25823",
"reservationFor": {
"startDate": "2015-05-09T16:00:00-07:00",
"endDate": "2015-05-09T22:30:00-07:00",
"description": "regularly schedule XXXX",
"location": {
"address": {
"addressCountry": "US",
"addressLocality": "XXX",
"addressRegion": "XXX",
"streetAddress": "XXX",
"postalCode": "XXX",
"#type": "PostalAddress"
},
"#type": "Place",
"name": "XXX"
},
"#type": "Event",
"name": "XXX Every 2 Weeks"
},
"modifyReservationUrl": "https://example.com/XXX",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"#type": "Person",
"name": "XXX"
},
"#context": "http://schema.org",
"#type": "EventReservation"
},
...
{
"reservationNumber": "40553edbce52f0052e153919a4dad49ec32516c15433bf4a",
"reservationFor": {
"startDate": "2015-05-23T16:00:00-07:00",
"endDate": "2015-05-23T22:30:00-07:00",
"description": "regularly schedule XXX",
"location": {
"address": {
"addressCountry": "US",
"addressLocality": "XXX",
"addressRegion": "XXX",
"streetAddress": "XXX",
"postalCode": "XXX",
"#type": "PostalAddress"
},
"#type": "Place",
"name": "XXX"
},
"#type": "Event",
"name": "XXX Every 2 Weeks"
},
"modifyReservationUrl": "https://example.com/XXX",
"reservationStatus": "http://schema.org/Confirmed",
"underName": {
"#type": "Person",
"name": "XXX"
},
"#context": "http://schema.org",
"#type": "EventReservation"
},
]
</script>
You can try adding this markup in the html file by using the Quick Apps script tutorial mentioned in the documentation here.
Does making a list help: https://schema.org/ItemList
Haven't tested this out, but it might be a useful approach.

Resources