top | item 45541874

Show HN: Modeling the human body in Rust so I can cmd+click through it

46 points| lleong1618 | 4 months ago |github.com

I started this trying to understand two things: why my Asian friends turn red after drinking, and why several friends all seemed to have migraine clusters.

I was reading medical papers and textbooks, but kept getting lost jumping between topics. I thought: what if I could just Cmd+Click through this like code? What if "ALDH2 gene" was actually clickable, and took me to the variant, the phenotype, the population frequencies?

So I started modeling human biology in Rust with my Ralph agent (Claude in a loop, ty ghuntley). Turns out the type system is perfect for this. Every biological entity is strongly-typed with relationships enforced at compile time.

After 1 day of agent coding: - 277 Rust files, ~95k lines of code - 1,561 tests passing - 13 complete organ systems - Genetics with ancestry-specific variants - Clinical pathology models

Try it:

git clone https://github.com/lantos1618/open_human_ontology cd open_human_ontology cargo run --example ide_navigation_demo

Then open `examples/ide_navigation_demo.rs` and Cmd+Click through:

Understanding Asian flush:

AsianGeneticVariantsCatalog::get_metabolic_variants()

// Click through to:

// → ALDH2 gene on chromosome 12q24.12

// → rs671 variant (Glu504Lys)

// → 40% frequency in Japanese population

// → Alcohol flush reaction

// → 10x esophageal cancer risk with alcohol

// → Acetaldehyde metabolism pathway

Understanding migraines: Migraine { subtype: WithAura, triggers: [Stress, LackOfSleep, HormonalChanges], genetic_variants: ["rs2075968", "rs1835740"], ... }

// Click through to:

// → 17 migraine trigger types

// → 12 aura symptom types

// → Genetic risk factors

// → Why clusters happen (HormonalChanges → Menstruation)

Now I can actually navigate the connections instead of flipping through PDFs. Heart → CoronaryArtery → Plaque. VisualCortex → 200M neurons → NeuralConnection pathways. It's like Wikipedia but type-checked and with jump-to-definition.

This isn't production medical software - it's a learning tool. But it's way more useful than textbooks for understanding how biological systems connect.

The agent keeps expanding it. Sometimes it OOMs but that's part of the fun.

Tech: Rust, nalgebra, serde, rayon, proptest

I am not a dr or medical professional this is for my education you can commit to it if you want to or review and open some PR's if you find wrong information or want to add references.

47 comments

order

pacoWebConsult|4 months ago

Any grounding in medical truth/ is anything sourced to legitimate references or is this entirely pulled from the model's general training of human anatomy?

lovecg|4 months ago

100k lines in one day of “coding”? I think you already know the answer.

lleong1618|4 months ago

I am pulling from the model and was thinking of attaching a research agent on per file to validate each file and adding sourced validated information.

it seems sound to get structure but on real values and source grounding is needed to be validated.

just a poc

jll29|4 months ago

