<commit_before>/**
 * Copyright (c) 2008 Washington University in Saint Louis. All Rights Reserved.
 */
package edu.wustl.xipHost.dataModel;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * @author <NAME>
 *
 */
public class Patient {	
	String patientName;	
	String patientID;
	String patientBirthDate;
	List<Study> studies = new ArrayList<Study>();
	List<Item> items = new ArrayList<Item>();
	Timestamp lastUpdated = null;
	
	public Patient(String patientName, String patientID, String patientBirthDate){
		this.patientName = patientName;
		this.patientID = patientID;
		this.patientBirthDate = patientBirthDate;	
	}
	
	public String getPatientName(){
		return this.patientName;
	}
	
	public String getPatientID(){
		if(patientID == null || patientID.isEmpty()){
			patientID = "xiphost-auto-" + UUID.randomUUID().toString();
		}
		return patientID;
	}
	
	public String getPatientBirthDate(){
		return this.patientBirthDate;
	}
		
	public String toString(){
		return new String("Patient:" + this.patientName + " " + this.patientID + " " + this.patientBirthDate);
	}
	
	public void addStudy(Study study){
		this.studies.add(study);
	}
	public List<Study> getStudies(){
		return studies;
	}
	public boolean contains(String studyInstanceUID){		
		for(int i = 0; i < studies.size(); i++){
			if(studies.get(i).getStudyInstanceUID().equalsIgnoreCase(studyInstanceUID)){return true;}
		}			
		return false;
	}
	
	public Study getStudy(String studyInstanceUID){
		for(Study study : studies){
			if(study.getStudyInstanceUID().equalsIgnoreCase(studyInstanceUID)){
				return study;
			} 
		}
		return null;
	}
	
	public void addItem(Item item){
		this.items.add(item);
	}
	public List<Item> getItems(){
		return items;
	}
	public boolean containsItem(String itemID){
		for(int i = 0; i < items.size(); i++){
			if(items.get(i).getItemID().equalsIgnoreCase(itemID)){return true;}
		}			
		return false;
	}

	public Timestamp getLastUpdated() {
		return lastUpdated;
	}

	public void setLastUpdated(Timestamp lastUpdated) {
		this.lastUpdated = lastUpdated;
	}
}
<commit_msg>Moved Patient auto-generated ID from the getPatientID() method to the constructor.<commit_after>/**
 * Copyright (c) 2008 Washington University in Saint Louis. All Rights Reserved.
 */
package edu.wustl.xipHost.dataModel;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * @author <NAME>
 *
 */
public class Patient {	
	String patientName;	
	String patientID;
	String patientBirthDate;
	List<Study> studies = new ArrayList<Study>();
	List<Item> items = new ArrayList<Item>();
	Timestamp lastUpdated = null;
	
	public Patient(String patientName, String patientID, String patientBirthDate){
		this.patientName = patientName;
		if(patientID == null) {
			this.patientID = "xiphost-auto-" + UUID.randomUUID().toString();
		} else if(patientID.isEmpty()) {
			this.patientID = "xiphost-auto-" + UUID.randomUUID().toString();
		} else {
			this.patientID = patientID;
		}
		this.patientBirthDate = patientBirthDate;	
	}
	
	public String getPatientName(){
		return this.patientName;
	}
	
	public String getPatientID(){
		return patientID;
	}
	
	public String getPatientBirthDate(){
		return this.patientBirthDate;
	}
		
	public String toString(){
		return new String("Patient:" + this.patientName + " " + this.patientID + " " + this.patientBirthDate);
	}
	
	public void addStudy(Study study){
		this.studies.add(study);
	}
	public List<Study> getStudies(){
		return studies;
	}
	public boolean contains(String studyInstanceUID){		
		for(int i = 0; i < studies.size(); i++){
			if(studies.get(i).getStudyInstanceUID().equalsIgnoreCase(studyInstanceUID)){return true;}
		}			
		return false;
	}
	
	public Study getStudy(String studyInstanceUID){
		for(Study study : studies){
			if(study.getStudyInstanceUID().equalsIgnoreCase(studyInstanceUID)){
				return study;
			} 
		}
		return null;
	}
	
	public void addItem(Item item){
		this.items.add(item);
	}
	public List<Item> getItems(){
		return items;
	}
	public boolean containsItem(String itemID){
		for(int i = 0; i < items.size(); i++){
			if(items.get(i).getItemID().equalsIgnoreCase(itemID)){return true;}
		}			
		return false;
	}

	public Timestamp getLastUpdated() {
		return lastUpdated;
	}

	public void setLastUpdated(Timestamp lastUpdated) {
		this.lastUpdated = lastUpdated;
	}
}

{'fraction_non_alphanumeric': 0.12185056472632494, 'fraction_numerical': 0.0026064291920069507, 'mean_word_length': 3.545903257650543, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5821518', 'n_tokens_mistral': 1642, 'n_tokens_neox': 1431, 'n_words': 331}