Skip to content

Commit

Permalink
More clean up & slight workflow improvement (totallylegitco#129)
Browse files Browse the repository at this point in the history
* Improve the appeal from to make the errors a bit more clear

* Style

* Fix OCR extract magic.
  • Loading branch information
holdenk authored Nov 17, 2024
1 parent 58b30c3 commit bd7e43e
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 23 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ If you don't have a GPU handy the other option is to use an external model. The
Tests are run through `tox`. If you dont have tox you can `pip` or `uv` install it. The tests are broken up into sync and async. You can run all tests by running `tox`.

An example of running just one test suite is `tox -e py311-django50-sync -- tests/sync/test_selenium_appeal_generation.py`


## Style

We use black for style checking, and it can auto apply many style fixes so if you get a style error just run `black fighthealthinsurance`.

## Types

We use mypy for type checking.
12 changes: 8 additions & 4 deletions fighthealthinsurance/core_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
class InterestedProfessionalForm(forms.ModelForm):
business_name = forms.CharField(required=False)
address = forms.CharField(
required=False, widget=forms.Textarea(attrs={"cols": 80, "rows": 5})
required=False, widget=forms.Textarea(attrs={"class": "full_address"})
)
comments = forms.CharField(
required=False, widget=forms.Textarea(attrs={"cols": 80, "rows": 5})
required=False, widget=forms.Textarea(attrs={"class": "comments"})
)
phone_number = forms.CharField(required=False)
job_title_or_provider_type = forms.CharField(required=False)
Expand Down Expand Up @@ -64,14 +64,18 @@ class DenialRefForm(forms.Form):


class ChooseAppealForm(DenialRefForm):
appeal_text = forms.CharField(required=True)
appeal_text = forms.CharField(
widget=forms.Textarea(attrs={"class": "appeal_text"}), required=True
)


class FaxForm(DenialRefForm):
name = forms.CharField(required=True, label="Your name (for the cover page)")
insurance_company = forms.CharField(required=True)
fax_phone = forms.CharField(required=True)
completed_appeal_text = forms.CharField(widget=forms.Textarea)
completed_appeal_text = forms.CharField(
widget=forms.Textarea(attrs={"class": "appeal_text"}), required=True
)
include_provided_health_history = forms.BooleanField(required=False)
pubmed_articles_to_include = forms.CharField(required=False)

Expand Down
15 changes: 15 additions & 0 deletions fighthealthinsurance/static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,18 @@ a.link:hover::after {
height: auto; /* Allows the content to occupy its natural height */
padding: initial; /* Restores padding */
}

.appeal_text {
width: 100%;
height: 20em;
}

.full_address {
height: 5em;
width: 80em;
}

.comments {
height: 10em;
width: 80em;
}
10 changes: 0 additions & 10 deletions fighthealthinsurance/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,6 @@ body {
Our extras
---*/

#google-map {
height: 300px;
margin: 0 auto;
padding: 0;
width: 100%;
border-radius: 4px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
background-color: #fff;
}

.options-table {
table-layout: fixed;
border-collapse: collapse;
Expand Down
9 changes: 9 additions & 0 deletions fighthealthinsurance/static/js/scrub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,19 @@ function validateScrubForm(event: Event): void {
document.getElementById('email-label').style.color="";
rehideHiddenMessage('email_error');
}
if (form.denial_text.value.length < 1) {
showHiddenMessage('need_denial');
document.getElementById('denial_text_label').style.color="red";
} else {
document.getElementById('denial_text_label').style.color="";
rehideHiddenMessage('need_denial');
}

if (form.pii.checked && form.privacy.checked && form.email.value.length > 0) {
rehideHiddenMessage('agree_chk_error');
rehideHiddenMessage('pii_error');
rehideHiddenMessage('email_error');
rehideHiddenMessage('need_denial');
// YOLO
return;
} else {
Expand Down
2 changes: 1 addition & 1 deletion fighthealthinsurance/templates/appeal.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<input type="hidden" name="email" value="{{ user_email }}">
<input type="hidden" name="denial_id" value="{{ denial_id }}">

<textarea style="width:100%" rows="20" name="appeal_text" id="scrubbed_appeal_text">
<textarea class="appeal_text" name="appeal_text" id="scrubbed_appeal_text">
{{appeal}}
</textarea>

Expand Down
5 changes: 4 additions & 1 deletion fighthealthinsurance/templates/scrub.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</div>
{% endif %}
<div class="form-group">
<label for="denial_text" class="form-label">
<label for="denial_text" id="denial_text_label" class="form-label">
<b>Your Insurance Denial</b>
<small class="text-muted">(Remove personally identifiable information (PII) as we store for Machine Learning and may review)</small>
</label><br>
Expand Down Expand Up @@ -148,6 +148,9 @@
<div class="hidden-error-message" id="pii_error">
Can't proceed as you didn't check that you had removed your Personal Identifiable Information (PII) from the text areas.
</div>
<div class="hidden-error-message" id="need_denial">
We need you to provide your denial message from your insurance company in the text field right underneath the words "Your Insurance Denial" if you didn't get one you can write that you have not received a denial but describe what was denied (for example: The pharmacy said my PrEP was denied). Normally insurance companies are required to provide denials, but in our experience they do not always comply with that.
</div>
<button type="submit" class="btn btn-green" id="submit">Submit</button>
</form>
<p>
Expand Down
13 changes: 6 additions & 7 deletions fighthealthinsurance/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,16 +363,15 @@ class ProcessView(generic.FormView):
template_name = "scrub.html"
form_class = DenialForm

def get_ocr_result(self):
def get_ocr_result(self) -> Optional[str]:
if self.request.method == "POST":
return self.request.POST.get("denial_text", "")
return ""
return self.request.POST.get("denial_text", None)
return None

def get_context_data(self, **kwargs):
context = {
"ocr_result": self.get_ocr_result(),
"upload_more": True,
}
context = super().get_context_data(**kwargs)
context["ocr_result"] = self.get_ocr_result()
context["upload_more"] = True
return context

def form_valid(self, form):
Expand Down

0 comments on commit bd7e43e

Please sign in to comment.