diff --git a/docs/HIVTxNetwork.html b/docs/HIVTxNetwork.html new file mode 100644 index 0000000..8064b61 --- /dev/null +++ b/docs/HIVTxNetwork.html @@ -0,0 +1,2026 @@ + + + + + + + Documentation Class: HIVTxNetwork + + + + + + + + + + +
+
+
+
+

Class: HIVTxNetwork

+
+
+

HIVTxNetwork

+
+ +
+
+
+
+

+ new HIVTxNetwork(json, + button_bar_ui, cluster_attributes) +

+
+
+
+ Represents an HIV transmission network with annotations +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
json + Object + + A JSON object containing the network data. +
button_bar_ui + HTMLElement + + A UI element for interacting with the network. +
cluster_attributes + Object + + Attributes related to clusters within the network. +
+ +
+
+
+ +

Members

+ +
+
+
+

+ _calc_country_nodes +

+
+
+
+ this is a function which calculates country node centers + for the (experimental) option of rendering networks with + topo maps +
+ +
+
+ +
+
+

+ auto_expand_pg_handler +

+
+
+
+ Grow a CoI defined in @pg based on its growth mode +
+ +
+
+ +
+
+

+ charge_correction +

+
+
+
d3 layout option setting
+ +
+
+ +
+
+

+ check_for_time_series +

+
+
+
+ Generate a function callback for attribute time series + data +
+ +
+
+ +
+
+

+ cluster_filtering_functions +

+
+
+
+ filters which control which clusters get rendered +
+ +
+
+ +
+
+

+ colorizer +

+
+
+
default node colorizer
+ +
+
+ +
+
+

+ defined_priority_groups +

+
+
+
+ the list of defined clusters of interest, format as + follows (SLKP, 20240715: may need updating) { 'name' : + 'unique name', 'nodes' : [ { 'node_id' : text, 'added' : + date, 'kind' : text }], 'created' : date, 'description' : + 'text', 'modified' : date, 'kind' : 'text' } +
+ +
+
+ +
+
+

+ filter_by_size +

+
+
+
+
+ +
+
+

+ filter_if_added +

+
+
+
+
+ +
+
+

+ filter_singletons +

+
+
+
+
+ +
+
+

+ filter_time_period +

+
+
+
+
+ +
+
+

+ highlight_unsuppored_edges +

+
+
+
+ if there is computed support for network edges, use it to + highlight possible spurious edges +
+ +
+
+ +
+
+

+ node_label_drag +

+
+
+
+ define a D3 behavior to make node labels draggable +
+ +
+
+ +
+
+

+ node_shaper +

+
+
+
default node shaper
+ +
+
+ +
+
+

+ priority_groups_all_events +

+
+
+
+ generate a set of all unique temporal events (when new + data were added to ANY CoI) return a Set of date strings + formatted with timeDateUtil.DateViewFormatSlider +
+ +
+
+ +
+
+

+ priority_groups_compute_overlap +

+
+
+
+ compute the overlap between CoI +
+ +
+
+ +
+
+

+ priority_groups_edit_set_description +

+
+
+
+ A function that updates the "freehand" description of a + specific CoI +
+ +
+
+ +
+
+

+ priority_groups_export +

+
+
+
+ export CoI records for interactions with the external DB +
+ +
+
+ +
+
+

+ priority_groups_export_nodes +

+
+
+
+ Export nodes that are members of CoI +
+ +
+
+ +
+
+

+ priority_groups_export_sets +

+
+
+
Export CoI summary info
+ +
+
+ +
+
+

+ priority_groups_find_by_name +

+
+
+
+ lookup a CoI by name; null if not found +
+ +
+
+ +
+
+

+ priority_groups_is_new_node +

+
+
+
+ returns true is the node was added by the system during + CoI definition/expansion +
+ +
+
+ +
+
+

+ priority_groups_remove_set +

+
+
+
+ Remove a CoI from the list of defined CoI +
+ +
+
+ +
+
+

+ priority_groups_update_node_sets +

+
+
+
+ interact with the remote DB to send updates of CoI + operations +
+ +
+
+ +
+
+

+ using_time_filter +

+
+
+
+ time filter element for various displays +
+ +
+
+
+ +

Methods

+ +
+
+
+

+ annotate_cluster_changes() +

+
+
+
+ annotate_cluster_changes If the network contains + information about cluster changes (new/moved/deleted + nodes, etc), this function will annotate cluster objects + (in place) with various attributes "delta" : change in the + size of the cluster "flag" : a status flag to be used in + the cluster display table if set to 2 then TBD if set to 3 + then TBD +
+ +
+
+ +
+
+

+ attribute_node_value_by_id(d:, id:, number:) +

+
+
+
+ Fetch the value of an attribute from the node +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
d:node object
id: + [string] the attribute whose value should be fetched +
number: + [bool] if true, only return numerical values +
+ +
+
+ +
+
+

+ cluster_display_filter() +

+
+
+
+
+ +
+
+

+ define_attribute_COI_membership(network, data:) +

+
+
+
+ define an attribute generator for subcluster membership + attribute +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
network + : the network / cluster object to ise +
data: + reference date to use +
+ +
+ +
Returns:
+ +
attribute definition
+
+ +
+
+

+ define_attribute_binned_vl(field:, title:) +

+
+
+
+ define an attribute generator for binned viral loads +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
field: + the node attribute field to use +
title: + display this title for the attribute +
+ +
+ +
Returns:
+ +
attribute definition dict
+
+ +
+
+

+ define_attribute_dx_years(relative:, label:) +

+
+
+
+ define an attribute generator for dx year +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
relative: + if T, compute dx date relative to the network date + in years +
label:use this label
+ +
+ +
Returns:
+ +
attribute definition dict
+
+ +
+
+

+ define_attribute_network_update() +

+
+
+
+ define an attribute generator for new network + nodes/clusters +
+ +
+ +
Returns:
+ +
attribute definition dict
+
+ +
+
+

+ define_attribute_vl_interpretaion() +

+
+
+
+ define an attribute generator for Viral load result + interpretatio +
+ +
+ +
Returns:
+ +
attribute definition dict
+
+ +
+
+

+ display_warning() +

+
+
+
display a warning string
+ +
+
+ +
+
+

+ extract_single_cluster(nodes, filter, no_clone) +

+
+
+
+ Extract the nodes and edges between them into a separate + object +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nodes + [array] the list of nodes to extract +
filter + [function, optional] (edge) -> bool filtering + function for deciding which edges will be used to + define clusters +
no_clone + [bool] if set to T, node objects are **not** shallow + cloned in the return object +
+ +
+ +
Returns:
+ +
+ [dict] the object representing "Nodes" and "Edges" in the + extracted cluster +
+
+ +
+
+

+ filter_by_date(cutoff, + date_file, start_date, node, count_newly_add) +

+
+
+
+ Check if the date attribute of a node falls within a + pre-specified range +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
cutoff
date_file
start_date
node
count_newly_add + [bool]; if true, then a "new node" attribute + overrides date checks, so all new (compared to the + previous network) nodes pass the check +
+ +
+
+ +
+
+

+ generateClusterOfInterestID() +

+
+
+
+ generate the name for a cluster of interest +
+ +
+
+ +
+
+

+ get_ui_element_selector_by_role(role:, nested:) +

+
+
+
+ retrive the DOM ID for an element given its + data-hivtrace-ui-role +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
role: + data-hivtrace-ui-role +
nested: + true if this is being called from a secondary + network or element (dialog, cluster view etc), which + does not have primary button_ui elements +
+ +
+
+ +
+
+

+ initialize_ui_ux_elements() +

+
+
+
initialize UI/UX elements
+ +
+
+ +
+
+

+ inject_attribute_description() +

+
+
+
+ add an attribute description Given an attribute definition + (see comments elsewhere), and a key to associate it with + do +
+ +
+
+ +
+
+

+ load_priority_sets(url, is_writeable) +

+
+
+
+ read and process JSON files defining COI +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
url + [string]: load the data from here +
is_writeable + [string]: if "writeable", changes to COI lists will + be pushed back to the server This needs to be called + AFTER the clusters/subclusters have been annotated +
+ +
+
+ +
+
+

+ map_ids_to_objects() +

+
+
+
+ create a map between node IDs and node objects +
+ +
+
+ +
+
+

+ parse_dates(value) +

+
+
+
parse a date record
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
value + (date object or string) +
+ +
+ +
Returns:
+ +
date object
+
+ +
+
+

+ populate_predefined_attribute(computed, key) +

+
+
+
+ populate_predefined_attribute Given an attribute + definition (see comments elsewhere), and a key to + associate it with do 0. Inject the definition of the + attribute into the network dictionary 1. Compute the value + of the attribute for all nodes 2. Compute unique values +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
computed + (dict) : attribute definition +
key + (string) : the key to associate with the attribute +
+ +
+
+ +
+
+

+ priority_group_node_record(node_id, date, kind) +

+
+
+
Generate a CoI node record
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
node_id + [string] : node name, +
date + (optional) : creation date +
kind + (optional) : node creation mode +
+ +
+
+ +
+
+

+ priority_groups_automatic() +

+
+
+
+ filter the list of CoI to return those which have been + created by the system +
+ +
+
+ +
+
+

+ priority_groups_compute_node_membership() +

+
+
+
+ Compute which CoI do various nodes belong to, and define + additional attributes for each node +
+ +
+
+ +
+
+

+ priority_groups_expanded() +

+
+
+
+ filter the list of CoI to return those which have been + automatically expanded +
+ +
+
+ +
+
+

+ priority_groups_pending() +

+
+
+
+ filter the list of CoI to return those which have not been + reviewed/validated +
+ +
+
+ +
+
+

+ priority_groups_validate(groups, auto_extend) +

+
+
+
validate the list of CoI
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
groups + array + + is a list of CoI name: unique string description: + string, nodes: { { 'id' : node id, 'added' : date, + 'kind' : _cdcPrioritySetNodeKind } }, created: date, + kind: kGlobals.CDCCOIKind, tracking: + kGlobals.CDCCOITrackingOptions createdBy : + kGlobals.CDCCOICreatedBySystem,kGlobals.CDCCOICreatedManually +
auto_extend + bool + + : if true, automatically expand existing CoI +
+ +
+
+ +
+
+

+ <static> inject_attribute_node_value_by_id(node, id, value) +

+
+
+
+ Add an attribute value to the node object +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
node[object] : node,
id + [string] : attribute id +
value: attribute value
+ +
+
+ +
+
+

+ <static> is_edge_injected() +

+
+
+
+ Is this node NOT genetic, i.e. added to the network via + social or other means +
+ +
+
+ +
+
+

+ <static> is_new_node() +

+
+
+
+ does the node have "new node" attribute +
+ +
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + diff --git a/docs/classes.list.html b/docs/classes.list.html new file mode 100644 index 0000000..9df5d01 --- /dev/null +++ b/docs/classes.list.html @@ -0,0 +1,5566 @@ + + + + + + + Documentation Classes + + + + + + + + + + +
+
+
+
+

Classes

+
+
+

+
+ +
+
+
+
+ +

Classes

+ +
+
HIVTxNetwork
+
+ +
+ hivtrace_generate_svg_polygon +
+
+
+ +

Members

+ +
+
+
+

+ <constant> CDCCOICanAutoExpand +

+
+
+
+ CDCCOITrackingOptions: Available tracking options for + Clusters of Interest Used as drop-downs for COI editors + and automatic filling +
+ +
+
+ +
+
+

