Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ If TEST_VERBOSE is "-v" debugging output will appear when running the tests.
## TEST_NAMESPACE

If TEST_NAMESPACE is blank or unspecified then each execution of './scripts/samples.sh' will not be
independent. Any assets events, locations will be visible to other users running the same tests
independent. Any assets or events will be visible to other users running the same tests
on the same URL.

Each example test creates assets,events,locations that are not visible to other example tests.
Each example test creates assets,events that are not visible to other example tests.
For example the door_entry assets,events etc are not visible to the synsation example tests.

Assets and locations are only created if they do not already exist according to namespace.
Assets are only created if they do not already exist according to namespace.

Due to restrictions attachments are always uploaded during every test execution.

Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ graft archivist_samples/c2pa/c2pa_files
graft archivist_samples/document/document_files
graft archivist_samples/door_entry/images
graft archivist_samples/synsation/images
graft archivist_samples/synsation/locations
graft archivist_samples/software_bill_of_materials/sbom_files
graft archivist_samples/sbom_document/sbom_files
graft archivist_samples/wipp/wipp_files
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ TEST_NAMESPACE is set to the date and time value in Unix format, thus providing

## TEST_NAMESPACE

If TEST_NAMESPACE is blank or unspecified, any assets events, locations will be visible to other users running the same examples
If TEST_NAMESPACE is blank or unspecified, any assets or events will be visible to other users running the same examples
on the same URL.

Each example creates assets,events,locations that are not visible to other examples.
Each example creates assets,events that are not visible to other examples.
For example the door_entry assets,events etc are not visible to the synsation example.

***Note: Assets and locations are only created if they do not already exist according to namespace. If one wants to execute a sample multiple
***Note: Assets are only created if they do not already exist according to namespace. If one wants to execute a sample multiple
times, feel free to set TEST_NAMESPACE to a different unique id.***

Due to restrictions attachments are always uploaded during every example execution.
Expand Down
6 changes: 1 addition & 5 deletions archivist_samples/c2pa/c2pa.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
# pylint:disable=missing-module-docstring # docstrings
# pylint:disable=missing-class-docstring # docstrings

try:
# Python < 3.9
import importlib_resources as res
except ImportError:
import importlib.resources as res
import importlib.resources as res

import logging

Expand Down
6 changes: 1 addition & 5 deletions archivist_samples/document/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
# pylint:disable=missing-class-docstring # docstrings
# pylint:disable=too-many-positional-arguments

try:
# Python < 3.9
import importlib_resources as res
except ImportError:
import importlib.resources as res
import importlib.resources as res

import logging

