Diagnosis was the process of identifying an illness, malfunction, or other problem by examining the symptoms of a person or object. Practiced in medicine, it was typical for a medical doctor to perform a diagnosis on a patient, but one could perform a self-diagnosis. Alternatively, it was typical for an engineer to perform a diagnostic on computers or other technologies, but an artificial lifeform could perform its own self-diagnostic.
In 2268, Lieutenant Commander Spock had been attempting to decipher obelisk symbols for fifty-eight days, having hardly eaten or slept in weeks. Doctor Leonard McCoy believed that if he didn't let up that he'd collapse. After Spock assured him that Vulcans can go without sleep for weeks, McCoy noted that his Vulcan metabolism was so low it could hardly be measured. McCoy diagnosed Spock with exhaustion, brought on by overwork and guilt, and prescribed rest. (TOS: "The Paradise Syndrome")
That same year, Doctor McCoy initially diagnosed orphaned children with lacunar amnesia after they displayed no indications of grief or fear in response to their parents committing mass suicide on Triacus. (TOS: "And the Children Shall Lead")
In most Betazoids, their telepathic gifts developed at adolescence, however, Tam Elbrun was born with his telepathic abilities switched on. Most Betazoids born that way never led a normal life as the noise of other peoples' thoughts and feelings were overwhelming, incomprehensible, and painful, especially to a child. Early diagnosis and special training helped Tam adjust but some problems remained. (TNG: "Tin Man")
In 2375, after Seven of Nine ran a complete self-diagnostic and concluded she had Albright-Salzman syndrome, The Doctor stated that she instead had a mild case of sensory aphasia and warned her about the danger of self-diagnosis; patients always assumed the worst. (VOY: "Relativity")
In 2377, the Quarren Doctor Kadan made false diagnoses and manipulated the memory engrams of kidnapped crewmembers from the USS Voyager so that they could be used for the Quarren workforce. (VOY: "Workforce", "Workforce, Part II")