Difference between revisions of "TruxtonSensitiveSiteList"

From truxwiki.com
Jump to navigation Jump to search
Line 15: Line 15:
 
This corresponds to the <code>[Name]</code> column of the <code>[SensitiveSiteList]</code> table.
 
This corresponds to the <code>[Name]</code> column of the <code>[SensitiveSiteList]</code> table.
  
==<code>picture</code>==
+
==<code>add(wgs84_latitude, wgs84_longitude, distance_in_meters, name, optional_id)</code>==
A [https://en.wikipedia.org/wiki/Base64 base64] encoded 300x300 [https://en.wikipedia.org/wiki/Portable_Network_Graphics PNG] image of the subject.
+
This adds a location to the current list.
 +
 
 +
==<code>delete()</code>==
 +
Deletes the list from Truxton.
 +
It will remove records from the <code>[SensitiveSite]</code> and <code>[SensitiveSiteList]</code> table.
 +
 
 +
==<code>remove(wgs84_latitude, wgs84_longitude, distance_in_meters, name)</code>==
 +
This removes an item from the list.
  
 
==<code>save()</code>==
 
==<code>save()</code>==
This will commit the information to the <code>[Suspect]</code> table.
+
This will commit the information to the <code>[SensitiveSiteList]</code> table.
 
It will return [https://docs.python.org/3/library/constants.html#True True] if the record was saved to the database, [https://docs.python.org/3/library/constants.html#False False] if there was an error.
 
It will return [https://docs.python.org/3/library/constants.html#True True] if the record was saved to the database, [https://docs.python.org/3/library/constants.html#False False] if there was an error.
 
==<code>tag(tag, reason, origin)</code>==
 
This creates a tag associated with this event in Truxton.
 
The <code>tag</code> parameter is a short, one or two word, bit of text that will be displayed in the UI.
 
The <code>reason</code> a sentence explaining why this event was tagged.
 
The <code>origin</code> is either <code>TAG_ORIGIN_AUTOMATIC</code> (1) or <code>TAG_ORIGIN_HUMAN</code> (2).
 
It will return
 
[https://docs.python.org/3.8/library/constants.html?highlight=false#True True] if the tag was associated with the file, [https://docs.python.org/3.8/library/constants.html?highlight=false#False False] on failure.
 
  
 
=Sample=
 
=Sample=

Revision as of 16:58, 29 May 2021

This class lets you add list of geographic coordinates that should be alerted on. This will populate the [SensitiveSiteList] table in the database.

Attributes and Methods

description

A description of the list. This corresponds to the [Description] column of the [SensitiveSiteList] table.

id

This is the GUID of the list. This corresponds to the [ID] column of the [SensitiveSiteList] table.

name

The name of the list. This corresponds to the [Name] column of the [SensitiveSiteList] table.

add(wgs84_latitude, wgs84_longitude, distance_in_meters, name, optional_id)

This adds a location to the current list.

delete()

Deletes the list from Truxton. It will remove records from the [SensitiveSite] and [SensitiveSiteList] table.

remove(wgs84_latitude, wgs84_longitude, distance_in_meters, name)

This removes an item from the list.

save()

This will commit the information to the [SensitiveSiteList] table. It will return True if the record was saved to the database, False if there was an error.

Sample

def add_subject():
  t = truxton.create()
  s = t.newsubject()
  s.id = "00138955-133D-D2C1-A9E9-ADFF27FA80F4"
  s.name = "Alexander Downer"
  s.description = "Australian High Commissioner to the United Kingdom."
  s.birthday = ticks("1951-09-09T00:00:00-00:00")
  s.picture = b64(SUPPORT_DOCUMENTS_FOLDER + "Images/Alexander Downer.png")
  s.save()
  s.tag("AUS", "Australia - Friendly Foreign Government", truxton.TAG_ORIGIN_HUMAN)
  return

def b64(filename):
  with open( filename, "rb" ) as input_file:
    data = input_file.read()
    return str(base64.b64encode(data))[2:-1]