+ <constant> CDCCOIConciseTrackingOptions +

+
+
+
+ CDCCOITrackingOptionsDateFilter: A filtering option + applied to cluster nodes when computing COI membership + under different tracking options Specifies the maximum + number of MONTHS (relative to the reference data) that a + node age must fall into +
+ +
+
+ +
+
+

+ <constant> CDCCOICreatedBySystem +

+
+
+
+ CDCCOINodeKind: Available options for how a COI member was + identified Used as drop-downs for COI editors and + automatic filling +
+ +
+
+ +
+
+

+ <constant> CDCCOICreatedManually +

+
+
+
+ CDCCOICreatedBySystem: The value of "createdBy" in a COI + record when the COI was created by the system + (automatically) +
+ +
+
+ +
+
+

+ <constant> CDCCOIKind +

+
+
+
+ ShapeOrdering: The range to which values for + categorical/ordinal variables will be mapped using the + "Shape" dropdown +
+ +
+
+ +
+
+

+ <constant> CDCCOIKindAutomaticCreation +

+
+
+
+ CDCJurisdictionLowMorbidity: The set of low-morbidity + jurisdictions for Secure HIV TRACE +
+ +
+
+ +
+
+

+ <constant> CDCCOINodeKind +

+
+
+
+ CDCCOIConciseTrackingOptions: Available shorter tracking + options for Clusters of Interest Used for COI exports +
+ +
+
+ +
+
+

+ <constant> CDCCOINodeKindDefault +

+
+
+
+ CDCCOIKindAutomaticCreation: The kind of COI that is + automatically created by the system +
+ +
+
+ +
+
+

+ <constant> CDCCOITrackingOptions +

+
+
+
+ CDCCOIKind: Available creation options for Clusters of + Interest +
+ +
+
+ +
+
+

+ <constant> CDCCOITrackingOptionsDateFilter +

+
+
+
+ CDCCOITrackingOptionsFilter: A filtering option is applied + to cluster edges when computing COI membership under + different tracking options Selects edges of different + lengths (0.5% vs 1.5%) +
+ +
+
+ +
+
+

+ <constant> CDCCOITrackingOptionsDefault +

+
+
+
+ CDCCOICanAutoExpand: The types of tracking modes which are + subject to automatic growth tracking +
+ +
+
+ +
+
+

+ <constant> CDCCOITrackingOptionsDistanceFilter +

+
+
+
+ CDCCOITrackingOptionsNone: The "no-tracking" option + assigned for COI +
+ +
+
+ +
+
+

+ <constant> CDCCOITrackingOptionsNone +

+
+
+
+ CDCCOITrackingOptionsDefault: The default tracking option + assigned to COI +
+ +
+
+ +
+
+

+ <constant> CDCJurisdictionCodes +

+
+
+
+ CDCCOICreatedManually: The value of "createdBy" in a COI + record when the COI was created manually +
+ +
+
+ +
+
+

+ <constant> CDCJurisdictionLowMorbidity +

+
+
+
+ CDCJurisdictionCodes: Mapping from full names to + two-letter codes for various Secure HIV-TRACE + jurisdictions +
+ +
+
+ +
+
+

+ <constant> CDCNPMember +

+
+
+
+ CDCCOINodeKindDefault: The method of node identification + used by default (and it automatically created COI) +
+ +
+
+ +
+
+

+ <constant> Categorical +

+
+
+
+ CategoricalBase: The default set of colors used for + displaying colors of categorical attributes +
+ +
+
+ +
+
+

+ <constant> DateFormats +

+
+
+
+ Used to generate pop-over labels for node displays, and + COI views +
+ +
+
+ +
+
+

+ <constant> DateUpperBoundYear +

+
+
+
+ Used in many places where alpha-numerically sorted dates + are desired +
+ +
+
+ +
+
+

+ <constant> DateViewFormat +

+
+
+
+ Used to generate legend labels for date-valued attributes + for network displayes +
+ +
+
+ +
+
+

+ <constant> DateViewFormatClusterCreate +

+
+
+
+ Maximum year value (no future dates) +
+ +
+
+ +
+
+

+ <constant> DateViewFormatShort +

+
+
+
+ this is currently used to display node addition dates to + COI +
+ +
+
+ +
+
+

+ <constant> DateViewFormatSlider +

+
+
+
+ List of accepted time formats for attribute values +
+ +
+
+ +
+
+

+ <constant> EdgeColorBase +

+
+
+
+ MaximumValuesInCategories: Maximum # of distinct values + that can be rendered for categorical variables +
+ +
+
+ +
+
+

+ <constant> MaximumValuesInCategories +

+
+
+
+ Categorical: Expanded color range using darker shades + based on `CategoricalBase` +
+ +
+
+ +
+
+

+ <constant> PresetColorSchemes +

+
+
+
+ EdgeColorBase: The default color range for shading network + EDGES +
+ +
+
+ +
+
+

+ <constant> PresetShapeSchemes +

+
+
+
+ PresetColorSchemes: Predefined (hard-coded) color schemes + for specific attribute fields. Keys are exactly matched by + categorical variable names These should be updated if a + specific attribute needs to use a particular color scheme + for value rendering +
+ +
+
+ +
+
+

+ <constant> SequentialColor +

+
+
+
+ PresetShapeSchemes: Predefined (hard-coded) shape schemes + for specific attribute fields. Keys are exactly matched by + categorical variable names These should be updated if a + specific attribute needs to use a particular shape scheme + for value rendering +
+ +
+
+ +
+
+

+ <constant> ShapeOrdering +

+
+
+
+ SequentialColor: The default color ranges for a fixed + number of values +
+ +
+
+ +
+
+

+ <constant> SubclusterSeparator +

+
+
+
+ network: Attributes and string constants for the network + object +
+ +
+
+ +
+
+

+ cluster_time_scale +

+
+
+
+ used as a part of auto-named COI, e.g. NC_202105_44.1 +
+ +
+
+ +
+
+

+ d3 +

+
+
+
+ A collection of table column definitions +
+ +
+
+ +
+
+

+ d3 +

+
+
+
+ Combined definitions and presets for various network + components. +
+ +
+
+ +
+
+

+ d3 +

+
+
+
+ Functions that help manipulate network JSON and perform + other utility operations +
+ +
+
+ +
+
+

+ <constant> formats +

+
+
+
+ missing: Values to use when displaying missing values +
+ +
+
+ +
+
+

+ <constant> missing +

+
+
+
+ CDCNPMember: The label for the auto-generated node + attribute (ever in NP CoI) +
+ +
+
+ +
+
+

+ <constant> network +

+
+
+
+ formats: Various formatters for numerical values +
+ +
+
+
+ +

Methods

+ +
+
+
+

+ _action_drop_down(self, pg) +

+
+
+
+ Generates a dropdown menu for actions on a cluster of + interest (COI). +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
pg + Object + + The cluster of interest data. +
+ +
+ +
Returns:
+ +
+ An array of dropdown menu options. +
+ +
+
Type
+
+ Array +
+
+
+ +
+
+

+ add_a_sortable_table(container, headers, content [, + overwrite] [, caption] [, priority_set_editor]) +

+
+
+
+ Adds a sortable table to a D3 selection container. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
container + d3.selection + + The D3 selection representing the container element + for the table. +
headers + Array.<string> + + An array of strings representing the table headers. +
content + Array.<Object> + + An array of objects representing the table content. + Each object should have properties that map to table + cells. +
overwrite + boolean + <optional>
+ An optional flag indicating whether to overwrite any + existing table content (default: false). +
caption + string + <optional>
+ An optional caption for the table. +
priority_set_editor + function + <optional>
+ An optional function used to customize cell + formatting based on priority sets. The function + should accept four arguments: - `d`: The data object + for the current cell. - `i`: The index of the + current cell within its row. - `cell`: The D3 + selection of the current cell element (a ` + + ` element). - `priority_set_editor`: The + `priority_set_editor` function passed to + `add_a_sortable_table`. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ b64toBlob(b64, + onsuccess [, onerror]) +

+
+
+
+ Converts a base64-encoded string to a Blob object. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
b64 + string + + The base64-encoded string. +
onsuccess + function + + A callback function to be called when the conversion + is successful. +
onerror + function + <optional>
+ An optional callback function to be called if an + error occurs. +
+ +
+
+ +
+
+

+ collapseLargeCategories(nodes, schema) +

+
+
+
+ Collapses rare categories to "Other" category if there are + >CATEGORY_UNIQUE_VALUE_LIMIT categories +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nodes + Array.<Object> + + An array of node objects, each containing patient + attributes. +
schema + Object + + An object defining the schema for the patient + attributes. +
+ +
+ +
Returns:
+ +
+ True if any categories were collapsed, false otherwise. +
+ +
+
Type
+
+ boolean +
+
+
+ +
+
+

+ colorPickerInput(id, + colorizer) +

+
+
+
+ Creates a color picker input element with a label. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + string + + The ID for the color picker input element. +
colorizer + function + + A colorizer function that maps values to colors. +
+ +
+ +
Returns:
+ +
+ The HTML markup for the color picker input element with + the label. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ colorPickerInputContinuous(id, color) +

+
+
+
+ Creates a color picker input element with a label for + continuous values. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + string + + The ID for the color picker input element. +
color + string + + The initial color value for the color picker. +
+ +
+ +
Returns:
+ +
+ The HTML markup for the color picker input element with + the label. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ colorStops(id, number) +

+
+
+
+ Creates a color stop input element with a label. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + string + + The ID for the color stop input element. +
number + number + + The initial value for the color stop. +
+ +
+ +
Returns:
+ +
+ The HTML markup for the color stop input element with the + label. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ copyToClipboard(text) +

+
+
+
+ Copies the given text to the clipboard. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
text + string + + The text to be copied. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ datamonkey_describe_vector(vector [, as_list]) +

+
+
+
+ Calculates descriptive statistics for a numerical vector. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
vector + Array.<number> + + An array of numbers representing the data. +
as_list + boolean + <optional>
+ An optional flag indicating whether to return the + statistics as a formatted string. +
+ +
+ +
Returns:
+ +
+ - If `as_list` is false, returns an object with the + following properties: - `min`: The minimum value. - `max`: + The maximum value. - `median`: The median value. - `Q1`: + The first quartile. - `Q3`: The third quartile. - `mean`: + The mean value. - If `as_list` is true, returns a + formatted string representing the statistics. +
+ +
+
Type
+
+ Object + | + + string +
+
+
+ +
+
+

+ datamonkey_export_csv_button(data [, name]) +

+
+
+
+ Creates a downloadable CSV file for the provided data and + adds a button to trigger the download. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
data + Array.<Object> + + An array of objects representing the data to be + exported. +
name + string + <optional>
+ An optional name for the exported CSV file. If not + provided, defaults to "export.csv". +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ datamonkey_export_handler(data [, filename] [, mimeType]) +

+
+
+
+ Handles exporting data to a file based on browser + capabilities. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
data + string + + The data to be exported. +
filename + string + <optional>
+ The desired filename for the downloaded file. + Defaults to "download.tsv". +
mimeType + string + <optional>
+ The MIME type of the data. Defaults to "text/plain" + if not provided. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ datamonkey_export_json_button(data [, title]) +

+
+
+
+ Creates a downloadable JSON file for the provided data and + adds a button to trigger the download. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
data + Object + | + + Array.<Object> + + The data to be exported, either a single object or + an array of objects. +
title + string + <optional>
+ An optional title for the exported JSON file. If not + provided, defaults to "export". +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ datamonkey_save_image(type, container) +

