yo i got stuff

This commit is contained in:
2025-03-11 20:22:47 -05:00
commit 65376b95cd
27 changed files with 437 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
package net.ayyalasomayajula.net;
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
}

View File

@@ -0,0 +1,20 @@
package net.ayyalasomayajula.net.shared;
import java.time.LocalDateTime;
import java.util.UUID;
/**
* Represents an appointment using a record.
*
* @author Krishna Ayyalasomayajula
* @version 1.0
*/
public record Appointment(UUID uuid, UUID patient, LocalDateTime time, boolean attendance, String description) {
/**
* Evaluates whether the allotted time has already passed.
* @return boolean object, true if date time is past
*/
public boolean isPast() {
return time.isBefore(LocalDateTime.now());
}
}

View File

@@ -0,0 +1,156 @@
import net.ayyalasomayajula.net.shared.Appointment;
import net.ayyalasomayajula.net.shared.Message;
import java.nio.file.Path;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
/**
* Electronic health record of the patient.
*
* This class stores and manages patient information, including medical notes, appointments, and X-ray records.
*
* @author Krishna Ayyalasomayajula
* @version 1.0
*/
public class EHR {
private String patientName;
private UUID uuid;
private List<String> medicalNotes;
private List<Appointment> appointmentLog;
private final LocalDateTime dob;
private final LocalDateTime joinDate;
private List<Path> xrays;
/**
* Constructs an Electronic Health Record (EHR) for a patient.
*
* @param patientName The name of the patient.
* @param uuid Unique identifier for the patient.
* @param medicalNotes List of medical notes related to the patient.
* @param appointmentLog List of appointments associated with the patient.
* @param dob Date of birth of the patient.
* @param joinDate Date the patient joined the system.
* @param xrays List of X-ray file paths.
*/
public EHR(String patientName, UUID uuid, List<String> medicalNotes, List<Appointment> appointmentLog,
LocalDateTime dob, LocalDateTime joinDate, List<Path> xrays) {
this.patientName = patientName;
this.uuid = uuid;
this.medicalNotes = new ArrayList<>(medicalNotes);
this.appointmentLog = new ArrayList<>(appointmentLog);
this.dob = dob;
this.joinDate = joinDate;
this.xrays = new ArrayList<>(xrays);
}
/**
* Gets the patient's name.
*
* @return The patient's name.
*/
public String getPatientName() {
return patientName;
}
/**
* Sets the patient's name.
*
* @param patientName The new patient name.
*/
public void setPatientName(String patientName) {
this.patientName = patientName;
}
/**
* Gets the unique identifier of the patient.
*
* @return The patient's UUID.
*/
public UUID getUuid() {
return uuid;
}
/**
* Sets the unique identifier of the patient.
*
* @param uuid The new UUID.
*/
public void setUuid(UUID uuid) {
this.uuid = uuid;
}
/**
* Gets the list of medical notes.
*
* @return List of medical notes.
*/
public List<String> getMedicalNotes() {
return medicalNotes;
}
/**
* Adds a medical note to the record.
*
* @param note The medical note to add.
*/
public void addMedicalNote(String note) {
this.medicalNotes.add(note);
}
/**
* Gets the appointment log.
*
* @return List of appointments.
*/
public List<Appointment> getAppointmentLog() {
return appointmentLog;
}
/**
* Adds an appointment to the log.
*
* @param appointment The appointment to add.
*/
public void addAppointment(Appointment appointment) {
this.appointmentLog.add(appointment);
}
/**
* Gets the patient's date of birth.
*
* @return The date of birth.
*/
public LocalDateTime getDob() {
return dob;
}
/**
* Gets the patient's join date.
*
* @return The join date.
*/
public LocalDateTime getJoinDate() {
return joinDate;
}
/**
* Gets the list of X-ray file paths.
*
* @return List of X-ray file paths.
*/
public List<Path> getXrays() {
return xrays;
}
/**
* Adds an X-ray file path to the record.
*
* @param xray The X-ray file path to add.
*/
public void addXray(Path xray) {
this.xrays.add(xray);
}
}

View File

@@ -0,0 +1,18 @@
package net.ayyalasomayajula.net.shared;
/**
* Encapsulates the socket message objects using a record.
*
* @author Krishna Ayyalasomayajula
* @version 1.0
*/
public record Message(MessageVariant messageVariant, String messageQuery, int timeoutSeconds, byte[] data) {
/**
* Constructor for Message record.
* @author Krishna Ayyalasomayajula
* @version 1.0
*/
public Message {
// Validation or preprocessing can be added here if necessary.
}
}

View File

@@ -0,0 +1,22 @@
package net.ayyalasomayajula.net.shared;
public enum MessageVariant{
GET("GET"), SET("SET"), UPSERT("UPSERT"), INSERT("INSERT");
private final String text;
/**
* Constructor that stores the text of the enum field
*/
MessageVariant(String key){
text=key;
}
/**
* Override toString method
* @return string text of the MessageVariant
*/
@Override
public String toString(){
return this.text;
}
}

View File

@@ -0,0 +1,38 @@
package net.ayyalasomayajula.net;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}