the adjudication or commitment, respectively, is based solely on a medical finding of disability, without an opportunity for a hearing by a court, board, commission, or other lawful authority, and the person has not been adjudicated as a mental defective consistent with
section 922(g)(4) of title 18, except that nothing in this section or any other provision of law shall prevent a Federal department or agency from providing to the Attorney General any record demonstrating that a person was adjudicated to be not guilty by reason of insanity, or based on lack of mental responsibility, or found incompetent to stand trial, in any criminal case or under the Uniform Code of Military Justice.