
115 Wis.2d 615 (1983)
340 N.W.2d 568
STATE of Wisconsin EX REL. B.S.L., Petitioner,
v.
Dr. Connie M. LEE, Treatment Director, and Dr. Norman V. Heintz, Attending Physician, Winnebago Mental Health Institute; Honorable Robert A. Hawley, Winnebago County Circuit Court, Branch IV; Eugene A. Bartman, Assistant District Attorney, Winnebago County; Terry Footit, Winnebago County Sheriff; and Dr. Darold A. Treffert, Director, Fond du Lac County Unified Board, Respondents.
No. 83-422.
Court of Appeals of Wisconsin.
Argued May 31, 1983.
Decided October 20, 1983.
*617 For the petitioner there was a memorandum brief and oral argument by Scott C. Jackson, Assistant State Public Defender.
For the respondents there was a memorandum brief and oral argument by Eugene A. Bartman, Assistant District Attorney, of Oshkosh.
Before Scott, C.J., Voss, P.J., and Brown, J.
VOSS, P.J.
This action originated as a petition for a writ of habeas corpus. After reviewing the petition and the record, we conclude that the petition shall be construed as a petition for leave to appeal a nonfinal order, which we grant.[1]
The major issue in this case relates to a portion of the mental health act relating to involuntary continuation of a juvenile's stay at an inpatient facility after his fourteenth birthday. Section 51.20(9) (a), Stats., requires two psychiatric reports prior to a final detention hearing. In this case, because of a mistake, the required *618 psychiatric examinations did not take place prior to the final hearing. As a result, the trial judge dismissed the case. The State immediately filed a second affidavit for emergency detention, again alleging the same facts. The juvenile argues that this second action is barred by res judicata. Because we agree with the trial judge's reasoning that the first action never reached the merits solely because of a procedural defect, we reject the juvenile's claim.
B.S.L. was voluntarily admitted to Winnebago Mental Health Institute when he was eleven years old, under sec. 51.13, Stats.[2] On January 18, 1983, B.S.L. requested that he be discharged within forty-eight hours of his fourteenth birthday, which occurred on January 22, 1983. Under sec. 51.13(7) (b), upon written request, a minor must be discharged within forty-eight hours of his fourteenth birthday unless an affidavit of emergency detention is filed. On January 21, 1983, Winnebago officials filed an affidavit for emergency detention. The *619 affidavit alleged seven specific incidents of aggression but did not disclose the names of the individuals reporting the incidents. Based on the affidavit, a probable cause hearing was held. The court found probable cause for continued commitment and pursuant to sec. 51.20 (9) (a), appointed two psychiatrists to examine B.S.L. and file reports of their findings. However, the examinations never took place.
A final commitment hearing was scheduled for February 11, 1983. The case was dismissed prior to the hearing because the requisite psychiatric examinations had not been conducted. The court ordered B.S.L. discharged. Winnebago officials immediately filed a second affidavit for emergency detention alleging essentially the same facts as the first affidavit. Probable cause to continue commitment was found, and a final commitment hearing was scheduled. B.S.L. appeals from that order. The trial court has stayed that hearing pending disposition of this appeal.
B.S.L.'s initial argument is that the first proceeding was dismissed on the merits, and, therefore, commencement of a second proceeding with an affidavit alleging essentially the same facts must be dismissed as res judicata.
In particular, B.S.L. argues that the motion to dismiss the first proceeding challenged the sufficiency of the evidence, and where such dismissal is granted, it is an adjudication on the merits under sec. 805.14(7), Stats.,[3] unless the court specifies in its order that the dismissal is for good cause. The trial court did not indicate in its dismissal that it was for good cause. B.S.L. concludes *620 that the dismissal was, therefore, on the merits. Since the second affidavit alleges essentially the same facts as the first affidavit, B.S.L. reasons the matter is res judicata. Our examination of the record, however, supports the trial judge's finding that the first proceeding was not dismissed on the merits.
Our examination of the record shows that the juvenile raised three separate grounds in his motion for dismissal: (1) he had not been examined by two psychiatrists; (2) the psychiatric reports were not available forty-eight hours prior to the final hearing, and (3) absent these reports, as a matter of law, Winnebago officials could not establish by clear and convincing evidence that B.S.L. required involuntary commitment.
There is no indication in the record that the court considered the merits of the State's petition at the February 11 hearing. The record only reflects that the court dismissed the proceedings on the basis of the two procedural defectsthe lack of examinations and written reports. No testimony was taken. The judge only noted that the examinations and reports were not available. In addition, during the second probable cause hearing, the circuit court expressly stated that the first proceeding had been dismissed without prejudice, for procedural defect.
The defendant argues that the above determination should not end our inquiry. Even if the circuit court dismissed the action based on the first two grounds, B.S.L. asserts the court's dismissal is implicitly based on a finding that there was insufficient evidence as a matter of law under sec. 805.14(7), Stats. Thus, under B.S.L.'s logic, this implicit determination amounts to an adjudication on the merits. We hold otherwise.
When the dismissal is prior to the taking of testimony, it is not on the merits and is not a bar to another action for the same cause. Newton v. Newton, 33 Wis. 2d 182, *621 186, 147 N.W.2d 328, 330 (1967). A motion, pursuant to sec. 805.14(7), Stats., contemplates testimony having been taken and is not to be made prior to trial. Thus, argument under that statute fails.
In the alternative, B.S.L. claims that he had a constitutional due process right to an examination by two independent specialists and access to their reports forty-eight hours before the final commitment hearing. Because this procedure was not followed, B.S.L. claims the State's second action to continue detention is an invasion of his liberty interest.
The right to due process protections depends initially upon a finding that a legitimate liberty interest is involved. B.S.L.'s freedom from involuntary commitment is clearly an interest protected by due process. Cf. In the Interest of S.D.R., 109 Wis. 2d 567, 573, 326 N.W.2d 762, 765 (1982). However, whether B.S.L. had a legitimate expectation to be discharged from the institution when the first proceeding was dismissed depends on the legislative intent under ch. 51.
All time limits required by statute were met during the first proceeding for continued detention. On February 11, 1983, the circuit court dismissed the first petition for continued detention for procedural defect. Winnebago officials immediately filed a second affidavit for emergency detention. This second affidavit began an entirely new proceeding, which is entirely independent from both the first affidavit and petition. Compliance with all of the statutory time limits for probable cause and final hearing was met.
There is no language in ch. 51 prohibiting the initiation of a second commitment proceeding if the first proceeding is dismissed. Thus, no legislative intent can be found giving B.S.L. a liberty interest upon dismissal of the first proceeding. This proceeding is no more a liberty *622 interest violation than a criminal proceeding where a court, upon finding a defect in an indictment, information or complaint, may order the defendant to be held for a maximum of seventy-two hours while the defect is corrected. Sec. 971.31 (6), Stats. We find that B.S.L.'s right to due process was not violated.
B.S.L.'s argument that allowing the filing of a second affidavit after dismissal of the first leads to abuse of the commitment process is also unpersuasive. Any initial proceeding may be dismissed with prejudice if the trial court believes the process is being abused. See Trispel v. Haefer, 89 Wis. 2d 725, 279 N.W.2d 242 (1979).
Finally, B.S.L. argues that both the first and second affidavits for emergency detention are deficient for failure to state the names of individuals observing or reporting the alleged incidents of aggression. We do not agree.
Section 51.10(5) (c), Stats., sets no requirements as to the contents of affidavits for emergency detention. The affidavits filed in this case are based on B.S.L.'s medical treatment records. They provide specific incidents of aggression and the dates on which they occurred. An affidavit for emergency detention is sufficient if it is based upon medical treatment records. See In the Matter of Haskins, 101 Wis. 2d 176, 191, 304 N.W.2d 125, 132 (Ct. App. 1980). Therefore, we affirm the circuit court's order finding probable cause for emergency detention and scheduling a final hearing.
By the Court.Order affirmed.
NOTES
[1]  We note that because of the importance of the issues, this case is being decided by a three-judge panel, rather than as a one-judge appeal. See sec. 809.41(3), Stats.
[2]  Section 51.13, Stats., reads in pertinent part: (1)(a) Except as provided in s. 51.45(2m), the application for voluntary admission of a minor who is under 14 years of age to an approved inpatient treatment facility shall be executed by a parent who has legal custody of the minor or the minor's guardian. Any statement or conduct by a minor under the age of 14 indicating that the minor does not agree to admission to the facility shall be noted on the face of the application and shall be noted in the petition required by sub. (4).

. . . .
(7)(b) Any minor 14 years of age or over voluntarily admitted under this section may request discharge in writing. Upon receipt of any form of written request for discharge, the director of the facility in which the minor is admitted shall immediately notify the minor's parent or guardian. The minor shall be discharged within 48 hours after submission of the request, exclusive of Saturdays, Sundays, and legal holidays, unless a petition or statement is filed for emergency detention, emergency commitment, involuntary commitment or protective placement.
[3]  Section 805.14(7), Stats., reads:

Unless the court in its order for dismissal otherwise specifies for good cause recited in the order, any dismissal under this section operates as an adjudication upon the merits.