+
+
+
+ Saves the contents of an SVG element as an image file. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + string + + The desired image format (either "svg" or "png"). +
container + jQuery + | + + HTMLElement + + A jQuery selector or element reference containing + the SVG element. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ draw_priority_set_table(self, container, priority_groups) +

+
+
+
+ Draws a table of priority sets (clusters of interest). +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
container + HTMLElement + + The HTML element where the table will be displayed + (optional). +
priority_groups + Array + + An array of objects representing the priority sets + (optional). +
+ +
+
+ +
+
+

+ edge_typer(e, + edge_types, T) +

+
+
+
+ Determines the type of an edge based on its length and + predefined edge types. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
e + Object + + The edge object to be classified. +
edge_types + Array.<string> + + An array of two edge types. The first type is used + for edges shorter than or equal to `T`, and the + second type is used for edges longer than `T`. +
T + number + + The threshold value for edge length classification. +
+ +
+ +
Returns:
+ +
+ The edge type corresponding to the edge's length. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ ensure_node_attributes_exist() +

+
+
+
+ ensure_node_attributes_exist Iterate over nodes in the + network. If a node does not have an array of attributes or + data dictionary records, create an empty one. This makes + error checking less complex downstream. +
+ +
+
+ +
+
+

+ exportColorScheme(uniqValues, colorizer) +

+
+
+
+ Exports a color scheme based on unique values and a + colorizer function. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
uniqValues + Object + + An object containing unique values for each + attribute, as returned by `getUniqueValues`. +
colorizer + function + + A colorizer function that maps values to colors. +
+ +
+ +
Returns:
+ +
+ An object where the keys are unique values and the values + are the corresponding colors. +
+ +
+
Type
+
+ Object +
+
+
+ +
+
+

+ filter_parse(filter_value) +

+
+
+
+ Parses a filter string into an array of filter objects. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
filter_value + string + + The filter string to be parsed. +
+ +
+ +
Returns:
+ +
+ An array of filter objects, each with a `type` property + and a corresponding `value` property. The `type` can be + "re" for regular expression, "date" for date range, or + "distance" for numerical comparison. +
+ +
+
Type
+
+ Array.<Object> +
+
+
+ +
+
+

+ filter_table(element) +

+
+
+
+ Filters a D3 table based on user-defined filters in column + headers. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
element + d3.selection + | + + HTMLElement + + The D3 selection or HTML element representing a + table header cell that triggered the filter +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ filter_table_by_column_handler(datum, conditions) +

+
+
+
+ Filters a table based on specified conditions applied to a + column. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datum + * + + The data object representing a row in the table. +
conditions + Array.<Object> + + An array of condition objects, each with the + following properties: - `type`: The type of + condition ("re" for regular expression, "date" for + date range, "distance" for numerical comparison). - + `value`: The value or range for the condition: - For + "re": A regular expression object. - For "date": An + array of two Date objects representing the start and + end dates. - For "distance": A number representing + the threshold value. - `greater_than` (optional): A + boolean indicating whether to use greater-than + comparison for "distance" conditions. +
+ +
+ +
Returns:
+ +
+ True if the row matches at least one condition, false + otherwise. +
+ +
+
Type
+
+ boolean +
+
+
+ +
+
+

+ format_a_cell(data, + index, item [, priority_set_editor]) +

+
+
+
+ Formats a cell in a table based on provided data. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
data + Object + + The data object representing the table cell. It + should have properties like: - `value`: The cell + value. - `format` (optional): A function used to + format the value. - `html` (optional): A flag + indicating whether the value should be set as HTML. + - `callback` (optional): A function used to + customize cell content and behavior. - `filter` + (optional): A flag indicating whether to enable + filtering for the column. - `column_id` (optional): + The index of the column (used for filtering). - + `sort` (optional): A flag indicating whether to + enable sorting for the column. - `presort` + (optional): A string ("asc" or "desc") for initial + sort direction. - `actions` (optional): An array of + button configurations for cell actions. - `help` + (optional): A string describing the cell content + (used as a tooltip). +
index + number + + The index of the cell within its row. +
item + d3.selection + + The D3 selection of the table cell element (a ` + ` element).
priority_set_editor + function + <optional>
+ An optional function used for priority set + functionality (internal). +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ getUniqueValues(nodes, + schema) +

+
+
+
+ Retrieves unique values for each attribute in a given + dataset. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nodes + Array.<Object> + + An array of node objects, each containing patient + attributes. +
schema + Object + + An object defining the schema for the patient + attributes. +
+ +
+ +
Returns:
+ +
+ An object where each key represents an attribute name and + the corresponding value is an array of unique values for + that attribute. +
+ +
+
Type
+
+ Object +
+
+
+ +
+
+

+ get_editor() +

+
+
+
+ Gets the current priority set editor object. +
+ +
+ +
Returns:
+ +
+ The priority set editor object, or null if not open. +
+ +
+
Type
+
+ Object +
+
+
+ +
+
+

+ get_ui_element_selector_by_role(role) +

+
+
+
+ Retrieves a CSS selector for UI elements based on their + `data-hivtrace-ui-role` attribute. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
role + string + + The value of the `data-hivtrace-ui-role` attribute. +
+ +
+ +
Returns:
+ +
+ A CSS selector string targeting elements with the + specified role. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ handle_cluster_click(self:, cluster, release) +

+
+
+
+ handle_cluster_click Handle contextual menus for clusters + and cluster drag +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self:network object
cluster + [optional]: the cluster object to act on +
release + [optional]: the cluster object to release the + "fixed" flag from +
+ +
+
+ +
+
+

+ handle_inline_confirm(this_button, generator, text, + action, disabled) +

+
+
+
+ Handles inline confirmation popovers. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
this_button + HTMLElement + + The button element that triggers the popover. +
generator + function + + A function that generates the HTML content for the + popover body. +
text + string + + The initial text to display in the popover's text + area (optional). +
action + function + + A callback function to be executed when the user + confirms the action. Takes the value from the text + area as input. +
disabled + boolean + + A flag indicating if the text area should be + disabled (optional). +
+ +
+
+ +
+
+

+ hiv_trace_export_table_to_text(parent_id, table_id, csv + [, file_name_placeholder]) +

+
+
+
+ This function creates a download button that, when + clicked, exports the data from the specified table as + either a CSV or TSV file. It uses D3 for DOM manipulation + and assumes the existence of a `helpers` object with + `table_to_text` and `export_handler` methods. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
parent_id + string + + The selector for the parent element where the button + will be appended. +
table_id + string + + The selector for the table to be exported. +
csv + boolean + + If true, exports as CSV; if false, exports as TSV. +
+ file_name_placeholder + + string + <optional>
+ The base name for the exported file. If not + provided, it defaults to the table_id without the + first character. +
+ +
+ +
Requires:
+
    +
  • module:d3
  • + +
  • module:helpers
  • +
+ +
Returns:
+ +
+ The D3 selection of the created button. +
+ +
+
Type
+
+ d3.Selection +
+
+ +
Example
+ +
+hiv_trace_export_table_to_text("#parent-div", "#data-table", true, "export-data");
+
+ +
+
+

+ hivtraceClusterGraphSummary() +

+
+
+
+ ## hivtraceClusterGraphSummary Function Creates and + populates a summary table for an HIV trace cluster graph. + #### Parameters `graph`: The input graph data. `tag`: The + HTML element to append the summary table to. `not_CDC`: A + flag indicating whether to include CDC-specific statistics + or not (optional). #### Returns None +
+ +
+
+ +
+
+

+ hivtrace_cluster_depthwise_traversal(nodes, edges [, + edge_filter] [, save_edges] [, seed_nodes] [, white_list]) +

+
+
+
+ Performs a depth-wise traversal on a cluster of nodes, + considering edges and optional filters. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
nodes + Array.<Object> + + An array of node objects. Each node should have an + `id` property. +
edges + Array.<Object> + + An array of edge objects. Each edge should have + `source` and `target` properties referencing node + IDs. +
edge_filter + function + <optional>
+ An optional filtering function applied to edges + before traversal. The function should accept an edge + object and return a boolean indicating whether to + include the edge. +
save_edges + function + <optional>
+ An optional function used to store traversed edges. + It should be called with an array where each element + represents the edges within a cluster. +
seed_nodes + Array.<Object> + <optional>
+ An optional array of node objects to use as starting + points for traversal. If not provided, all nodes + will be considered. +
white_list + Set + <optional>
+ An optional set of node IDs restricting traversal to + nodes within the set. +
+ +
+ +
Throws:
+ +
+
+
+ If an edge references non-existent nodes. +
+
+
+
+
Type
+
+ Error +
+
+
+
+ +
Returns:
+ +
+ An array of clusters, where each cluster is an array of + node objects. +
+ +
+
Type
+
+ Array.<Array.<Object>> +
+
+
+ +
+
+

+ hivtrace_coi_timeseries(cluster, element [, plot_width]) +

+
+
+
+ This function creates a detailed time series visualization + for a cluster of interest (COI). It displays nodes and + events over time, with interactive features for + highlighting and displaying additional information. The + visualization includes: - A time axis - Lines representing + nodes - Circles representing events - Interactive + highlighting and tooltips - Time range boxes for context +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
cluster + Object + + The cluster object containing node and event + information. +
+ Properties +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
node_info + Object + + Information about nodes in the cluster. +
event_info + Object + + Information about events in the cluster. +
+
element + d3.Selection + + The D3 selection of the element where the + visualization will be rendered. +
plot_width + number + <optional>
1000 + The width of the plot in pixels. +
+ +
+ +
Requires:
+
    +
  • module:d3
  • + +
  • module:lodash
  • +
+ +
Example
+ +
+const cluster = {
+  node_info: {...},
+  event_info: {...}
+};
+const element = d3.select("#visualization-container");
+hivtrace_coi_timeseries(cluster, element, 1200);
+
+ +
+
+

+ hivtrace_compute_node_degrees(obj) +

+
+
+
+ This function modifies the input object by adding a + 'degree' property to each node. The degree of a node is + the number of edges connected to it. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
obj + Object + + The graph object containing nodes and edges. +
+ Properties +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Nodes + Object + + An object representing the nodes of the + graph. +
Edges + Object + + An object representing the edges of the + graph. +
+ Edges[].source + + string + + The source node of an edge. +
+ Edges[].target + + string + + The target node of an edge. +
+
+ +
+ +
Example
+ +
+const graph = {
+  Nodes: {
+    "1": {},
+    "2": {}
+  },
+  Edges: {
+    "e1": { source: "1", target: "2" }
+  }
+};
+hivtrace_compute_node_degrees(graph);
+// graph.Nodes["1"].degree === 1
+// graph.Nodes["2"].degree === 1
+
+ +
+
+

+ hivtrace_date_or_na_if_missing(date [, formatter]) +

+
+
+
+ Formats a date using a specified formatter, or returns + "N/A" if the date is missing. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
date + Date + + The date object to be formatted. +
formatter + function + <optional>
+ An optional formatter function used to format the + date. If not provided, `DateViewFormatExport` is + used. +
+ +
+ +
Returns:
+ +
+ The formatted date string, or "N/A" if the date is + missing. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ hivtrace_generate_svg_symbol(type) +