Expand Down
2 changes: 1 addition & 1 deletion archivist_samples/door_entry/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def main():
dest="create_assets",
action="store_true",
default=False,
help="create the locations and assets. DO THIS ONLY ONCE.",
help="create the assets. DO THIS ONLY ONCE.",
)
operations.add_argument(
"-l",
Expand Down
105 changes: 2 additions & 103 deletions archivist_samples/door_entry/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

# pylint: disable=missing-docstring


try:
# Python < 3.9
import importlib_resources as res
except ImportError:
import importlib.resources as res
import importlib.resources as res

from copy import copy
import logging
Expand Down Expand Up @@ -71,18 +66,6 @@ def create_datatrails_paris(doors):
),
"wavestone_asset_id": "paris.france.datatrails.das",
},
location={
"props": {
"display_name": "DataTrails Paris",
"description": "Sales and sales support for the French region",
"latitude": 48.8339211,
"longitude": 2.371345,
},
"attrs": {
"address": "5 Parvis Alan Turing, 75013 Paris, France",
"wavestone_ext": "managed",
},
},
attachments=[
AttachmentDescription("entry_terminal.jpg", "arc_primary_image"),
],
Expand All @@ -102,18 +85,6 @@ def create_cityhall(doors):
),
"wavestone_asset_id": "cityhall.paris.wavestonedas",
},
location={
"props": {
"display_name": "Paris City Hall",
"description": "Seat of Paris local city adminstration",
"latitude": 48.856389,
"longitude": 2.352222,
},
"attrs": {
"address": "Place de l'Hôtel de Ville, 75004 Paris, France",
"wavestone_ext": "managed",
},
},
attachments=[
AttachmentDescription("cityhall.jpg", "arc_primary_image"),
],
Expand All @@ -133,18 +104,6 @@ def create_courts(doors):
),
"wavestone_asset_id": "courts.paris.wavestonedas",
},
location={
"props": {
"display_name": "Paris Courts of Justice",
"description": ("Public museum in the former Palais de Justice"),
"latitude": 48.855722,
"longitude": 2.345051,
},
"attrs": {
"address": "10 Boulevard du Palais, 75001 Paris, France",
"wavestone_ext": "managed",
},
},
attachments=[
AttachmentDescription("courts.jpg", "arc_primary_image"),
],
Expand All @@ -164,20 +123,6 @@ def create_bastille(doors):
),
"wavestone_asset_id": "bastille.paris.wavestonedas",
},
location={
"props": {
"display_name": "Bastille",
"description": (
"Medieval fortress, made famous by the " "French Revolution"
),
"latitude": 48.85333,
"longitude": 2.36917,
},
"attrs": {
"address": "Place de la Bastille, 75011 Paris, France",
"wavestone_ext": "managed",
},
},
attachments=[
AttachmentDescription("bastille.jpg", "arc_primary_image"),
],
Expand All @@ -197,20 +142,6 @@ def create_gdn_front(doors):
),
"wavestone_asset_id": "front.gdn.paris.wavestonedas",
},
location={
"props": {
"display_name": "Apartements du Gare du Nord",
"description": (
"Residential apartment building in new complex " "above GdN station"
),
"latitude": 48.8809,
"longitude": 2.3553,
},
"attrs": {
"address": "18 Rue de Dunkerque, 75010 Paris, France",
"wavestone_ext": "managed",
},
},
attachments=[
AttachmentDescription("gdn_front.jpg", "arc_primary_image"),
],
Expand All @@ -230,20 +161,6 @@ def create_gdn_side(doors):
),
"wavestone_asset_id": "side.gdn.paris.wavestonedas",
},
location={
"props": {
"display_name": "Apartements du Gare du Nord",
"description": (
"Residential apartment building in new complex " "above GdN station"
),
"latitude": 48.8809,
"longitude": 2.3553,
},
"attrs": {
"address": "18 Rue de Dunkerque, 75010 Paris, France",
"wavestone_ext": "managed",
},
},
attachments=[
AttachmentDescription("gdn_side.jpg", "arc_primary_image"),
],
Expand Down Expand Up @@ -274,9 +191,8 @@ def create_doors(doors):

def create_cards(cards):
LOGGER.info("Creating all cards...")
# We don't create locations for cards - they float free.
# If there's a natural affinity between cards and home
# locations/owners in the real world then of course we
# owners in the real world then of course we
# can add this.
# Similarly there's no real benefit to creating a
# Primary_image for them so leave that empty too
Expand Down Expand Up @@ -320,13 +236,10 @@ def list_doors(doors):
LOGGER.info("Listing all doors tracked by the system:")
for door in doors.assets.list():
attrs = door["attributes"]
location = doors.locations.read(attrs["arc_home_location_identity"])
attachments = find_attachment_attributes(attrs)

print(f"\tAsset name:\t{attrs['arc_display_name']}")
print(f"\tAsset type:\t{attrs['arc_display_type']}")
print(f"\tAsset location:\t{location['display_name']}")
print(f"\tAsset address:\t{location['attributes']['address']}")
print(f"\tArchivist ID:\t{door['identity']}")
for a in attachments:
print(f"\tAttachment identity: \t{a['arc_blob_identity']}")
Expand Down Expand Up @@ -460,12 +373,6 @@ def open_door(doors, doorid, cards, cardid):
wsext_door_wsid = door["attributes"]["wavestone_asset_id"]
corval = str(uuid.uuid4())

# Work out where we are
location = doors.locations.read(door["attributes"]["arc_home_location_identity"])
if not location:
LOGGER.error("Door location is missing")
return

