<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Will Ware on Medium]]></title>
        <description><![CDATA[Stories by Will Ware on Medium]]></description>
        <link>https://medium.com/@wware?source=rss-bcd09ad71293------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*KKdlTgEGVqgZOifh.</url>
            <title>Stories by Will Ware on Medium</title>
            <link>https://medium.com/@wware?source=rss-bcd09ad71293------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 21:57:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@wware/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A BFS-based graph query language]]></title>
            <link>https://medium.com/@wware/a-bfs-based-graph-query-language-5ba120776e49?source=rss-bcd09ad71293------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ba120776e49</guid>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[agentic-rag]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[knowledge-graph]]></category>
            <dc:creator><![CDATA[Will Ware]]></dc:creator>
            <pubDate>Sat, 21 Mar 2026 20:37:40 GMT</pubDate>
            <atom:updated>2026-03-21T20:37:40.141Z</atom:updated>
            <content:encoded><![CDATA[<p>Recent work on Graph RAG included the design of a query language using bread-first search (BFS) to provide a single, general-purpose mechanism for retrieving subgraphs from a knowledge graph. It is designed to be constructed easily by an LLM while minimizing unnecessary context window consumption in both the query and the response.</p><p>The design separates two orthogonal concerns:</p><ul><li>Topology: BFS from one or more seed nodes up to a specified hop depth defines which nodes and edges are included in the subgraph. Filtering has no effect on this.</li><li>Presentation: Node and edge filters determine which items in that subgraph receive full metadata vs. a minimal stub. This is purely a serialization decision applied after the subgraph is computed.</li></ul><p>Stub items carry only enough information to understand the graph’s topology without consuming context on irrelevant details. The LLM sees the full shape of the neighborhood while receiving rich data only where it matters.</p><h3>Query Format</h3><pre>{<br>  &quot;seeds&quot;: [&quot;&lt;entity_id&gt;&quot;, ...],<br>  &quot;max_hops&quot;: &lt;int&gt;,<br>  &quot;node_filter&quot;: {<br>    &quot;entity_types&quot;: [&quot;&lt;type&gt;&quot;, ...]<br>  },<br>  &quot;edge_filter&quot;: {<br>    &quot;predicates&quot;: [&quot;&lt;predicate&gt;&quot;, ...]<br>  }<br>}</pre><ul><li>“seeds” (required): Array of one or more entity IDs to use as BFS starting points. All seeds are expanded simultaneously; the result is the union of their neighborhoods.</li><li>“max_hops” (require): Maximum graph distance from any seed node. Values of 1–3 are typical; larger values may return very large subgraphs.</li><li>“node_filter” (optional): Controls which nodes receive full metadata. Nodes not matching the filter appear as stubs. Omit to receive full data on all nodes.</li><li>“node_filter.entity_types” (optional): List of entity type names. A node matches if its type is in this list.</li><li>“edge_filter” (optional): Controls which edges receive full metadata including provenance. Edges not matching appear as stubs. Omit to receive full data on all edges.</li><li>“edge_filter.predicates” (optional): List of predicate names. An edge matches if its predicate is in this list.</li><li>If node_filter is omitted entirely, all nodes in the subgraph receive full data.</li><li>If edge_filter is omitted entirely, all edges receive full data including provenance.</li><li>Omitting both filters is appropriate for small subgraphs or debugging, but will produce large responses on dense neighborhoods.</li><li>Multiple seeds are useful when you want to explore the shared neighborhood of several entities simultaneously — for example, finding publications co-authored by two researchers, or finding diseases connected to a set of genes.</li></ul><h3>Response Format</h3><pre>{<br>  &quot;seeds&quot;: [&quot;&lt;entity_id&gt;&quot;, ...],<br>  &quot;max_hops&quot;: 2,<br>  &quot;node_count&quot;: &lt;int&gt;,<br>  &quot;edge_count&quot;: &lt;int&gt;,<br>  &quot;nodes&quot;: [<br>    {<br>      &quot;id&quot;: &quot;&lt;entity_id&gt;&quot;,<br>      &quot;entity_type&quot;: &quot;&lt;type&gt;&quot;,<br>      &quot;&lt;additional fields&gt;&quot;: &quot;...&quot;<br>    }<br>  ],<br>  &quot;edges&quot;: [<br>    {<br>      &quot;subject&quot;: &quot;&lt;entity_id&gt;&quot;,<br>      &quot;predicate&quot;: &quot;&lt;predicate&gt;&quot;,<br>      &quot;object&quot;: &quot;&lt;entity_id&gt;&quot;,<br>      &quot;&lt;additional fields&gt;&quot;: &quot;...&quot;<br>    }<br>  ]<br>}</pre><p><em>Full Node</em></p><p>A node that matches the node_filter (or when no filter is specified) includes all available metadata:</p><pre>{<br>  &quot;id&quot;: &quot;PUB:PMC2386281&quot;,<br>  &quot;entity_type&quot;: &quot;Publication&quot;,<br>  &quot;title&quot;: &quot;The Diagnosis of Cushing&#39;s Syndrome&quot;,<br>  &quot;canonical_id&quot;: &quot;PMID:18493314&quot;,<br>  &quot;year&quot;: 2008,<br>  &quot;journal&quot;: &quot;Reviews in Endocrine and Metabolic Disorders&quot;,<br>  &quot;authors&quot;: [&quot;Stewart PM&quot;],<br>  &quot;abstract_snippet&quot;: &quot;...&quot;<br>}</pre><p><em>Stub Node</em></p><p>A node that does not match the node_filter appears as a stub with only identity information:</p><pre>{<br>  &quot;id&quot;: &quot;PERSON:67890&quot;,<br>  &quot;entity_type&quot;: &quot;Person&quot;<br>}</pre><p><em>Full Edge</em></p><p>An edge that matches the edge_filter (or when no filter is specified) includes all provenance and metadata:</p><pre>{<br>  &quot;subject&quot;: &quot;PERSON:12345&quot;,<br>  &quot;predicate&quot;: &quot;AUTHORED&quot;,<br>  &quot;object&quot;: &quot;PUB:PMC2386281&quot;,<br>  &quot;confidence&quot;: 0.97,<br>  &quot;provenance&quot;: [<br>    {<br>      &quot;source_doc&quot;: &quot;PMC2386281&quot;,<br>      &quot;section&quot;: &quot;metadata&quot;,<br>      &quot;method&quot;: &quot;structured_extraction&quot;,<br>      &quot;evidence_type&quot;: &quot;primary_authorship&quot;<br>    }<br>  ]<br>}</pre><p><em>Stub Edge</em></p><p>An edge that does not match the edge_filter appears with topology only:</p><pre>{<br>  &quot;subject&quot;: &quot;PERSON:12345&quot;,<br>  &quot;predicate&quot;: &quot;COLLEAGUE_OF&quot;,<br>  &quot;object&quot;: &quot;PERSON:67890&quot;<br>}</pre><h3>LLM Prompt Template</h3><p>The following can be included in a system prompt or tool description to instruct an LLM how to construct BFS queries.</p><p>To explore the knowledge graph, call bfs_query() with a JSON body. The query performs a breadth-first search from one or more seed nodes and returns the resulting subgraph.</p><p>Nodes and edges in the subgraph are either full (all metadata and provenance included) or stub (identity only), depending on the filters you specify. Filtering affects only what data is returned, not which nodes and edges are included in the subgraph.</p><p><em>Query structure</em></p><pre>{<br>  &quot;seeds&quot;: [&quot;&lt;id&gt;&quot;, ...],       // one or more starting entity IDs<br>  &quot;max_hops&quot;: &lt;int&gt;,            // graph distance from seeds (1-3 recommended)<br>  &quot;node_filter&quot;: {              // optional: which nodes get full data<br>    &quot;entity_types&quot;: [...]       // e.g. [&quot;Publication&quot;, &quot;Disease&quot;, &quot;Drug&quot;]<br>  },<br>  &quot;edge_filter&quot;: {              // optional: which edges get full data + provenance<br>    &quot;predicates&quot;: [...]         // e.g. [&quot;AUTHORED&quot;, &quot;TREATS&quot;, &quot;INHIBITS&quot;]<br>  }<br>}</pre><p>Stub nodes contain only {id, entity_type}. Stub edges contain only {subject, predicate, object}. Omitting a filter entirely returns full data for all nodes or edges respectively.</p><p><em>Example 1: Find an author’s publications with provenance</em></p><p>You know Dr. Stewart’s entity ID and want to retrieve her publications along with the evidence that links her to each one. You don’t need full metadata on other entities in the neighborhood.</p><pre>{<br>  &quot;seeds&quot;: [&quot;PERSON:12345&quot;],<br>  &quot;max_hops&quot;: 1,<br>  &quot;node_filter&quot;: {<br>    &quot;entity_types&quot;: [&quot;Publication&quot;]<br>  },<br>  &quot;edge_filter&quot;: {<br>    &quot;predicates&quot;: [&quot;AUTHORED&quot;]<br>  }<br>}</pre><p>Result: Full data on Publication nodes, full provenance on AUTHORED edges. Any other nodes or edges at hop 1 (e.g. institutional affiliations) appear as stubs.</p><p><em>Example 2: Explore a disease neighborhood, focusing on drugs</em></p><p>You want to understand what drugs are connected to Cushing’s syndrome within two hops, without being overwhelmed by the full metadata of every gene, symptom, and pathway in the neighborhood.</p><pre>{<br>  &quot;seeds&quot;: [&quot;MeSH:D003480&quot;],<br>  &quot;max_hops&quot;: 2,<br>  &quot;node_filter&quot;: {<br>    &quot;entity_types&quot;: [&quot;Drug&quot;]<br>  }<br>}</pre><p>Result: Full data on Drug nodes. All other node types (Disease, Gene, Symptom, etc.) appear as stubs. All edges appear as stubs since no edge_filter targets specific predicates — you can see the topology of the neighborhood without consuming context on provenance you haven’t asked for.</p><p><em>Example 3: Find shared connections between two entities</em></p><p>You want to explore what two researchers have in common — shared publications, shared diseases they’ve written about, or shared collaborators — within two hops of either of them.</p><pre>{<br>  &quot;seeds&quot;: [&quot;PERSON:12345&quot;, &quot;PERSON:67890&quot;],<br>  &quot;max_hops&quot;: 2,<br>  &quot;node_filter&quot;: {<br>    &quot;entity_types&quot;: [&quot;Publication&quot;, &quot;Disease&quot;]<br>  },<br>  &quot;edge_filter&quot;: {<br>    &quot;predicates&quot;: [&quot;AUTHORED&quot;, &quot;DISCUSSES&quot;]<br>  }<br>}</pre><p>Result: BFS expands from both researchers simultaneously. The returned subgraph is the union of both neighborhoods. Full data on Publications and Diseases they connect to; full provenance on AUTHORED and DISCUSSES edges. Everything else is stubbed. Nodes reachable from both seeds appear once, making shared connections directly visible.</p><h3>Design Considerations</h3><p><em>Topology and presentation are orthogonal</em></p><p>The subgraph returned by a BFS query is determined entirely by seeds and max_hops. Filters have no effect on which nodes or edges are included — they only control how much data each item carries in the response. This means the LLM always sees an accurate picture of the graph’s topology, regardless of what it filtered for. A stub node is not a missing node; it is a node whose full metadata was not requested.</p><p><em>Why stubs rather than omission</em></p><p>Omitting non-matching nodes entirely would produce a misleading picture of the graph. If Dr. Jones appears as a stub rather than disappearing, the LLM knows that Stewart has a connection to another person in the graph, and can issue a follow-up query for Jones if needed. Omission would make the graph appear sparser than it is, causing the LLM to miss connections it doesn’t know to ask about.</p><p><em>Edge provenance is expensive context</em></p><p>A single edge with strong multi-source support may carry a long provenance list — source documents, confidence scores, evidence types, extraction methods. Returning full provenance on every edge in a two-hop neighborhood would dominate the context window on most queries. The edge_filter gives the LLM precise control over where that cost is paid.</p><p><em>Multiple seeds enable relational queries</em></p><p>Accepting an array of seeds rather than a single seed allows the LLM to express relational questions — “what do these entities have in common?” — without requiring a specialized query type. The union semantics are simple to implement and simple to reason about.</p><p><em>Filters are independently optional</em></p><p>node_filter and edge_filter compose independently. You can request full node data with stub edges (useful when you want entity details but not provenance), full edge provenance with stub nodes (useful when you want to audit support for a relationship without loading entity metadata), both (for focused high-detail queries), or neither (for small graphs or debugging). No special cases are required.</p><p><em>BFS depth guidance</em></p><p>Depth 1 is appropriate for direct relationships: an author’s publications, a drug’s known indications, a gene’s associated diseases. Depth 2 surfaces indirect connections: diseases associated with genes that a drug targets, co-authors of papers a researcher has written. Depth 3 and beyond can return very large subgraphs on well-connected nodes and should be used with targeted filters. When in doubt, start at depth 1 and increase.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ba120776e49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Medical Literature Knowledge Graph]]></title>
            <link>https://medium.com/@wware/medical-literature-knowledge-graph-8f32898cca1c?source=rss-bcd09ad71293------2</link>
            <guid isPermaLink="false">https://medium.com/p/8f32898cca1c</guid>
            <category><![CDATA[graphrag]]></category>
            <category><![CDATA[medical]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Will Ware]]></dc:creator>
            <pubDate>Fri, 20 Feb 2026 20:32:48 GMT</pubDate>
            <atom:updated>2026-02-25T13:57:49.076Z</atom:updated>
            <content:encoded><![CDATA[<p>For a while now I’ve been telling anybody who’d listen that knowledge graphs are a good way to provide grounded information to language models. In recent months I’ve been slowly building a graph with a bunch of PubMed papers on cancer research, and finally I’m starting to see results worth talking about.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_FoIeFMaYs3z8EF312aN8w.png" /></figure><p>One thing I realized early was that the various entities (or in graph language, the nodes) should be mapped to authoritative ontologies (MeSH, UMLS, UniProt, RxNorm, and the like, with DBPedia for anything not found in those) so that the LLM can compare apples to apples when reasoning. I also found that LLMs are very comfortable using GraphQL (shockingly, a query language for graphs). So without further ado, a bit of conversation between Claude Code and myself about some contents of my little cancer literature graph.</p><pre>**User**: show me the first 15 biomarkers please<br><br>**Assistant**: I&#39;ll query for the first 15 biomarkers in the knowledge graph.<br><br>```graphql<br>{<br>  biomarkers: entities(filter: { entityType: &quot;biomarker&quot; }, limit: 15) {<br>    items {<br>      entityId<br>      entityType<br>      name<br>      status<br>      confidence<br>      usageCount<br>      source<br>      canonicalUrl<br>    }<br>    total<br>  }<br>}<br>```<br><br>### First 15 Biomarkers (out of 81 total)<br><br>1. **CA-125**<br>   - Status: provisional<br>   - Confidence: 0.45, Usage: 2<br>   - Source: PMC12757429<br><br>2. **JC-1 fluorescent probe**<br>   - Status: provisional<br>   - Confidence: 0.475, Usage: 1<br>   - Source: PMC12757429<br><br>3. **BCR Shannon diversity**<br>   - Status: provisional<br>   - Confidence: 0.35, Usage: 2<br>   - Source: PMC12757429<br><br>4. ...<br><br>7. **DDR-IF score**<br>   - Status: provisional<br>   - Confidence: 0.475, Usage: 21<br>   - Source: PMC12757875<br><br>8. ...<br><br>15. **STING activation score**<br>    - Status: provisional<br>    - Confidence: 0.475, Usage: 1<br>    - Source: PMC12757875<br><br>**Observations:**<br>- All 15 biomarkers shown are **provisional** (none have been promoted to canonical status yet)<br>- They come from 2 medical papers (PMC12757429 and PMC12757875)<br>- Usage counts range from 1 to 21 (DDR-IF score being the most used)<br>- Confidence scores range from 0.35 to 0.475<br>- Many relate to cancer research (STING pathway, TCGA cohort, CA-125, etc.)<br><br>---<br><br>## Query 3: DDR-IF Score Investigation<br><br>**User**: DDR-IF score is discussed (possibly for the first time?) in this paper: https://pubmed.ncbi.nlm.nih.gov/41487593/ - curious that it has no canonical ID<br><br>**Assistant**: Excellent detective work! You&#39;re absolutely right. The **DDR-IF score** has no canonical ID because it&#39;s a **novel composite biomarker** introduced in that very recent paper (PMC12757875, which corresponds to PubMed ID 41487593).<br><br>### Why DDR-IF score is provisional (not canonical):<br><br>**Novel Research Contribution**: The paper introduces the DDR-IF score as a new composite biomarker that integrates:<br><br>- **DNA Damage Response (DDR)** alterations (HRD component)<br>- **Immune Infiltration (IF)** features (TME/tumor microenvironment)<br>- **STING activation** (immune signaling)<br><br>From the relationships extracted:<br><br>1. **Purpose**: Predicts PARP-ICB (PARP inhibitor + immune checkpoint blockade) response in ES-SCLC (extensive-stage small cell lung cancer)<br>   - AUROC = 0.81 (strong predictive power)<br><br>2. **Clinical utility**: Identifies tumors most susceptible to PARP-ICB combination therapy<br><br>3. **Cut-off**: ≥0.65 defines &quot;DDR-IF-high&quot; status<br><br>**Why no canonical ID exists:**<br>- This is **cutting-edge research** (2026 paper based on the creation date in properties)<br>- Not yet incorporated into standardized biomarker databases like:<br>  - MeSH (Medical Subject Headings)<br>  - LOINC (Logical Observation Identifiers Names and Codes)<br>  - NCBI Gene (for molecular markers)<br>- May require validation in multiple studies before databases assign canonical identifiers<br>- It&#39;s a **composite score** (not a single molecule/gene), which makes canonicalization more complex<br><br>The knowledge graph correctly identified it as **provisional** with decent usage (21 mentions across 3 papers), showing it&#39;s gaining traction but not yet standardized in biomedical ontologies.<br><br>---<br><br>## Query 4: Understanding STING Activation<br><br>**User**: dumb question, what is STING activation?<br><br>**Assistant**: Not a dumb question at all! STING is actually pretty complex immunology. Let me search the knowledge graph for more details.<br><br>**STING** = **S**timulator of **I**nterferon **G**enes<br><br>#### What it does:<br>STING is part of your **innate immune system** - your body&#39;s first-line defense against threats. Think of it as an alarm system inside cells.<br><br>#### How it works:<br><br>1. **Detection**: When DNA appears in the wrong place inside a cell (e.g., from viruses, bacteria, or damaged cancer cells), a sensor called **cGAS** detects it<br><br>2. **Activation**: cGAS triggers **STING protein**, which gets phosphorylated (p-STING in the biomarker list)<br><br>3. **Alarm response**: Activated STING causes the cell to produce:<br>   - **Interferons** (signaling proteins that alert the immune system)<br>   - **Inflammatory cytokines** (recruit immune cells to attack)<br><br>#### Why it matters in cancer:<br><br>**The double-edged sword:**<br>- **Good news**: Cancer cells with damaged DNA can trigger STING → immune system attacks tumor<br>- **Bad news**: Chronic activation can lead to **&quot;cGAS-STING exhaustion&quot;** where the pathway stops working (like a fire alarm that gets ignored)<br><br>**In the DDR-IF score context:**<br>- Tumors with **DNA damage** (from PARP inhibitors) → release DNA fragments → activate STING<br>- **STING activation** → recruits immune cells → makes **immunotherapy** (checkpoint blockade) work better<br>- The DDR-IF score measures STING activation to predict which tumors will respond to the PARP + immunotherapy combination<br><br>**Clinical relevance:**<br>- &quot;**STING-desert phenotypes**&quot; = tumors with no STING activity (won&#39;t respond well to immunotherapy)<br>- &quot;**STING agonists**&quot; = drugs being developed to artificially activate this pathway<br><br>So STING activation is basically your cell&#39;s burglar alarm going off when it detects suspicious DNA, calling in the immune system cavalry!</pre><p>This conversation demonstrates:</p><ul><li>Natural language querying of a medical knowledge graph</li><li>GraphQL API for structured entity and relationship retrieval</li><li>Semantic search capabilities across biomedical entities</li><li>Relationship traversal to discover connections between entities</li><li>Provisional vs canonical entity distinction based on standardization status</li><li>Usage tracking and confidence scores for entity mentions</li></ul><p>What really is interesting about this is that (at least to me, and I am very much not a doctor), it sounds pretty intelligent. Nothing it’s saying is crazy or stupid.</p><p>If you want to view the graph and click on nodes and things, go to <a href="http://104.131.171.175/graph-viz/">http://104.131.171.175/graph-viz/</a>.</p><p>To have a chat like the one appearing above, go to <a href="http://104.131.171.175/chat/">http://104.131.171.175/chat/</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8f32898cca1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Head scratching re DbC]]></title>
            <link>https://medium.com/@wware/head-scratching-re-dbc-2dc56fabe180?source=rss-bcd09ad71293------2</link>
            <guid isPermaLink="false">https://medium.com/p/2dc56fabe180</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[quality-software]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[design-by-contract]]></category>
            <dc:creator><![CDATA[Will Ware]]></dc:creator>
            <pubDate>Sat, 05 Feb 2022 21:23:04 GMT</pubDate>
            <atom:updated>2022-02-05T21:23:04.071Z</atom:updated>
            <content:encoded><![CDATA[<p>A couple of times I’ve been exposed to an idea called “Design by contract”. In broad strokes it’s simple: every function or method has preconditions (asserts on the arguments), postconditions (asserts on the return value and arguments) and invariants (things that should not be changed by having called the function or method). All of these are optional. Different languages provide different levels of support for this idea. It’s one of the things one can do to try to make code less buggy.</p><p>I work mostly in Python. For historical reasons, I work in Python 2.7 while slowly working on migrating my legacy project to Python 3.9. For Python 3, there are a couple DbC packages called “icontract” and “deal” that both look well designed.</p><p>The codebase I work on is old and cantankerous, with plenty of little hacks put together in a hurry to work around this or that user complaint, or to accommodate some oddity on some other machine or in some other service, and these hacks have piled up over years. I have myself been responsible for too many of them, and periodically I pine for the redemption of some silver bullet methodology to make everything clean again.</p><p>DbC <strong><em>sounds</em></strong> like a great idea. Its advocates make all the right noises about making my code more reliable and less buggy, reducing reliance on unit tests, etc. I worry that my code may be too crappy to benefit. There are functions and classes and methods, but they don’t all fit into some nice clean block diagram of clear abstractions. I can shoe-horn in a few contracts here and there but I don’t know how far I can get with that.</p><p>And is DbC everything one might hope? Even if I successfully added contracts everywhere, and all my contracts were nice and specific, and I did everything right, would it have been worth the effort? Will my project benefit?</p><p>Realistically anything I do must be an incremental effort. I need to keep the system functioning continuously, it’s a crucial part of my employer’s infrastructure, so no big sweeping changes. I can phase in DbC a bit at a time, and I can start adding more assert statements. Certainly there are areas of the code that are identifiably more challenging than other areas, and that’s probably the right place to focus.</p><p>I have no idea if this head-scratching will be of any use to anybody. For anybody who has found anything useful here, I can suggest some other discussions that you may also find worthwhile:</p><ul><li><a href="https://stackoverflow.com/questions/26455/does-design-by-contract-work-for-you">https://stackoverflow.com/questions/26455/does-design-by-contract-work-for-you</a></li><li><a href="https://stackoverflow.com/questions/8563464/using-design-by-contract-in-python">https://stackoverflow.com/questions/8563464/using-design-by-contract-in-python</a></li><li><a href="https://stackoverflow.com/questions/3709369/has-someone-experiences-with-metrics-for-design-by-contract-or-can-recommend-met">https://stackoverflow.com/questions/3709369/has-someone-experiences-with-metrics-for-design-by-contract-or-can-recommend-met</a></li><li><a href="https://stackoverflow.com/questions/18030887/design-by-contract-and-fail-fast">https://stackoverflow.com/questions/18030887/design-by-contract-and-fail-fast</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2dc56fabe180" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evezor and other robot arms]]></title>
            <link>https://medium.com/@wware/ezevor-and-other-robot-arms-dbbeadc802af?source=rss-bcd09ad71293------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbbeadc802af</guid>
            <category><![CDATA[mechanical-engineering]]></category>
            <category><![CDATA[robotics]]></category>
            <category><![CDATA[3d-printing]]></category>
            <dc:creator><![CDATA[Will Ware]]></dc:creator>
            <pubDate>Sat, 29 Jul 2017 06:50:00 GMT</pubDate>
            <atom:updated>2020-02-12T20:55:00.514Z</atom:updated>
            <content:encoded><![CDATA[<p>I stumbled across the <a href="https://www.kickstarter.com/projects/1474681136/evezor-open-source-robotic-arm-manufacturing-platf/description">Evezor Kickstarter page</a> recently and was fascinated to see the range of things this <a href="https://en.wikipedia.org/wiki/SCARA">SCARA arm</a> can do. It can 3d print, carve or mill like a CNC machine, laser-engrave, pick and place electronic parts, paint or draw, and more. It also appears on <a href="https://www.thingiverse.com/thing:2323187">Thingiverse</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/0*lwklAHZPsi2p6eRo.jpg" /></figure><p>There are <a href="https://www.youtube.com/channel/UC-tU6l-nTdWPQbU-4Q3yjlA/videos">Youtube videos</a> of many of these operations. The resolution is good. The effective build volume is enormous. The speed is decent. As I watched more videos, I got a little bit obsessed with the whole thing and decided to blog about it.</p><p>The Kickstarter campaign was regrettably unsuccessful. You can still <a href="http://store.evezor.com/product/evezor-robotic-arm/">pre-order one</a> for $2650, but I can’t justify an expense like that currently, and I suspect the lead time would be substantial.</p><p>In the midst of my obsession, I started poking around the interwebs to see what other similar projects might exist, and might be more affordable as well as open source, and came across quite a few. Several arms work like a Luxo lamp, using parallelograms along the arm segments to keep the end effector in a consistently vertical orientation.</p><ul><li><a href="https://www.thingiverse.com/thing:1454048">EEZYbot Arm MK2</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*lRCMrmQlZ_jIefcN.jpg" /></figure><ul><li><a href="https://www.thingiverse.com/thing:1652309">Tertiam</a>, built from an Ikea Tertial lamp (basically a Luxo lamp)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*qRVwyhW73b9oEjQl.jpg" /></figure><ul><li>A mostly-printed <a href="https://www.thingiverse.com/thing:1204552">desktop robot arm</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*2i2-il40b22qfX5V.jpg" /></figure><ul><li>An early-model uArm, now <a href="https://www.sparkfun.com/products/13663">available at SparkFun</a> for $340</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*AjxDiKfUThkqRXL3.jpg" /></figure><ul><li>One more, <a href="https://www.tindie.com/products/i-make-robots/3dof-robot-arm-50cm-reach-125g-payload/">available from Tindie</a> for $350</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*IPYXne66Jajp5VRm.jpg" /></figure><p>These are all appealing for cost reasons, but I worry about the resolution. They’d be fine for picking up small objects, and maybe some drawing, but I’d be surprised if they could do 3d printing or CNC milling with a Dremel tool.</p><p>There are a couple other SCARA arms. These are more commercial and expensive, and don’t appear to be open source. But for that price they probably have the resolution.</p><ul><li><a href="http://makerarm.com/">MakerArm</a>, $1900 to pre-order</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*XWnt0iEg__gSiMfO.jpg" /></figure><ul><li><a href="http://www.dobot.cc/dobot-m1/product-overview.html">Dobot M1</a>, no obvious price on website</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*ZQ0D4VFDYg7YGjaC.jpg" /></figure><p>I found a couple more that were neither Luxo-style nor SCARA.</p><ul><li>An <a href="https://github.com/maxosprojects/open-dobot">“open dobot” project on Github</a>, probably from a deprecated older Dobot product.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*wQyt1ii5-knVQXHe.png" /></figure><ul><li>The BCN3D Moveo on <a href="https://www.thingiverse.com/thing:1693444">Thingiverse</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*JZ4Vz1LzoObqmIF7.jpg" /></figure><p>So if you get obsessed with the idea of a robot arm that can do a wide range of precision tasks with a potentially heavy payload (like a router for doing CNC milling), what should you do? My own inclination would be to print parts for an Ezevor. It would be interesting to see whether either the SparkFun arm or the Tindie arm could be a serviceable 3d printer. If not, I’d probably hunt around for a larger 3d printer than the one I have at home.</p><p><em>Originally published at </em><a href="http://willware.blogspot.com/2017/07/ezevor-and-other-robot-arms.html"><em>willware.blogspot.com</em></a><em> on July 29, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbbeadc802af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Graceful shutdown for the Raspberry Pi]]></title>
            <link>https://medium.com/@wware/graceful-shutdown-for-the-raspberry-pi-cc50a4f8c8d5?source=rss-bcd09ad71293------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc50a4f8c8d5</guid>
            <category><![CDATA[raspberry-pi]]></category>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[linux]]></category>
            <dc:creator><![CDATA[Will Ware]]></dc:creator>
            <pubDate>Sat, 09 Jan 2016 08:11:00 GMT</pubDate>
            <atom:updated>2017-08-09T15:33:28.992Z</atom:updated>
            <content:encoded><![CDATA[<p>The Raspberry Pi is a great little board, but because it runs Linux, you risk corrupting the file system on the SD card if you simply switch off the power. The standard advice is to type “sudo shutdown -h now” and wait until the shutdown process has finished, or has at least unmounted all the file systems, before switching off the power. What if the RPi is part of some embedded widget with no keyboard and screen? How then to initiate a shutdown, and how to know when it’s finished? It was while contemplating the creation of just such an embedded widget that I hit upon this piece of brilliance. First, build this circuit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*f74G_esgb-Y3zGww.png" /></figure><p>How does this work? When you plug in the wall wart, we don’t want to draw power from the 9 volt battery yet, so we want Q1 to be off. This is accomplished by using Q4 to keep the Q2/Q3 Darlington turned off. The wall wart power flows thru the three diodes in parallel and operates the switching voltage regulator (I picked up a bunch of these from some Chinese outfit on eBay). Meanwhile C1 charges to around 9 volts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/0*mnEEPm5yRzmIa-6h.gif" /></figure><p>What happens when you yank the wall wart? Why, magic of course. Magic happens. Specifically, Q4 turns off, and C1 begins to discharge thru R1 and R6, turning on the Darlington pair, which turns on Q1 so that now the switching regulator is running on battery power. The battery power remains on for some multiple of the RC time constant (100 uF * 500K = 50 secs), and you end up with about two minutes to get the Raspberry Pi to shutdown.</p><p>I’ve started <a href="https://github.com/wware/rpi-shutdown">a Github repository</a> for this, and it includes the two scripts that make graceful shutdown a service that starts automatically when the RPi boots.</p><p><em>Originally published at </em><a href="http://willware.blogspot.com/2016/01/graceful-shutdown-for-raspberry-pi.html"><em>willware.blogspot.com</em></a><em> on January 9, 2016.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc50a4f8c8d5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Once upon a time, I built a 3d printer]]></title>
            <link>https://medium.com/@wware/once-upon-a-time-i-built-a-3d-printer-942c93500d4a?source=rss-bcd09ad71293------2</link>
            <guid isPermaLink="false">https://medium.com/p/942c93500d4a</guid>
            <category><![CDATA[3d-printing]]></category>
            <dc:creator><![CDATA[Will Ware]]></dc:creator>
            <pubDate>Mon, 02 Mar 2015 16:06:00 GMT</pubDate>
            <atom:updated>2017-08-09T16:34:27.601Z</atom:updated>
            <content:encoded><![CDATA[<p>This is an overview of a resin-based 3D printer that I showed at <a href="http://makerfaire.com/new-york-2014/">Makerfaire NYC 2014</a>. I designed it myself, borrowing a couple of ideas from other printers. My printer built objects from a liquid resin that solidifies under ultraviolet light. Your dentist may use similar stuff to fill cavities. I got the ultraviolet light from an unmodified <a href="http://www.infocus.com/projectors/IN114a">conference room projector</a> that cost me about $350, the single biggest expense of the whole project. The most important design principle was that a person of very low craftsmanship like myself should be able to build the thing. It pretty much does not require precision at any point in the construction.</p><p>The idea to use a projector rather than <a href="https://en.wikipedia.org/wiki/Laser_scanning#Scanning_mirrors">steering a laser</a> came from the <a href="http://b9creator.com/">B9 Creator</a> printer. The <a href="https://www.youtube.com/watch?v=80HsW4HmUes">Peachy printer</a> gave me the idea of floating resin on salt water and projecting the light onto the surface of the liquid. The idea to raise and lower the build platform using three threaded rods driven by a bicycle chain was my own, and it turned out not to be such a great idea. Bicycle chain can easily get “sticky” links, and one such link plagued the printer’s operation for most of its working life.</p><p>After the whole printer adventure ended, I started to think about things I might do differently, if I ever get back into resin-based printer design…</p><ul><li>Replace the bicycle chain and those three threaded rods with something simpler and more reliable.</li><li>Clean up the electronics and software so I don’t need a laptop to control it. The printer should be able to print from an SD card or a USB stick.</li><li>Replace the orange bucket with something with transparent sides, like an aquarium, so that people can watch the printing process. The shape grows under the surface of the resin as the build platform descends, and you’d be able to see it through the salt water.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/0*W4dJLOGakki0tNuo.jpg" /></figure><p>With the bicycle chain not yet in place, the printer looks like this. Those gray sprockets engage the bicycle chain, which goes around in a sort of diamond shape. The orange bucket is one of the three-dollar buckets from Home Depot. The plywood, nuts and bolts, and threaded rods also came from Home Depot. At this particular point in the work, I thought I would suspend a mirror over the top of the bucket at 45 degrees, which is why you see a piece of wood in the upper right of the photo. But I didn’t know about <a href="https://www.youtube.com/watch?v=IaEaaeajCSI&amp;t=73s">first surface mirrors</a> then, and I lost enough UV going through the glass twice that I couldn’t get the resin to solidify, so I then positioned the projector directly over the bucket, pointing downward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/0*RRbfAy6Xs8PWvm9x.jpg" /></figure><p>The <a href="https://www.thingiverse.com/thing:426854">sprockets</a> were designed using <a href="http://www.openscad.org/">OpenSCAD</a> and initially the teeth were too pointy — correct in theory but too sticky for real-world bicycle chain, so you can see where I cut off the points, and later revised the design. Once I had the design straightened out, I put them in a<a href="https://www.shapeways.com/shops/wills-3d-stuff"> Shapeways store</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/0*n1UvO9r3lulNKgI4.jpg" /></figure><p>Here is the printer fully assembled. The bicycle chain is driven by a stepper motor. Each revolution of the stepper motor (200 steps) raises or lowers the build platform by 1/20th of an inch because the thread on the threaded rods is 1/4–20.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/0*k5w58_YPNn_5ZWsR.jpg" /></figure><p>When it’s printing, it looks like this. Only where the light is the strongest is the resin solidified. The resin happily ignores ambient diffuse daylight in the room where I’m printing, so I don’t need to use dark room lighting. Pictured below are some of the objects I’ve printed with the thing. I started out with a bottle of green resin and when that started getting low, I added a bottle of clear, so my things tend to vary between green and clear.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/0*bIwjXMMkgoPpfdEi.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/0*OfqKEmDhqymVrC8Z.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/434/0*PPN4jp0Xl8uRqgw-.jpg" /></figure><p><em>Originally published at </em><a href="http://willware.blogspot.com/2015/03/an-overview-of-2014-printer.html"><em>willware.blogspot.com</em></a><em> on March 2, 2015.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=942c93500d4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>