The sleep diary can be replaced or validated by the use of out-patient actigraphy for a week or more, using a non-invasive device that measures movement.Workers who complain of insomnia should not routinely have polysomnography to screen for sleep disorders. This test may be indicated for patients with symptoms in addition to insomnia, including sleep apnea, obesity, a thick neck diameter, or high-risk fullness of the flesh in the oropharynx. Usually, the test is not needed to make a diagnosis, and insomnia especially for working people can often be treated by changing a job schedule to make time for sufficient sleep and by improving sleep hygiene.Some patients may need to do an overnight sleep study to determine if insomnia is present. Such a study will commonly involve assessment tools including a polysomnogram and the multiple sleep latency test. Specialists in sleep medicine are qualified to diagnose disorders within the, according to the ICSD, 81 major sleep disorder diagnostic categories. Patients with some disorders, including delayed sleep phase disorder, are often mis-diagnosed with primary insomnia; when a person has trouble getting to sleep and awakening at desired times, but has a normal sleep pattern once asleep, a circadian rhythm disorder is a likely cause. In many cases, insomnia is co-morbid with another disease, side-effects from medications, or a psychological problem. Approximately half of all diagnosed insomnia is related to psychiatric disorders. For those who have depression, "insomnia should be regarded as a co-morbid condition, rather than as a secondary one;" insomnia typically predates psychiatric symptoms.
Because their perception of their sleep is incomplete, they incorrectly believe it takes them an abnormally long time to fall asleep, and they underestimate how long they remain asleep. Causes
Symptoms of insomnia can be caused by or be associated with:

Sleep breathing disorders, such as sleep apnea or upper airway resistance syndrome
Use of psychoactive drugs (such as stimulants), including certain medications, herbs, caffeine, nicotine, cocaine, amphetamines, methylphenidate, aripiprazole, MDMA, modafinil, or excessive alcohol intake
Use of or withdrawal from alcohol and other sedatives, such as anti-anxiety and sleep drugs like benzodiazepines
Use of or withdrawal from pain-relievers such as opioids
Heart disease
Restless legs syndrome, which can cause sleep onset insomnia due to the discomforting sensations felt and the need to move the legs or other body parts to relieve these sensations
Periodic limb movement disorder (PLMD), which occurs during sleep and can cause arousals of which the sleeper is unaware
Pain: an injury or condition that causes pain can preclude an individual from finding a comfortable position in which to fall asleep, and can also cause awakening.