Skip to content

Instantly share code, notes, and snippets.

@MonteLogic
Last active July 26, 2024 19:03
Show Gist options
  • Select an option

  • Save MonteLogic/fa92e77ba845cf22f894139e4e365590 to your computer and use it in GitHub Desktop.

Select an option

Save MonteLogic/fa92e77ba845cf22f894139e4e365590 to your computer and use it in GitHub Desktop.
hp-work-notes

Health Care Profiler Work Notes

Wed 17 Jul 2024 07:20:11 AM CDT

Managed to get it to run with a different .env.

Okay,

I would say the mathematics of it is going to be the toughest part, so I need to focus. I need to get this from working with the mathematics part because It might overrun, we need to like, run like like Phoenix. If It gets out of bounds and doesn't look good.

So we need to focus on that. So the mathematical part is gonna be the tough part.

Going to prune the rest of cbud.app And going to deploy it live. Just a PDF generation but that PDF generations. Not going to rely on the work time objects that obviously worked obvious not going to be there, so it's just going to be like a plain input object, it's cleaning pot, you put object, and then upload that to scale And then get to grinding on the math of it.

So it looks good. So upload to planning skill. Let's do that by 10 A.M.

...

Why is the menu on second-menu? Why not first-menu?

Now, we are going to work on the object which it will be fed, think I'm going to feed it a dummy object for now so just a PDF generates.

This 'dummy' object will be come from a JSON file on the code base.

I think I'm going to fire up the the other project so we can know what initialRoutes[0] looks like, exactly.

That var where it's called actually shows it's last stop before going on:

const modifiedPdfBytes = await generateEnidanPDF(
  workTimeTop,
  selectedEmployeeID,
  selectedEmployeeName,
  startDate,
  endDate,
  initialRoutes
);

Within the function generateEnidanPDF notice the param inputted of initialRoutes.

The object looks as such:

32 [
  {
    id: 'clxxmxsnp0002g6cr0sdj8xm5',
    routeNiceName: 'Pleasant Plains',
    organizationID: 'org_2fKIXFsK3Xmp0UGghHxafJHXyYX',
    routeIDFromPostOffice: '5125341',
    assocTrucks: '',
    dateRouteAcquired: 2024-06-27T19:06:15.253Z,
    dateAddedToCB: 2024-06-27T19:06:15.251Z,
    currentTruckForRoute: '0',
    allocatedShifts: [ [Object], [Object] ],
    img: ''
  },
  {
    id: 'clxxnkqiq0003g6cryq8yeqtj',
    routeNiceName: 'Jacksonville',
    organizationID: 'org_2fKIXFsK3Xmp0UGghHxafJHXyYX',
    routeIDFromPostOffice: '626XX',
    assocTrucks: '',
    dateRouteAcquired: 2024-06-27T19:24:05.570Z,
    dateAddedToCB: 2024-06-27T19:24:05.568Z,
    currentTruckForRoute: '0',
    allocatedShifts: [ [Object], [Object], [Object], [Object] ],
    img: ''
  },
  {
    id: 'clxxojuv70004g6cr7k3jgzze',
    routeNiceName: 'Lincoln',
    organizationID: 'org_2fKIXFsK3Xmp0UGghHxafJHXyYX',
    routeIDFromPostOffice: '626XX',
    assocTrucks: '',
    dateRouteAcquired: 2024-06-27T19:51:24.163Z,
    dateAddedToCB: 2024-06-27T19:51:24.160Z,
    currentTruckForRoute: '0',
    allocatedShifts: [ [Object], [Object] ],
    img: ''
  },
  {
    id: 'clxxomfix0005g6crz1311kmv',
    routeNiceName: 'Extra Routes / Cities',
    organizationID: 'org_2fKIXFsK3Xmp0UGghHxafJHXyYX',
    routeIDFromPostOffice: '626XX',
    assocTrucks: '',
    dateRouteAcquired: 2024-06-27T19:53:24.249Z,
    dateAddedToCB: 2024-06-27T19:53:24.246Z,
    currentTruckForRoute: '0',
    allocatedShifts: [ [Object], [Object] ],
    img: ''
  },
  {
    id: 'clxxqnlab0006g6cru3fhs9nc',
    routeNiceName: 'Palmer',
    organizationID: 'org_2fKIXFsK3Xmp0UGghHxafJHXyYX',
    routeIDFromPostOffice: '625M5',
    assocTrucks: '',
    dateRouteAcquired: 2024-06-27T20:50:17.603Z,
    dateAddedToCB: 2024-06-27T20:50:17.602Z,
    currentTruckForRoute: '0',
    allocatedShifts: [ [Object], [Object] ],
    img: ''
  }
]

