22
33# pylint: disable=missing-docstring
44
5-
6- try :
7- # Python < 3.9
8- import importlib_resources as res
9- except ImportError :
10- import importlib .resources as res
5+ import importlib .resources as res
116
127from copy import copy
138import logging
@@ -71,18 +66,6 @@ def create_datatrails_paris(doors):
7166 ),
7267 "wavestone_asset_id" : "paris.france.datatrails.das" ,
7368 },
74- location = {
75- "props" : {
76- "display_name" : "DataTrails Paris" ,
77- "description" : "Sales and sales support for the French region" ,
78- "latitude" : 48.8339211 ,
79- "longitude" : 2.371345 ,
80- },
81- "attrs" : {
82- "address" : "5 Parvis Alan Turing, 75013 Paris, France" ,
83- "wavestone_ext" : "managed" ,
84- },
85- },
8669 attachments = [
8770 AttachmentDescription ("entry_terminal.jpg" , "arc_primary_image" ),
8871 ],
@@ -102,18 +85,6 @@ def create_cityhall(doors):
10285 ),
10386 "wavestone_asset_id" : "cityhall.paris.wavestonedas" ,
10487 },
105- location = {
106- "props" : {
107- "display_name" : "Paris City Hall" ,
108- "description" : "Seat of Paris local city adminstration" ,
109- "latitude" : 48.856389 ,
110- "longitude" : 2.352222 ,
111- },
112- "attrs" : {
113- "address" : "Place de l'Hôtel de Ville, 75004 Paris, France" ,
114- "wavestone_ext" : "managed" ,
115- },
116- },
11788 attachments = [
11889 AttachmentDescription ("cityhall.jpg" , "arc_primary_image" ),
11990 ],
@@ -133,18 +104,6 @@ def create_courts(doors):
133104 ),
134105 "wavestone_asset_id" : "courts.paris.wavestonedas" ,
135106 },
136- location = {
137- "props" : {
138- "display_name" : "Paris Courts of Justice" ,
139- "description" : ("Public museum in the former Palais de Justice" ),
140- "latitude" : 48.855722 ,
141- "longitude" : 2.345051 ,
142- },
143- "attrs" : {
144- "address" : "10 Boulevard du Palais, 75001 Paris, France" ,
145- "wavestone_ext" : "managed" ,
146- },
147- },
148107 attachments = [
149108 AttachmentDescription ("courts.jpg" , "arc_primary_image" ),
150109 ],
@@ -164,20 +123,6 @@ def create_bastille(doors):
164123 ),
165124 "wavestone_asset_id" : "bastille.paris.wavestonedas" ,
166125 },
167- location = {
168- "props" : {
169- "display_name" : "Bastille" ,
170- "description" : (
171- "Medieval fortress, made famous by the " "French Revolution"
172- ),
173- "latitude" : 48.85333 ,
174- "longitude" : 2.36917 ,
175- },
176- "attrs" : {
177- "address" : "Place de la Bastille, 75011 Paris, France" ,
178- "wavestone_ext" : "managed" ,
179- },
180- },
181126 attachments = [
182127 AttachmentDescription ("bastille.jpg" , "arc_primary_image" ),
183128 ],
@@ -197,20 +142,6 @@ def create_gdn_front(doors):
197142 ),
198143 "wavestone_asset_id" : "front.gdn.paris.wavestonedas" ,
199144 },
200- location = {
201- "props" : {
202- "display_name" : "Apartements du Gare du Nord" ,
203- "description" : (
204- "Residential apartment building in new complex " "above GdN station"
205- ),
206- "latitude" : 48.8809 ,
207- "longitude" : 2.3553 ,
208- },
209- "attrs" : {
210- "address" : "18 Rue de Dunkerque, 75010 Paris, France" ,
211- "wavestone_ext" : "managed" ,
212- },
213- },
214145 attachments = [
215146 AttachmentDescription ("gdn_front.jpg" , "arc_primary_image" ),
216147 ],
@@ -230,20 +161,6 @@ def create_gdn_side(doors):
230161 ),
231162 "wavestone_asset_id" : "side.gdn.paris.wavestonedas" ,
232163 },
233- location = {
234- "props" : {
235- "display_name" : "Apartements du Gare du Nord" ,
236- "description" : (
237- "Residential apartment building in new complex " "above GdN station"
238- ),
239- "latitude" : 48.8809 ,
240- "longitude" : 2.3553 ,
241- },
242- "attrs" : {
243- "address" : "18 Rue de Dunkerque, 75010 Paris, France" ,
244- "wavestone_ext" : "managed" ,
245- },
246- },
247164 attachments = [
248165 AttachmentDescription ("gdn_side.jpg" , "arc_primary_image" ),
249166 ],
@@ -274,9 +191,8 @@ def create_doors(doors):
274191
275192def create_cards (cards ):
276193 LOGGER .info ("Creating all cards..." )
277- # We don't create locations for cards - they float free.
278194 # If there's a natural affinity between cards and home
279- # locations/ owners in the real world then of course we
195+ # owners in the real world then of course we
280196 # can add this.
281197 # Similarly there's no real benefit to creating a
282198 # Primary_image for them so leave that empty too
@@ -320,13 +236,10 @@ def list_doors(doors):
320236 LOGGER .info ("Listing all doors tracked by the system:" )
321237 for door in doors .assets .list ():
322238 attrs = door ["attributes" ]
323- location = doors .locations .read (attrs ["arc_home_location_identity" ])
324239 attachments = find_attachment_attributes (attrs )
325240
326241 print (f"\t Asset name:\t { attrs ['arc_display_name' ]} " )
327242 print (f"\t Asset type:\t { attrs ['arc_display_type' ]} " )
328- print (f"\t Asset location:\t { location ['display_name' ]} " )
329- print (f"\t Asset address:\t { location ['attributes' ]['address' ]} " )
330243 print (f"\t Archivist ID:\t { door ['identity' ]} " )
331244 for a in attachments :
332245 print (f"\t Attachment identity: \t { a ['arc_blob_identity' ]} " )
@@ -460,12 +373,6 @@ def open_door(doors, doorid, cards, cardid):
460373 wsext_door_wsid = door ["attributes" ]["wavestone_asset_id" ]
461374 corval = str (uuid .uuid4 ())
462375
463- # Work out where we are
464- location = doors .locations .read (door ["attributes" ]["arc_home_location_identity" ])
465- if not location :
466- LOGGER .error ("Door location is missing" )
467- return
468-
469376 # Capture a picture of the building entrance
470377 # In this example we just dig out the main image of the building
471378 # but the principle here is that the operative could snap it from
@@ -554,14 +461,6 @@ def open_door(doors, doorid, cards, cardid):
554461 "arc_display_type" : "Door Open" ,
555462 "arc_evidence" : "ARQC: 0x12345678" ,
556463 "arc_correlation_value" : corval ,
557- # Events take optional GIS coordinates to record where
558- # they happened and trace movements. In this case things
559- # are very simple - we just record the fixed location of
560- # the door being opened - but it can be used for any
561- # mobile asset such as a self-driving car, a drone, or a
562- # container in supply chain events
563- "arc_gis_lat" : f"{ location ['latitude' ]} " ,
564- "arc_gis_lng" : f"{ location ['longitude' ]} " ,
565464 "wavestone_door_name" : wsext_doorname ,
566465 "wavestone_door_archivist_id" : door ["identity" ],
567466 "wavestone_evt_type" : "door_open" ,
0 commit comments