+
+
+
+ Generates an SVG symbol based on the specified type. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + string + + The type of symbol to generate. Possible values are: + - "circle" - "cross" - "diamond" - "square" - + "triangle-down" - "triangle-up" - "triangle" - + "pentagon" - "hexagon" - "septagon" - "octagon" - + "ellipse" +
+ +
+ +
Requires:
+
    +
  • module:d3
  • + +
  • module:hivtrace_generate_svg_polygon
  • + +
  • module:hivtrace_generate_svg_ellipse
  • +
+ +
Returns:
+ +
+ A D3 symbol generator or a custom polygon/ellipse + generator. - For "circle", "cross", "diamond", "square", + "triangle-down", "triangle-up": Returns a D3 symbol + generator of the specified type. - For "triangle", + "pentagon", "hexagon", "septagon", "octagon": Returns a + custom polygon generator with the specified number of + sides. - For "ellipse": Returns a custom ellipse + generator. - For any other input: Returns a D3 symbol + generator of type "circle" as default. +
+ +
+
Type
+
+ Object +
+
+
+ +
+
+

+ hivtrace_histogram(graph, histogram_tag, histogram_label) +

+
+
+
+ Renders a histogram for a graph property and displays a + descriptive label. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
graph + Object + + An object containing graph data, including + distribution and fitted data for the property. +
histogram_tag + string + + The ID of the HTML element where the histogram will + be rendered. +
histogram_label + string + + The ID of the HTML element where the descriptive + label will be displayed. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ hivtrace_histogram_distances(graph, histogram_tag, + histogram_label) +

+
+
+
+ Renders a histogram for edge lengths (genetic distances) + and displays a label. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
graph + Object + + An object containing graph data, including edges. +
histogram_tag + string + + The ID of the HTML element where the histogram will + be rendered. +
histogram_label + string + + The ID of the HTML element where the descriptive + label will be displayed. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ hivtrace_plot_cluster_dynamics(time_series, container, + x_title, y_title [, y_scale] [, bin_by] [, options]) +

+
+
+
+ Generates a plot visualizing cluster dynamics over time. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
time_series + Array.<Object> + + An array of data points, each with a required `time` + property (a date object) and optional properties + representing attributes. +
container + d3.selection + + A D3 selection representing the container element + for the plot. +
x_title + string + + The title for the x-axis. +
y_title + string + + The title for the y-axis. +
y_scale + d3.scale + <optional>
+ An optional D3 scale for the y-axis. If not + provided, a linear scale will be used. +
bin_by + function + <optional>
+ An optional function used to bin data points into + time intervals. The function should accept a date + object and return an array with three elements: - + The bin label (e.g., "Q1 2023"). - The start date of + the bin. - The middle date of the bin (used for + x-axis positioning). If not provided, a default + function that bins by quarters is used. +
options + Object + <optional>
+ An optional configuration object for the plot. - + `base_line`: (number, default: 20) The baseline + value for the y-axis. - `top`: (number, default: 40) + The top padding for the plot. - `right`: (number, + default: 30) The right padding for the plot. - + `bottom`: (number, default: 60) The bottom padding + for the plot. - `left`: (number, default: 100) The + left padding for the plot. - `font_size`: (number, + default: 18) The font size for labels and text + elements. - `rect_size`: (number, default: 22) The + size of rectangles used in the legend. - `width`: + (number, default: 1024) The width of the plot + container. - `height`: (number, default: 600) The + height of the plot container. - `barchart`: + (boolean, default: false) If true, the plot will be + displayed as a bar chart. - `skip_cumulative`: + (boolean, default: false) If true, the cumulative + area will not be displayed. - `x-tick-format`: + (Function) An optional function for formatting + x-axis tick labels. - `prefix`: (string) An optional + prefix to add to attribute names displayed in the + legend. - `colorizer`: (Object) An optional + colorizer object for attributes. Keys should be + attribute names, and values should be D3 scales used + for coloring lines/bars. - `drag`: (Object) An + optional drag object for enabling dragging the plot. +
+ +
+ +
Throws:
+ +
+
+
+ If no data points are provided. +
+
+
+
+
Type
+
+ Error +
+
+
+
+
+ +
+
+

+ hivtrace_render_histogram(counts [, fit], w, h, id) +

+
+
+
+ Renders a histogram for discrete data using D3.js. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
counts + Array.<number> + + An array of counts for each category. +
fit + Array.<number> + <optional>
+ (optional) - An array of fitted values for each + category. +
w + number + + The width of the plot area. +
h + number + + The height of the plot area. +
id + string + + The ID of the HTML element where the histogram will + be rendered. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ hivtrace_render_histogram_continuous(data, w, h, id) +

+
+
+
+ Renders a histogram for continuous data using D3.js. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + Array.<number> + + An array of numerical values. +
w + number + + The width of the plot area. +
h + number + + The height of the plot area. +
id + string + + The ID of the HTML element where the histogram will + be rendered. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ hivtrace_render_scatterplot(points, w, h, id, labels [, + dates]) +

+
+
+
+ Renders a scatter plot using D3.js. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
points + Array.<Object> + + An array of data points, each with x and y + coordinates (and optionally a title). +
w + number + + The width of the plot area. +
h + number + + The height of the plot area. +
id + string + + The ID of the HTML element where the plot will be + rendered. +
labels + Object + + An object containing labels for the x and y axes. +
dates + boolean + <optional>
false + A flag indicating whether the x-axis should + represent dates. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ init(self) +

+
+
+
+ Initializes the component, setting up event listeners and + UI elements. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The component object itself. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ n_months_ago(reference_date, months) +

+
+
+
+ Calculates a date that is `months` months ago from a given + reference date. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
reference_date + Date + + The reference date from which to calculate the past + date. +
months + number + + The number of months to go back. +
+ +
+ +
Returns:
+ +
+ A new Date object representing the date `months` months + ago from the reference date. +
+ +
+
Type
+
+ Date +
+
+
+ +
+
+

+ normalize_node_attributes() +

+
+
+
+ normalize_node_attributes Iterate over node attributes, + lower case all the keys for mapping. If attributes are + found that are not in the data dictionary, attempt to map + them using "labels". +
+ +
+
+ +
+
+

+ open_editor(self, + node_set, name, description, cluster_kind, kind_options, + validation_mode, existing_set, cluster_tracking, + created_by) +

+
+
+
+ Opens a priority node set editor. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
node_set + Array + + An existing priority node set (optional). +
name + string + + Name of the priority node set (optional for new + sets). +
description + string + + Description of the priority node set (optional). +
cluster_kind + string + + The method used to identify the cluster (optional). +
kind_options + Array + + Available options for cluster identification + methods. +
validation_mode + string + + Indicates the mode (create, validate, revise). +
existing_set + Object + + Reference to the existing priority node set (for + revisions). +
cluster_tracking + string + + Method for tracking cluster growth (optional). +
created_by + string + + Who created the node set (system or manual). +
+ +
+
+ +
+
+

+ priority_groups_add_set(self, nodeset, update_table, + not_validated, prior_name, op_code) +

+
+
+
+ Adds a new priority set to the network visualization. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
nodeset + Object + + The object representing the new priority set. +
update_table + boolean + + Flag indicating whether to update the priority set + table. (optional) +
not_validated + boolean + + Flag indicating whether to perform validation before + adding. (optional) +
prior_name + string + + Optional name of an existing priority set to + replace. +
op_code + string + + Optional operation code (defaults to "insert"). +
+ +
+ +
Returns:
+ +
+ True if the set was added successfully, false otherwise. +
+ +
+
Type
+
+ boolean +
+
+
+ +
+
+

+ priority_groups_check_name(defined_priority_groups, + string [, prior_name]) +

+
+
+
+ A valid name must: - Have a length between 1 and 35 + characters. - Not be a duplicate among existing priority + groups (excluding itself if editing). +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
+ defined_priority_groups + + Array.<Object> + + An array of existing priority group objects. +
string + string + + The name to be validated. +
prior_name + string + <optional>
+ (optional) - The previous name of the priority group + (used for edit case). +
+ +
+ +
Returns:
+ +
+ True if the name is valid, false otherwise. +
+ +
+
Type
+
+ boolean +
+
+
+ +
+
+

+ priority_set_inject_node_attibutes(self, nodes, + node_attributes) +

+
+
+
+ Injects priority set related attributes into network + nodes. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
nodes + Array + + Array of network nodes. +
node_attributes + Array + + Array of priority set attributes for specific nodes + (identified by name). +
+ +
+
+ +
+
+

+ priority_set_view(self, priority_set, options) +

+
+
+
+ Creates a subcluster view for a specific priority set. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
priority_set + Object + + The priority set object. +
options + Object + + Optional configuration options for the view. +
+ +
+
+ +
+
+

+ random_id( [alphabet] + [, length]) +

+
+
+
+ Generates a random ID string using a specified alphabet + and length. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
alphabet + Array.<string> + <optional>
+ An optional array of characters to use in the ID. If + not provided, a default alphabet of letters "a" to + "g" is used. +
length + number + <optional>
+ An optional length for the ID. If not provided, a + default length of 32 is used. +
+ +
+ +
Returns:
+ +
+ A randomly generated ID string. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ secure_hiv_trace_subcluster_columns(self) +

+
+
+
+ Defines secure column definitions for HIV Trace subcluster + data. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + (optional) - The object containing context for + calculations (presumably the component using this + function). +
+ +
+ +
Returns:
+ +
+ An array of column definition objects. Each object has the + following properties: - `description`: - `value`: (string) + The human-readable name of the column. - `sort`: + (function) A function used to sort the column data. - + `presort` (string, optional): The default sort direction + ("asc" or "desc"). - `help`: (string) Help text displayed + when hovering over the column header. - `generator`: + (function) A function that generates the value and actions + for each cluster based on the provided cluster object. - + The generator function receives the cluster object as an + argument. - It should return an object with the following + properties: - `html`: (boolean) Whether the column value + should be rendered as HTML. - `value`: (array|string) The + actual data for the column. - `volatile`: (boolean, + optional) Whether the value needs to be recalculated + frequently. - `format`: (function, optional) A function + used to format the column value for display. - `actions`: + (function, optional) A function used to generate actions + for the column. - The actions function receives two + arguments: - `item`: (object) The current cluster object. + - `value`: (array|string) The value of the column for the + current cluster. - It should return an array of action + objects, each with the following properties: - `icon`: + (string) The icon class name to display for the action. - + `action`: (function) The function executed when the action + is clicked. - The action function receives two arguments: + - `button`: (jQuery object) The button element + representing the action. - `v`: (array|string) The value + of the column for the current cluster. - `help`: (string) + The help text displayed when hovering over the action + icon. +
+ +
+
Type
+
+ Array.<Object> +
+
+
+ +
+
+

+ sort_table_by_column(element, datum) +

+
+
+
+ Sorts a D3 table based on the clicked column header. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
element + d3.selection + | + + HTMLElement + + HTML element representing the clicked column header. +
datum + * + + (optional) - The data object associated with the + table (used internally). +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ sort_table_toggle_icon(element [, value]) +

+
+
+
+ Toggles the sort icon on a column header and returns a + sorting function. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
element + d3.selection + | + + HTMLElement + + The D3 selection or HTML element representing the + column header. +
value + string + <optional>
+ (optional) - The desired sort direction ("asc", + "desc", or "unsorted"). +
+ +
+ +
Returns:
+ +
+ - If `value` is provided, returns nothing. - If `value` is + not provided, returns a sorting function (`d3.ascending` + or `d3.descending`) based on the current sort state. +
+ +
+
Type
+
+ function + | + + void +
+
+
+ +
+
+

