api
API stubs for interacting with NextGen services.
Classes
AppointmentTemporalState
class AppointmentTemporalState( value, names=None, *, module=None, qualname=None, type=None, start=1,):
Denotes whether appointment is in the past or the future.
NextGenEnterpriseAPI
class NextGenEnterpriseAPI( session: BearerAuthSession | NextGenAuthSession, next_gen_enterprise_url: str = 'https://nativeapi.nextgen.com/nge/prod/nge-api/api',):
API for interacting with the NextGen Enterprise API.
Create a new instance for interacting with the NextGen Enterprise API.
Arguments
session
: Session containing bearer token information for NextGen API.next_gen_enterprise_url
: Base URL of the FHIR API endpoint. Should be of a similar style tohttps://nativeapi.nextgen.com/nge/prod/nge-api/api/
.
Methods
get_appointments_information
def get_appointments_information( self, patient_id: str, appointment_temporal_state: Optional[AppointmentTemporalState] = None,) ‑> Optional[list[NextGenEnterpriseAppointmentsEntryJSON]]:
Retrieve the upcoming appointments information for a patient.
Arguments
patient_id
: The NextGen patient identifier for the target patient.appointment_temporal_state
: Filter for appointments either in past or future. If None, returns all appointments.
Returns A list of JSON objects containing information on upcoming appointments for a patient. The list may be empty. If there was no such list in the JSON at all, return None.
get_bulk_patient_info
def get_bulk_patient_info( self, patient_id: str,) ‑> Optional[BulkPatientInfo]:
Retrieve bulk patient information for a given patient ID.
If unable to find, or patient has no relevant information, return None.
This method is a sugar method for the cases where all information for a given patient might be needed. Generally the specific calls should be used in preference to avoid unnecessary API calls to NextGen.
Returned patient information contains: - list of diagnoses/conditions for the patient - list of procedures for the patient - list of future appointments - list of past appointments
Arguments
patient_id
: The NextGen patient identifier for the target patient.
Returns A BulkPatientInfo object containing information on the patient. If no information could be retrieved, returns None.
get_conditions_information
def get_conditions_information( self, patient_id: str,) ‑> Optional[list[NextGenEnterpriseConditionsEntryJSON]]:
Retrieve the diagnoses/conditions information for a patient.
Arguments
patient_id
: The NextGen patient identifier for the target patient.
Returns A list of JSON objects containing information on diagnoses/conditions of the patient. The list may be empty. If there was no such list in the JSON at all, return None.
get_diagnoses_information
def get_diagnoses_information( self, patient_id: str,) ‑> Optional[list[NextGenEnterpriseConditionsEntryJSON]]:
Retrieve the diagnoses/conditions information for a patient.
Arguments
patient_id
: The NextGen patient identifier for the target patient.
Returns A list of JSON objects containing information on diagnoses/conditions of the patient. If there was no such list, return None.
get_procedures_information
def get_procedures_information( self, patient_id: str,) ‑> Optional[list[NextGenEnterpriseProceduresEntryJSON]]:
Retrieve the procedures information for a patient.
Arguments
patient_id
: The NextGen patient identifier for the target patient.
Returns A list of JSON objects containing information on procedures of the patient. The list may be empty. If there was no such list in the JSON at all, return None.
NextGenFHIRAPI
class NextGenFHIRAPI( session: BearerAuthSession | NextGenAuthSession, next_gen_fhir_url: str = 'https://fhir.nextgen.com/nge/prod/fhir-api-r4/fhir/R4',):
API for interacting with the NextGen FHIR API.
Create a new instance for interacting with the NextGen FHIR API.
Arguments
session
: Session containing bearer token information for NextGen API.next_gen_fhir_url
: Base URL of the FHIR API endpoint. Should be of a similar style tohttps://fhir.nextgen.com/nge/prod/fhir-api-r4/fhir/R4/
.
Variables
- static
DEFAULT_NEXT_GEN_FHIR_URL : Final[str]
Methods
get_patient_info
def get_patient_info( self, dob: str | date, given_name: Optional[str] = None, family_name: Optional[str] = None,) ‑> Optional[RetrievedPatientDetailsJSON]:
Search for a patient info given patient information.
If unable to find, or unable to narrow down to a specific patient, return None.
Arguments except for DoB are optional, but additional arguments will help to narrow down the patients to a singular patient.
Arguments
dob
: Date of birth as either a string (must contain YMD information as minimum and in that order) or an existing date/datetime object representing the date of birth.given_name
: The given name of the patient. Can be a portion of the given name as will be substring-matched.family_name
: The family name of the patient. Can be a portion of the given name as will be substring-matched.
Returns The patient info if a singular match was found, otherwise None.
Raises
ValueError
: if no criteria are supplied.