Difference between revisions of "TruxtonSubject"
(→Sample) |
|||
| Line 5: | Line 5: | ||
==<code>birthday</code>== | ==<code>birthday</code>== | ||
When the subject was born in [https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime FILETIME] ticks. | When the subject was born in [https://docs.microsoft.com/en-us/windows/win32/api/minwinbase/ns-minwinbase-filetime FILETIME] ticks. | ||
| − | This corresponds to the <code>DateOfBirth</code> column of the <code>Suspect</code> table. | + | This corresponds to the <code>[DateOfBirth]</code> column of the <code>[Suspect]</code> table. |
==<code>custom</code>== | ==<code>custom</code>== | ||
Free form notes about the subject. | Free form notes about the subject. | ||
These appear as "Remarks" in the desktop user interface. | These appear as "Remarks" in the desktop user interface. | ||
| − | This corresponds to the <code>Custom</code> column of the <code>Suspect</code> table. | + | This corresponds to the <code>[Custom]</code> column of the <code>[Suspect]</code> table. |
==<code>description</code>== | ==<code>description</code>== | ||
A description of the subject, their title, etc. | A description of the subject, their title, etc. | ||
| − | 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>[Suspect]</code> table. |
==<code>id</code>== | ==<code>id</code>== | ||
| Line 24: | Line 24: | ||
==<code>name</code>== | ==<code>name</code>== | ||
The name of the subject. | The name of the subject. | ||
| − | 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>[Suspect]</code> table. |
==<code>picture</code>== | ==<code>picture</code>== | ||
| Line 30: | Line 30: | ||
==<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>[Suspect]</code> table. |
==<code>tag(tag, reason, origin)</code>== | ==<code>tag(tag, reason, origin)</code>== | ||
| Line 41: | Line 41: | ||
=Sample= | =Sample= | ||
| − | + | <source lang="Python" highlight="3-10"> | |
| − | < | ||
def add_subject(): | def add_subject(): | ||
t = truxton.create() | t = truxton.create() | ||
| Line 59: | Line 58: | ||
data = input_file.read() | data = input_file.read() | ||
return str(base64.b64encode(data))[2:-1] | return str(base64.b64encode(data))[2:-1] | ||
| − | </ | + | </source> |
Revision as of 17:13, 30 November 2020
This class lets you add information about the subject of an investigation.
This will populate the Suspect table in the database.
Contents
Attributes and Methods
birthday
When the subject was born in FILETIME ticks.
This corresponds to the [DateOfBirth] column of the [Suspect] table.
custom
Free form notes about the subject.
These appear as "Remarks" in the desktop user interface.
This corresponds to the [Custom] column of the [Suspect] table.
description
A description of the subject, their title, etc.
This corresponds to the [Description] column of the [Suspect] table.
id
This is the GUID of the event.
Unlike most of the other identifiers in Truxton, this one can be optionally set.
If you have generated a well known GUID you can store it in id before calling save()
If id is all zeroes, a random value will be generated in the call to save().
name
The name of the subject.
This corresponds to the [Name] column of the [Suspect] table.
picture
A base64 encoded 300x300 PNG image of the subject.
save()
This will commit the information to the [Suspect] table.
tag(tag, reason, origin)
This creates a tag associated with this event in Truxton.
The tag parameter is a short, one or two word, bit of text that will be displayed in the UI.
The reason a sentence explaining why this event was tagged.
The origin is either TAG_ORIGIN_AUTOMATIC (1) or TAG_ORIGIN_HUMAN (2).
It will return
True if the tag was associated with the file, False on failure.
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]