Table 1.
Regular expressions used in final rule-based natural language processing algorithm.
| Information searched | Regular expressions * used in query | Examples |
|---|---|---|
| Sexual history | sex[a-z,\.,\s,\/]|intercourse | MATCH: “sexual activity,” “does not have sex,” no sex/drug use,” “had sex” NOT A MATCH: “Sex: Male” |
| Protection used | protect|condom condom cath|child protect |
MATCH: “uses protection,” “uses condoms some of the time” NOT A MATCH: “condom catheter,” “child protection services” |
| STI testing offered/previously performed | GC[∧S]|G\/C|gonorr| gonnor|gonor|gonoc|chlam| ST[I|D]\s(test|screen|lab)| test(ing|ed|\s)\sfor\sST[I|D] chlam pneumo|chlamydia pneumo |
MATCH: “will send GC/CT,” “STD testing,” “test for STI,” “chlamydia” NOT A MATCH: “chlamydia pneumonia” |
| Not sexually active | denies (any sex|history of sex|hx of sex|intercourse|hx of intercourse|being sexual|ever being sexual)|no sex|never (had sex|been sexual)|not sexually active |
MATCHES: “denies ever being sexually active,” “never been sexually active” NOT A MATCH: “denies ever having been sexually active” |
| Partner gender | Within substring of text 50 characters prior to and 50 characters after/ sex[a-z,\.,\s,\/]|intercourse/ male/boy/girl/men/man |
MATCH: “has sex with female partners,” “hx of sexual activity with women” NOT A MATCH: “interested in men” (with no mention of sex or intercourse within 50 characters) |
| Type of sexual practice | (oral|vaginal|anal)\s(sex|penetration| intercourse) |
MATCH: “has had oral sex,” “anal penetration” NOT A MATCH: “has had sex—both oral and anal” |
| Contraception used | OCP|contraceptive|contraception, birth control|planon|IUD|nuvaring| depo |
MATCH: “is on OCP,” “Depo-provera 1 month ago,” “on birth control for PCOS” NOT A MATCH: “on mini pill” |
All regular expressions are given in Python format and were multi-line and case insensitive.