rama creada apartir de master en j

This commit is contained in:
jrojas
2026-06-26 10:29:23 +02:00
parent 319fd3dfb0
commit c1517fda87
2810 changed files with 1927392 additions and 25392 deletions
@@ -15,6 +15,13 @@ public class AdasProvider(IOptions<ProvidersSettings> providerSettings, IHttpCli
* Predict of UCI stay duration
* Predict of medications for patients
*/
/// <summary>
/// Retrieves patient observations from the ADAS system, including stay duration predictions (most and less confident scenarios) and medication predictions.
/// Logs an error and skips stay prediction observations if the prediction result is null or contains an error.
/// Skips the medication prediction observation if no medication predictions are returned.
/// </summary>
/// <param name="patient">The patient for whom observations are being calculated.</param>
/// <returns>A task that represents the asynchronous operation, returning a list of patient observations.</returns>
public override async Task<List<PatientObservation>> GetObservations(Patient patient)
{
var calculatedObservations = new List<PatientObservation>();
@@ -69,12 +76,23 @@ public class AdasProvider(IOptions<ProvidersSettings> providerSettings, IHttpCli
return calculatedObservations;
}
/// <summary>
/// Concatenates up to the first five ADAS medication prediction results into a single caret-delimited string for use as a medication observation value.
/// </summary>
/// <param name="medicationPredict">The list of ADAS medication prediction results to be serialized. Only the first five entries are included.</param>
/// <returns>A string containing the selected medication prediction entries joined by the "^" delimiter.</returns>
private static string ParseAdasMedicationsToMedicationObservation(
List<ResultModelPredictMedicationAdas> medicationPredict)
List<ResultModelPredictMedicationAdas> medicationPredict)
{
return string.Join("^", medicationPredict.Take(5));
}
/// <summary>
/// Retrieves the ADAS prediction of length of stay for the specified patient from an external service.
/// Returns null if the patient number is null, if the service response is unsuccessful, or if an exception occurs during the request.
/// </summary>
/// <param name="patientNumber">The unique identifier of the patient whose ADAS stay prediction is being requested.</param>
/// <returns>A task containing the deserialized <see cref="ResultModelPredictOfStayAdas"/> result on success, or null if the patient number is null, the response is unsuccessful, or the call throws.</returns>
private async Task<ResultModelPredictOfStayAdas?> GetPredictOfStay(string? patientNumber)
{
if (patientNumber == null)
@@ -109,6 +127,12 @@ public class AdasProvider(IOptions<ProvidersSettings> providerSettings, IHttpCli
}
}
/// <summary>
/// Retrieves the predicted medication needs for a given patient by calling the pharmacy prediction service.
/// Returns null if the patient number is null, the service response is unsuccessful, or an exception occurs during the request.
/// </summary>
/// <param name="patientNumber">The unique identifier of the patient whose ADAS medication predictions are being retrieved.</param>
/// <returns>A task containing a list of <see cref="ResultModelPredictMedicationAdas"/> with the predicted medication data, or null if the request fails or the patient number is null.</returns>
private async Task<List<ResultModelPredictMedicationAdas>?> GetPredictMedications(string? patientNumber)
{
if (patientNumber == null)
@@ -141,6 +165,10 @@ public class AdasProvider(IOptions<ProvidersSettings> providerSettings, IHttpCli
}
}
/// <summary>
/// Creates a new <see cref="HttpClient"/> instance and configures it with the configured base address URL.
/// </summary>
/// <returns>An <see cref="HttpClient"/> with its <see cref="HttpClient.BaseAddress"/> set to the configured <c>Url</c>.</returns>
private HttpClient GetClient()
{
var client = HttpClientFactory.CreateClient();