Skip to content

Commit

Permalink
fixing linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
shaselton committed Dec 5, 2023
1 parent 0528e2a commit 2f0bd99
Showing 1 changed file with 119 additions and 112 deletions.
231 changes: 119 additions & 112 deletions src/pages/txt-generator.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from "react"
import Clipboard from "clipboard"
import { useEffect, useState } from "react"
import {
Alert,
Grid,
Button,
Label,
TextInput,
FormGroup,
} from "@trussworks/react-uswds"
import { Grid } from "@trussworks/react-uswds"
import Layout from "../layouts"

const txtFileOutput = (hospitals) =>
Expand All @@ -28,11 +21,6 @@ contact-email: ${contactEmail}`
)
.join("\n\n")

const removeIndex = (array, index) => [
...array.slice(0, index),
...array.slice(index + 1),
]

const TxtGenerator = () => {
const baseHospital = {
name: "",
Expand Down Expand Up @@ -60,125 +48,144 @@ const TxtGenerator = () => {
})
}, [state.hospitals])

const updateHospital = (index, updatedHospital) => {
const hospitals = [...state.hospitals]
hospitals[index] = { ...hospitals[index], ...updatedHospital }
setState({ ...state, hospitals })
}

const getAlertParams = () => {
if (
state.hospitals.length === 1 &&
Object.values(state.hospitals[0]).every((v) => !v.trim())
) {
return {
type: "info",
message: "Fill in hospital fields to generate file",
}
}
if (
state.hospitals.every((hospital) =>
Object.values(hospital).every((v) => v.trim())
)
) {
return {
type: "success",
message: "Generated file is valid",
}
} else {
return {
type: "error",
message: "All fields must be filled in for each hospital",
}
}
}

const { type: alertType, message: alertMessage } = getAlertParams()

return (
<Layout>
<div className="bg-base-lightest">
<section className="grid-container usa-section">
<Grid row gap>
<Grid
desktop={{ col: 12 }}
className="bg-white display-flex flex-column flex-align-self-start margin-bottom-4">
className="bg-white display-flex flex-column flex-align-self-start margin-bottom-4"
>
<h2 className="margin-bottom-0">TXT File Instructions</h2>
<h3 className="margin-bottom-0"><u>Background</u></h3>
<p>As finalized in the CY2024 OPPS/ASC Final Rule, beginning January 1, 2024, each hospital must ensure
that the public website it selects to host its machine-readable file (MRF) establishes and maintains, in
the form and manner specified by CMS:
<h3 className="margin-bottom-0">
<u>Background</u>
</h3>
<p>
As finalized in the CY2024 OPPS/ASC Final Rule, beginning
January 1, 2024, each hospital must ensure that the public
website it selects to host its machine-readable file (MRF)
establishes and maintains, in the form and manner specified by
CMS:
<ul>
<li>A .txt file in the root folder that includes:
<li>
A .txt file in the root folder that includes:
<ul>
<li> The hospital location name that corresponds to the MRF;</li>
<li> The source page URL that hosts the MRF;</li>
<li> A direct link to the MRF (the MRF URL); and</li>
<li> Hospital point of contact information.</li>
<li>
{" "}
The hospital location name that corresponds to the MRF;
</li>
<li> The source page URL that hosts the MRF;</li>
<li> A direct link to the MRF (the MRF URL); and</li>
<li> Hospital point of contact information.</li>
</ul>
</li>
<li>A link in the footer on its website, including but not limited to the homepage, that is labeled “Price Transparency” and links directly to the publicly available webpage that hosts the link to the MRF.</li>
<li>
A link in the footer on its website, including but not
limited to the homepage, that is labeled “Price
Transparency” and links directly to the publicly available
webpage that hosts the link to the MRF.
</li>
</ul>
The purpose of these requirements is to facilitate automated access to hospital MRFs. Please refer to 45 CFR 180.50 (d)(6) and discussion at 88 FR 82111-82113.
The purpose of these requirements is to facilitate automated
access to hospital MRFs. Please refer to 45 CFR 180.50 (d)(6)
and discussion at 88 FR 82111-82113.
</p>

<h3 className="margin-bottom-0"><u>TXT technical specifications</u></h3>
<p> Steps:
<h3 className="margin-bottom-0">
<u>TXT technical specifications</u>
</h3>
<p>
{" "}
Steps:
<ol>
<li>Generate a TXT file that includes the required information indicated below.</li>
<li>If the MRF contains standard charge information for more than one location, create an entry for each of the inpatient locations and standalone emergency hospitals in the TXT file.</li>
<li>
Generate a TXT file that includes the required information
indicated below.
</li>
<li>
If the MRF contains standard charge information for more
than one location, create an entry for each of the inpatient
locations and standalone emergency hospitals in the TXT
file.
</li>
<li>Name the file “cms-hpt.txt”.</li>
<li>Place the TXT file on the root of the domain of the public website your hospital has selected to host its machine-readable file (MRF), without regard to page structure. As an example, a hospital with the website https://hospital.com would locate its file at https://hospital.com/cms-hpt.txt</li>
</ol>
<li>
Place the TXT file on the root of the domain of the public
website your hospital has selected to host its
machine-readable file (MRF), without regard to page
structure. As an example, a hospital with the website
https://hospital.com would locate its file at
https://hospital.com/cms-hpt.txt
</li>
</ol>
</p>
<h3 className="margin-bottom-0"><u>Required Information for the TXT File</u></h3>
<table class="usa-table">
<h3 className="margin-bottom-0">
<u>Required Information for the TXT File</u>
</h3>
<table className="usa-table">
<thead>
<tr>
<th>Attribute: Value</th>
<th>Name</th>
<th>Definition</th>
</tr>
</thead>
<tr>
<td>location-name: [hospital location name]</td>
<td>Hospital Location Name</td>
<td>Indicate the hospital location name that corresponds to the standard charge information contained in the MRF.</td>
</tr>
<tr>
<td>source-page-url: [URL]</td>
<td>Source page URL</td>
<td>The source page URL is the URL of the public webpage you have selected to host the MRF.</td>
</tr>
<tr>
<td>mrf-url: [URL]</td>
<td>Machine-readable file URL</td>
<td>Indicate the URL of the MRF.</td>
</tr>
<tr>
<td>contact-name: [name]</td>
<td>POC Name</td>
<td>Indicate the name of a point of contact (POC) that is capable of answering technical questions about your hospital’s MRF and the data contained in it.</td>
</tr>
<tr>
<td>contact-email: [email]</td>
<td>Contact email</td>
<td>Indicate the email address of the POC you have designated to answer technical questions about your hospital’s MRF and the data contained in it.</td>
</tr>
</table>
<h3 className="margin-bottom-0"><u>Example TXT File</u></h3>
<tr>
<th>Attribute: Value</th>
<th>Name</th>
<th>Definition</th>
</tr>
</thead>
<tr>
<td>location-name: [hospital location name]</td>
<td>Hospital Location Name</td>
<td>
Indicate the hospital location name that corresponds to the
standard charge information contained in the MRF.
</td>
</tr>
<tr>
<td>source-page-url: [URL]</td>
<td>Source page URL</td>
<td>
The source page URL is the URL of the public webpage you
have selected to host the MRF.
</td>
</tr>
<tr>
<td>mrf-url: [URL]</td>
<td>Machine-readable file URL</td>
<td>Indicate the URL of the MRF.</td>
</tr>
<tr>
<td>contact-name: [name]</td>
<td>POC Name</td>
<td>
Indicate the name of a point of contact (POC) that is
capable of answering technical questions about your
hospital’s MRF and the data contained in it.
</td>
</tr>
<tr>
<td>contact-email: [email]</td>
<td>Contact email</td>
<td>
Indicate the email address of the POC you have designated to
answer technical questions about your hospital’s MRF and the
data contained in it.
</td>
</tr>
</table>
<h3 className="margin-bottom-0">
<u>Example TXT File</u>
</h3>
<p id="generator-output">
location-name: Test Hospital <br/>
source-page-url: https://example.com <br/>
mrf-url: https://example.com/HPT <br/>
contact-name: Jon Snow <br/>
contact-email: [email protected] <br/>
<br/>
location-name: Test Hospital 2 <br/>
source-page-url: https://example2.com <br/>
mrf-url: https://example2.com/HPT <br/>
contact-name: Jane Doe <br/>
contact-email: [email protected] <br/>
location-name: Test Hospital <br />
source-page-url: https://example.com <br />
mrf-url: https://example.com/HPT <br />
contact-name: Jon Snow <br />
contact-email: [email protected] <br />
<br />
location-name: Test Hospital 2 <br />
source-page-url: https://example2.com <br />
mrf-url: https://example2.com/HPT <br />
contact-name: Jane Doe <br />
contact-email: [email protected] <br />
</p>
</Grid>
</Grid>
Expand Down

0 comments on commit 2f0bd99

Please sign in to comment.