<commit_before># Private Results
Private Results provides a way for patients to get their test results via phone or the web.

## Workflow
1. Patient visits a clinic and gets some tests done.
2. Clinic hands patient a card with phone number, website, username and password for Private Results.
3. Clinic imports patient_data.csv into Private Results (providing visit and test result info).
4. Patient calls (or visits website) Private Results and enters the username and password they were provided.
5. Private Results looks up the username and password and delivers the results.

The results provided are dependant on the status of each test result and follows the following logic:
```ruby
# Found in app/models/visit.rb
if results.any?{ |result| result.status.nil? || result.status == "Come back to clinic" }
  message = "Come back to the clinic"
elsif results.any?{ |result| result.status == "Pending" } and visited_on > 7.days.ago
  message = "Your test results are still pending, call back..."
else
  message = results.messages.join("\n")
end
```

This ensures that if any test result does not have a status or has the status **"Come back to clinic"**,
the patient will not receive any of their results and will instead be instructed to come back to the clinic.
Similarly, if any test result is still **"Pending"**, and the patient's visit was recent (less than 7 days ago),
then the patient will be told to call back. If neither of those cases is true, then we deliver each test result to the patient.

## Dependencies
* Rails 4.1.8
* Ruby 2.1.5
* [PhantomJS](https://github.com/teampoltergeist/poltergeist#installing-phantomjs) (for testing)
* Postgres
* [Twilio](https://twilio.com/) Account

## Development

Private Results is well tested, please run `rspec spec` from the top directory in order to make sure everything is working as it should.

The seeds file contains the initial list of:<commit_msg>Add comment about BCHD in README<commit_after># Private Results
Private Results provides a way for patients to get their test results via phone or the web. Currently, this project has hardcoded data for [BCHD](http://health.baltimorecity.gov/) (clinic info).


## Workflow
1. Patient visits a clinic and gets some tests done.
2. Clinic hands patient a card with phone number, website, username and password for Private Results.
3. Clinic imports patient_data.csv into Private Results (providing visit and test result info).
4. Patient calls (or visits website) Private Results and enters the username and password they were provided.
5. Private Results looks up the username and password and delivers the results.

The results provided are dependant on the status of each test result and follows the following logic:
```ruby
# Found in app/models/visit.rb
if results.any?{ |result| result.status.nil? || result.status == "Come back to clinic" }
  message = "Come back to the clinic"
elsif results.any?{ |result| result.status == "Pending" } and visited_on > 7.days.ago
  message = "Your test results are still pending, call back..."
else
  message = results.messages.join("\n")
end
```

This ensures that if any test result does not have a status or has the status **"Come back to clinic"**,
the patient will not receive any of their results and will instead be instructed to come back to the clinic.
Similarly, if any test result is still **"Pending"**, and the patient's visit was recent (less than 7 days ago),
then the patient will be told to call back. If neither of those cases is true, then we deliver each test result to the patient.


## Dependencies
* Rails 4.1.8
* Ruby 2.1.5
* [PhantomJS](https://github.com/teampoltergeist/poltergeist#installing-phantomjs) (for testing)
* Postgres
* [Twilio](https://twilio.com/) Account


## Development
Private Results is well tested, please run `rspec spec` from the top directory in order to make sure everything is working as it should.

The seeds file contains the initial list of:
{'fraction_non_alphanumeric': 0.07809330628803246, 'fraction_numerical': 0.006592292089249493, 'mean_word_length': 4.404109589041096, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '276981', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1021, 'n_words': 564}