{"id":15017282,"url":"https://github.com/ohare93/brain-brew","last_synced_at":"2025-10-29T20:41:29.224Z","repository":{"id":41847187,"uuid":"254617397","full_name":"ohare93/brain-brew","owner":"ohare93","description":"Automated Anki flashcard creation and extraction to/from Csv ","archived":false,"fork":false,"pushed_at":"2024-09-11T16:04:53.000Z","size":412,"stargazers_count":97,"open_issues_count":13,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-12T02:05:13.282Z","etag":null,"topics":["anki","anki-flashcards","brain-brew","collaboration","crowdanki","csv","csv-converter","data-manipulation","learning","open-source","python","python37","yamale"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ohare93.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ohare93","patreon":"jmohare","open_collective":null,"ko_fi":"brainbrew","tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2020-04-10T11:24:45.000Z","updated_at":"2025-06-01T01:27:23.000Z","dependencies_parsed_at":"2024-09-20T14:41:09.728Z","dependency_job_id":null,"html_url":"https://github.com/ohare93/brain-brew","commit_stats":{"total_commits":111,"total_committers":5,"mean_commits":22.2,"dds":"0.33333333333333337","last_synced_commit":"dbe106954cd2c610959a41b459460961c7d9444b"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ohare93/brain-brew","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohare93%2Fbrain-brew","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohare93%2Fbrain-brew/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohare93%2Fbrain-brew/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohare93%2Fbrain-brew/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ohare93","download_url":"https://codeload.github.com/ohare93/brain-brew/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ohare93%2Fbrain-brew/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265455021,"owners_count":23768473,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anki","anki-flashcards","brain-brew","collaboration","crowdanki","csv","csv-converter","data-manipulation","learning","open-source","python","python37","yamale"],"created_at":"2024-09-24T19:50:15.397Z","updated_at":"2025-10-29T20:41:29.130Z","avatar_url":"https://github.com/ohare93.png","language":"Python","funding_links":["https://github.com/sponsors/ohare93","https://patreon.com/jmohare","https://ko-fi.com/brainbrew","https://www.patreon.com/jmohare?fan_landing=true"],"categories":[],"sub_categories":[],"readme":"# Brain-Brew\n\n\u003ca title=\"Buy me a cuppa tea\" href=\"https://ko-fi.com/brainbrew\"\u003e\u003cimg src=\"https://img.shields.io/badge/ko--fi-contribute-%23579ebd.svg\"\u003e\u003c/a\u003e\n\u003ca title=\"Support a fellow Weekend Warrior on Patreon\" href=\"https://www.patreon.com/jmohare?fan_landing=true\"\u003e\u003cimg src=\"https://img.shields.io/badge/patreon-support-%23f96854.svg\"\u003e\u003c/a\u003e\n\nBrain Brew is an open-source flashcard manipulation tool designed to allow users to convert their Anki flashcards to/from many different formats to suit their own needs.\nThe goal is to facilitate collaboration and maximize user choice, with a powerful tool that minimizes effort.\n[CrowdAnki](https://github.com/Stvad/CrowdAnki) Exports and Csv(s) are the only supported file types as of now, but there will be more to come.\n\n\n[Anki Ultimate Geography](https://github.com/axelboc/anki-ultimate-geography/) is currently the best working example of a Flashcard repo using Brain Brew :tada:\nSee there for inspiration!\n\n\n# Installation\n\n\nInstall the latest version of [Brain Brew on PyPi.org](https://pypi.org/project/Brain-Brew/)\nwith `pip install brain-brew`. Virtual environment using `pipenv` is recommended!\n\n:exclamation: See the [Brain Brew Starter Project][BrainBrewStarter] for a working clone-able Git repo.\nFrom this repo you can now create a functional Brain Brew setup automatically, \nwith your own flashcards! Simply by running\n\n```bash\nbrainbrew init [Your CrowdAnki Export Folder]\n```\n\nThis will generate the entire working repo for you, including the recipe files, source files, and build folder.\nFor bi-directional sync: Anki \u003c-\u003e Source!\n\nSee [the starter repo][BrainBrewStarter] for a step-by-step guide for all of this.\n\n# Usage\n\nBrain Brew runs from the command line and takes a *Recipe.yaml* file to run.\n\n```bash\nbrainbrew run source_to_anki.yaml\n```\n\nFull usage help text:\n```bash\nBrain Brew vx.y.z\nusage: brainbrew [-h] {run,init} ...\n\nManage Flashcards by transforming them to various types.\n\npositional arguments:\n  {run,init}  Commands that can be run\n    run       Run a recipe file. This will convert some data to another format, based on the instructions in the recipe file.\n    init      Initialise a Brain Brew repository, using a CrowdAnki export as the base data.\n\noptional arguments:\n  -h, --help  show this help message and exit\n```\n\n\n## Recipes\n\nThese are the instructions for how Brain Brew will ~~build~~ *brew* your data into another format.\n\nWhat's YAML? See the current spec [here](http://www.yaml.org/spec/1.2/spec.html).\n\nRun a recipe with `--verify` or `-v` to confirm your recipe is valid, without actually running it.\nA dry run of sorts.\n\n### Tasks\n\nA recipe is made of many individual tasks, which do specific functions. \nFull detailed list coming soon™️, but see the [Yamale recipe schema](https://github.com/ohare93/brain-brew/blob/master/brain_brew/schemas/recipe.yaml) \n(local file: `brain_brew/schemas/recipe.yaml`) in the meantime :+1:\n\n\n\n\n[//]: \u003c\u003e (Yamale)\n\n# The Why\n\nBrain Brew was made in an effort to solve some of the following issues with current collaboration of Anki Flashcards:\n\n#### Sharing Personal Information or Copyrighted Material\n\nHave some personal notes on your cards? Used some images randomly taken from the internet? \nThat usually means you cannot share your deck entirely, without having to go to the effort of removing the offending material and/or managing two separate copies.\n\n#### Having to Pick Between Source Control or Anki Editing\n\nPutting your cards into a source control system brings a lot of benefits. \nYou can see any changes that occur, go back in time should an mistake be discovered, and collaborate with others.\n\nHowever the current tools for managing Anki cards in source control \n(such as [Anki-DM](https://github.com/OnkelTem/anki-dm), [GenAnki](https://github.com/kerrickstaley/genanki), \nand [Remote Decks](https://github.com/c-okelly/anki-remote-decks)) are only one way.\nYou generate cards from a csv into a file that can *only be imported* into Anki. \nThere is no way to export them back, meaning a user must manually copy their changes over, or simple not edit their cards anywhere other than in source control.\n\nThis robs the user of two important work flows:\n1. Editing/fixing cards in Anki as you review them (on desktop or mobile)\n1. The plethora of Anki add-ons that already exist that are amazingly useful. E.g: Image Occlusion, Morphman, AwesomeTTS. \n\nA user should not have to pick between these fantastic work flows and the usage of source control to structure, manage, and share their cards.\n\n#### Lack of Formatting Choice\n\nCsvs are great for editing data, but can only go so far by themselves. Having all the data inside one csv leaves a lot to be desired and can result in eventual problems.\nWhen one gets as many columns as *this* (from [Ultimate Geography](https://github.com/axelboc/anki-ultimate-geography/)) then it becomes a nightmare to manage:\n\n|guid|Country|Country:de|Country:es|Country:fr|Country:nb|\"Country info\"|\"Country info:de\"|\"Country info:es\"|\"Country info:fr\"|\"Country info:nb\"|Capital|Capital:de|Capital:es|Capital:fr|Capital:nb|\"Capital info\"|\"Capital info:de\"|\"Capital info:es\"|\"Capital info:fr\"|\"Capital info:nb\"|\"Capital hint\"|\"Capital hint:de\"|\"Capital hint:es\"|\"Capital hint:fr\"|\"Capital hint:nb\"|Flag|\"Flag similarity\"|\"Flag similarity:de\"|\"Flag similarity:es\"|\"Flag similarity:fr\"|\"Flag similarity:nb\"|Map|tags|\n| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |\n|crr.AfnVRi|England|England|Inglaterra|Angleterre|England|\"Constituent country of the United Kingdom.\"|\"Landesteil des Vereinigten Königreichs.\"|\"Nación constitutiva del Reino Unido.\"|\"Nation constitutive du Royaume-Uni.\"|\"Land som utgjør en del av Storbritannia.\"|London|London|Londres|Londres|London| | | | | |\"Not a sovereign country\"|\"Kein souveräner Staat\"|\"No es un país soberano\"|\"Pas une nation souveraine\"|\"Ikke selvstendig land\"|\"\u003cimg src=\"\"ug-flag-england.svg\"\" /\u003e\"| | | | | |\"\u003cimg src=\"\"ug-map-england.png\"\" /\u003e\"|UG::Europe|\n\"h\u003cB?Kff,?3\"|\"Ivory Coast\"|Elfenbeinküste|\"Costa de Marfil\"|\"Côte d’Ivoire\"|Elfenbenskysten|\"Officially Côte d'Ivoire.\"|\"Offiziell Côte d'Ivoire.\"|\"Oficialmente Côte d'Ivoire.\"| | |Yamoussoukro|Yamoussoukro|Yamusukro|Yamoussoukro|Yamoussoukro|\"While Yamoussoukro is the official capital, Abidjan is the de facto seat of government.\"|\"Yamoussoukro ist die offizielle Hauptstadt, aber Abidjan ist der Regierungssitz.\"|\"Aunque Yamusukro es la capital oficial, Abiyán es la capital de facto.\"|\"Bien que Yamoussoukro soit la capitale officielle, Abidjan est le siège du gouvernement.\"|\"Yamoussoukro er offisiell hovedstad, mens Abidjan er de facto regjeringssete.\"| | | | | |\"\u003cimg src=\"\"ug-flag-ivory_coast.svg\"\" /\u003e\"|\"Ireland (orange and green flipped, wider)\"|\"Irland (Orange und Grün vertauscht, breiter)\"|\"Irlanda (naranja y verde intercambiados, más ancha)\"|\"Irlande (orange et vert inversés, plus large)\"|\"Ireland (byttet plass på oransje og grønt, bredere)\"|\"\u003cimg src=\"\"ug-map-ivory_coast.png\"\" /\u003e\"|\"UG::Africa UG::Sovereign_State UG::West_Africa\"\n\nThen there's having too many rows in one csv for it to be properly managed.\n\n\n# Features of Brain Brew\n### Multi-directional Card Syncing\nMake changes in your source file and sync those into your Anki collection.\n\nMake changes inside Anki and pull those back into the source.\n\nAny user of your shared deck can make a change inside Anki and at some later point export their deck (or just part of it) using CrowdAnki.\nThen the source file can be updated with their changes and a new CrowdAnki Export for all users to import can be generated with one run of Brain Brew.\n\n### Modular Configuration Files \nYaml config files are what drive the conversion of Brain Brew, allowing users to easily change the functionality as they wish.\n\n\u003c!--\nReusable subconfig files allow for minor changes without breaking the DRY principle.\n--\u003e\n\n```Yaml\n- generate_guids_in_csv:\n    source: src/data/words.csv\n    columns: [ guid ]\n\n- build_parts:\n  - note_model_from_yaml_part:\n      part_id: LL Word\n      file: src/note_models/LL Word.yaml\n\n  - headers_from_yaml_part:\n      part_id: default header\n      file: src/headers/default.yaml\n      override:  # Optional\n        deck_description_html_file: src/headers/desc.html\n\n  - media_group_from_folder:\n      part_id: all_media\n      source: src/media\n      recursive: true  # Optional\n\n  - notes_from_csvs:\n      part_id: english-to-danish\n\n      note_model_mappings:\n        - note_models:\n            - LL Word\n          columns_to_fields:  # Optional\n            guid: guid\n            tags: tags\n\n            english: English\n            danish: Word\n            picture: Picture\n            danish audio: Pronunciation (Recording and/or IPA)\n      \n      file_mappings:\n        - file: src/data/words.csv\n          note_model: LL Word\n          sort_by_columns: [english]  # Optional\n          reverse_sort: no  # Optional\n```\n\n### Personal Fields \nDeck managers can set specific fields to be \"Personal\", meaning they will not overwrite an existing value on import. \n\nWorking version currently exists, but full PR coming soon to CrowdAnki!\n\n### Extensibility and Open Source\nFree for all to use, modify, or sell this product.\n\nFurther source types are relatively easy to add due to the flexible nature of the backend\nInstead of creating a Csv \u003c-\u003e CrowdAnki converter Brain Brew first goes through a middle layer called \"Deck Parts\". \nThese consist of Notes, Headers, Note Models, and Media files. \n\nEach new source type to be added to Brain Brew (such as Markdown) need only be able to convert from Deck Parts \u003c-\u003e itself, and suddenly it can convert to and from all existing source types!\n\n### Smart Csvs\n\nCsvs only update the rows which have changed. \nMeaning a user can import *a subset* of their cards which have changed and still update the source file without deleting the cards they did not include.\n\n##### Csv Splitting / Derivatives\n\nSplit data into multiple csvs so that your data is neatly organised however you like. \n\nThe two following csv files contain information about England, but split into different csv files:\n\n###### data-main.csv\n\n| guid | country | flag | map | tags |\n| ---- | ---- | ---- | ---- | ---- |\n| \"e+/O]%*qfk | England | \u003cimg src=\"\"ug-flag-england.svg\"\" /\u003e | \u003cimg src=\"\"ug-map-england.png\"\" /\u003e | UG::Europe |\n\n###### data-capital.csv\n| country | capital | capital de | capital es | capital fr | capital nb | \n| ---- | ---- | ---- | ---- | ---- | ---- |\n| England | London | London | Londres | Londres | London | \n\nBrain Brew can be told that `data-capital` is a derivative of `data-main` in the build config file as such:\n\n```yaml\n- file: src/data/data-main.csv               # \u003c---- Main\n  note_model: Ultimate Geography\n  derivatives:\n    - file: src/data/data-country.csv\n    - file: src/data/data-country-info.csv\n    - file: src/data/data-capital.csv        # \u003c---- Capital\n    - file: src/data/data-capital-info.csv\n    - file: src/data/data-capital-hint.csv\n    # note_model: different_note_model\n    # derivatives:\n    # - file: derivative-of-a-derivative.csv\n      # derivatives:\n      # - file: infinite-nesting.csv\n    - file: src/data/data-flag-similarity.csv\n```\n\nWhen run Brain Brew will perform the following steps for each derivative:\n1. Finds which columns in the derivative csv match the main (only `country` in this case)\n1. Go through each row in the derivative and find the row with matching values in the main file\n1. Add in the extra columns (`capital` in each language) to that matching row in the main file \n\n###### Resulting csv data\n| guid | country | flag | map | tags | capital | capital de | capital es | capital fr | capital nb | \n| ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- | ---- |\n| \"e+/O]%*qfk | England | \u003cimg src=\"\"ug-flag-england.svg\"\" /\u003e | \u003cimg src=\"\"ug-map-england.png\"\" /\u003e | UG::Europe | London | London | Londres | Londres | London | \n\n##### Note:\n\n1. **Derivatives can also have derivatives**.\n\n1. **Csv splitting works in both directions**, to and from csv.\n\n1. **Derivatives can be given a Note Model**, which overrides their parent's note model for all the matched rows.\n\nSee the [Brain Brew Starter Project][BrainBrewStarter] for an example of Csv Derivatives working.\n\n\n\n[BrainBrewStarter]: https://github.com/ohare93/brain-brew-starter\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fohare93%2Fbrain-brew","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fohare93%2Fbrain-brew","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fohare93%2Fbrain-brew/lists"}