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