+ table_get_cell_value(data) +

+
+
+
+ Retrieves the value of a cell in a table data object. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + Object + + The data object representing the table cell. It + should have a `value` property. +
+ +
+ +
Returns:
+ +
+ The value of the cell, or the result of calling + `data.value()` if it's a function. +
+ +
+
Type
+
+ * +
+
+
+ +
+
+

+ unpack_compact_json() +

+
+
+
+ unpack_compact_json: If the input network JSON is in + compact form, i.e. instead of storing key : value it + stores key : integer index of value unique_values: list of + values convert it to key: value The operation is performed + in place on the `json` argument +
+ +
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + diff --git a/docs/fonts/glyphicons-halflings-regular.eot b/docs/fonts/glyphicons-halflings-regular.eot new file mode 100644 index 0000000..b93a495 Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.eot differ diff --git a/docs/fonts/glyphicons-halflings-regular.svg b/docs/fonts/glyphicons-halflings-regular.svg new file mode 100644 index 0000000..94fb549 --- /dev/null +++ b/docs/fonts/glyphicons-halflings-regular.svg @@ -0,0 +1,288 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docs/fonts/glyphicons-halflings-regular.ttf b/docs/fonts/glyphicons-halflings-regular.ttf new file mode 100644 index 0000000..1413fc6 Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.ttf differ diff --git a/docs/fonts/glyphicons-halflings-regular.woff b/docs/fonts/glyphicons-halflings-regular.woff new file mode 100644 index 0000000..9e61285 Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.woff differ diff --git a/docs/fonts/glyphicons-halflings-regular.woff2 b/docs/fonts/glyphicons-halflings-regular.woff2 new file mode 100644 index 0000000..64539b5 Binary files /dev/null and b/docs/fonts/glyphicons-halflings-regular.woff2 differ diff --git a/docs/global.html b/docs/global.html new file mode 100644 index 0000000..5c2800f --- /dev/null +++ b/docs/global.html @@ -0,0 +1,5552 @@ + + + + + + + Documentation Global + + + + + + + + + + +
+
+
+
+

Global

+
+
+

+
+ +
+
+
+
+ +

Members

+ +
+
+
+

+ <constant> CDCCOICanAutoExpand +

+
+
+
+ CDCCOITrackingOptions: Available tracking options for + Clusters of Interest Used as drop-downs for COI editors + and automatic filling +
+ +
+
+ +
+
+

+ <constant> CDCCOIConciseTrackingOptions +

+
+
+
+ CDCCOITrackingOptionsDateFilter: A filtering option + applied to cluster nodes when computing COI membership + under different tracking options Specifies the maximum + number of MONTHS (relative to the reference data) that a + node age must fall into +
+ +
+
+ +
+
+

+ <constant> CDCCOICreatedBySystem +

+
+
+
+ CDCCOINodeKind: Available options for how a COI member was + identified Used as drop-downs for COI editors and + automatic filling +
+ +
+
+ +
+
+

+ <constant> CDCCOICreatedManually +

+
+
+
+ CDCCOICreatedBySystem: The value of "createdBy" in a COI + record when the COI was created by the system + (automatically) +
+ +
+
+ +
+
+

+ <constant> CDCCOIKind +

+
+
+
+ ShapeOrdering: The range to which values for + categorical/ordinal variables will be mapped using the + "Shape" dropdown +
+ +
+
+ +
+
+

+ <constant> CDCCOIKindAutomaticCreation +

+
+
+
+ CDCJurisdictionLowMorbidity: The set of low-morbidity + jurisdictions for Secure HIV TRACE +
+ +
+
+ +
+
+

+ <constant> CDCCOINodeKind +

+
+
+
+ CDCCOIConciseTrackingOptions: Available shorter tracking + options for Clusters of Interest Used for COI exports +
+ +
+
+ +
+
+

+ <constant> CDCCOINodeKindDefault +

+
+
+
+ CDCCOIKindAutomaticCreation: The kind of COI that is + automatically created by the system +
+ +
+
+ +
+
+

+ <constant> CDCCOITrackingOptions +

+
+
+
+ CDCCOIKind: Available creation options for Clusters of + Interest +
+ +
+
+ +
+
+

+ <constant> CDCCOITrackingOptionsDateFilter +

+
+
+
+ CDCCOITrackingOptionsFilter: A filtering option is applied + to cluster edges when computing COI membership under + different tracking options Selects edges of different + lengths (0.5% vs 1.5%) +
+ +
+
+ +
+
+

+ <constant> CDCCOITrackingOptionsDefault +

+
+
+
+ CDCCOICanAutoExpand: The types of tracking modes which are + subject to automatic growth tracking +
+ +
+
+ +
+
+

+ <constant> CDCCOITrackingOptionsDistanceFilter +

+
+
+
+ CDCCOITrackingOptionsNone: The "no-tracking" option + assigned for COI +
+ +
+
+ +
+
+

+ <constant> CDCCOITrackingOptionsNone +

+
+
+
+ CDCCOITrackingOptionsDefault: The default tracking option + assigned to COI +
+ +
+
+ +
+
+

+ <constant> CDCJurisdictionCodes +

+
+
+
+ CDCCOICreatedManually: The value of "createdBy" in a COI + record when the COI was created manually +
+ +
+
+ +
+
+

+ <constant> CDCJurisdictionLowMorbidity +

+
+
+
+ CDCJurisdictionCodes: Mapping from full names to + two-letter codes for various Secure HIV-TRACE + jurisdictions +
+ +
+
+ +
+
+

+ <constant> CDCNPMember +

+
+
+
+ CDCCOINodeKindDefault: The method of node identification + used by default (and it automatically created COI) +
+ +
+
+ +
+
+

+ <constant> Categorical +

+
+
+
+ CategoricalBase: The default set of colors used for + displaying colors of categorical attributes +
+ +
+
+ +
+
+

+ <constant> DateFormats +

+
+
+
+ Used to generate pop-over labels for node displays, and + COI views +
+ +
+
+ +
+
+

+ <constant> DateUpperBoundYear +

+
+
+
+ Used in many places where alpha-numerically sorted dates + are desired +
+ +
+
+ +
+
+

+ <constant> DateViewFormat +

+
+
+
+ Used to generate legend labels for date-valued attributes + for network displayes +
+ +
+
+ +
+
+

+ <constant> DateViewFormatClusterCreate +

+
+
+
+ Maximum year value (no future dates) +
+ +
+
+ +
+
+

+ <constant> DateViewFormatShort +

+
+
+
+ this is currently used to display node addition dates to + COI +
+ +
+
+ +
+
+

+ <constant> DateViewFormatSlider +

+
+
+
+ List of accepted time formats for attribute values +
+ +
+
+ +
+
+

+ <constant> EdgeColorBase +

+
+
+
+ MaximumValuesInCategories: Maximum # of distinct values + that can be rendered for categorical variables +
+ +
+
+ +
+
+

+ <constant> MaximumValuesInCategories +

+
+
+
+ Categorical: Expanded color range using darker shades + based on `CategoricalBase` +
+ +
+
+ +
+
+

+ <constant> PresetColorSchemes +

+
+
+
+ EdgeColorBase: The default color range for shading network + EDGES +
+ +
+
+ +
+
+

+ <constant> PresetShapeSchemes +

+
+
+
+ PresetColorSchemes: Predefined (hard-coded) color schemes + for specific attribute fields. Keys are exactly matched by + categorical variable names These should be updated if a + specific attribute needs to use a particular color scheme + for value rendering +
+ +
+
+ +
+
+

+ <constant> SequentialColor +

+
+
+
+ PresetShapeSchemes: Predefined (hard-coded) shape schemes + for specific attribute fields. Keys are exactly matched by + categorical variable names These should be updated if a + specific attribute needs to use a particular shape scheme + for value rendering +
+ +
+
+ +
+
+

+ <constant> ShapeOrdering +

+
+
+
+ SequentialColor: The default color ranges for a fixed + number of values +
+ +
+
+ +
+
+

+ <constant> SubclusterSeparator +

+
+
+
+ network: Attributes and string constants for the network + object +
+ +
+
+ +
+
+

+ cluster_time_scale +

+
+
+
+ used as a part of auto-named COI, e.g. NC_202105_44.1 +
+ +
+
+ +
+
+

+ d3 +

+
+
+
+ A collection of table column definitions +
+ +
+
+ +
+
+

+ d3 +

+
+
+
+ Combined definitions and presets for various network + components. +
+ +
+
+ +
+
+

+ d3 +

+
+
+
+ Functions that help manipulate network JSON and perform + other utility operations +
+ +
+
+ +
+
+

+ <constant> formats +

+
+
+
+ missing: Values to use when displaying missing values +
+ +
+
+ +
+
+

+ <constant> missing +

+
+
+
+ CDCNPMember: The label for the auto-generated node + attribute (ever in NP CoI) +
+ +
+
+ +
+
+

+ <constant> network +

+
+
+
+ formats: Various formatters for numerical values +
+ +
+
+
+ +

Methods

+ +
+
+
+

+ _action_drop_down(self, pg) +

+
+
+
+ Generates a dropdown menu for actions on a cluster of + interest (COI). +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
pg + Object + + The cluster of interest data. +
+ +
+ +
Returns:
+ +
+ An array of dropdown menu options. +
+ +
+
Type
+
+ Array +
+
+
+ +
+
+

+ add_a_sortable_table(container, headers, content [, + overwrite] [, caption] [, priority_set_editor]) +

+
+
+
+ Adds a sortable table to a D3 selection container. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
container + d3.selection + + The D3 selection representing the container element + for the table. +
headers + Array.<string> + + An array of strings representing the table headers. +
content + Array.<Object> + + An array of objects representing the table content. + Each object should have properties that map to table + cells. +
overwrite + boolean + <optional>
+ An optional flag indicating whether to overwrite any + existing table content (default: false). +
caption + string + <optional>
+ An optional caption for the table. +
priority_set_editor + function + <optional>
+ An optional function used to customize cell + formatting based on priority sets. The function + should accept four arguments: - `d`: The data object + for the current cell. - `i`: The index of the + current cell within its row. - `cell`: The D3 + selection of the current cell element (a ` + + ` element). - `priority_set_editor`: The + `priority_set_editor` function passed to + `add_a_sortable_table`. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ b64toBlob(b64, + onsuccess [, onerror]) +

+
+
+
+ Converts a base64-encoded string to a Blob object. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
b64 + string + + The base64-encoded string. +
onsuccess + function + + A callback function to be called when the conversion + is successful. +
onerror + function + <optional>
+ An optional callback function to be called if an + error occurs. +
+ +
+
+ +
+
+

+ collapseLargeCategories(nodes, schema) +

+
+
+
+ Collapses rare categories to "Other" category if there are + >CATEGORY_UNIQUE_VALUE_LIMIT categories +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nodes + Array.<Object> + + An array of node objects, each containing patient + attributes. +
schema + Object + + An object defining the schema for the patient + attributes. +
+ +
+ +
Returns:
+ +
+ True if any categories were collapsed, false otherwise. +
+ +
+
Type
+
+ boolean +
+
+
+ +
+
+

+ colorPickerInput(id, + colorizer) +

+
+
+
+ Creates a color picker input element with a label. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + string + + The ID for the color picker input element. +
colorizer + function + + A colorizer function that maps values to colors. +
+ +
+ +
Returns:
+ +
+ The HTML markup for the color picker input element with + the label. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ colorPickerInputContinuous(id, color) +

