Created
          April 16, 2014 00:05 
        
      - 
      
 - 
        
Save favila/10791297 to your computer and use it in GitHub Desktop.  
    Create HumanName.text from a HumanName
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | (defn nametext [hn] | |
| (->> [:fhir-attr/HumanName.prefix :fhir-attr/HumanName.given | |
| :fhir-attr/HumanName.family :fhir-attr/HumanName.suffix] | |
| (mapcat #(get hn %)) | |
| (filter not-empty) | |
| (interpose \space) | |
| (apply str))) | |
| (defn humanname-text-tx [d] | |
| (->> (d/datoms d :avet :phi.element/type "fhir-type/HumanName") | |
| (map :e) | |
| (map #(d/entity d %)) | |
| (map (juxt :db/id nametext)) | |
| (map (fn [[k v]] (do [:db/add k :fhir-attr/HumanName.text v]))))) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment