Python
scenario_vetting_criteria
load_criteria
load_criteria(components, csv_engine='pandas')
Loads and returns the criteria definitions contained in the package.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
components
|
str | list[str] | tuple[str]
|
A string or list/vector of strings. The return type changes depending on whether a list/vector or a single string is provided. |
required |
csv_engine
|
str = 'pandas'
|
The method for loading CSV files if these are supposed to be loaded. Must
be one of |
'pandas'
|
Returns:
Type | Description |
---|---|
pd.DataFrame | dict[str, str] | dict[str, pd.DataFrame | dict[str, str]]
|
Returns the loaded data. This data can be a dataframe or a nested list. If multiple data components are requested, then the components are returned inside a keyworded list. |
Source code in python/scenario_vetting_criteria/loading.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
|
scenario_vetting_criteria.formatting
format_sources
format_sources(
bib_data,
style="alpha",
form="plaintext",
exclude_fields=None,
)
Takes a citation style, a citation format, and (optionally) excluded fields, and returns a formatted list of sources based on the specified style and format. The sources are loaded from 'references-data.bib' file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
style
|
str
|
Specifies the formatting style for the bibliography entries. |
'alpha'
|
form
|
str
|
Specifies the format in which the citation should be rendered. It determines how the citation information will be displayed or structured in the final output. This can be 'plaintext' or 'html'. |
'plaintext'
|
exclude_fields
|
Optional[list]
|
Specifies a list of fields that should be excluded from the final output. These fields will be removed from the entries before formatting and returning the citation data. |
None
|
Returns:
Type | Description |
---|---|
list[dict]
|
A list of dictionaries containing the identifier, citation, and URL information for each entry in the bibliography data, formatted according to the specified style and form, with any excluded fields removed. |
Source code in python/scenario_vetting_criteria/formatting.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
|
insert_citations
insert_citations(text, citations, link=None)
Inserts citations into a text passed as a string.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
Text that contains replacement patterns for citations. |
required |
citations
|
dict[str]
|
Formatted citations for each identifier. |
required |
Returns:
Type | Description |
---|---|
str
|
The updated text, which has the patterns replaced with citations. |
Source code in python/scenario_vetting_criteria/formatting.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|