From 18f7bc970e260194339e180668c16fb9b23c0194 Mon Sep 17 00:00:00 2001 From: Pat Sier Date: Tue, 13 Jun 2023 10:13:32 -0500 Subject: [PATCH 1/8] feat: add txt generator --- src/components/HptHeader.jsx | 7 ++ src/css/style.css | 14 +++ src/pages/txt-generator.jsx | 193 +++++++++++++++++++++++++++++++++++ src/txt-generator.jsx | 17 +++ txt-generator/index.html | 24 +++++ 5 files changed, 255 insertions(+) create mode 100644 src/pages/txt-generator.jsx create mode 100644 src/txt-generator.jsx create mode 100644 txt-generator/index.html diff --git a/src/components/HptHeader.jsx b/src/components/HptHeader.jsx index 2e36071..aae3e68 100644 --- a/src/components/HptHeader.jsx +++ b/src/components/HptHeader.jsx @@ -29,6 +29,13 @@ const HptHeader = () => { > File name wizard , + + TXT generator + , ] return ( diff --git a/src/css/style.css b/src/css/style.css index e8bbf2b..2398a8b 100644 --- a/src/css/style.css +++ b/src/css/style.css @@ -64,3 +64,17 @@ body, max-width: unset; width: 100%; } + +.generator-results-row { + align-items: center; + justify-content: space-between; +} + +#generator-output { + user-select: all; + -moz-user-select: all; + background-color: #eee; + padding: 8px 12px; + max-width: 100%; + overflow-x: scroll; +} diff --git a/src/pages/txt-generator.jsx b/src/pages/txt-generator.jsx new file mode 100644 index 0000000..121f56a --- /dev/null +++ b/src/pages/txt-generator.jsx @@ -0,0 +1,193 @@ +import React from "react" +import Clipboard from "clipboard" +import { useEffect, useState } from "react" +import { + Grid, + Button, + Label, + TextInput, + FormGroup, +} from "@trussworks/react-uswds" +import Layout from "../layouts" + +const txtFileOutput = (hospitals) => + hospitals + .map( + ({ name, sourcePageUrl, mrfUrl, contact }) => `location-name: ${name} +source-page-url: ${sourcePageUrl} +mrf-url: ${mrfUrl} +contact-email: ${contact}` + ) + .join("\n\n") + +const removeIndex = (array, index) => [ + ...array.slice(0, index), + ...array.slice(index + 1), +] + +const TxtGenerator = () => { + const [state, setState] = useState({ + hospitals: [{ name: "", sourcePageUrl: "", mrfUrl: "", contact: "" }], + downloadUrl: "", + }) + + useEffect(() => { + new Clipboard("[data-clipboard-target]") + }, []) + + useEffect(() => { + let blob = new Blob([txtFileOutput(state.hospitals)], { + type: "text/plain;charset=utf8", + }) + setState({ + ...state, + downloadUrl: window.URL.createObjectURL(blob), + }) + }, [state.hospitals]) + + const updateHospital = (index, updatedHospital) => { + const hospitals = [...state.hospitals] + hospitals[index] = { ...hospitals[index], ...updatedHospital } + setState({ ...state, hospitals }) + } + + return ( + +
+
+ + +

Generator

+
+ {state.hospitals.map((hospital, index) => ( + + + + updateHospital(index, { name: e.target.value }) + } + /> + + + updateHospital(index, { sourcePageUrl: e.target.value }) + } + /> + + + updateHospital(index, { mrfUrl: e.target.value }) + } + /> + + + updateHospital(index, { contact: e.target.value }) + } + /> + {state.hospitals.length > 1 ? ( + + ) : ( + `` + )} + + ))} +
+ +
+ +

Results

+ + Download + +
+ +
{txtFileOutput(state.hospitals)}
+
+ +
+

What this tool helps with

+

This generates the cms-hpt.txt for indexing files.

