(a) Within a period of 24 hours after the court receives a petition for hospitalization of a person for emergency observation and diagnosis, filed by the administrator of a hospital or chief clinical officer of the Department pursuant to section 21-523, the court shall:
(1) order the hospitalization; or
(2) order the person’s immediate release.
(b) The court, in making its determination under this section, shall consider the written reports of the agent, officer, physician or qualified psychologist who made the application under section 21-522, the certificate of the examining psychiatrist or examining qualified psychologist which accompanied it, and any other relevant information.