Skip to content

Instantly share code, notes, and snippets.

@riceissa
Last active April 29, 2018 01:12
Show Gist options
  • Select an option

  • Save riceissa/542f5a9a46e92d7ad2c9aebcce758f32 to your computer and use it in GitHub Desktop.

Select an option

Save riceissa/542f5a9a46e92d7ad2c9aebcce758f32 to your computer and use it in GitHub Desktop.

Instructions for converting model code to a hyperlinked SVG

  1. Copy the model code in causes.txt to the "Model code" box in http://www.dagitty.net/dags.html and update the model.

  2. In the top menu, click "Model" then "Export as SVG".

  3. Open the model SVG in Vim and run the following commands:

    %!tidy -xml -q -i -w 0
    %s@\(<text[^>]\+\)>\([^>]\+\)<@\1><a xlink:href="https://causeprioritization.org/\2">\2</a><@

    The first command uses the program tidy (must be installed) to clean up the XML so that each tag is on its own line. This makes the regex possible to run.

    The second command does a regex replacement to insert hyperlinks so that each text node is clickable.

  4. In the <svg> tag near the top of the SVG, add the following attribute:

    xmlns:xlink="http://www.w3.org/1999/xlink"

    So now the SVG tag should look something like the following (the width and height will be different):

    <svg xmlns="http://www.w3.org/2000/svg" width="922" height="608" xmlns:xlink="http://www.w3.org/1999/xlink" style="font-family: Arial, sans-serif;">
  5. Save the SVG.