+
+
+
+
+
+
+ ) +} + +export default TxtGenerator diff --git a/src/txt-generator.jsx b/src/txt-generator.jsx new file mode 100644 index 0000000..fa4235e --- /dev/null +++ b/src/txt-generator.jsx @@ -0,0 +1,17 @@ +import "./polyfills.js" +import React from "react" +import ReactDOM from "react-dom/client" +import TxtGenerator from "./pages/txt-generator" + +import "@trussworks/react-uswds/lib/uswds.css" +import "@trussworks/react-uswds/lib/index.css" + +import "./css/style.css" + +const root = ReactDOM.createRoot(document.getElementById("root")) + +root.render( + + + +) diff --git a/txt-generator/index.html b/txt-generator/index.html new file mode 100644 index 0000000..4ff3abe --- /dev/null +++ b/txt-generator/index.html @@ -0,0 +1,24 @@ + + + + + + CMS HPT TXT Generator | Hospital Price Transparency + + + + +
+ + + From 3d3dacb4ee84fe7e4bdce54aa560b9a7e87a4fe2 Mon Sep 17 00:00:00 2001 From: Pat Sier Date: Fri, 24 Nov 2023 11:23:25 -0500 Subject: [PATCH 2/8] refactor: update txt generator content --- src/pages/txt-generator.jsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/pages/txt-generator.jsx b/src/pages/txt-generator.jsx index 121f56a..da0122b 100644 --- a/src/pages/txt-generator.jsx +++ b/src/pages/txt-generator.jsx @@ -179,8 +179,24 @@ const TxtGenerator = () => { className="border-top border-base-lighter padding-top-4 desktop:border-0 desktop:padding-top-0" >
-

What this tool helps with

-

This generates the cms-hpt.txt for indexing files.

+

How this tool helps

+

+ This tool generates cms-hpt.txt files that can be + placed at the root of a hospital's domain including + information to improve discoverability of machine readable + files. +

+

+
+

Contact

+

+ Have you run into an issue or have a question about this tool? + Please reach out to us at{" "} + + PriceTransparencyHospitalCharges@cms.hhs.gov + + . +

From 95e993dbe9bd78600a46e7a1b23a2b644e689f19 Mon Sep 17 00:00:00 2001 From: Pat Sier Date: Thu, 30 Nov 2023 12:05:05 -0500 Subject: [PATCH 3/8] feat: update txt generator fields, alerts --- src/pages/txt-generator.jsx | 95 ++++++++++++++++++++++++++++++------- 1 file changed, 77 insertions(+), 18 deletions(-) diff --git a/src/pages/txt-generator.jsx b/src/pages/txt-generator.jsx index da0122b..85f7c6e 100644 --- a/src/pages/txt-generator.jsx +++ b/src/pages/txt-generator.jsx @@ -2,6 +2,7 @@ import React from "react" import Clipboard from "clipboard" import { useEffect, useState } from "react" import { + Alert, Grid, Button, Label, @@ -13,10 +14,17 @@ import Layout from "../layouts" const txtFileOutput = (hospitals) => hospitals .map( - ({ name, sourcePageUrl, mrfUrl, contact }) => `location-name: ${name} + ({ + name, + sourcePageUrl, + mrfUrl, + contactName, + contactEmail, + }) => `location-name: ${name} source-page-url: ${sourcePageUrl} mrf-url: ${mrfUrl} -contact-email: ${contact}` +contact-name: ${contactName} +contact-email: ${contactEmail}` ) .join("\n\n") @@ -26,8 +34,15 @@ const removeIndex = (array, index) => [ ] const TxtGenerator = () => { + const baseHospital = { + name: "", + sourcePageUrl: "", + mrfUrl: "", + contactName: "", + contactEmail: "", + } const [state, setState] = useState({ - hospitals: [{ name: "", sourcePageUrl: "", mrfUrl: "", contact: "" }], + hospitals: [{ ...baseHospital }], downloadUrl: "", }) @@ -51,6 +66,35 @@ const TxtGenerator = () => { 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 (
@@ -60,7 +104,7 @@ const TxtGenerator = () => { desktop={{ col: 6 }} className="bg-white display-flex flex-column flex-align-self-start margin-bottom-4" > -

Generator

+

TXT Generator

{state.hospitals.map((hospital, index) => ( @@ -106,17 +150,32 @@ const TxtGenerator = () => { /> + + updateHospital(index, { contactName: e.target.value }) + } + /> + - updateHospital(index, { contact: e.target.value }) + updateHospital(index, { contactEmail: e.target.value }) } /> {state.hospitals.length > 1 ? ( @@ -145,20 +204,20 @@ const TxtGenerator = () => { onClick={() => setState({ ...state, - hospitals: [ - ...state.hospitals, - { - name: "", - sourcePageUrl: "", - mrfUrl: "", - contact: "", - }, - ], + hospitals: [...state.hospitals, baseHospital], }) } > Add + + {alertMessage} +

Results

From a4e3d41db5c0b3b39b692614294970b0f170407b Mon Sep 17 00:00:00 2001 From: Scott Haselton Date: Thu, 30 Nov 2023 13:58:55 -0800 Subject: [PATCH 4/8] initial txt readme page --- txt-generator/README.md | 48 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 txt-generator/README.md diff --git a/txt-generator/README.md b/txt-generator/README.md new file mode 100644 index 0000000..81cac27 --- /dev/null +++ b/txt-generator/README.md @@ -0,0 +1,48 @@ +TXT technical specifications and generator tool +=============================================== + +#### Background +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: +* A .txt file in the root folder that includes: + * The hospital location name that corresponds to the MRF; + * The source page URL that hosts the MRF; + * A direct link to the MRF (the MRF URL); and + * Hospital point of contact information. +* 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. + +The purpose of these requirements is to facilitate automated access to hospital MRFs. + +#### Steps: +1. Generate a TXT file that includes the required information indicated below.  +1. 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. +1. Name the file “cms-hpt.txt”. +1. 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     + + +#### Required information for the TXT file: +| Attribute | Name | Description | +| ----- | ---- | ---- | +| location-name: [hospital location name] | Hospital Location Name | Indicate the hospital location name that corresponds to the standard charge information contained in the MRF. | +| source-page-url: [URL] | Source page URL | The source page URL is the URL of the public webpage you have selected to host the MRF.| +| mrf-url: [URL] | Machine-readable file URL | Indicate the URL of the MRF. | +| contact-name: [name] | POC Name | 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. | +| contact-email: [email] | Contact email | 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. | + + +#### Example TXT File +``` +location-name: Test Hospital +source-page-url: https://example.com +mrf-url: https://example.com/HPT +contact-name: Jon Snow +contact-email: jsnow@example.com + +location-name: Test Hospital 2 +source-page-url: https://example2.com +mrf-url: https://example2.com/HPT +contact-name: Jane Doe +contact-email: jdoe@example2.com +``` From 6641629796233327687966d5ac37bf9f5e1ac636 Mon Sep 17 00:00:00 2001 From: Scott Haselton Date: Thu, 30 Nov 2023 13:59:56 -0800 Subject: [PATCH 5/8] formatting fix --- txt-generator/README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/txt-generator/README.md b/txt-generator/README.md index 81cac27..613242f 100644 --- a/txt-generator/README.md +++ b/txt-generator/README.md @@ -16,10 +16,7 @@ The purpose of these requirements is to facilitate automated access to hospital 1. Generate a TXT file that includes the required information indicated below.  1. 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. 1. Name the file “cms-hpt.txt”. -1. 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     +1. 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     #### Required information for the TXT file: From 3a4f4f0aff27aa40050f3d7879cdf3c53c32ae49 Mon Sep 17 00:00:00 2001 From: Scott Haselton Date: Thu, 30 Nov 2023 17:53:15 -0800 Subject: [PATCH 6/8] removing temp readme --- txt-generator/README.md | 45 ----------------------------------------- 1 file changed, 45 deletions(-) delete mode 100644 txt-generator/README.md diff --git a/txt-generator/README.md b/txt-generator/README.md deleted file mode 100644 index 613242f..0000000 --- a/txt-generator/README.md +++ /dev/null @@ -1,45 +0,0 @@ -TXT technical specifications and generator tool -=============================================== - -#### Background -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: -* A .txt file in the root folder that includes: - * The hospital location name that corresponds to the MRF; - * The source page URL that hosts the MRF; - * A direct link to the MRF (the MRF URL); and - * Hospital point of contact information. -* 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. - -The purpose of these requirements is to facilitate automated access to hospital MRFs. - -#### Steps: -1. Generate a TXT file that includes the required information indicated below.  -1. 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. -1. Name the file “cms-hpt.txt”. -1. 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     - - -#### Required information for the TXT file: -| Attribute | Name | Description | -| ----- | ---- | ---- | -| location-name: [hospital location name] | Hospital Location Name | Indicate the hospital location name that corresponds to the standard charge information contained in the MRF. | -| source-page-url: [URL] | Source page URL | The source page URL is the URL of the public webpage you have selected to host the MRF.| -| mrf-url: [URL] | Machine-readable file URL | Indicate the URL of the MRF. | -| contact-name: [name] | POC Name | 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. | -| contact-email: [email] | Contact email | 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. | - - -#### Example TXT File -``` -location-name: Test Hospital -source-page-url: https://example.com -mrf-url: https://example.com/HPT -contact-name: Jon Snow -contact-email: jsnow@example.com - -location-name: Test Hospital 2 -source-page-url: https://example2.com -mrf-url: https://example2.com/HPT -contact-name: Jane Doe -contact-email: jdoe@example2.com -``` From 0528e2a38241232eed71e018547946c9c4be195c Mon Sep 17 00:00:00 2001 From: Scott Haselton Date: Tue, 5 Dec 2023 09:44:49 -0800 Subject: [PATCH 7/8] adding TXT static instructions --- src/pages/txt-generator.jsx | 233 ++++++++++----------------- src/pages/txt-generator.jsx.bak | 268 ++++++++++++++++++++++++++++++++ 2 files changed, 346 insertions(+), 155 deletions(-) create mode 100644 src/pages/txt-generator.jsx.bak diff --git a/src/pages/txt-generator.jsx b/src/pages/txt-generator.jsx index 85f7c6e..0b3cf6f 100644 --- a/src/pages/txt-generator.jsx +++ b/src/pages/txt-generator.jsx @@ -101,162 +101,85 @@ const TxtGenerator = () => {
-

TXT Generator

- - {state.hospitals.map((hospital, index) => ( - - - - updateHospital(index, { name: e.target.value }) - } - /> - - - updateHospital(index, { sourcePageUrl: e.target.value }) - } - /> - - - updateHospital(index, { mrfUrl: e.target.value }) - } - /> - - - updateHospital(index, { contactName: e.target.value }) - } - /> - - - updateHospital(index, { contactEmail: e.target.value }) - } - /> - {state.hospitals.length > 1 ? ( - - ) : ( - `` - )} - - ))} - - - - {alertMessage} - -
- -

Results

- - Download - -
+ desktop={{ col: 12 }} + className="bg-white display-flex flex-column flex-align-self-start margin-bottom-4"> +

TXT File Instructions

+

Background

+

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: +

    +
  • A .txt file in the root folder that includes: +
      +
    • The hospital location name that corresponds to the MRF;
    • +
    • The source page URL that hosts the MRF;
    • +
    • A direct link to the MRF (the MRF URL); and
    • +
    • Hospital point of contact information.
    • +
    +
  • +
  • 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.
  • +
+ 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. +

-
{txtFileOutput(state.hospitals)}
-
- -
-

How this tool helps

-

- This tool generates cms-hpt.txt files that can be - placed at the root of a hospital's domain including - information to improve discoverability of machine readable - files. -

-

-
-

Contact

-

- Have you run into an issue or have a question about this tool? - Please reach out to us at{" "} - - PriceTransparencyHospitalCharges@cms.hhs.gov - - . -

-
+

TXT technical specifications

+

Steps: +

    +
  1. Generate a TXT file that includes the required information indicated below.
  2. +
  3. 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.
  4. +
  5. Name the file “cms-hpt.txt”.
  6. +
  7. 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
  8. +
+

+

Required Information for the TXT File

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Attribute: ValueNameDefinition
location-name: [hospital location name]Hospital Location NameIndicate the hospital location name that corresponds to the standard charge information contained in the MRF.
source-page-url: [URL]Source page URLThe source page URL is the URL of the public webpage you have selected to host the MRF.
mrf-url: [URL]Machine-readable file URLIndicate the URL of the MRF.
contact-name: [name]POC NameIndicate 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.
contact-email: [email]Contact emailIndicate the email address of the POC you have designated to answer technical questions about your hospital’s MRF and the data contained in it.
+

Example TXT File

+

+ location-name: Test Hospital
+ source-page-url: https://example.com
+ mrf-url: https://example.com/HPT
+ contact-name: Jon Snow
+ contact-email: jsnow@example.com
+
+ location-name: Test Hospital 2
+ source-page-url: https://example2.com
+ mrf-url: https://example2.com/HPT
+ contact-name: Jane Doe
+ contact-email: jdoe@example2.com
+

diff --git a/src/pages/txt-generator.jsx.bak b/src/pages/txt-generator.jsx.bak new file mode 100644 index 0000000..85f7c6e --- /dev/null +++ b/src/pages/txt-generator.jsx.bak @@ -0,0 +1,268 @@ +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 Layout from "../layouts" + +const txtFileOutput = (hospitals) => + hospitals + .map( + ({ + name, + sourcePageUrl, + mrfUrl, + contactName, + contactEmail, + }) => `location-name: ${name} +source-page-url: ${sourcePageUrl} +mrf-url: ${mrfUrl} +contact-name: ${contactName} +contact-email: ${contactEmail}` + ) + .join("\n\n") + +const removeIndex = (array, index) => [ + ...array.slice(0, index), + ...array.slice(index + 1), +] + +const TxtGenerator = () => { + const baseHospital = { + name: "", + sourcePageUrl: "", + mrfUrl: "", + contactName: "", + contactEmail: "", + } + const [state, setState] = useState({ + hospitals: [{ ...baseHospital }], + downloadUrl: "", + }) + + useEffect(() => { + new Clipboard("[data-clipboard-target]") + }, []) + + useEffect(() => { + let blob = new Blob([txtFileOutput(state.hospitals)], { + type: "text/plain;charset=utf8", + }) + setState({ + ...state, + downloadUrl: window.URL.createObjectURL(blob), + }) + }, [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 ( + +
+
+ + +

TXT Generator

+
+ {state.hospitals.map((hospital, index) => ( + + + + updateHospital(index, { name: e.target.value }) + } + /> + + + updateHospital(index, { sourcePageUrl: e.target.value }) + } + /> + + + updateHospital(index, { mrfUrl: e.target.value }) + } + /> + + + updateHospital(index, { contactName: e.target.value }) + } + /> + + + updateHospital(index, { contactEmail: e.target.value }) + } + /> + {state.hospitals.length > 1 ? ( + + ) : ( + `` + )} + + ))} +
+ + + {alertMessage} + +
+ +

Results

+ + Download + +
+ +
{txtFileOutput(state.hospitals)}
+
+ +
+

How this tool helps

+

+ This tool generates cms-hpt.txt files that can be + placed at the root of a hospital's domain including + information to improve discoverability of machine readable + files. +

+

+
+

Contact

+

+ Have you run into an issue or have a question about this tool? + Please reach out to us at{" "} + + PriceTransparencyHospitalCharges@cms.hhs.gov + + . +

+
+
+
+
+
+
+ ) +} + +export default TxtGenerator From 2f0bd993e8601a4a716b1d307e79d8885e2f1c9a Mon Sep 17 00:00:00 2001 From: Scott Haselton Date: Tue, 5 Dec 2023 09:52:37 -0800 Subject: [PATCH 8/8] fixing linting errors --- src/pages/txt-generator.jsx | 231 +++++++++++++++++++----------------- 1 file changed, 119 insertions(+), 112 deletions(-) diff --git a/src/pages/txt-generator.jsx b/src/pages/txt-generator.jsx index 0b3cf6f..a879a30 100644 --- a/src/pages/txt-generator.jsx +++ b/src/pages/txt-generator.jsx @@ -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) => @@ -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: "", @@ -60,41 +48,6 @@ 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 (
@@ -102,83 +55,137 @@ const TxtGenerator = () => { + className="bg-white display-flex flex-column flex-align-self-start margin-bottom-4" + >

TXT File Instructions

-

Background

-

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: +

+ Background +

+

+ 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:

    -
  • A .txt file in the root folder that includes: +
  • + A .txt file in the root folder that includes:
      -
    • The hospital location name that corresponds to the MRF;
    • -
    • The source page URL that hosts the MRF;
    • -
    • A direct link to the MRF (the MRF URL); and
    • -
    • Hospital point of contact information.
    • +
    • + {" "} + The hospital location name that corresponds to the MRF; +
    • +
    • The source page URL that hosts the MRF;
    • +
    • A direct link to the MRF (the MRF URL); and
    • +
    • Hospital point of contact information.
  • -
  • 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.
  • +
  • + 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. +
- 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.

-

TXT technical specifications

-

Steps: +

+ TXT technical specifications +

+

+ {" "} + Steps:

    -
  1. Generate a TXT file that includes the required information indicated below.
  2. -
  3. 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.
  4. +
  5. + Generate a TXT file that includes the required information + indicated below. +
  6. +
  7. + 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. +
  8. Name the file “cms-hpt.txt”.
  9. -
  10. 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
  11. -
+
  • + 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 +
  • +

    -

    Required Information for the TXT File

    - +

    + Required Information for the TXT File +

    +
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Attribute: ValueNameDefinition
    location-name: [hospital location name]Hospital Location NameIndicate the hospital location name that corresponds to the standard charge information contained in the MRF.
    source-page-url: [URL]Source page URLThe source page URL is the URL of the public webpage you have selected to host the MRF.
    mrf-url: [URL]Machine-readable file URLIndicate the URL of the MRF.
    contact-name: [name]POC NameIndicate 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.
    contact-email: [email]Contact emailIndicate the email address of the POC you have designated to answer technical questions about your hospital’s MRF and the data contained in it.
    -

    Example TXT File

    + + Attribute: Value + Name + Definition + + + + location-name: [hospital location name] + Hospital Location Name + + Indicate the hospital location name that corresponds to the + standard charge information contained in the MRF. + + + + source-page-url: [URL] + Source page URL + + The source page URL is the URL of the public webpage you + have selected to host the MRF. + + + + mrf-url: [URL] + Machine-readable file URL + Indicate the URL of the MRF. + + + contact-name: [name] + POC Name + + 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. + + + + contact-email: [email] + Contact email + + 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. + + + +

    + Example TXT File +

    - location-name: Test Hospital
    - source-page-url: https://example.com
    - mrf-url: https://example.com/HPT
    - contact-name: Jon Snow
    - contact-email: jsnow@example.com
    -
    - location-name: Test Hospital 2
    - source-page-url: https://example2.com
    - mrf-url: https://example2.com/HPT
    - contact-name: Jane Doe
    - contact-email: jdoe@example2.com
    + location-name: Test Hospital
    + source-page-url: https://example.com
    + mrf-url: https://example.com/HPT
    + contact-name: Jon Snow
    + contact-email: jsnow@example.com
    +
    + location-name: Test Hospital 2
    + source-page-url: https://example2.com
    + mrf-url: https://example2.com/HPT
    + contact-name: Jane Doe
    + contact-email: jdoe@example2.com