# Capture a picture of the building entrance
# In this example we just dig out the main image of the building
# but the principle here is that the operative could snap it from
Expand Down Expand Up @@ -554,14 +461,6 @@ def open_door(doors, doorid, cards, cardid):
"arc_display_type": "Door Open",
"arc_evidence": "ARQC: 0x12345678",
"arc_correlation_value": corval,
# Events take optional GIS coordinates to record where
# they happened and trace movements. In this case things
# are very simple - we just record the fixed location of
# the door being opened - but it can be used for any
# mobile asset such as a self-driving car, a drone, or a
# container in supply chain events
"arc_gis_lat": f"{location['latitude']}",
"arc_gis_lng": f"{location['longitude']}",
"wavestone_door_name": wsext_doorname,
"wavestone_door_archivist_id": door["identity"],
"wavestone_evt_type": "door_open",
Expand Down
5 changes: 1 addition & 4 deletions archivist_samples/estate_info/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ def run(poc, args):
if args.quick_count:
LOGGER.info("Number of events is %d", poc.events.count())
LOGGER.info("Number of assets is %d", poc.assets.count())
LOGGER.info("Number of locations is %d", poc.locations.count())
return 0

if args.double_check:
Expand Down Expand Up @@ -61,16 +60,14 @@ def run(poc, args):

num_events = poc.events.count()
num_assets = poc.assets.count()
num_locations = poc.locations.count()

LOGGER.info(
(
"There are %s events registered against %s assets"
" in the system spread over %s locations."
" in the system spread."
),
num_events,
num_assets,
num_locations,
)

LOGGER.info("Performing double-check... FINISH")
Expand Down
6 changes: 1 addition & 5 deletions archivist_samples/sample_scripts/c2pa/c2pa_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@

import sample

try:
# Python < 3.9
import importlib_resources as res
except ImportError:
import importlib.resources as res
import importlib.resources as res


# DataTrails Connection Parameters -- Honest Abe
Expand Down
6 changes: 1 addition & 5 deletions archivist_samples/sbom_document/software_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
# pylint:disable=unused-import # To prevent cyclical import errors forward referencing is used
# pylint:disable=cyclic-import # but pylint doesn't understand this feature

try:
# Python < 3.9
import importlib_resources as res
except ImportError:
import importlib.resources as res
import importlib.resources as res

import logging
from sys import exit as sys_exit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@
# pylint:disable=unused-import # To prevent cyclical import errors forward referencing is used
# pylint:disable=cyclic-import # but pylint doesn't understand this feature

try:
# Python < 3.9
import importlib_resources as res
except ImportError:
import importlib.resources as res
import importlib.resources as res

import logging
from sys import exit as sys_exit
Expand Down
8 changes: 4 additions & 4 deletions archivist_samples/synsation/initialise.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,31 @@ def entry():
dest="create_corporation",
action="store_false",
default=True,
help="don't create the Synsation Corporation locations and assets",
help="don't create the Synsation Corporation assets",
)
parser.add_argument(
"-M",
"--no-manufacturing",
dest="create_manufacturing",
action="store_false",
default=True,
help="don't create the Synsation Manufacturing locations and assets",
help="don't create the Synsation Manufacturing assets",
)
parser.add_argument(
"-I",
"--no-industries",
dest="create_industries",
action="store_false",
default=True,
help="don't create the Synsation Industries locations and assets",
help="don't create the Synsation Industries assets",
)
parser.add_argument(
"-S",
"--no-smartcity",
dest="create_smartcity",
action="store_false",
default=True,
help="don't create the Synsation Smart City locations and assets",
help="don't create the Synsation Smart City assets",
)
parser.add_argument(
"-n",
Expand Down
1 change: 0 additions & 1 deletion archivist_samples/synsation/locations/__init__.py

This file was deleted.

10 changes: 0 additions & 10 deletions archivist_samples/synsation/locations/asia.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions archivist_samples/synsation/locations/baltimore.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions archivist_samples/synsation/locations/european.yaml

This file was deleted.

Loading