I wasn't sure what to expect, so I opened a random bit of the code.

                Some(Ancestry::Ashkenazi) => Self {
                    ancestry,
                    lactose_restricted: false,
                    alcohol_restriction_level: AlcoholRestrictionLevel::Moderate,
                    vitamin_d_supplementation_iu: 800.0,
                    recommended_foods: vec![
                        "Fish".to_string(),
                        "Whole grains".to_string(),
                        "Vegetables".to_string(),
                        "Olive oil".to_string(),
                        "Nuts".to_string(),
                    ],
                    foods_to_limit: vec![
                        "High-fat dairy".to_string(),
                        "Processed meats".to_string(),
                    ],
Now this seems to mix a couple of things in the same module: I would suggest to separate out dietary views from a model of the human body and its genetic heritage.

Scientific views may change over time based on new results, and even body properties like blood pressure or BMI are not constant per person but bound to vary; so perhaps a Body should be modeled as a view or snapshot of a set of time series?

I would like to encourage you to take a scientist's view: if you had not just one (your own) but two models, how would you evaluate which is "better" - in other words the evaluation question. You could set a particular task and perhaps finding out something works better with your model than with a full-text index of the textbook you used and a simple Lucene search interface?

Are you planning to connect your model to any kind of visualization? Should be useful.

rafram|4 months ago

Hah. Ashkenazis marked as not being lactose-intolerant? Interesting stuff.

ShrimpHawk|4 months ago

The entire project is AI coded. Thought of this level was not put into developing it.

jstrieb|4 months ago

This project reminds me of Matt Might's work (predating LLMs) on using techniques from Precision Medicine to help his son, who had a rare disease.

https://www.youtube.com/watch?v=Rt3XyeFHvt4 (poorly transcribed here: https://www.janestreet.com/tech-talks/algorithm-for-precisio...)

If I recall correctly, he used miniKanren along with formalized, structured data extracted from medical research. Unfortunately, his son has since passed away.

lleong1618|4 months ago

This is an incredible story, heart goes out to him. He has done some amazing work from this information.

There's nothing that is not actionable, you can always do science.

rfl890|4 months ago

How do we know this is accurate and not some big hallucination? Is the data sourced anywhere? Has anyone with a relevant background even skimmed through the code? It seems like a great idea in theory, but this execution is worrying.

lleong1618|4 months ago

Yes, It's very much a "I wonder if this would work" and kinda did. to be taken in some what of a regard would be attaching a research agent on each commit.

I did spot checks on random files with research agents and it seems to be ok for a claude code loop.

I'm not a Dr'

Please! is anyone a DR

koakuma-chan|4 months ago

I think it's time to learn to stop publishing clearly fully AI generated "projects." Anyone can pull up CC and type "model the human body in Rust," or whatever.

jvanderbot|4 months ago

The old "Look what I built" thread has really bifurcated into "here's what I painstakingly crafted and maybe some lessons learned" and "look what I asked AI to make and it worked".

The latter feels a bit less hacker. Akin to saying "I got someone on fiver to mod this game look how cool it is". Sure, ideas are something, but as AI gets better this is less hacker and more just "Tool worked".

nomilk|4 months ago

That was my first impression too, but not my conclusion. A project of this scale would take years if not for AI assistance, and OP is absolutely not trying to pass this off as a medical tool developed by professionals, but as a fun learning tool and interesting application of type systems and agents to solve a problem.

tehlike|4 months ago

This is hackernews, this is the place for people to hack stuff, and share.

lleong1618|4 months ago

maybe putting - Ai as a tag might help? but this is 100% a hack and experiment for fun. Test out what agents can do and can we model bio with rust.

overtone1000|4 months ago

I wonder how much it would cost to pay a domain expert to review 95k lines of code. As a domain expert who codes for fun and loves rust, I can only say the answer is, "A lot."

HeavyStorm|4 months ago

Clickable? Like a... Hyperlink?

After the "this meeting could have been an email", we get the "code could have been html"

sixo|4 months ago

the absurd things people come up with to meet their own needs are usually good indicators of products and services which want to exist

dietr1ch|4 months ago

True, but to me it seems the product is halfway there with org-roam/logseq/obsidian and that Rust code is the wrong way to start building it.

I'd try generating markdown to be rendered in logseq by teaching the AI how to link and whatnot in my AGENT.md (or whatever people call their project-local instruction/context file).

From outside, I'd not trust hallucinated stuff, but it'd be neat to start a project where knowledgeable humans did oversee all the proposed changes.

lleong1618|4 months ago

Yeah ahaha, I mean I just needed 2 pieces of information and got carried away. But would be awesome to have a runnable human emulation.

csunoser|4 months ago

Maybe this is the future. But I dread looking at perfectly formatted yet sterile readme with too many emojis for comfort.

moron4hire|4 months ago

It's one emoji

stronglikedan|4 months ago

I have an Asian friend that gets flushed when drinking, but I didn't know it was an Asian thing. TIL

lleong1618|4 months ago

updates on learnings - the feed back from hn about ground truths was helpful passed this thread into the ai and it started to base truth on exa search. - it produced alot of slop so it added a review cycle to remove alot of the slop. - it worked out it was doing performative work then removed the data as code and moved this to toml. it then started to focus heavy on processes and doing things like the ALDH2 metabolic process.

honest take - decent at getting a quick understanding of what the ALDH2 process is like but struggles with harder modelling, the experiment gave better insights into ai then medical. (slop is countable with exa mcp (ground truthing, research, anti hallucinations).