Difference between revisions of "TruxtonSensitiveSiteList"

From truxwiki.com
Jump to navigation Jump to search
(Created page with "This class lets you add list of geographic coordinates that should be alerted on. This will populate the <code>[SensitiveSiteList]</code> table in the database. =Attributes a...")
 
 
(10 intermediate revisions by the same user not shown)
Line 3: Line 3:
  
 
=Attributes and Methods=
 
=Attributes and Methods=
==<code>birthday</code>==
+
==<code>add(wgs84_latitude: float, wgs84_longitude: float, distance_in_meters: float, name: str, optional_id: str) -> boolean</code>==
When the subject was born in [https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime FILETIME] ticks.
+
This adds a location to the current list.
This corresponds to the <code>[DateOfBirth]</code> column of the <code>[Suspect]</code> table.
+
It will add a record to the <code>[SensitiveSite]</code> table.
 +
The [https://en.wikipedia.org/wiki/Latitude latitude] and [https://en.wikipedia.org/wiki/Longitude longitude] coordinates should use the [https://en.wikipedia.org/wiki/World_Geodetic_System#WGS84 WGS84] ellipsoid.
 +
The <code>optional_id</code>, when present, will be the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the record and corresponds to the <code>[ID]</code> column of the <code>[SensitiveSite]</code> table.
  
==<code>custom</code>==
+
==<code>delete() -> boolean</code>==
Free form notes about the subject.
+
Deletes the list from Truxton.
These appear as "Remarks" in the desktop user interface.
+
It will remove records from the <code>[SensitiveSite]</code> and <code>[SensitiveSiteList]</code> table.
This corresponds to the <code>[Custom]</code> column of the <code>[Suspect]</code> table.
 
  
==<code>description</code>==
+
==<code>description: str</code>==
A description of the subject, their title, etc.
+
A description of the list.
This corresponds to the <code>[Description]</code> column of the <code>[Suspect]</code> table.
+
This corresponds to the <code>[Description]</code> column of the <code>[SensitiveSiteList]</code> table.
  
==<code>id</code>==
+
==<code>id: str</code>==
This is the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the event.
+
This is the [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] of the list.
Unlike most of the other identifiers in Truxton, this one can be optionally set.
+
This corresponds to the <code>[ID]</code> column of the <code>[SensitiveSiteList]</code> table.
If you have generated a well known [https://en.wikipedia.org/wiki/Universally_unique_identifier GUID] you can store it in <code>id</code> before calling <code>save()</code>
 
If <code>id</code> is all zeroes, a random value will be generated in the call to <code>save()</code>.
 
  
==<code>name</code>==
+
==<code>name: str</code>==
The name of the subject.
+
The name of the list.
This corresponds to the <code>[Name]</code> column of the <code>[Suspect]</code> table.
+
This corresponds to the <code>[Name]</code> column of the <code>[SensitiveSiteList]</code> table.
  
==<code>picture</code>==
+
==<code>remove(wgs84_latitude: float, wgs84_longitude: float, distance_in_meters: float, name: str) -> boolean</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 removes an item from the list.
  
==<code>save()</code>==
+
==<code>save() -> boolean</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>==
+
=Sample=
This creates a tag associated with this event in Truxton.
+
<source lang="Python" highlight="7-11,13,14,16,17">
The <code>tag</code> parameter is a short, one or two word, bit of text that will be displayed in the UI.
+
import sys
The <code>reason</code> a sentence explaining why this event was tagged.
+
sys.path.append('C:/Program Files/Truxton/SDK')
The <code>origin</code> is either <code>TAG_ORIGIN_AUTOMATIC</code> (1) or <code>TAG_ORIGIN_HUMAN</code> (2).
+
import truxton
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.
+
def main():
 +
t = truxton.create()
 +
ssl = t.newsensitivesitelist()
 +
ssl.id = "43434343-4443-4343-4343-434343434343"
 +
ssl.name = "Test SSV"
 +
ssl.description = "The description of the test SSV"
 +
ssl.save()
 +
 
 +
ssl.add(39.136001, -77.701114, 100, "Lothar's")
 +
ssl.add(39.137793, -77.692892, 100, "Chik", "A30BE334-56B3-42FD-8860-92F74D47C9CC")
 +
 
 +
ssl.remove(39.136001, -77.701114, 100, "Lothar's")
 +
ssl.delete()
 +
 
 +
return None
 +
 
 +
if __name__ == "__main__":
 +
  sys.exit(main())
 +
</source>
  
=Sample=
+
Here's how to delete an existing list.
<source lang="Python" highlight="3-10">
+
<source lang="Python" highlight="7,9">
def add_subject():
+
import sys
  t = truxton.create()
+
sys.path.append('C:/Program Files/Truxton/SDK')
  s = t.newsubject()
+
import truxton
  s.id = "00138955-133D-D2C1-A9E9-ADFF27FA80F4"
+
 
  s.name = "Alexander Downer"
+
def main():
  s.description = "Australian High Commissioner to the United Kingdom."
+
t = truxton.create()
  s.birthday = ticks("1951-09-09T00:00:00-00:00")
+
ssl = t.getsensitivesitelistid("43434343-4443-4343-4343-434343434343")
  s.picture = b64(SUPPORT_DOCUMENTS_FOLDER + "Images/Alexander Downer.png")
+
 
  s.save()
+
ssl.delete()
  s.tag("AUS", "Australia - Friendly Foreign Government", truxton.TAG_ORIGIN_HUMAN)
+
 
  return
+
return None
  
def b64(filename):
+
if __name__ == "__main__":
  with open( filename, "rb" ) as input_file:
+
  sys.exit(main())
    data = input_file.read()
 
    return str(base64.b64encode(data))[2:-1]
 
 
</source>
 
</source>

Latest revision as of 11:27, 18 August 2023

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

add(wgs84_latitude: float, wgs84_longitude: float, distance_in_meters: float, name: str, optional_id: str) -> boolean

This adds a location to the current list. It will add a record to the [SensitiveSite] table. The latitude and longitude coordinates should use the WGS84 ellipsoid. The optional_id, when present, will be the GUID of the record and corresponds to the [ID] column of the [SensitiveSite] table.

delete() -> boolean

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

description: str

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

id: str

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

name: str

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

remove(wgs84_latitude: float, wgs84_longitude: float, distance_in_meters: float, name: str) -> boolean

This removes an item from the list.

save() -> boolean

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

import sys
sys.path.append('C:/Program Files/Truxton/SDK')
import truxton

def main():
 t = truxton.create()
 ssl = t.newsensitivesitelist()
 ssl.id = "43434343-4443-4343-4343-434343434343"
 ssl.name = "Test SSV"
 ssl.description = "The description of the test SSV"
 ssl.save()

 ssl.add(39.136001, -77.701114, 100, "Lothar's")
 ssl.add(39.137793, -77.692892, 100, "Chik", "A30BE334-56B3-42FD-8860-92F74D47C9CC")

 ssl.remove(39.136001, -77.701114, 100, "Lothar's")
 ssl.delete()

 return None

if __name__ == "__main__":
  sys.exit(main())

Here's how to delete an existing list.

import sys
sys.path.append('C:/Program Files/Truxton/SDK')
import truxton

def main():
 t = truxton.create()
 ssl = t.getsensitivesitelistid("43434343-4443-4343-4343-434343434343")

 ssl.delete()

 return None

if __name__ == "__main__":
  sys.exit(main())