+
+
+
+ Creates a color picker input element with a label for + continuous values. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + string + + The ID for the color picker input element. +
color + string + + The initial color value for the color picker. +
+ +
+ +
Returns:
+ +
+ The HTML markup for the color picker input element with + the label. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ colorStops(id, number) +

+
+
+
+ Creates a color stop input element with a label. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + string + + The ID for the color stop input element. +
number + number + + The initial value for the color stop. +
+ +
+ +
Returns:
+ +
+ The HTML markup for the color stop input element with the + label. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ copyToClipboard(text) +

+
+
+
+ Copies the given text to the clipboard. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
text + string + + The text to be copied. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ datamonkey_describe_vector(vector [, as_list]) +

+
+
+
+ Calculates descriptive statistics for a numerical vector. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
vector + Array.<number> + + An array of numbers representing the data. +
as_list + boolean + <optional>
+ An optional flag indicating whether to return the + statistics as a formatted string. +
+ +
+ +
Returns:
+ +
+ - If `as_list` is false, returns an object with the + following properties: - `min`: The minimum value. - `max`: + The maximum value. - `median`: The median value. - `Q1`: + The first quartile. - `Q3`: The third quartile. - `mean`: + The mean value. - If `as_list` is true, returns a + formatted string representing the statistics. +
+ +
+
Type
+
+ Object + | + + string +
+
+
+ +
+
+

+ datamonkey_export_csv_button(data [, name]) +

+
+
+
+ Creates a downloadable CSV file for the provided data and + adds a button to trigger the download. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
data + Array.<Object> + + An array of objects representing the data to be + exported. +
name + string + <optional>
+ An optional name for the exported CSV file. If not + provided, defaults to "export.csv". +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ datamonkey_export_handler(data [, filename] [, mimeType]) +

+
+
+
+ Handles exporting data to a file based on browser + capabilities. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
data + string + + The data to be exported. +
filename + string + <optional>
+ The desired filename for the downloaded file. + Defaults to "download.tsv". +
mimeType + string + <optional>
+ The MIME type of the data. Defaults to "text/plain" + if not provided. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ datamonkey_export_json_button(data [, title]) +

+
+
+
+ Creates a downloadable JSON file for the provided data and + adds a button to trigger the download. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
data + Object + | + + Array.<Object> + + The data to be exported, either a single object or + an array of objects. +
title + string + <optional>
+ An optional title for the exported JSON file. If not + provided, defaults to "export". +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ datamonkey_save_image(type, container) +

+
+
+
+ Saves the contents of an SVG element as an image file. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + string + + The desired image format (either "svg" or "png"). +
container + jQuery + | + + HTMLElement + + A jQuery selector or element reference containing + the SVG element. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ draw_priority_set_table(self, container, priority_groups) +

+
+
+
+ Draws a table of priority sets (clusters of interest). +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
container + HTMLElement + + The HTML element where the table will be displayed + (optional). +
priority_groups + Array + + An array of objects representing the priority sets + (optional). +
+ +
+
+ +
+
+

+ edge_typer(e, + edge_types, T) +

+
+
+
+ Determines the type of an edge based on its length and + predefined edge types. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
e + Object + + The edge object to be classified. +
edge_types + Array.<string> + + An array of two edge types. The first type is used + for edges shorter than or equal to `T`, and the + second type is used for edges longer than `T`. +
T + number + + The threshold value for edge length classification. +
+ +
+ +
Returns:
+ +
+ The edge type corresponding to the edge's length. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ ensure_node_attributes_exist() +

+
+
+
+ ensure_node_attributes_exist Iterate over nodes in the + network. If a node does not have an array of attributes or + data dictionary records, create an empty one. This makes + error checking less complex downstream. +
+ +
+
+ +
+
+

+ exportColorScheme(uniqValues, colorizer) +

+
+
+
+ Exports a color scheme based on unique values and a + colorizer function. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
uniqValues + Object + + An object containing unique values for each + attribute, as returned by `getUniqueValues`. +
colorizer + function + + A colorizer function that maps values to colors. +
+ +
+ +
Returns:
+ +
+ An object where the keys are unique values and the values + are the corresponding colors. +
+ +
+
Type
+
+ Object +
+
+
+ +
+
+

+ filter_parse(filter_value) +

+
+
+
+ Parses a filter string into an array of filter objects. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
filter_value + string + + The filter string to be parsed. +
+ +
+ +
Returns:
+ +
+ An array of filter objects, each with a `type` property + and a corresponding `value` property. The `type` can be + "re" for regular expression, "date" for date range, or + "distance" for numerical comparison. +
+ +
+
Type
+
+ Array.<Object> +
+
+
+ +
+
+

+ filter_table(element) +

+
+
+
+ Filters a D3 table based on user-defined filters in column + headers. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
element + d3.selection + | + + HTMLElement + + The D3 selection or HTML element representing a + table header cell that triggered the filter +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ filter_table_by_column_handler(datum, conditions) +

+
+
+
+ Filters a table based on specified conditions applied to a + column. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
datum + * + + The data object representing a row in the table. +
conditions + Array.<Object> + + An array of condition objects, each with the + following properties: - `type`: The type of + condition ("re" for regular expression, "date" for + date range, "distance" for numerical comparison). - + `value`: The value or range for the condition: - For + "re": A regular expression object. - For "date": An + array of two Date objects representing the start and + end dates. - For "distance": A number representing + the threshold value. - `greater_than` (optional): A + boolean indicating whether to use greater-than + comparison for "distance" conditions. +
+ +
+ +
Returns:
+ +
+ True if the row matches at least one condition, false + otherwise. +
+ +
+
Type
+
+ boolean +
+
+
+ +
+
+

+ format_a_cell(data, + index, item [, priority_set_editor]) +

+
+
+
+ Formats a cell in a table based on provided data. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
data + Object + + The data object representing the table cell. It + should have properties like: - `value`: The cell + value. - `format` (optional): A function used to + format the value. - `html` (optional): A flag + indicating whether the value should be set as HTML. + - `callback` (optional): A function used to + customize cell content and behavior. - `filter` + (optional): A flag indicating whether to enable + filtering for the column. - `column_id` (optional): + The index of the column (used for filtering). - + `sort` (optional): A flag indicating whether to + enable sorting for the column. - `presort` + (optional): A string ("asc" or "desc") for initial + sort direction. - `actions` (optional): An array of + button configurations for cell actions. - `help` + (optional): A string describing the cell content + (used as a tooltip). +
index + number + + The index of the cell within its row. +
item + d3.selection + + The D3 selection of the table cell element (a ` + ` element).
priority_set_editor + function + <optional>
+ An optional function used for priority set + functionality (internal). +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ getUniqueValues(nodes, + schema) +

+
+
+
+ Retrieves unique values for each attribute in a given + dataset. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
nodes + Array.<Object> + + An array of node objects, each containing patient + attributes. +
schema + Object + + An object defining the schema for the patient + attributes. +
+ +
+ +
Returns:
+ +
+ An object where each key represents an attribute name and + the corresponding value is an array of unique values for + that attribute. +
+ +
+
Type
+
+ Object +
+
+
+ +
+
+

+ get_editor() +

+
+
+
+ Gets the current priority set editor object. +
+ +
+ +
Returns:
+ +
+ The priority set editor object, or null if not open. +
+ +
+
Type
+
+ Object +
+
+
+ +
+
+

+ get_ui_element_selector_by_role(role) +

+
+
+
+ Retrieves a CSS selector for UI elements based on their + `data-hivtrace-ui-role` attribute. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
role + string + + The value of the `data-hivtrace-ui-role` attribute. +
+ +
+ +
Returns:
+ +
+ A CSS selector string targeting elements with the + specified role. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ handle_cluster_click(self:, cluster, release) +

+
+
+
+ handle_cluster_click Handle contextual menus for clusters + and cluster drag +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self:network object
cluster + [optional]: the cluster object to act on +
release + [optional]: the cluster object to release the + "fixed" flag from +
+ +
+
+ +
+
+

+ handle_inline_confirm(this_button, generator, text, + action, disabled) +

+
+
+
+ Handles inline confirmation popovers. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
this_button + HTMLElement + + The button element that triggers the popover. +
generator + function + + A function that generates the HTML content for the + popover body. +
text + string + + The initial text to display in the popover's text + area (optional). +
action + function + + A callback function to be executed when the user + confirms the action. Takes the value from the text + area as input. +
disabled + boolean + + A flag indicating if the text area should be + disabled (optional). +
+ +
+
+ +
+
+

+ hiv_trace_export_table_to_text(parent_id, table_id, csv + [, file_name_placeholder]) +

+
+
+
+ This function creates a download button that, when + clicked, exports the data from the specified table as + either a CSV or TSV file. It uses D3 for DOM manipulation + and assumes the existence of a `helpers` object with + `table_to_text` and `export_handler` methods. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
parent_id + string + + The selector for the parent element where the button + will be appended. +
table_id + string + + The selector for the table to be exported. +
csv + boolean + + If true, exports as CSV; if false, exports as TSV. +
+ file_name_placeholder + + string + <optional>
+ The base name for the exported file. If not + provided, it defaults to the table_id without the + first character. +
+ +
+ +
Requires:
+
    +
  • module:d3
  • + +
  • module:helpers
  • +
+ +
Returns:
+ +
+ The D3 selection of the created button. +
+ +
+
Type
+
+ d3.Selection +
+
+ +
Example
+ +
+hiv_trace_export_table_to_text("#parent-div", "#data-table", true, "export-data");
+
+ +
+
+

+ hivtraceClusterGraphSummary() +

+
+
+
+ ## hivtraceClusterGraphSummary Function Creates and + populates a summary table for an HIV trace cluster graph. + #### Parameters `graph`: The input graph data. `tag`: The + HTML element to append the summary table to. `not_CDC`: A + flag indicating whether to include CDC-specific statistics + or not (optional). #### Returns None +
+ +
+
+ +
+
+

+ hivtrace_cluster_depthwise_traversal(nodes, edges [, + edge_filter] [, save_edges] [, seed_nodes] [, white_list]) +

+
+
+
+ Performs a depth-wise traversal on a cluster of nodes, + considering edges and optional filters. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
nodes + Array.<Object> + + An array of node objects. Each node should have an + `id` property. +
edges + Array.<Object> + + An array of edge objects. Each edge should have + `source` and `target` properties referencing node + IDs. +
edge_filter + function + <optional>
+ An optional filtering function applied to edges + before traversal. The function should accept an edge + object and return a boolean indicating whether to + include the edge. +
save_edges + function + <optional>
+ An optional function used to store traversed edges. + It should be called with an array where each element + represents the edges within a cluster. +
seed_nodes + Array.<Object> + <optional>
+ An optional array of node objects to use as starting + points for traversal. If not provided, all nodes + will be considered. +
white_list + Set + <optional>
+ An optional set of node IDs restricting traversal to + nodes within the set. +
+ +
+ +
Throws:
+ +
+
+
+ If an edge references non-existent nodes. +
+
+
+
+
Type
+
+ Error +
+
+
+
+ +
Returns:
+ +
+ An array of clusters, where each cluster is an array of + node objects. +
+ +
+
Type
+
+ Array.<Array.<Object>> +
+
+
+ +
+
+

+ hivtrace_coi_timeseries(cluster, element [, plot_width]) +