AI_policy 1 @0.010,-1.150
AI_safety 1 @0.234,-1.400
Abundance_mentality 1 @-1.822,1.266
Access_to_entertainment 1 @0.391,-0.015
Adult_friendships 1 @-1.053,1.513
Adult_learning 1 @-0.884,1.329
Advancing_liberty 1 @-0.357,-0.631
Advocacy 1 @-0.354,-1.856
Agrarian_reform 1 @-0.696,-1.045
Alcohol_replacement 1 @-0.957,0.546
Aliens 1 @0.395,-1.197
Alternative_foods 1 @1.364,-0.403
Animal_welfare 1 @-1.537,-1.514
Anxiety 1 @0.943,-0.105
Argument_mapping 1 @-0.201,0.921
Asteroids 1 @1.423,-1.736
Augmented_reality 1 @0.267,0.468
Better_entertainment 1 @0.176,-0.198
Better_epistemology 1 @0.548,0.685
Better_explanations 1 @0.344,1.610
Bipolar_disorder 1 @0.995,-0.392
Climate_change 1 @0.062,-1.760
Climate_policy 1 @0.046,-1.418
Computer_security 1 @-1.594,0.097
Content_creation 1 @0.499,1.226
Contributing_to_free_and_open-source_software_projects 1 @0.943,0.468
Coordination 1 @-1.087,0.810
Copyright_reform 1 @-1.404,-0.068
Cultural_preservation 1 @-0.551,0.752
Decentralized_web 1 @-2.046,0.115
Deposit_contract_for_smoking_cessation 1 @-0.598,0.207
Depression 1 @0.748,-0.249
Digital_preservation 1 @-1.578,0.524
Digital_rights 1 @-1.778,-0.436
Drug_liberalization 1 @0.002,-0.888
E-cigarettes 1 @-1.050,0.310
Eating_disorders 1 @0.477,-0.360
Education_reform_and_disruption 1 @-0.772,-0.498
Electromagnetic_pulses 1 @1.055,-0.929
Emotional_intelligence 1 @-1.368,1.516
Existential_risk 1 @0.537,-1.730
Factory_farm_reform 1 @-1.349,-0.701
Fluid_intelligence_decline_with_age 1 @1.258,1.502
Forecasting 1 @0.725,1.016
Frugality 1 @-1.640,0.829
GCRs 1 @0.963,-1.791
Gaming 1 @0.169,0.281
Geomagnetic_storms 1 @1.320,-1.147
Hedonism 1 @0.340,-0.907
Homelessness 1 @-0.610,-0.631
Humane_insecticides 1 @-1.451,-0.914
In_vitro_meat 1 @-1.773,-1.186
Increasing_savings 1 @-1.942,0.593
Injuries 1 @-1.248,-1.646
Insect_suffering 1 @-1.544,-1.164
Instrumental_rationality 1 @1.268,0.314
Internet_mortality 1 @-1.848,-0.028
Job_selection 1 @-1.573,1.355
Journalism 1 @0.102,1.206
Knowledge_loss_over_time 1 @0.176,0.939
Lithium 1 @0.660,0.200
Mechanism_and_institution_design 1 @-0.783,0.983
Mental_health 1 @0.653,-0.679
Migration 1 @-0.047,-0.604
Nootropics 1 @1.094,1.013
Nuclear_security 1 @0.621,-1.078
Open_science 1 @0.760,1.551
Organ_transplants 1 @-0.382,-1.004
Pain_relief 1 @-1.113,-1.407
Patent_reform 1 @-0.867,0.044
Pet_population_control 1 @-2.004,-1.381
Philosophical_progress 1 @1.054,1.323
Policy 1 @-0.830,-1.811
Pornography 1 @-0.453,-0.124
Preventing_totalitarianism 1 @0.843,-1.289
Prison_reform 1 @-0.240,-1.466
Privacy 1 @-2.127,-0.139
Productivity_tools 1 @1.406,0.638
Prostitution 1 @-0.175,-0.113
Providing_helmets 1 @-1.300,-1.480
Rationality 1 @0.976,0.182
Recovering_from_a_global_catastrophe 1 @1.273,-0.683
Recreational_drug_use 1 @-0.642,0.502
Reducing_crackpotism 1 @0.278,1.314
Reducing_suffering 1 @-1.147,-1.878
Reforming_academia 1 @-1.238,0.913
Romance 1 @-0.364,-0.344
Romantic_and_sexual 1 @0.052,-0.355
Self-actualization 1 @-1.178,1.171
Summer_programs 1 @-0.416,1.082
TENS_for_menstrual_pain_reduction 1 @-1.713,-1.859
Tax_reform 1 @-1.097,-0.576
Vegan_leafleting 1 @-1.160,-0.245
Vibrator_distribution 1 @-0.078,0.130
Violent_actions 1 @-1.882,0.946
Virtual_reality 1 @-0.050,0.461
Volcanic_eruptions 1 @1.375,-1.370
Wastes_of_time 1 @-0.629,1.329
Zoning 1 @-0.954,-0.752
AI_safety AI_policy
Advancing_liberty Drug_liberalization Migration
Advocacy Vegan_leafleting
Animal_welfare Factory_farm_reform In_vitro_meat Insect_suffering Pet_population_control
Better_epistemology Argument_mapping Better_explanations Content_creation Cultural_preservation Fluid_intelligence_decline_with_age Forecasting Journalism Knowledge_loss_over_time Nootropics Open_science Philosophical_progress Reducing_crackpotism
Climate_change Climate_policy
Coordination Mechanism_and_institution_design Reforming_academia
Cultural_preservation Digital_preservation
Depression Lithium
Digital_rights Computer_security Copyright_reform Decentralized_web Digital_preservation Internet_mortality Patent_reform Privacy
Existential_risk AI_safety Aliens Nuclear_security
Factory_farm_reform Vegan_leafleting
GCRs Asteroids Climate_change Electromagnetic_pulses Existential_risk Forecasting Geomagnetic_storms Preventing_totalitarianism Recovering_from_a_global_catastrophe Volcanic_eruptions
Hedonism Access_to_entertainment Alcohol_replacement Augmented_reality Better_entertainment Content_creation Deposit_contract_for_smoking_cessation Drug_liberalization E-cigarettes Gaming Recreational_drug_use Romantic_and_sexual Self-actualization Virtual_reality
Increasing_savings Frugality
Injuries Providing_helmets
Insect_suffering Humane_insecticides
Instrumental_rationality Contributing_to_free_and_open-source_software_projects Productivity_tools
Mental_health Anxiety Bipolar_disorder Depression Drug_liberalization Eating_disorders
Policy AI_policy Advancing_liberty Agrarian_reform Climate_policy Copyright_reform Education_reform_and_disruption Factory_farm_reform Homelessness Increasing_savings Migration Organ_transplants Patent_reform Prison_reform Tax_reform Zoning
Productivity_tools Nootropics
Rationality Better_epistemology Instrumental_rationality
Recovering_from_a_global_catastrophe Alternative_foods
Reducing_suffering Animal_welfare Increasing_savings Injuries Mental_health Pain_relief Reducing_crackpotism Romance Self-actualization TENS_for_menstrual_pain_reduction
Romantic_and_sexual Pornography Prostitution Romance Vibrator_distribution
Self-actualization Abundance_mentality Adult_friendships Adult_learning Job_selection Wastes_of_time
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment