AMITT/HTML_GENERATING_CODE/.ipynb_checkpoints/test_new_code-checkpoint.ipynb
Sara-Jayne Terp e1ae84d741 Updated datasheet generating code
Overhauled generating code to include:
* datasheet for each counter
* one file to generate all TTPs (creator and counter)
* one master data spreadsheet (creator and counter)
* more readable code
* counter lists in technique sheets
2021-02-19 06:09:32 +00:00

884 строки
32 KiB
Plaintext
Исходник Ответственный История

Этот файл содержит неоднозначные символы Юникода

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"from generate_amitt_ttps import Amitt\n",
"amitt = Amitt()\n",
"amitt.update_markdown_files()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"updated ../matrix.md\n",
"updated ../incidents.md\n",
"updated ../matrix_to_message.html\n",
"Writing ../counter_tactics/TA01counters.md\n",
"Writing ../counter_tactics/TA02counters.md\n",
"Writing ../counter_tactics/TA03counters.md\n",
"Writing ../counter_tactics/TA04counters.md\n",
"Writing ../counter_tactics/TA05counters.md\n",
"Writing ../counter_tactics/TA06counters.md\n",
"Writing ../counter_tactics/TA07counters.md\n",
"Writing ../counter_tactics/TA08counters.md\n",
"Writing ../counter_tactics/TA09counters.md\n",
"Writing ../counter_tactics/TA10counters.md\n",
"Writing ../counter_tactics/TA11counters.md\n",
"Writing ../counter_tactics/TA12counters.md\n",
"updated ../counter_tactic_counts.md\n",
"Writing ../counters_metatag/cleaningcounters.md\n",
"Writing ../counters_metatag/countermessagingcounters.md\n",
"Writing ../counters_metatag/data pollutioncounters.md\n",
"Writing ../counters_metatag/daylightcounters.md\n",
"Writing ../counters_metatag/dilutioncounters.md\n",
"Writing ../counters_metatag/diversioncounters.md\n",
"Writing ../counters_metatag/frictioncounters.md\n",
"Writing ../counters_metatag/metatechniquecounters.md\n",
"Writing ../counters_metatag/reduce resourcescounters.md\n",
"Writing ../counters_metatag/removalcounters.md\n",
"Writing ../counters_metatag/resiliencecounters.md\n",
"Writing ../counters_metatag/scoringcounters.md\n",
"Writing ../counters_metatag/targetingcounters.md\n",
"Writing ../counters_metatag/verificationcounters.md\n",
"updated ../counter_metatag_counts.md\n",
"Writing ../counter_resource/DHScounters.md\n",
"Writing ../counter_resource/NGOcounters.md\n",
"Writing ../counter_resource/activistscounters.md\n",
"Writing ../counter_resource/adtechcounters.md\n",
"Writing ../counter_resource/civil_societycounters.md\n",
"Writing ../counter_resource/community_groupscounters.md\n",
"Writing ../counter_resource/companiescounters.md\n",
"Writing ../counter_resource/content_creatorscounters.md\n",
"Writing ../counter_resource/data_scientistcounters.md\n",
"Writing ../counter_resource/datastreamscounters.md\n",
"Writing ../counter_resource/developerscounters.md\n",
"Writing ../counter_resource/educatorscounters.md\n",
"Writing ../counter_resource/elvescounters.md\n",
"Writing ../counter_resource/factcheckerscounters.md\n",
"Writing ../counter_resource/fundingcounters.md\n",
"Writing ../counter_resource/gamesdesignerscounters.md\n",
"Writing ../counter_resource/governmentcounters.md\n",
"Writing ../counter_resource/government:policymakerscounters.md\n",
"Writing ../counter_resource/influencerscounters.md\n",
"Writing ../counter_resource/influencers:trusted_authoritycounters.md\n",
"Writing ../counter_resource/infoseccounters.md\n",
"Writing ../counter_resource/librariescounters.md\n",
"Writing ../counter_resource/mediacounters.md\n",
"Writing ../counter_resource/militarycounters.md\n",
"Writing ../counter_resource/moneycounters.md\n",
"Writing ../counter_resource/platform_admincounters.md\n",
"Writing ../counter_resource/platform_admin:adtechcounters.md\n",
"Writing ../counter_resource/platform_admin:fundingsitescounters.md\n",
"Writing ../counter_resource/platform_admin:socialmediacounters.md\n",
"Writing ../counter_resource/platform_algorithmscounters.md\n",
"Writing ../counter_resource/platform_outreachcounters.md\n",
"Writing ../counter_resource/platformscounters.md\n",
"Writing ../counter_resource/publiccounters.md\n",
"Writing ../counter_resource/public:account_ownerscounters.md\n",
"Writing ../counter_resource/religious_organisationscounters.md\n",
"Writing ../counter_resource/schoolscounters.md\n",
"Writing ../counter_resource/server_admincounters.md\n",
"updated ../counter_resource_counts.md\n"
]
}
],
"source": [
"amitt.write_grid_markdown()\n",
"amitt.write_incidentlist_markdown()\n",
"amitt.write_grid_message_generator()\n",
"amitt.write_counters_tactics_markdown()\n",
"amitt.write_counters_metacounts_markdown()\n",
"amitt.write_counters_resource_markdown()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"vars(amitt)['tactics']"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"vars(amitt).keys()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"###. TEST AREA"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\"\\n| Counters |\\n| -------- |\\n| [C00008 Create shared fact-checking database](../counters/C00008.md) |\\n| [C00014 Real-time updates to fact-checking database](../counters/C00014.md) |\\n| [C00015 Reputation scores for social media users](../counters/C00015.md) |\\n| [C00023 Promote civility as an identity that people will defend](../counters/C00023.md) |\\n| [C00024 Promote constructive narratives i.e. not polarising. Pro-life, pro-choice, or pro-USA?](../counters/C00024.md) |\\n| [C00025 Promote identity neutral narratives](../counters/C00025.md) |\\n| [C00073 Educate on how to handle info pollution. Push out targeted education on why it's pollution](../counters/C00073.md) |\\n\""
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"def create_tactic_counters_string(tactic_id):\n",
" table_string = '''\n",
"| Response types | Counters |\n",
"| -------------- | -------- |\n",
"'''\n",
" tactic_counters = amitt.df_counters[amitt.df_counters['tactic_id']==tactic_id]\n",
" row_string = '| {0} | [{1} {2}](../counters/{1}.md) |\\n'\n",
" for index, row in tactic_counters.sort_values(['responsetype', 'id']).iterrows():\n",
" table_string += row_string.format(row['responsetype'], row['id'], row['name'])\n",
" return table_string\n",
"\n",
"\n",
"def create_technique_counters_string(technique_id):\n",
" table_string = '''\n",
"| Counters |\n",
"| -------- |\n",
"'''\n",
" technique_counters = amitt.cross_counterid_techniqueid[amitt.cross_counterid_techniqueid['technique_id']==technique_id]\n",
" technique_counters = pd.merge(technique_counters, amitt.df_counters[['id', 'name']])\n",
" row_string = '| [{0} {1}](../counters/{0}.md) |\\n'\n",
" for index, row in technique_counters.sort_values('id').iterrows():\n",
" table_string += row_string.format(row['id'], row['name'])\n",
" return table_string\n",
"\n",
"create_technique_counters_string('TA01')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>name</th>\n",
" <th>metatechnique</th>\n",
" <th>summary</th>\n",
" <th>playbooks</th>\n",
" <th>resources_needed</th>\n",
" <th>how_found</th>\n",
" <th>references</th>\n",
" <th>incident_ids</th>\n",
" <th>tactic</th>\n",
" <th>responsetype</th>\n",
" <th>notes</th>\n",
" <th>techniques</th>\n",
" <th>longname</th>\n",
" <th>tactic_id</th>\n",
" <th>tactic_name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>C00001</td>\n",
" <td>Better models of info spread up the layers</td>\n",
" <td>metatechnique</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2019-11-workshop</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>TA01 Strategic Planning</td>\n",
" <td>ALL</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>C00001 - Better models of info spread up the l...</td>\n",
" <td>TA01</td>\n",
" <td>Strategic Planning</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>C00003</td>\n",
" <td>How can we safeguard against extremists using ...</td>\n",
" <td>metatechnique</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2019-11-workshop</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>TA01 Strategic Planning</td>\n",
" <td>ALL</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>C00003 - How can we safeguard against extremis...</td>\n",
" <td>TA01</td>\n",
" <td>Strategic Planning</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>C00004</td>\n",
" <td>Managing like a chronic disease</td>\n",
" <td>metatechnique</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2019-11-workshop</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>TA01 Strategic Planning</td>\n",
" <td>ALL</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>C00004 - Managing like a chronic disease</td>\n",
" <td>TA01</td>\n",
" <td>Strategic Planning</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>C00005</td>\n",
" <td>Policy: makers, terminology, elements: a) broa...</td>\n",
" <td>metatechnique</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>2019-11-workshop</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>TA01 Strategic Planning</td>\n",
" <td>ALL</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>C00005 - Policy: makers, terminology, elements...</td>\n",
" <td>TA01</td>\n",
" <td>Strategic Planning</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>C00006</td>\n",
" <td>Charge for social media</td>\n",
" <td>friction</td>\n",
" <td>No corresponding AMITT technique.</td>\n",
" <td>NaN</td>\n",
" <td>platform_admin:socialmedia</td>\n",
" <td>2019-11-workshop</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>TA01 Strategic Planning</td>\n",
" <td>D2 Deny</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>C00006 - Charge for social media</td>\n",
" <td>TA01</td>\n",
" <td>Strategic Planning</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>132</th>\n",
" <td>C00215</td>\n",
" <td>Use fraud legislation to clean up social media</td>\n",
" <td>metatechnique</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>government:policymakers</td>\n",
" <td>2019-11-workshop</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>TA07 Channel Selection</td>\n",
" <td>D3 Disrupt</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>C00215 - Use fraud legislation to clean up soc...</td>\n",
" <td>TA07</td>\n",
" <td>Channel Selection</td>\n",
" </tr>\n",
" <tr>\n",
" <th>82</th>\n",
" <td>C00216</td>\n",
" <td>Use advertiser controls to stem flow of funds ...</td>\n",
" <td>reduce resources</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>platform_admin:adtech</td>\n",
" <td>2019-11-workshop</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>TA05 Microtargeting</td>\n",
" <td>D2 Deny</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>C00216 - Use advertiser controls to stem flow ...</td>\n",
" <td>TA05</td>\n",
" <td>Microtargeting</td>\n",
" </tr>\n",
" <tr>\n",
" <th>133</th>\n",
" <td>C00217</td>\n",
" <td>Registries alert when large batches of newsy U...</td>\n",
" <td>daylight</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>platform_admin</td>\n",
" <td>grugq</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>TA07 Channel Selection</td>\n",
" <td>D2 Deny</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>C00217 - Registries alert when large batches o...</td>\n",
" <td>TA07</td>\n",
" <td>Channel Selection</td>\n",
" </tr>\n",
" <tr>\n",
" <th>167</th>\n",
" <td>C00218</td>\n",
" <td>Censorship</td>\n",
" <td>removal</td>\n",
" <td>Alter and/or block the publication/disseminati...</td>\n",
" <td>NaN</td>\n",
" <td>platform_admin</td>\n",
" <td>grugq</td>\n",
" <td>Taylor81</td>\n",
" <td>NaN</td>\n",
" <td>TA09 Exposure</td>\n",
" <td>D2 Deny</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>C00218 - Censorship</td>\n",
" <td>TA09</td>\n",
" <td>Exposure</td>\n",
" </tr>\n",
" <tr>\n",
" <th>115</th>\n",
" <td>C00219</td>\n",
" <td>Add metadata to content - out of the control o...</td>\n",
" <td>daylight</td>\n",
" <td>NaN</td>\n",
" <td>Add date and source to images</td>\n",
" <td>NaN</td>\n",
" <td>grugq</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>TA06 Develop Content</td>\n",
" <td>D3 Disrupt</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>C00219 - Add metadata to content - out of the ...</td>\n",
" <td>TA06</td>\n",
" <td>Develop Content</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>186 rows × 16 columns</p>\n",
"</div>"
],
"text/plain": [
" id name \\\n",
"0 C00001 Better models of info spread up the layers \n",
"1 C00003 How can we safeguard against extremists using ... \n",
"2 C00004 Managing like a chronic disease \n",
"3 C00005 Policy: makers, terminology, elements: a) broa... \n",
"4 C00006 Charge for social media \n",
".. ... ... \n",
"132 C00215 Use fraud legislation to clean up social media \n",
"82 C00216 Use advertiser controls to stem flow of funds ... \n",
"133 C00217 Registries alert when large batches of newsy U... \n",
"167 C00218 Censorship \n",
"115 C00219 Add metadata to content - out of the control o... \n",
"\n",
" metatechnique summary \\\n",
"0 metatechnique NaN \n",
"1 metatechnique NaN \n",
"2 metatechnique NaN \n",
"3 metatechnique NaN \n",
"4 friction No corresponding AMITT technique. \n",
".. ... ... \n",
"132 metatechnique NaN \n",
"82 reduce resources NaN \n",
"133 daylight NaN \n",
"167 removal Alter and/or block the publication/disseminati... \n",
"115 daylight NaN \n",
"\n",
" playbooks resources_needed \\\n",
"0 NaN NaN \n",
"1 NaN NaN \n",
"2 NaN NaN \n",
"3 NaN NaN \n",
"4 NaN platform_admin:socialmedia \n",
".. ... ... \n",
"132 NaN government:policymakers \n",
"82 NaN platform_admin:adtech \n",
"133 NaN platform_admin \n",
"167 NaN platform_admin \n",
"115 Add date and source to images NaN \n",
"\n",
" how_found references incident_ids tactic \\\n",
"0 2019-11-workshop NaN NaN TA01 Strategic Planning \n",
"1 2019-11-workshop NaN NaN TA01 Strategic Planning \n",
"2 2019-11-workshop NaN NaN TA01 Strategic Planning \n",
"3 2019-11-workshop NaN NaN TA01 Strategic Planning \n",
"4 2019-11-workshop NaN NaN TA01 Strategic Planning \n",
".. ... ... ... ... \n",
"132 2019-11-workshop NaN NaN TA07 Channel Selection \n",
"82 2019-11-workshop NaN NaN TA05 Microtargeting \n",
"133 grugq NaN NaN TA07 Channel Selection \n",
"167 grugq Taylor81 NaN TA09 Exposure \n",
"115 grugq NaN NaN TA06 Develop Content \n",
"\n",
" responsetype notes techniques \\\n",
"0 ALL NaN NaN \n",
"1 ALL NaN NaN \n",
"2 ALL NaN NaN \n",
"3 ALL NaN NaN \n",
"4 D2 Deny NaN NaN \n",
".. ... ... ... \n",
"132 D3 Disrupt NaN NaN \n",
"82 D2 Deny NaN NaN \n",
"133 D2 Deny NaN NaN \n",
"167 D2 Deny NaN NaN \n",
"115 D3 Disrupt NaN NaN \n",
"\n",
" longname tactic_id \\\n",
"0 C00001 - Better models of info spread up the l... TA01 \n",
"1 C00003 - How can we safeguard against extremis... TA01 \n",
"2 C00004 - Managing like a chronic disease TA01 \n",
"3 C00005 - Policy: makers, terminology, elements... TA01 \n",
"4 C00006 - Charge for social media TA01 \n",
".. ... ... \n",
"132 C00215 - Use fraud legislation to clean up soc... TA07 \n",
"82 C00216 - Use advertiser controls to stem flow ... TA05 \n",
"133 C00217 - Registries alert when large batches o... TA07 \n",
"167 C00218 - Censorship TA09 \n",
"115 C00219 - Add metadata to content - out of the ... TA06 \n",
"\n",
" tactic_name \n",
"0 Strategic Planning \n",
"1 Strategic Planning \n",
"2 Strategic Planning \n",
"3 Strategic Planning \n",
"4 Strategic Planning \n",
".. ... \n",
"132 Channel Selection \n",
"82 Microtargeting \n",
"133 Channel Selection \n",
"167 Exposure \n",
"115 Develop Content \n",
"\n",
"[186 rows x 16 columns]"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"amitt.df_counters"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>technique_id</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>C00008</td>\n",
" <td>T0006</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>C00014</td>\n",
" <td>T0006</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>C00023</td>\n",
" <td>T0006</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>C00024</td>\n",
" <td>T0006</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>C00025</td>\n",
" <td>T0006</td>\n",
" </tr>\n",
" <tr>\n",
" <th>35</th>\n",
" <td>C00031</td>\n",
" <td>T0006</td>\n",
" </tr>\n",
" <tr>\n",
" <th>100</th>\n",
" <td>C00088</td>\n",
" <td>T0006</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" id technique_id\n",
"6 C00008 T0006\n",
"12 C00014 T0006\n",
"21 C00023 T0006\n",
"22 C00024 T0006\n",
"23 C00025 T0006\n",
"35 C00031 T0006\n",
"100 C00088 T0006"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"amitt.cross_counterid_techniqueid[amitt.cross_counterid_techniqueid['technique_id'] == 'T0006']"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>technique_id</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>C00008</td>\n",
" <td>TA01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>C00008</td>\n",
" <td>TA06</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>C00008</td>\n",
" <td>TA08</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>C00008</td>\n",
" <td>T0006</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>C00008</td>\n",
" <td>T0009</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>182</th>\n",
" <td>C00145</td>\n",
" <td>T0015</td>\n",
" </tr>\n",
" <tr>\n",
" <th>182</th>\n",
" <td>C00145</td>\n",
" <td>T0046</td>\n",
" </tr>\n",
" <tr>\n",
" <th>183</th>\n",
" <td>C00147</td>\n",
" <td>T0060</td>\n",
" </tr>\n",
" <tr>\n",
" <th>185</th>\n",
" <td>C00149</td>\n",
" <td>TA12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>185</th>\n",
" <td>C00149</td>\n",
" <td>T0020</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>283 rows × 2 columns</p>\n",
"</div>"
],
"text/plain": [
" id technique_id\n",
"6 C00008 TA01\n",
"6 C00008 TA06\n",
"6 C00008 TA08\n",
"6 C00008 T0006\n",
"6 C00008 T0009\n",
".. ... ...\n",
"182 C00145 T0015\n",
"182 C00145 T0046\n",
"183 C00147 T0060\n",
"185 C00149 TA12\n",
"185 C00149 T0020\n",
"\n",
"[283 rows x 2 columns]"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"amitt.cross_counterid_techniqueid"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>id</th>\n",
" <th>technique_id</th>\n",
" <th>name</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>C00008</td>\n",
" <td>T0006</td>\n",
" <td>Create shared fact-checking database</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>C00014</td>\n",
" <td>T0006</td>\n",
" <td>Real-time updates to fact-checking database</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>C00023</td>\n",
" <td>T0006</td>\n",
" <td>Promote civility as an identity that people wi...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>C00024</td>\n",
" <td>T0006</td>\n",
" <td>Promote constructive narratives i.e. not polar...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>C00025</td>\n",
" <td>T0006</td>\n",
" <td>Promote identity neutral narratives</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>C00031</td>\n",
" <td>T0006</td>\n",
" <td>Dilute the core narrative - create multiple pe...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>C00088</td>\n",
" <td>T0006</td>\n",
" <td>Poison pill recasting of message</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" id technique_id name\n",
"0 C00008 T0006 Create shared fact-checking database\n",
"1 C00014 T0006 Real-time updates to fact-checking database\n",
"2 C00023 T0006 Promote civility as an identity that people wi...\n",
"3 C00024 T0006 Promote constructive narratives i.e. not polar...\n",
"4 C00025 T0006 Promote identity neutral narratives\n",
"5 C00031 T0006 Dilute the core narrative - create multiple pe...\n",
"6 C00088 T0006 Poison pill recasting of message"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"technique_id='T0006'\n",
"xx = amitt.cross_counterid_techniqueid[amitt.cross_counterid_techniqueid['technique_id']==technique_id]\n",
"pd.merge(xx, amitt.df_counters[['id', 'name']])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"tactics=self.create_counter_tactics_string(row['id'])\n",
"techniques=self.create_counter_techniques_string(row['id'])\n",
"incidents=self.create_counter_incidents_string(row['id'])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}