+
+
+
+ This function creates a detailed time series visualization + for a cluster of interest (COI). It displays nodes and + events over time, with interactive features for + highlighting and displaying additional information. The + visualization includes: - A time axis - Lines representing + nodes - Circles representing events - Interactive + highlighting and tooltips - Time range boxes for context +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
cluster + Object + + The cluster object containing node and event + information. +
+ Properties +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
node_info + Object + + Information about nodes in the cluster. +
event_info + Object + + Information about events in the cluster. +
+
element + d3.Selection + + The D3 selection of the element where the + visualization will be rendered. +
plot_width + number + <optional>
1000 + The width of the plot in pixels. +
+ +
+ +
Requires:
+
    +
  • module:d3
  • + +
  • module:lodash
  • +
+ +
Example
+ +
+const cluster = {
+  node_info: {...},
+  event_info: {...}
+};
+const element = d3.select("#visualization-container");
+hivtrace_coi_timeseries(cluster, element, 1200);
+
+ +
+
+

+ hivtrace_compute_node_degrees(obj) +

+
+
+
+ This function modifies the input object by adding a + 'degree' property to each node. The degree of a node is + the number of edges connected to it. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
obj + Object + + The graph object containing nodes and edges. +
+ Properties +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
Nodes + Object + + An object representing the nodes of the + graph. +
Edges + Object + + An object representing the edges of the + graph. +
+ Edges[].source + + string + + The source node of an edge. +
+ Edges[].target + + string + + The target node of an edge. +
+
+ +
+ +
Example
+ +
+const graph = {
+  Nodes: {
+    "1": {},
+    "2": {}
+  },
+  Edges: {
+    "e1": { source: "1", target: "2" }
+  }
+};
+hivtrace_compute_node_degrees(graph);
+// graph.Nodes["1"].degree === 1
+// graph.Nodes["2"].degree === 1
+
+ +
+
+

+ hivtrace_date_or_na_if_missing(date [, formatter]) +

+
+
+
+ Formats a date using a specified formatter, or returns + "N/A" if the date is missing. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
date + Date + + The date object to be formatted. +
formatter + function + <optional>
+ An optional formatter function used to format the + date. If not provided, `DateViewFormatExport` is + used. +
+ +
+ +
Returns:
+ +
+ The formatted date string, or "N/A" if the date is + missing. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ hivtrace_generate_svg_symbol(type) +

+
+
+
+ Generates an SVG symbol based on the specified type. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
type + string + + The type of symbol to generate. Possible values are: + - "circle" - "cross" - "diamond" - "square" - + "triangle-down" - "triangle-up" - "triangle" - + "pentagon" - "hexagon" - "septagon" - "octagon" - + "ellipse" +
+ +
+ +
Requires:
+
    +
  • module:d3
  • + +
  • module:hivtrace_generate_svg_polygon
  • + +
  • module:hivtrace_generate_svg_ellipse
  • +
+ +
Returns:
+ +
+ A D3 symbol generator or a custom polygon/ellipse + generator. - For "circle", "cross", "diamond", "square", + "triangle-down", "triangle-up": Returns a D3 symbol + generator of the specified type. - For "triangle", + "pentagon", "hexagon", "septagon", "octagon": Returns a + custom polygon generator with the specified number of + sides. - For "ellipse": Returns a custom ellipse + generator. - For any other input: Returns a D3 symbol + generator of type "circle" as default. +
+ +
+
Type
+
+ Object +
+
+
+ +
+
+

+ hivtrace_histogram(graph, histogram_tag, histogram_label) +

+
+
+
+ Renders a histogram for a graph property and displays a + descriptive label. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
graph + Object + + An object containing graph data, including + distribution and fitted data for the property. +
histogram_tag + string + + The ID of the HTML element where the histogram will + be rendered. +
histogram_label + string + + The ID of the HTML element where the descriptive + label will be displayed. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ hivtrace_histogram_distances(graph, histogram_tag, + histogram_label) +

+
+
+
+ Renders a histogram for edge lengths (genetic distances) + and displays a label. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
graph + Object + + An object containing graph data, including edges. +
histogram_tag + string + + The ID of the HTML element where the histogram will + be rendered. +
histogram_label + string + + The ID of the HTML element where the descriptive + label will be displayed. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ hivtrace_plot_cluster_dynamics(time_series, container, + x_title, y_title [, y_scale] [, bin_by] [, options]) +

+
+
+
+ Generates a plot visualizing cluster dynamics over time. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
time_series + Array.<Object> + + An array of data points, each with a required `time` + property (a date object) and optional properties + representing attributes. +
container + d3.selection + + A D3 selection representing the container element + for the plot. +
x_title + string + + The title for the x-axis. +
y_title + string + + The title for the y-axis. +
y_scale + d3.scale + <optional>
+ An optional D3 scale for the y-axis. If not + provided, a linear scale will be used. +
bin_by + function + <optional>
+ An optional function used to bin data points into + time intervals. The function should accept a date + object and return an array with three elements: - + The bin label (e.g., "Q1 2023"). - The start date of + the bin. - The middle date of the bin (used for + x-axis positioning). If not provided, a default + function that bins by quarters is used. +
options + Object + <optional>
+ An optional configuration object for the plot. - + `base_line`: (number, default: 20) The baseline + value for the y-axis. - `top`: (number, default: 40) + The top padding for the plot. - `right`: (number, + default: 30) The right padding for the plot. - + `bottom`: (number, default: 60) The bottom padding + for the plot. - `left`: (number, default: 100) The + left padding for the plot. - `font_size`: (number, + default: 18) The font size for labels and text + elements. - `rect_size`: (number, default: 22) The + size of rectangles used in the legend. - `width`: + (number, default: 1024) The width of the plot + container. - `height`: (number, default: 600) The + height of the plot container. - `barchart`: + (boolean, default: false) If true, the plot will be + displayed as a bar chart. - `skip_cumulative`: + (boolean, default: false) If true, the cumulative + area will not be displayed. - `x-tick-format`: + (Function) An optional function for formatting + x-axis tick labels. - `prefix`: (string) An optional + prefix to add to attribute names displayed in the + legend. - `colorizer`: (Object) An optional + colorizer object for attributes. Keys should be + attribute names, and values should be D3 scales used + for coloring lines/bars. - `drag`: (Object) An + optional drag object for enabling dragging the plot. +
+ +
+ +
Throws:
+ +
+
+
+ If no data points are provided. +
+
+
+
+
Type
+
+ Error +
+
+
+
+
+ +
+
+

+ hivtrace_render_histogram(counts [, fit], w, h, id) +

+
+
+
+ Renders a histogram for discrete data using D3.js. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
counts + Array.<number> + + An array of counts for each category. +
fit + Array.<number> + <optional>
+ (optional) - An array of fitted values for each + category. +
w + number + + The width of the plot area. +
h + number + + The height of the plot area. +
id + string + + The ID of the HTML element where the histogram will + be rendered. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ hivtrace_render_histogram_continuous(data, w, h, id) +

+
+
+
+ Renders a histogram for continuous data using D3.js. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + Array.<number> + + An array of numerical values. +
w + number + + The width of the plot area. +
h + number + + The height of the plot area. +
id + string + + The ID of the HTML element where the histogram will + be rendered. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ hivtrace_render_scatterplot(points, w, h, id, labels [, + dates]) +

+
+
+
+ Renders a scatter plot using D3.js. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDefaultDescription
points + Array.<Object> + + An array of data points, each with x and y + coordinates (and optionally a title). +
w + number + + The width of the plot area. +
h + number + + The height of the plot area. +
id + string + + The ID of the HTML element where the plot will be + rendered. +
labels + Object + + An object containing labels for the x and y axes. +
dates + boolean + <optional>
false + A flag indicating whether the x-axis should + represent dates. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ init(self) +

+
+
+
+ Initializes the component, setting up event listeners and + UI elements. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The component object itself. +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ n_months_ago(reference_date, months) +

+
+
+
+ Calculates a date that is `months` months ago from a given + reference date. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
reference_date + Date + + The reference date from which to calculate the past + date. +
months + number + + The number of months to go back. +
+ +
+ +
Returns:
+ +
+ A new Date object representing the date `months` months + ago from the reference date. +
+ +
+
Type
+
+ Date +
+
+
+ +
+
+

+ normalize_node_attributes() +

+
+
+
+ normalize_node_attributes Iterate over node attributes, + lower case all the keys for mapping. If attributes are + found that are not in the data dictionary, attempt to map + them using "labels". +
+ +
+
+ +
+
+

+ open_editor(self, + node_set, name, description, cluster_kind, kind_options, + validation_mode, existing_set, cluster_tracking, + created_by) +

+
+
+
+ Opens a priority node set editor. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
node_set + Array + + An existing priority node set (optional). +
name + string + + Name of the priority node set (optional for new + sets). +
description + string + + Description of the priority node set (optional). +
cluster_kind + string + + The method used to identify the cluster (optional). +
kind_options + Array + + Available options for cluster identification + methods. +
validation_mode + string + + Indicates the mode (create, validate, revise). +
existing_set + Object + + Reference to the existing priority node set (for + revisions). +
cluster_tracking + string + + Method for tracking cluster growth (optional). +
created_by + string + + Who created the node set (system or manual). +
+ +
+
+ +
+
+

+ priority_groups_add_set(self, nodeset, update_table, + not_validated, prior_name, op_code) +

+
+
+
+ Adds a new priority set to the network visualization. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
nodeset + Object + + The object representing the new priority set. +
update_table + boolean + + Flag indicating whether to update the priority set + table. (optional) +
not_validated + boolean + + Flag indicating whether to perform validation before + adding. (optional) +
prior_name + string + + Optional name of an existing priority set to + replace. +
op_code + string + + Optional operation code (defaults to "insert"). +
+ +
+ +
Returns:
+ +
+ True if the set was added successfully, false otherwise. +
+ +
+
Type
+
+ boolean +
+
+
+ +
+
+

+ priority_groups_check_name(defined_priority_groups, + string [, prior_name]) +

+
+
+
+ A valid name must: - Have a length between 1 and 35 + characters. - Not be a duplicate among existing priority + groups (excluding itself if editing). +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
+ defined_priority_groups + + Array.<Object> + + An array of existing priority group objects. +
string + string + + The name to be validated. +
prior_name + string + <optional>
+ (optional) - The previous name of the priority group + (used for edit case). +
+ +
+ +
Returns:
+ +
+ True if the name is valid, false otherwise. +
+ +
+
Type
+
+ boolean +
+
+
+ +
+
+

+ priority_set_inject_node_attibutes(self, nodes, + node_attributes) +

+
+
+
+ Injects priority set related attributes into network + nodes. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
nodes + Array + + Array of network nodes. +
node_attributes + Array + + Array of priority set attributes for specific nodes + (identified by name). +
+ +
+
+ +
+
+

+ priority_set_view(self, priority_set, options) +

+
+
+
+ Creates a subcluster view for a specific priority set. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + The main network visualization object. +
priority_set + Object + + The priority set object. +
options + Object + + Optional configuration options for the view. +
+ +
+
+ +
+
+

+ random_id( [alphabet] + [, length]) +

+
+
+
+ Generates a random ID string using a specified alphabet + and length. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
alphabet + Array.<string> + <optional>
+ An optional array of characters to use in the ID. If + not provided, a default alphabet of letters "a" to + "g" is used. +
length + number + <optional>
+ An optional length for the ID. If not provided, a + default length of 32 is used. +
+ +
+ +
Returns:
+ +
+ A randomly generated ID string. +
+ +
+
Type
+
+ string +
+
+
+ +
+
+

