Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding a glossary endpoint which attempts to get patient-friendly descriptions from code. #120

Merged
merged 7 commits into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Working (kinda). Couldnt find a way tto truncate text, so for now we'…
…re just adding scroll bars :(

Force IPV4 for medline api (ipv6 timesout).
  • Loading branch information
AnalogJ committed Mar 20, 2023
commit 2371cdaffc783bc9820318ce7e2a883d61e19032
16 changes: 15 additions & 1 deletion backend/pkg/web/handler/glossary.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package handler

import (
"context"
"encoding/json"
"fmt"
"github.com/fastenhealth/fastenhealth-onprem/backend/pkg"
Expand All @@ -9,6 +10,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
"log"
"net"
"net/http"
"net/url"
"strings"
Expand Down Expand Up @@ -69,7 +71,19 @@ func GlossarySearchByCode(c *gin.Context) {
}

// Send the HTTP GET request to the API and retrieve the response
resp, err := http.Get(medlinePlusConnectEndpoint + "?" + params.Encode())
//TODO: when using IPV6 to communicate with MedlinePlus, we're getting timeouts. Force IPV4
var (
zeroDialer net.Dialer
httpClient = &http.Client{
Timeout: 10 * time.Second,
}
)
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
return zeroDialer.DialContext(ctx, "tcp4", addr)
}
httpClient.Transport = transport
resp, err := httpClient.Get(medlinePlusConnectEndpoint + "?" + params.Encode())
if err != nil {
fmt.Println("Error sending request:", err)
return
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:host {
max-height:300px;
overflow-y:scroll;
display: inline-block;
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class GlossaryLookupComponent implements OnInit {
this.url = result.url
this.source = result.publisher
this.description = this.sanitized.bypassSecurityTrustHtml(result.description)
// this.description = result.description
})
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,7 @@
<div class="col-6 bg-gray-100">
<div class="row">
<div class="col-12 mt-3">
<p>
<small>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</small>
</p>
<app-glossary-lookup [code]="observationCode" [codeSystem]="'http:https://loinc.org'"></app-glossary-lookup>
</div>

<div class="col-12">
Expand Down