What does the field validation look like?

We could make an example generator for cbud.

But for this we can make an example generator.

I think I'm going to comment on the JSON stuff with YAML files. These fields you can add multiple fields onto them, they aren't limited to however many node the array/object was initiated with.

For some of these fields I would like them to be more rigid than just field1:field1

How can we make a correlating mechanism which can create picklist for filling in the empty fields.

I'm thinking it's going to be a big object for it.

I think I'm going to start off with a centralized one and then go to profiles as profiles I'll have to work on authorization logic.

Installing Planetscale CLI so we can inject 'Autocompletes' data into the db.

I think I'm going to put data injection into the db on the backburner until we get the web app working.

I need to turn the drop downs into inputs.

Dropdown is in a arbitrary clone within.

I'm basically going to have to rewrite the component from the top down.

But, before we do that, lets have a live implementation.

Need to get rid of org switcher and start to add inputs,

I'm just going to work on getting the input fields to work as I've already had input fields before. With the pay period, just need to add that and reduce complexity.

So, how did I add the time period input cause we need that logic.

This is what it looks like:

<div className="space-y-2">
  <label htmlFor="pay-period-select">Current pay period:</label>
  <select
    id="pay-period-select"
    onChange={(e) => {
      const [start, end] = e.target.value.split("-").map(Number);
      setStartPayPeriod(start);
      setEndPayPeriod(end);
    }}
    className="w-full rounded bg-black p-2 text-white"
    value={`${startPayPeriod}-${endPayPeriod}`}
  >
    <option
      value={`${PAY_PERIOD_INTERVALS.first}-${PAY_PERIOD_INTERVALS.second}`}
    >
      1st - 15th
    </option>
    <option
      value={`${PAY_PERIOD_INTERVALS.second}-${PAY_PERIOD_INTERVALS.third}`}
    >
      16th - End of Month
    </option>
  </select>
</div>

So, a bunch of state variables, useState.

Right now, there are inputs and one of them is changing but the rest of the input aren't even loading to the DOM.

Also, no PDF is being generated.

For Work Experience that date field needs to be a date and not a string Also, need to work on the page switcher.

Make an if statement if that part of the object is there, then have a heading.

Also, it creates a URL, I want it to DOWNLOAD!

So, if we hit Generate Healthcare Profile PDF

After adding another Work Experience and don't fill in that work experience there is an error.

Okay, so we are going to make name required.

And that is going to be in the top hand right corner.

Okay we are going to have a variable for each called cumulative space. This var will be added up by every sector....

There is going to be a finite amount of space/'real estate' on each page if it runs over this number then create a page and then go there.

Or maybe I can create pages from the start and then just keep decrementing/incrementing my way down, because I think pixels transfer down based on where it's put at.

We'll calculate how much space is needed from the jump and then fill in as needed.

We will get the total number and then divide that by how many pixel can fix on the screen and then use the product of that to create n number of pages.

I'm going to make a fn called dummy data where you can just press a button and all of the inputs get loaded with dummy data imported from a JSON file on the code base.

Need to add the name of the field not just the value.

Also, maybe to much space,

Still need to add the education field.

Added education field.

Wed 17 Jul 2024 09:15:32 PM CDT

We need to have a button which is going to load the DOM with a bunch of dummy data.

Okay, so we need a button which says clear form.

Okay, so 'Fill with example data'.

Currently work experiences is getting cut off from the PDF.

Let's see the integer which is being returned for the size of the needed real estate.

Make borders so if it's too high on the page push it down automatically.

For the strict dummy data I'm getting: 1080

Pages are generating but they are going off the screen, so I think my conjecture of just using the 'first' page and picking whatever y height and it'll just find its way to the second was an incorrect conjecture.

Okay, so now we need forbidden coordinates where the math will adjust to get in the allowed coordinates.

It must loop because every field may be unlimited.

Okay, so log in the console if the text is out of bounds.

It's all taking one var and traveling down with it, looks like I'm going to have to change that logic to have it panic and then go back to a safe space. pdfDoc.getPages()[j],

I would like to have a dropdown which says small example, medium example data, large example data

Reference check should be under work experience.

Thu 18 Jul 2024 11:09:16 AM CDT Alright, so how are we going to make this selector friendly like,

It may need to be a modal.

Client input:

It looks much better. Just please be sure to have new sections start on a new page like the reference checks section. Also are you able to take the line across from margin to margin for each section and move the name over like in my example? I look forward to seeing the functionality once you enter the picklist. You can put the machines proficient section after the work experience section and before the Reference Check. I'm glad to see you are having success. Also the files should align like in the example for readability.

Start:

Autocomplete look kinda decent.

  • Need to enact forbidden zone.

  • Make colon x-axis a certain value for a category.

  • Figure out why 2 pages are being / why are more pages being generated than needed

  • Example data dropdown.

  • Calculate if, the section will run off before the end of the page and if it does, then put it on a new page.

"Have new sections start on a new page like the reference checks section." I can have "Reference Check" start on a different page.

"Also are you able to take the line across from margin to margin for each section and move the name over like in my example?"

"You can put the machines proficient section after the work experience section and before the Reference Check."

Working... Okay, so Personal Information can start at a fixed area because it will always be in this area.

What is the forbidden zone for generated text?

Forbidden zone than colon placement.

Let's figure this out so Personal Information is in the correct position:

// Name heading
addHeading(prunedFormData.name, 400, 750, 14, false);

// Personal Information
addHeading("Personal Information", 50, currentY);
currentY -= 30;

add addName function, add pagePlacer function, add logoBottomPlacer function

Personal Information coordinates from Reference is at: [100,675]

Okay, so when the addHeading is called under it we will log just how much y value will grow and where it will end up, if the run off will have to share a page with a section heading.

But this doesn't make sense to me.

Licenses/Certification the run off share a page with other sections,

we could make it so that WorK Experience can have this logic of having the last entry of its section not share a page with another section.

I need to add error checks when user's data have issues on the PDF.

Okay, the name is starting to get hard to do so, its good enough for now but we still need page number and logo at bottom of screen.

Okay, so we are going to find out where the colon in Work Experience is.

Start: Sat 20 Jul 2024 04:51:01 PM CDT

[X] Move name to the right and make it bold

[X] Make line full width extending from right

[ ] Change date format to mm/dd/yyyy

[-] Between work experience and Reference Check there should be a section which says machines used.

  • We're going to save this for the next part because this wasn't on the PDF when I quoted my price.

So we will just add a section which says machines used and it could be a big drop down, we can also make it so that there's a category so like machines Nurses use vs. machines surgeons used.

1.1 Release Notes:

  • Move name to the right and make it bold

  • Make line full width extending from right

  • Change date format to mm/dd/yyyy

  • Extended line to the right.

  • Move and bold the name.

  • Fix address field

  • Add space to colon.

  • Add page numbers.

    1.1 input:

everything looks fine except for the dates of employment in the reference and work experience fields. It should be a from and to format, when trying to enter a range as text ie 06/22/2024-01/07/2025 I get an invalid date field on the final profile. Please let me know how many more hours you will need to add an Imaging Equipment Experience Field with the picklist I sent. I know the first I part is $300 but just need to know the additional hours you will need to finalize the work and reference dates and add the final picklist.

When in this date format: 06/22/2024-01/07/2025 I get an error of Invalid date.

Start: Mon 22 Jul 2024 09:52:56 AM CDT We are going to make

In between work experience there should be a field which is called machines used.

Make machines used not viewable if user did not input data there..

Looks terrible on mobile and I would like to have dash lines in between every one denoting machine 1, machine 2 for every machine added.

Start: Getting errors here:

const pageNumbers = (
    currentPage: PDFPage,
    pageIndex: number,
    totalPages: number,
  ): void => {
    const fontSize = 10;
    const text = `${pageIndex + 1} of ${totalPages + 1}`;
    const textWidth = font.widthOfTextAtSize(text, fontSize);

    const pageWidth = currentPage.getWidth();
    const pageHeight = currentPage.getHeight();

The error case needs 5 pages, it may have an issue due to the fact that it is an odd number.

Start: Thu 25 Jul 2024 11:06:51 AM CDT

I don't want to use Amplify because I would have to put in my GH credentials and thats a non-starter.

I could add a paywall and it would be if users generate more than 5 PDFs than after that every PDF cost a dime or a quarter or whatever price point you would like.

What I'll need to have ready: Vercel open and showing the data needed to be transferred. For reference: https://www.jpmti2016.com/posts/vercel-aws-route-53-custom-domain https://vercel.com/docs/projects/domains/add-a-domain

Start: Fri 26 Jul 2024 01:49:01 PM CDT Put clerk into production mode

Nah not putting it in Production for now.

What's next: Make SaaS for that medical PDF creation stuff.

Make Saas for unidirectional data flow from HubSpot to WooCommerce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment