ai_cdss.cdss.CDSS#

class ai_cdss.cdss.CDSS(scoring, n=12, days=7, protocols_per_day=5)[source]#

Clinical Decision Support System (CDSS) Class.

This system provides personalized recommendations for patients based on scoring data. It allows protocol recommendations, scheduling, and prescription adjustments.

Parameters:
scoringDataFrame

A DataFrame containing patient protocol scores.

nint, optional

Number of top protocols to recommend, by default 12.

daysint, optional

Number of days for scheduling, by default 7.

protocols_per_dayint, optional

Maximum number of protocols per day, by default 5.

Methods

decide_prescription_swap(patient_id)

Determine which prescriptions to swap based on their score.

get_prescriptions(patient_id)

Retrieve the current prescriptions for a patient.

get_scores(patient_id, protocol_id)

Retrieve scores for a given patient and protocol.

get_substitute(patient_id, protocol_id, ...)

Find a suitable substitute for a given protocol.

get_top_protocols(patient_id)

Select the top N protocols for a patient based on scores.

recommend(patient_id, protocol_similarity)

Recommend prescriptions for a patient.

schedule_protocols(protocols)

Distribute protocols across days while ensuring constraints.

recommend(patient_id, protocol_similarity)[source]#

Recommend prescriptions for a patient.

Return type:

DataFrame[ScoringSchema]

Parameters:
patient_idint

The ID of the patient.

protocol_similarityDataFrame

A DataFrame containing protocol similarity scores.

Returns:
DataFrame

A DataFrame mapping recommended protocol IDs to their scheduling details.

schedule_protocols(protocols)[source]#

Distribute protocols across days while ensuring constraints.

Parameters:
protocolslist of int

List of protocol IDs to distribute.

Returns:
dict

A dictionary mapping days to scheduled protocols.

decide_prescription_swap(patient_id)[source]#

Determine which prescriptions to swap based on their score.

Return type:

List[int]

Parameters:
patient_idint

The ID of the patient.

Returns:
list of int

List of protocol IDs to be swapped.

get_substitute(patient_id, protocol_id, protocol_similarity, protocol_excluded=None)[source]#

Find a suitable substitute for a given protocol.

Parameters:
patient_idint

The ID of the patient.

protocol_idint

The protocol to be substituted.

protocol_similarityDataFrame

A DataFrame containing protocol similarity scores.

protocol_excludedlist of int, optional

List of protocols to exclude from consideration, by default None.

Returns:
int

The ID of the substitute protocol, or None if no suitable substitute is found.

get_top_protocols(patient_id)[source]#

Select the top N protocols for a patient based on scores.

Return type:

List[int]

Parameters:
patient_idint

The ID of the patient.

Returns:
list of int

A list of top protocol IDs.

get_prescriptions(patient_id)[source]#

Retrieve the current prescriptions for a patient.

Parameters:
patient_idint

The ID of the patient.

Returns:
DataFrame

A DataFrame containing prescription details.

get_scores(patient_id, protocol_id)[source]#

Retrieve scores for a given patient and protocol.

Parameters:
patient_idint

The ID of the patient.

protocol_idint

The ID of the protocol.

Returns:
dict

A dictionary containing score details for the specified patient and protocol.