+ secure_hiv_trace_subcluster_columns(self) +

+
+
+
+ Defines secure column definitions for HIV Trace subcluster + data. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
self + Object + + (optional) - The object containing context for + calculations (presumably the component using this + function). +
+ +
+ +
Returns:
+ +
+ An array of column definition objects. Each object has the + following properties: - `description`: - `value`: (string) + The human-readable name of the column. - `sort`: + (function) A function used to sort the column data. - + `presort` (string, optional): The default sort direction + ("asc" or "desc"). - `help`: (string) Help text displayed + when hovering over the column header. - `generator`: + (function) A function that generates the value and actions + for each cluster based on the provided cluster object. - + The generator function receives the cluster object as an + argument. - It should return an object with the following + properties: - `html`: (boolean) Whether the column value + should be rendered as HTML. - `value`: (array|string) The + actual data for the column. - `volatile`: (boolean, + optional) Whether the value needs to be recalculated + frequently. - `format`: (function, optional) A function + used to format the column value for display. - `actions`: + (function, optional) A function used to generate actions + for the column. - The actions function receives two + arguments: - `item`: (object) The current cluster object. + - `value`: (array|string) The value of the column for the + current cluster. - It should return an array of action + objects, each with the following properties: - `icon`: + (string) The icon class name to display for the action. - + `action`: (function) The function executed when the action + is clicked. - The action function receives two arguments: + - `button`: (jQuery object) The button element + representing the action. - `v`: (array|string) The value + of the column for the current cluster. - `help`: (string) + The help text displayed when hovering over the action + icon. +
+ +
+
Type
+
+ Array.<Object> +
+
+
+ +
+
+

+ sort_table_by_column(element, datum) +

+
+
+
+ Sorts a D3 table based on the clicked column header. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
element + d3.selection + | + + HTMLElement + + HTML element representing the clicked column header. +
datum + * + + (optional) - The data object associated with the + table (used internally). +
+ +
+ +
Returns:
+ +
+
Type
+
+ void +
+
+
+ +
+
+

+ sort_table_toggle_icon(element [, value]) +

+
+
+
+ Toggles the sort icon on a column header and returns a + sorting function. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeArgumentDescription
element + d3.selection + | + + HTMLElement + + The D3 selection or HTML element representing the + column header. +
value + string + <optional>
+ (optional) - The desired sort direction ("asc", + "desc", or "unsorted"). +
+ +
+ +
Returns:
+ +
+ - If `value` is provided, returns nothing. - If `value` is + not provided, returns a sorting function (`d3.ascending` + or `d3.descending`) based on the current sort state. +
+ +
+
Type
+
+ function + | + + void +
+
+
+ +
+
+

+ table_get_cell_value(data) +

+
+
+
+ Retrieves the value of a cell in a table data object. +
+ +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
data + Object + + The data object representing the table cell. It + should have a `value` property. +
+ +
+ +
Returns:
+ +
+ The value of the cell, or the result of calling + `data.value()` if it's a function. +
+ +
+
Type
+
+ * +
+
+
+ +
+
+

+ unpack_compact_json() +

+
+
+
+ unpack_compact_json: If the input network JSON is in + compact form, i.e. instead of storing key : value it + stores key : integer index of value unique_values: list of + values convert it to key: value The operation is performed + in place on the `json` argument +
+ +
+
+
+
+
+
+
+ +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + diff --git a/docs/hivtrace_generate_svg_polygon.html b/docs/hivtrace_generate_svg_polygon.html new file mode 100644 index 0000000..1dca6a5 --- /dev/null +++ b/docs/hivtrace_generate_svg_polygon.html @@ -0,0 +1,686 @@ + + + + + + + Documentation Class: hivtrace_generate_svg_polygon + + + + + + + + + + +
+
+
+
+

Class: hivtrace_generate_svg_polygon

+
+
+

hivtrace_generate_svg_polygon

+
+ +
+
+
+
+

+ new + hivtrace_generate_svg_polygon() +

+
+
+
+ Creates and returns an SVG polygon generator. +
+ +
+
Properties:
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
polygon + function + + Generates the SVG path for the polygon. +
sides + function + + Gets or sets the number of sides of the polygon. + When called with a number > 2, sets the sides + and returns the polygon generator. When called + without arguments, returns the current number of + sides. +
type + function + + Returns the polygon generator function. +
size + function + + Gets or sets the size of the polygon. When + called with a number, sets the size and returns + the polygon generator. When called without + arguments, returns the current size. +
+
+
+ +
Requires:
+
    +
  • module:lodash
  • + +
  • module:hivtrace_generate_svg_polygon_lookup
  • +
+ +
Returns:
+ +
+ An object with methods to generate and manipulate an SVG + polygon. +
+ +
+
Type
+
+ Object +
+
+ +
Example
+ +
+const polygonGenerator = hivtrace_generate_svg_polygon();
+const path = polygonGenerator();
+polygonGenerator.sides(8);
+polygonGenerator.size(100);
+
+
+ +

Requires

+ +
    +
  • module:lodash
  • + +
  • module:hivtrace_generate_svg_polygon_lookup
  • +
+
+
+
+
+ +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + diff --git a/docs/img/glyphicons-halflings-white.png b/docs/img/glyphicons-halflings-white.png new file mode 100644 index 0000000..3bf6484 Binary files /dev/null and b/docs/img/glyphicons-halflings-white.png differ diff --git a/docs/img/glyphicons-halflings.png b/docs/img/glyphicons-halflings.png new file mode 100644 index 0000000..a996999 Binary files /dev/null and b/docs/img/glyphicons-halflings.png differ diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..0f93f81 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,585 @@ + + + + + + + Documentation Index + + + + + + + + + + +
+
+
+
+
+
+

hivtrace-viz

+

+ This repository contains the visualization code for HIV-TRACE. +

+

Dependencies

+
    +
  • Yarn or NPM
  • +
+

Development

+
git clone https://github.com/veg/hivtrace-viz.git
+cd hivtrace-viz
+yarn
+yarn develop
+
+

Navigate your browser to localhost:8273

+

Deployment

+

+ The HIV-Trace webpage was formerly hosted using github-pages + at https://veg.github.io/hivtrace-viz/ but has been migrated + to using a pm2 process at hivtrace-viz.hyphy.org (see + veg/operations documentation for details). +

+

+ The master branch of this repo should always be in sync with + what is published to NPM and is live on the production + website. With the exception of urgent bug fixes, all changes + to veg/master should be done via pull requests from + veg/develop. +

+
+
+
+
+ +
+ +
+ +
+
+
+ + + + + + + + + + + + + + + + + + + diff --git a/docs/quicksearch.html b/docs/quicksearch.html new file mode 100644 index 0000000..ac778a4 --- /dev/null +++ b/docs/quicksearch.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + diff --git a/docs/scripts/docstrap.lib.js b/docs/scripts/docstrap.lib.js new file mode 100644 index 0000000..8d86c43 --- /dev/null +++ b/docs/scripts/docstrap.lib.js @@ -0,0 +1,22646 @@ +if ( + (!(function (a, b) { + "object" == typeof module && "object" == typeof module.exports + ? (module.exports = a.document + ? b(a, !0) + : function (a) { + if (!a.document) + throw new Error("jQuery requires a window with a document"); + return b(a); + }) + : b(a); + })("undefined" != typeof window ? window : this, function (a, b) { + function c(a) { + var b = "length" in a && a.length, + c = _.type(a); + return ( + "function" !== c && + !_.isWindow(a) && + (!(1 !== a.nodeType || !b) || + "array" === c || + 0 === b || + ("number" == typeof b && b > 0 && b - 1 in a)) + ); + } + function d(a, b, c) { + if (_.isFunction(b)) + return _.grep(a, function (a, d) { + return !!b.call(a, d, a) !== c; + }); + if (b.nodeType) + return _.grep(a, function (a) { + return (a === b) !== c; + }); + if ("string" == typeof b) { + if (ha.test(b)) return _.filter(b, a, c); + b = _.filter(b, a); + } + return _.grep(a, function (a) { + return U.call(b, a) >= 0 !== c; + }); + } + function e(a, b) { + for (; (a = a[b]) && 1 !== a.nodeType; ); + return a; + } + function f(a) { + var b = (oa[a] = {}); + return ( + _.each(a.match(na) || [], function (a, c) { + b[c] = !0; + }), + b + ); + } + function g() { + Z.removeEventListener("DOMContentLoaded", g, !1), + a.removeEventListener("load", g, !1), + _.ready(); + } + function h() { + Object.defineProperty((this.cache = {}), 0, { + get: function () { + return {}; + }, + }), + (this.expando = _.expando + h.uid++); + } + function i(a, b, c) { + var d; + if (void 0 === c && 1 === a.nodeType) + if ( + ((d = "data-" + b.replace(ua, "-$1").toLowerCase()), + (c = a.getAttribute(d)), + "string" == typeof c) + ) { + try { + c = + "true" === c || + ("false" !== c && + ("null" === c + ? null + : +c + "" === c + ? +c + : ta.test(c) + ? _.parseJSON(c) + : c)); + } catch (a) {} + sa.set(a, b, c); + } else c = void 0; + return c; + } + function j() { + return !0; + } + function k() { + return !1; + } + function l() { + try { + return Z.activeElement; + } catch (a) {} + } + function m(a, b) { + return _.nodeName(a, "table") && + _.nodeName(11 !== b.nodeType ? b : b.firstChild, "tr") + ? a.getElementsByTagName("tbody")[0] || + a.appendChild(a.ownerDocument.createElement("tbody")) + : a; + } + function n(a) { + return (a.type = (null !== a.getAttribute("type")) + "/" + a.type), a; + } + function o(a) { + var b = Ka.exec(a.type); + return b ? (a.type = b[1]) : a.removeAttribute("type"), a; + } + function p(a, b) { + for (var c = 0, d = a.length; d > c; c++) + ra.set(a[c], "globalEval", !b || ra.get(b[c], "globalEval")); + } + function q(a, b) { + var c, d, e, f, g, h, i, j; + if (1 === b.nodeType) { + if ( + ra.hasData(a) && + ((f = ra.access(a)), (g = ra.set(b, f)), (j = f.events)) + ) { + delete g.handle, (g.events = {}); + for (e in j) + for (c = 0, d = j[e].length; d > c; c++) _.event.add(b, e, j[e][c]); + } + sa.hasData(a) && + ((h = sa.access(a)), (i = _.extend({}, h)), sa.set(b, i)); + } + } + function r(a, b) { + var c = a.getElementsByTagName + ? a.getElementsByTagName(b || "*") + : a.querySelectorAll + ? a.querySelectorAll(b || "*") + : []; + return void 0 === b || (b && _.nodeName(a, b)) ? _.merge([a], c) : c; + } + function s(a, b) { + var c = b.nodeName.toLowerCase(); + "input" === c && ya.test(a.type) + ? (b.checked = a.checked) + : ("input" === c || "textarea" === c) && + (b.defaultValue = a.defaultValue); + } + function t(b, c) { + var d, + e = _(c.createElement(b)).appendTo(c.body), + f = + a.getDefaultComputedStyle && (d = a.getDefaultComputedStyle(e[0])) + ? d.display + : _.css(e[0], "display"); + return e.detach(), f; + } + function u(a) { + var b = Z, + c = Oa[a]; + return ( + c || + ((c = t(a, b)), + ("none" !== c && c) || + ((Na = ( + Na || _("